From f56c6ae3899fc9201a1ee520fa7fe939679fd831 Mon Sep 17 00:00:00 2001 From: Aurelijus Banelis Date: Sun, 10 Nov 2019 20:30:53 +0200 Subject: [PATCH 01/12] Fix documentation: GitHub actions instead of TravisCI --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 92eb535f2..86d5cadc7 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ visais reikalingais failais ir įrankiais darbui: - Paprastas pavyzdys (Controller, Template, CSS) - Įdiegtas bootstrap - Asset'ų buildinimas (encore, yarn, sass) -- Travis CI template - +- GitHub actions (CI) pavyzdys # Paleidimo instrukcija From 305eeef14d6d5222c7c54b2027a4524ab65fc08c Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 18:54:12 +0000 Subject: [PATCH 02/12] first commit twig loop --- src/Controller/HomeController.php | 6 +++++- templates/home/index.html.twig | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 90484f11f..8e6513b2f 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -13,7 +13,11 @@ class HomeController extends AbstractController public function index() { return $this->render('home/index.html.twig', [ - 'someVariable' => 'NFQ Akademija', + 'someVariable' => [ + 'Jonas', + 'Petras', + 'Kazys', + ] ]); } } diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index b1bd0115c..24d38f4e2 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -1,7 +1,11 @@ {% extends 'base.html.twig' %} -{% block title %}{{ someVariable }}{% endblock %} +{% block title %}{% endblock %} {% block body %} -
{{ someVariable }}
+ + {% for student in someVariable %} +
{{ student }}
+ {% endfor %} + {% endblock %} From 86a7ad8b0bdda7edc0e31a31a656a85bfcafb082 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 19:17:47 +0000 Subject: [PATCH 03/12] added bootstrap --- templates/home/index.html.twig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 24d38f4e2..f0f91cf54 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -4,8 +4,16 @@ {% block body %} - {% for student in someVariable %} -
{{ student }}
- {% endfor %} +
    +
  • Studentai
  • + {% for student in someVariable %} +
  • {{ student }}
  • + {% endfor %} +
+ + {% endblock %} + + + From 7ad5ec8f61ccb3944d129d581c35729003a4f32d Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 19:48:42 +0000 Subject: [PATCH 04/12] background colour --- assets/css/app.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/css/app.scss b/assets/css/app.scss index f955fad8f..1bdda5478 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,3 +1,5 @@ +$body-bg: #195b88; + // customize some Bootstrap variables $primary: darken(#428bca, 20%); From 3d39baf4d68a31f07d33a16a7e834af3f313952b Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 20:11:50 +0000 Subject: [PATCH 05/12] query parameters --- src/Controller/HomeController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 8e6513b2f..7d9d3645c 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -2,7 +2,9 @@ namespace App\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; class HomeController extends AbstractController @@ -10,11 +12,12 @@ class HomeController extends AbstractController /** * @Route("/", name="home") */ - public function index() + public function index(Request $request) { + return $this->render('home/index.html.twig', [ 'someVariable' => [ - 'Jonas', + $request->get('student', 'nezinau'), 'Petras', 'Kazys', ] From c7372df43d43592cd4aa05dfd547eded5450ea57 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 20:19:30 +0000 Subject: [PATCH 06/12] New controller Student --- src/Controller/StudentController.php | 19 +++++++++++++++++++ templates/student/index.html.twig | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/Controller/StudentController.php create mode 100644 templates/student/index.html.twig diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php new file mode 100644 index 000000000..b0e1e297a --- /dev/null +++ b/src/Controller/StudentController.php @@ -0,0 +1,19 @@ +render('student/index.html.twig', [ + 'controller_name' => 'StudentController', + ]); + } +} diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig new file mode 100644 index 000000000..a8ecbe4d3 --- /dev/null +++ b/templates/student/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello StudentController!{% endblock %} + +{% block body %} + + +
+

Hello {{ controller_name }}! ✅

+ + This friendly message is coming from: + +
+{% endblock %} From 55ad084443a34234050b2fd389b8a184e23003a0 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 20:38:29 +0000 Subject: [PATCH 07/12] Kernel interface --- src/Controller/StudentController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index b0e1e297a..8fda4a8e9 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -2,7 +2,9 @@ namespace App\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; class StudentController extends AbstractController @@ -10,10 +12,12 @@ class StudentController extends AbstractController /** * @Route("/student", name="student") */ - public function index() + public function index(KernelInterface $request) { + + $a = $request->getProjectDir(); return $this->render('student/index.html.twig', [ - 'controller_name' => 'StudentController', + 'controller_name' => $a, ]); } } From 0277457769297b3e12f1fcfccbb26293a48053d2 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Tue, 19 Nov 2019 20:57:21 +0000 Subject: [PATCH 08/12] if else --- assets/css/app.scss | 2 +- templates/home/index.html.twig | 2 +- templates/student/index.html.twig | 19 +++++++------------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index 1bdda5478..a5d759474 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,4 +1,4 @@ -$body-bg: #195b88; +$body-bg: #887c08; // customize some Bootstrap variables $primary: darken(#428bca, 20%); diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index f0f91cf54..b4993772c 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -11,7 +11,7 @@ {% endfor %} - +Studentas {% endblock %} diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig index a8ecbe4d3..aecd3ec67 100644 --- a/templates/student/index.html.twig +++ b/templates/student/index.html.twig @@ -3,18 +3,13 @@ {% block title %}Hello StudentController!{% endblock %} {% block body %} - +Katalogas: {{ controller_name }} -
-

