|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the feedback project. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Florian Moser <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace App\Controller\Administration\Semester; |
|
13
|
|
|
|
|
14
|
|
|
use App\Controller\Base\BaseApiController; |
|
15
|
|
|
use App\Entity\Event; |
|
16
|
|
|
use App\Entity\Semester; |
|
17
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
18
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @Route("/event/{event}/view/api") |
|
22
|
|
|
*/ |
|
23
|
|
|
class ApiController extends BaseApiController |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @Route("/active", name="administration_semester_event_view_api_active") |
|
27
|
|
|
* |
|
28
|
|
|
* @param Event $event |
|
29
|
|
|
* |
|
30
|
|
|
* @return JsonResponse |
|
31
|
|
|
*/ |
|
32
|
|
|
public function activeEventAction(Event $event) |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->returnActiveEvent($event); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @Route("/{event2}/{identifier}/answers", name="administration_semester_event_view_api_active_answers") |
|
39
|
|
|
* |
|
40
|
|
|
* @throws \Exception |
|
41
|
|
|
* |
|
42
|
|
|
* @return JsonResponse |
|
43
|
|
|
*/ |
|
44
|
|
|
public function activeAnswersAction() |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->json([]); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @Route("/semesters", name="administration_semester_event_view_api_semesters") |
|
51
|
|
|
* |
|
52
|
|
|
* @return JsonResponse |
|
53
|
|
|
*/ |
|
54
|
|
|
public function semestersAction() |
|
55
|
|
|
{ |
|
56
|
|
|
$semesters = $this->getDoctrine()->getRepository(Semester::class)->findBy([], ['name' => 'DESC']); |
|
57
|
|
|
|
|
58
|
|
|
return $this->returnSemester($semesters); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @Route("/{event2}/answer", name="administration_semester_event_view_api_event_answer") |
|
63
|
|
|
* |
|
64
|
|
|
* @throws \Exception |
|
65
|
|
|
* |
|
66
|
|
|
* @return JsonResponse |
|
67
|
|
|
*/ |
|
68
|
|
|
public function answerAction() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->json(true); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @Route("/{event2}/finish", name="administration_semester_event_view_api_event_finish") |
|
75
|
|
|
* |
|
76
|
|
|
* @return JsonResponse |
|
77
|
|
|
*/ |
|
78
|
|
|
public function finishAction() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->json(true); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|