From f56c6ae3899fc9201a1ee520fa7fe939679fd831 Mon Sep 17 00:00:00 2001 From: Aurelijus Banelis Date: Sun, 10 Nov 2019 20:30:53 +0200 Subject: [PATCH 01/10] 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 618d2ba23933b11f72bfbef0714bb8e0ed466aef Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 21:26:47 +0200 Subject: [PATCH 02/10] Done, but formating is still not fixed, html is not passed as a parameter in the last "student" (not really a student, but more of a test data) --- public/students.json | 181 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 public/students.json diff --git a/public/students.json b/public/students.json new file mode 100644 index 000000000..c06cff4d5 --- /dev/null +++ b/public/students.json @@ -0,0 +1,181 @@ +{ + "team1": { + "name": "Team1", + "mentors": [ + "Mantas" + ], + "students": [ + "Tadas", + "Gytis", + "Ričardas" + ] + }, + "baltichalatai": { + "name": "BaltiChalatai", + "mentors": [ + "Lukas" + ], + "students": [ + "Vytas", + "Lukas", + "Diana" + ] + }, + "nnizer": { + "name": "ePacientas", + "mentors": [ + "Tadas" + ], + "students": [ + "Kornelijus", + "Dominykas", + "Miglė" + ] + }, + "activegen": { + "name": "ActiveGen", + "mentors": [ + "Arnoldas" + ], + "students": [ + "Andrius", + "Nojus", + "Martynas", + "Edvinas" + ] + }, + "mms": { + "name": "Membership-management-system", + "mentors": [ + "Mindaugas" + ], + "students": [ + "Erika", + "Rokas", + "Valentinas", + "Eligijus" + ] + }, + "pamainos": { + "name": "NFQ pamainu sistema", + "mentors": [ + "Paulius" + ], + "students": [ + "Liudas", + "Justina", + "Andrius" + ] + }, + "receptai": { + "name": "Receptai", + "mentors": [ + "Mantas" + ], + "students": [ + "Arnoldas", + "Arentas", + "Tautvydas" + ] + }, + "pulse": { + "name": "NFQ pulse", + "mentors": [ + "Lorenas" + ], + "students": [ + "Arvydas", + "Titas", + "Kristijonas", + "Andrius" + ] + }, + "lita": { + "name": "NFQ Petro atrankos problema akademijai", + "mentors": [ + "Paulius" + ], + "students": [ + "Kristina", + "Indrė", + "Dmitri" + ] + }, + "myfleet": { + "name": "MyFleet", + "mentors": [ + "Laurynas" + ], + "students": [ + "Artūras", + "Ignas", + "Jonas" + ] + }, + "career": { + "name": "NFQ Career Criteria Assessment", + "mentors": [ + "Erikas" + ], + "students": [ + "Matas", + "Andrius", + "Ainis" + ] + }, + "carparking": { + "name": "NFQ Car parking", + "mentors": [ + "Andrejus" + ], + "students": [ + "Kęstas", + "Lukas", + "Lukas" + ] + }, + "podcast": { + "name": "Krepšinio podcastai", + "mentors": [ + "Eligijus" + ], + "students": [ + "Edvardas", + "Nerijus", + "Kazimieras" + ] + }, + "Barakas": { + "name": "barakas", + "mentors": [ + "Armandas" + ], + "students": [ + "Raimondas", + "Mantas", + "Tomas" + ] + }, + "devcollab": { + "name": "Education sharing platform", + "mentors": [ + "Viktoras" + ], + "students": [ + "Karolis", + "Arnas", + "Evaldas", + "Algirdas" + ] + }, + "hacker'is po .mySubdomain &project=123": { + "name": "' OR 1 -- DROP DATABASE", + "mentors": [ + "Ponas Programišius" + ], + "students": [ + "Aurelijus", + "Ir jo \"geras\" draug'as" + ] + } +} \ No newline at end of file From 68a4711ef41285ec3b56df9334acea02427a6f7f Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 21:56:09 +0200 Subject: [PATCH 03/10] Fixed Formatting, now html is sent correctly --- src/Controller/StudentController.php | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/Controller/StudentController.php diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php new file mode 100644 index 000000000..2c15eeea5 --- /dev/null +++ b/src/Controller/StudentController.php @@ -0,0 +1,30 @@ +get('name'); + $project=$request->get('project'); + $myName = false; + + if($name == 'Ričardas') $myName=true; + + return $this->render('student/index.html.twig', [ + 'name' => $name, + 'project' => $project, + 'myName' => $myName + ]); + } +} From 5a9aab914acbba9c1af3987d89c6344962bef3d7 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 22:02:27 +0200 Subject: [PATCH 04/10] Hopefully fixed php formatting to remove the code style error --- templates/student/index.html.twig | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 templates/student/index.html.twig diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig new file mode 100644 index 000000000..0e844e24a --- /dev/null +++ b/templates/student/index.html.twig @@ -0,0 +1,33 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello StudentController!{% endblock %} + +{% block body %} +
+ + + + + + + + + + + +
ProjektasStudentas
{{ project|escape }}{{ name |escape}}
+ {% if myName %} + + {% else %} + + {% endif %} +
+ + +{% endblock %} \ No newline at end of file From 4301f63cb8707361e6f04512cdd5e8fcfaf332f2 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 22:10:22 +0200 Subject: [PATCH 05/10] Did not notice I did not commit all files --- assets/css/app.scss | 1 + composer.json | 1 + src/Controller/HomeController.php | 15 ++++++-- src/Controller/StudentController.php | 7 ++-- templates/base.html.twig | 4 +-- templates/home/index.html.twig | 54 ++++++++++++++++++++++++++-- 6 files changed, 74 insertions(+), 8 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index f955fad8f..d28649877 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -1,5 +1,6 @@ // customize some Bootstrap variables $primary: darken(#428bca, 20%); +$body-bg: #ff6b00; // the ~ allows you to reference things in node_modules @import "~bootstrap/scss/bootstrap"; diff --git a/composer.json b/composer.json index 5e4c82c5e..8bbd68220 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", + "ext-j" "symfony/asset": "4.3.*", "symfony/console": "4.3.*", "symfony/dotenv": "4.3.*", diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 90484f11f..3cc94a9c3 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -3,6 +3,7 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; class HomeController extends AbstractController @@ -10,10 +11,20 @@ class HomeController extends AbstractController /** * @Route("/", name="home") */ - public function index() + public function index(KernelInterface $kernel ) { + $projects = json_decode(file_get_contents($kernel->getProjectDir().'/public/students.json' ), true); + + $result=[]; + foreach ($projects as $projectName => $project) { + foreach ($project['students'] as $student) { + $result[] = ['student' => $student, 'project' => $projectName, 'mentors' => $project['mentors']]; + } + } + return $this->render('home/index.html.twig', [ - 'someVariable' => 'NFQ Akademija', + 'studentData' => $result, + 'projects' => $projects ]); } } diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 2c15eeea5..10e878c9d 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\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class StudentController extends AbstractController @@ -11,7 +12,7 @@ class StudentController extends AbstractController /** * @Route("/student", name="student") * @param Request $request - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function index(Request $request) { @@ -19,7 +20,9 @@ public function index(Request $request) $project=$request->get('project'); $myName = false; - if($name == 'Ričardas') $myName=true; + if ($name == 'Ričardas'){ + $myName=true; + } return $this->render('student/index.html.twig', [ 'name' => $name, diff --git a/templates/base.html.twig b/templates/base.html.twig index e06313d52..a8069b8bc 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -1,7 +1,7 @@ - + - + {% block title %}Welcome!{% endblock %} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index b1bd0115c..f8c3ebbbe 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -1,7 +1,57 @@ {% extends 'base.html.twig' %} -{% block title %}{{ someVariable }}{% endblock %} +{% block title %}Projektai{% endblock %} {% block body %} -
{{ someVariable }}
+
    +
  • Studentai
  • + {% for dataRow in studentData %} +
  • + {{dataRow['student']|escape}} + ( + Mentorius {{dataRow['mentors']|join(', ')|escape }} + ) +
  • + {% endfor %} +