Hello {{ controller_name }}! ✅

+ {% if controller_name == '/code' %} + (Dockeryje) + {% else %} + Kazkur kitur + {% endif %} - This friendly message is coming from: - -
+ Pagrindinis {% endblock %} From b9b455ace2fdc73e3de449773080bc698f7655cb Mon Sep 17 00:00:00 2001 From: Montekarl Date: Wed, 20 Nov 2019 00:15:06 +0000 Subject: [PATCH 09/12] json data --- composer.json | 1 + composer.lock | 172 ++++++++++++++++++++++++- config/bundles.php | 1 + config/packages/dev/web_profiler.yaml | 6 + config/packages/test/web_profiler.yaml | 6 + config/routes/dev/web_profiler.yaml | 7 + src/Controller/HomeController.php | 17 +-- src/Controller/StudentController.php | 1 - symfony.lock | 20 +++ templates/home/index.html.twig | 6 +- templates/student/index.html.twig | 8 -- 11 files changed, 221 insertions(+), 24 deletions(-) create mode 100644 config/packages/dev/web_profiler.yaml create mode 100644 config/packages/test/web_profiler.yaml create mode 100644 config/routes/dev/web_profiler.yaml diff --git a/composer.json b/composer.json index 5e4c82c5e..d87e1084c 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "symfony/flex": "^1.3.1", "symfony/framework-bundle": "4.3.*", "symfony/orm-pack": "^1.0", + "symfony/profiler-pack": "^1.0", "symfony/twig-pack": "^1.0", "symfony/webpack-encore-bundle": "^1.7", "symfony/yaml": "4.3.*" diff --git a/composer.lock b/composer.lock index 99073b588..4e62f59ed 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1ef246e2c00d457122ed5e9043e91bac", + "content-hash": "9e974b813bcc2219441d85c06aa41fe6", "packages": [ { "name": "doctrine/annotations", @@ -2995,6 +2995,34 @@ ], "time": "2019-08-06T08:03:45+00:00" }, + { + "name": "symfony/profiler-pack", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/profiler-pack.git", + "reference": "99c4370632c2a59bb0444852f92140074ef02209" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/profiler-pack/zipball/99c4370632c2a59bb0444852f92140074ef02209", + "reference": "99c4370632c2a59bb0444852f92140074ef02209", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/stopwatch": "*", + "symfony/twig-bundle": "*", + "symfony/web-profiler-bundle": "*" + }, + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A pack for the Symfony web profiler", + "time": "2018-12-10T12:11:44+00:00" + }, { "name": "symfony/routing", "version": "v4.3.5", @@ -3442,6 +3470,82 @@ "description": "A Twig pack for Symfony projects", "time": "2019-10-17T05:44:22+00:00" }, + { + "name": "symfony/var-dumper", + "version": "v4.3.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "ea4940845535c85ff5c505e13b3205b0076d07bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ea4940845535c85ff5c505e13b3205b0076d07bf", + "reference": "ea4940845535c85ff5c505e13b3205b0076d07bf", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2019-10-13T12:02:04+00:00" + }, { "name": "symfony/var-exporter", "version": "v4.3.5", @@ -3502,6 +3606,72 @@ ], "time": "2019-08-22T07:33:08+00:00" }, + { + "name": "symfony/web-profiler-bundle", + "version": "v4.3.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "6ce12ffe97d9e26091b0e7340a9d661fba64655e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/6ce12ffe97d9e26091b0e7340a9d661fba64655e", + "reference": "6ce12ffe97d9e26091b0e7340a9d661fba64655e", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/config": "^4.2", + "symfony/http-kernel": "^4.3", + "symfony/routing": "~3.4|~4.0", + "symfony/twig-bundle": "~4.2", + "symfony/var-dumper": "~3.4|~4.0", + "twig/twig": "^1.41|^2.10" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/form": "<4.3", + "symfony/messenger": "<4.2", + "symfony/var-dumper": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\WebProfilerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony WebProfilerBundle", + "homepage": "https://symfony.com", + "time": "2019-10-23T17:52:52+00:00" + }, { "name": "symfony/webpack-encore-bundle", "version": "v1.7.0", diff --git a/config/bundles.php b/config/bundles.php index 7b4814201..00fefb260 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -9,4 +9,5 @@ Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], ]; diff --git a/config/packages/dev/web_profiler.yaml b/config/packages/dev/web_profiler.yaml new file mode 100644 index 000000000..e92166a7f --- /dev/null +++ b/config/packages/dev/web_profiler.yaml @@ -0,0 +1,6 @@ +web_profiler: + toolbar: true + intercept_redirects: false + +framework: + profiler: { only_exceptions: false } diff --git a/config/packages/test/web_profiler.yaml b/config/packages/test/web_profiler.yaml new file mode 100644 index 000000000..03752de21 --- /dev/null +++ b/config/packages/test/web_profiler.yaml @@ -0,0 +1,6 @@ +web_profiler: + toolbar: false + intercept_redirects: false + +framework: + profiler: { collect: false } diff --git a/config/routes/dev/web_profiler.yaml b/config/routes/dev/web_profiler.yaml new file mode 100644 index 000000000..c82beff2f --- /dev/null +++ b/config/routes/dev/web_profiler.yaml @@ -0,0 +1,7 @@ +web_profiler_wdt: + resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' + prefix: /_wdt + +web_profiler_profiler: + resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' + prefix: /_profiler diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 7d9d3645c..8fd085b56 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -2,9 +2,7 @@ namespace App\Controller; - use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; class HomeController extends AbstractController @@ -12,15 +10,12 @@ class HomeController extends AbstractController /** * @Route("/", name="home") */ - public function index(Request $request) + public function index() { - - return $this->render('home/index.html.twig', [ - 'someVariable' => [ - $request->get('student', 'nezinau'), - 'Petras', - 'Kazys', - ] - ]); + $data = file_get_contents('https://hw1.nfq2019.online/students.json'); + $process=json_decode($data, true); + return $this->render('home/index.html.twig', [ + 'process' => $process, + ]); } } diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 8fda4a8e9..612ecd9ea 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -14,7 +14,6 @@ class StudentController extends AbstractController */ public function index(KernelInterface $request) { - $a = $request->getProjectDir(); return $this->render('student/index.html.twig', [ 'controller_name' => $a, diff --git a/symfony.lock b/symfony.lock index fe3f6a33e..b4b80f361 100644 --- a/symfony.lock +++ b/symfony.lock @@ -224,6 +224,9 @@ "symfony/polyfill-php73": { "version": "v1.12.0" }, + "symfony/profiler-pack": { + "version": "v1.0.4" + }, "symfony/routing": { "version": "4.2", "recipe": { @@ -268,9 +271,26 @@ "symfony/twig-pack": { "version": "v1.0.0" }, + "symfony/var-dumper": { + "version": "v4.3.8" + }, "symfony/var-exporter": { "version": "v4.3.5" }, + "symfony/web-profiler-bundle": { + "version": "3.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "3.3", + "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6" + }, + "files": [ + "config/packages/dev/web_profiler.yaml", + "config/packages/test/web_profiler.yaml", + "config/routes/dev/web_profiler.yaml" + ] + }, "symfony/webpack-encore-bundle": { "version": "1.0", "recipe": { diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index b4993772c..8470da23f 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -6,12 +6,12 @@
  • Studentai
  • - {% for student in someVariable %} -
  • {{ student }}
  • + {% for student in process %} +
  • {{ 'process' }}
  • {% endfor %}
