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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
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"
]
}
}
15 changes: 13 additions & 2 deletions src/Controller/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
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")
*/
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
]);
}
}
40 changes: 40 additions & 0 deletions src/Controller/StudentController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Controller;

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
{
/**
* @Route("/student", name="student")
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$name = $request->get('name', 'nenurodyta');
$project=$request->get('project', 'nenurodyta');


return $this->render('student/index.html.twig', [
'name' => $name,
'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);
}
}
2 changes: 1 addition & 1 deletion templates/base.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
Expand Down
54 changes: 52 additions & 2 deletions templates/home/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@
{% extends 'base.html.twig' %}

{% block title %}{{ someVariable }}{% endblock %}
{% block title %}Projektai{% endblock %}

{% block body %}
<div class="nfq-academy">{{ someVariable }}</div>
<ul class="list-group m-4">
<li class="list-group-item list-group-item-info">Studentai</li>
{% for dataRow in studentData %}
<li class="list-group-item">
<a href="{{ path('student', {name:dataRow['student'], project: dataRow['project']}) }}">{{dataRow['student']}}</a>
(
<span class="badge">Mentorius</span> {{dataRow['mentors']|join(', ') }}
)
</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 name, project in projects %}
<li class="list-group-item">
<h3>{{ project['name'] }}</h3>
<div class="panel panel-default">
<div>
<a target="_blank" href="https://github.com/nfqakademija/{{ name|url_encode }}">github.com/nfqakademija/{{ name }}</a>
<span class="badge">GitHub</span>
</div>
<div>
<a target="_blank" href="http://{{ name|url_encode }}.projektai.nfqakademija.lt/">{{ name }}.projektai.nfqakademija.lt/</a>
<span class="badge">Web</span>
</div>
<div>
<pre>ssh {{ name }}@deploy.nfqakademija.lt -p 2222</pre>
</div>
</div>
</li>
{% endfor %}
</ul>


<div class="m-4">
<a class="text-light" href="{{ path('students-json') }}">Duomenų failas</a>
</div>

{% endblock %}
33 changes: 33 additions & 0 deletions templates/student/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'base.html.twig' %}

{% block title %}Hello StudentController!{% endblock %}

{% 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 }}</td>
<td>{{ name}}</td>
</tr>
</tbody>
</table>
{% if name == 'Ričardas' %}
<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 %}