+ +
+
+
+ +
+
+ +
+ +
+
+ + + + + + {% endblock %} From 166a30f5811ad41abbe163565d99a900c2f65584 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 22:12:15 +0200 Subject: [PATCH 06/10] fixed .json, was going to fix PHPStorm warning, that ext-json is missing, but missed and error and commited it.. --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 8bbd68220..5e4c82c5e 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,6 @@ "php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", - "ext-j" "symfony/asset": "4.3.*", "symfony/console": "4.3.*", "symfony/dotenv": "4.3.*", From f4ae2dcd5ce8adb798d60353ebbbada17ceb7568 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 22:18:07 +0200 Subject: [PATCH 07/10] php code style errors --- composer.json | 3 ++- src/Controller/HomeController.php | 4 ++-- src/Controller/StudentController.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 5e4c82c5e..b8402c545 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "symfony/orm-pack": "^1.0", "symfony/twig-pack": "^1.0", "symfony/webpack-encore-bundle": "^1.7", - "symfony/yaml": "4.3.*" + "symfony/yaml": "4.3.*", + "ext-json": "*" }, "require-dev": { "squizlabs/php_codesniffer": "^3.5", diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 3cc94a9c3..21ff8c375 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -11,9 +11,9 @@ class HomeController extends AbstractController /** * @Route("/", name="home") */ - public function index(KernelInterface $kernel ) + public function index(KernelInterface $kernel) { - $projects = json_decode(file_get_contents($kernel->getProjectDir().'/public/students.json' ), true); + $projects = json_decode(file_get_contents($kernel->getProjectDir().'/public/students.json'), true); $result=[]; foreach ($projects as $projectName => $project) { diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 10e878c9d..212b48d47 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -20,7 +20,8 @@ public function index(Request $request) $project=$request->get('project'); $myName = false; - if ($name == 'Ričardas'){ + if($name == 'Ričardas') + { $myName=true; } From 9f6e15ce8e1201581ee6498d0fbf99b2eac4d924 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Tue, 19 Nov 2019 22:20:23 +0200 Subject: [PATCH 08/10] php code style errors --- src/Controller/StudentController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 212b48d47..c94a88376 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -20,8 +20,7 @@ public function index(Request $request) $project=$request->get('project'); $myName = false; - if($name == 'Ričardas') - { + if ($name == 'Ričardas') { $myName=true; } From fa292002d1a0a843b15893e59df7c4e813f0f2ea Mon Sep 17 00:00:00 2001 From: Ricardas Date: Sat, 7 Dec 2019 23:48:13 +0200 Subject: [PATCH 09/10] Namu dabu taisymas --- src/Controller/StudentController.php | 9 ++------- templates/base.html.twig | 2 +- templates/home/index.html.twig | 8 ++++---- templates/student/index.html.twig | 6 +++--- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index c94a88376..7b98bd0f3 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -16,18 +16,13 @@ class StudentController extends AbstractController */ public function index(Request $request) { - $name = $request->get('name'); - $project=$request->get('project'); - $myName = false; + $name = $request->get('name', 'nenurodyta'); + $project=$request->get('project', 'nenurodyta'); - if ($name == 'Ričardas') { - $myName=true; - } return $this->render('student/index.html.twig', [ 'name' => $name, 'project' => $project, - 'myName' => $myName ]); } } diff --git a/templates/base.html.twig b/templates/base.html.twig index a8069b8bc..e84ca0f06 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -1,7 +1,7 @@ - + {% block title %}Welcome!{% endblock %} diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index f8c3ebbbe..551570efb 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -7,16 +7,16 @@
  • Studentai
  • {% for dataRow in studentData %}
  • - {{dataRow['student']|escape}} + {{dataRow['student']}} ( - Mentorius {{dataRow['mentors']|join(', ')|escape }} + Mentorius {{dataRow['mentors']|join(', ') }} )
  • {% endfor %}
    -
    +
    @@ -51,7 +51,7 @@ {% endblock %} diff --git a/templates/student/index.html.twig b/templates/student/index.html.twig index 0e844e24a..9c41ee2e2 100644 --- a/templates/student/index.html.twig +++ b/templates/student/index.html.twig @@ -11,12 +11,12 @@ Studentas - {{ project|escape }} - {{ name |escape}} + {{ project }} + {{ name}} - {% if myName %} + {% if name == 'Ričardas' %} From 715a386238ae1d24781a68d308469f15280fbfd9 Mon Sep 17 00:00:00 2001 From: Ricardas Date: Sun, 8 Dec 2019 00:29:56 +0200 Subject: [PATCH 10/10] Namu dabu taisymas --- src/Controller/StudentController.php | 12 ++++++++++++ templates/home/index.html.twig | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Controller/StudentController.php b/src/Controller/StudentController.php index 7b98bd0f3..9e297c00d 100644 --- a/src/Controller/StudentController.php +++ b/src/Controller/StudentController.php @@ -5,6 +5,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Routing\Annotation\Route; class StudentController extends AbstractController @@ -25,4 +26,15 @@ public function index(Request $request) 'project' => $project, ]); } + + /** + * @Route("/student/json", name="students-json") + * @param KernelInterface $kernel + * @return Response + */ + public function studentsjson(KernelInterface $kernel) + { + $students = json_decode(file_get_contents($kernel->getProjectDir().'/public/students.json'), true); + return $this->json($students); + } } diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 551570efb..ff1a8bcc9 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -7,7 +7,7 @@
  • Studentai
  • {% for dataRow in studentData %}
  • - {{dataRow['student']}} + {{dataRow['student']}} ( Mentorius {{dataRow['mentors']|join(', ') }} ) @@ -51,7 +51,7 @@ {% endblock %}