-Studentas +{{ path('student') }} {% endblock %} diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig index aecd3ec67..39d88d9e9 100644 --- a/templates/student/index.html.twig +++ b/templates/student/index.html.twig @@ -3,13 +3,5 @@ {% block title %}Hello StudentController!{% endblock %} {% block body %} -Katalogas: {{ controller_name }} - - {% if controller_name == '/code' %} - (Dockeryje) - {% else %} - Kazkur kitur - {% endif %} - Pagrindinis {% endblock %} From 026830683c06599924762c1b3807d42e84b9501d Mon Sep 17 00:00:00 2001 From: Montekarl Date: Wed, 20 Nov 2019 14:00:31 +0000 Subject: [PATCH 10/12] team name --- assets/css/app.scss | 2 +- src/Controller/StudentController.php | 1 + templates/home/index.html.twig | 12 ++++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index a5d759474..4ab466a99 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,4 +1,4 @@ -$body-bg: #887c08; +$body-bg: #bec3d1; // customize some Bootstrap variables $primary: darken(#428bca, 20%); diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 612ecd9ea..d14b38158 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -18,5 +18,6 @@ public function index(KernelInterface $request) return $this->render('student/index.html.twig', [ 'controller_name' => $a, ]); + } } diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 8470da23f..cd7dd1f4c 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -6,12 +6,20 @@
  • Studentai
  • + {% for student in process %} -
  • {{ 'process' }}
  • +
  • +
    + Student + {{ student["name"] }} + {{ 'mentoriaus vardas' }} +
    +
  • {% endfor %}
