Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$body-bg: #ff622b;
// customize some Bootstrap variables
$primary: darken(#428bca, 20%);

Expand Down
181 changes: 181 additions & 0 deletions public/students.json
Original file line number Diff line number Diff line change
@@ -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"
]
},
"hack<b>er</b>'is po .mySubdomain &project=123": {
"name": "' OR 1 -- DROP DATABASE",
"mentors": [
"<b>Ponas</b> Programišius"
],
"students": [
"Aurelijus",
"<b>Ir</b> jo \"geras\" draug'as"
]
}
}
22 changes: 20 additions & 2 deletions src/Controller/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route;

class HomeController extends AbstractController
{
/**
* @Route("/", name="home")
* @param KernelInterface $kernel
* @return \Symfony\Component\HttpFoundation\Response
*/
public function index()
public function index(KernelInterface $kernel)
{
$projects = json_decode(file_get_contents($kernel->getProjectDir() . '/public/students.json'), true);

$students = $this->groupByStudents($projects);
return $this->render('home/index.html.twig', [
'someVariable' => 'NFQ Akademija',
'someVariable' => $students,
'projects' => $projects
]);
}

private function groupByStudents(array $projects)
{
$result = [];
foreach ($projects as $projectName => $project) {
foreach ($project['students'] as $student) {
$result[] = ['student' => $student, 'project' => $projectName, 'mentor' => $project['mentors'][0]];
}
}
return $result;
}
}
27 changes: 27 additions & 0 deletions src/Controller/StudentController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;

class StudentController extends AbstractController
{
/**
* @Route("/student", name="student")
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/

public function index(Request $request)
{
$name = $request->get('name');
$project = $request->get('project');

return $this->render('student/index.html.twig', [
'name' => $name,
'project' => $project,
]);
}
}
60 changes: 56 additions & 4 deletions templates/home/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,59 @@
{% extends 'base.html.twig' %}

{% block title %}{{ someVariable }}{% endblock %}
{% block title %}Student{% endblock %}

{% block body %}
<ul class="list-group m-4">
<li class="list-group-item list-group-item-info">Studentai</li>
{% for student in someVariable %}
<li class="list-group-item">
<a href="{{ path('student') }}?name={{ student.student|url_encode }}&project={{ student.project|url_encode }}">{{ student.student|escape }}</a>
( <span class="badge"> Mentorius</span> {{ student.mentor|escape }})
</li>
{% endfor %}
</ul>

<div class="m-4">
<form action="{{ path('student') }}" method="get">

<div class="input-group">
<input name="name" type="text" class="form-control" placeholder="Studentas">
</div>
<div class="input-group">
<input name="project" type="text" class="form-control" placeholder="Projektas">
</div>

<button type="submit" class="btn btn-success">Sužinoti vertinimą</button>
</form>
</div>

<ul class="list-group m-4">
<li class="list-group-item list-group-item-info">Projektai</li>
{% for nameUrl, project in projects %}
<li class="list-group-item">
<h3>{{ project.name }}</h3>
<div class="panel panel-default">
<div>
<a href="//github.com/nfqakademija/{{ nameUrl|url_encode }}">github.com/nfqakademija/{{ nameUrl|escape }}</a>
<span class="badge">GitHub</span>
</div>
<div>
<a href="//{{ nameUrl|url_encode }}.projektai.nfqakademija.lt">{{ nameUrl|escape }}
.projektai.nfqakademija.lt</a>
<span class="badge">Web</span>
</div>
<div>
<pre>ssh {{ nameUrl|escape }}@deploy.nfqakademija.lt -p 2222</pre>
</div>
</div>
</li>
{% endfor %}
</ul>
<div class="m-4">
<a class="text-light" href="students.json">Duomenų failas</a>
</div>
{% endblock %}




{% block body %}
<div class="nfq-academy">{{ someVariable }}</div>
{% endblock %}
32 changes: 32 additions & 0 deletions templates/student/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends 'base.html.twig' %}

{% block body %}
<div class="bg-light m-4">
<table class="table">
<tbody>
<tr>
<th scope="row">Projektas</th>
<th scope="row">Studentas</th>
</tr>
<tr>
<td>{{ project|escape }}</td>
<td>{{ name|escape }}</td>
</tr>
</tbody>
</table>

{% if name == 'Indrė' %}
<div class="alert alert-success" role="alert">
Dešimt balų
</div>
{% else %}
<div class="alert alert-warning" role="alert">
Gal pasiseks kitą kartą
</div>
{% endif %}
</div>

<div class="m-4">
<a class="text-light" href="{{ path('home') }}">Visi studentai</a>
</div>
{% endblock %}
Loading