-{{ path('student') }} +Student {% endblock %} From 06701abcabe8569a3a7ce6f31fefb3b41e17ecc4 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Wed, 20 Nov 2019 20:23:15 +0000 Subject: [PATCH 11/12] komandos nariai ir nuorodos --- src/Controller/HomeController.php | 2 ++ src/Controller/StudentController.php | 10 ++++++--- src/Controller/TeamController.php | 32 ++++++++++++++++++++++++++++ templates/home/index.html.twig | 19 +++++++++++------ templates/student/index.html.twig | 2 +- templates/team/index.html.twig | 20 +++++++++++++++++ 6 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 src/Controller/TeamController.php create mode 100644 templates/team/index.html.twig diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 8fd085b56..236fadd3d 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -18,4 +18,6 @@ public function index() 'process' => $process, ]); } + + } diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index d14b38158..d90efe0cc 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -4,6 +4,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; @@ -12,11 +13,14 @@ class StudentController extends AbstractController /** * @Route("/student", name="student") */ - public function index(KernelInterface $request) + public function index(Request $request) { - $a = $request->getProjectDir(); + $data = file_get_contents('https://hw1.nfq2019.online/students.json'); + $students=json_decode($data, true); + $name = $request->get('student'); + return $this->render('student/index.html.twig', [ - 'controller_name' => $a, + 'HomeController' => $name, ]); } diff --git a/src/Controller/TeamController.php b/src/Controller/TeamController.php new file mode 100644 index 000000000..d7e9f5060 --- /dev/null +++ b/src/Controller/TeamController.php @@ -0,0 +1,32 @@ +getProjectDir(); + return $this->render('team/index.html.twig', [ + 'controller_name' => $a, + ]); + } + + public function groupByStudents(array $projects) + { + $data1 = file_get_contents('https://hw1.nfq2019.online/students.json'); + foreach ($projects as $projectName => $project) { + foreach ($project['students'] as $student) { + $data1[] = ['student' => $student, 'project' => $projectName, 'mentors' => $project['mentors']]; + } + } + return $data1; + } +} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index cd7dd1f4c..a916dccce 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -5,21 +5,28 @@ {% block body %}
    -
  • Studentai
  • +
  • Komandos
  • - {% for student in process %} + {% for team in process %}
  • - Student - {{ student["name"] }} - {{ 'mentoriaus vardas' }} +

    Komanda: {{ team["name"] }}

    +

    Vadovas: {{ team["mentors"] [0] }}

    + Komandos nariai: +
      + {% for student in team["students"] %} +
    • + {{student}} +
    • + {% endfor %} +
  • {% endfor %}
Student + Pagrindinis + Pagrindinis {% endblock %} diff --git a/templates/team/index.html.twig b/templates/team/index.html.twig new file mode 100644 index 000000000..440b72d0b --- /dev/null +++ b/templates/team/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello TeamController!{% endblock %} + +{% block body %} + + +
+

Hello {{ controller_name }}! ✅

+ + This friendly message is coming from: + +
+{% endblock %} From f8f31f293229565c4bc90cade072efc8e15ceda6 Mon Sep 17 00:00:00 2001 From: Montekarl Date: Wed, 20 Nov 2019 21:15:38 +0000 Subject: [PATCH 12/12] finish --- src/Controller/HomeController.php | 2 -- src/Controller/StudentController.php | 1 - templates/student/index.html.twig | 18 +++++++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 236fadd3d..8fd085b56 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -18,6 +18,4 @@ public function index() 'process' => $process, ]); } - - } diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index d90efe0cc..6086a4682 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -5,7 +5,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; class StudentController extends AbstractController diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig index 3bd1aef4d..bca0825eb 100644 --- a/templates/student/index.html.twig +++ b/templates/student/index.html.twig @@ -3,5 +3,21 @@ {% block title %}Hello StudentController!{% endblock %} {% block body %} - Pagrindinis + Pagrindinis +
+

{{app.request.query.get('student')}}

+ + {% if 'Karolis' in app.request.query.get('student') %} +
+                

+ Gerb, dėstytojau, + atsiprašau, kad vėluoju. Parašykite penkis, prašau. + Pagarbiai, + Karolis Petrikas +

+
+ {% else %} +

Gal pasiseks kitą kartą

+ {% endif %} +
{% endblock %}