|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Menu; |
|
4
|
|
|
|
|
5
|
|
|
use App\Security\Voter\ExamVoter; |
|
6
|
|
|
use Knp\Menu\ItemInterface; |
|
7
|
|
|
|
|
8
|
|
|
class AdminDataMenuBuilder extends AbstractMenuBuilder { |
|
9
|
|
|
public function dataMenu(array $options = []): ItemInterface { |
|
|
|
|
|
|
10
|
|
|
$root = $this->factory->createItem('root'); |
|
11
|
|
|
|
|
12
|
|
|
if($this->authorizationChecker->isGranted('ROLE_ADMIN')) { |
|
13
|
|
|
$root->addChild('admin.sections.label', [ |
|
14
|
|
|
'route' => 'admin_sections' |
|
15
|
|
|
]) |
|
16
|
|
|
->setExtra('icon', 'fas fa-sliders-h'); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
if($this->authorizationChecker->isGranted('ROLE_DOCUMENTS_ADMIN')) { |
|
20
|
|
|
$root->addChild('admin.documents.label', [ |
|
21
|
|
|
'route' => 'admin_documents' |
|
22
|
|
|
]) |
|
23
|
|
|
->setExtra('icon', 'fas fa-file-alt'); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
if($this->authorizationChecker->isGranted('ROLE_MESSAGE_CREATOR')) { |
|
27
|
|
|
$root->addChild('admin.messages.label', [ |
|
28
|
|
|
'route' => 'admin_messages' |
|
29
|
|
|
]) |
|
30
|
|
|
->setExtra('icon', 'fas fa-envelope-open-text'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
if($this->authorizationChecker->isGranted(ExamVoter::Manage)) { |
|
34
|
|
|
$root->addChild('admin.exams.label', [ |
|
35
|
|
|
'route' => 'admin_exams' |
|
36
|
|
|
]) |
|
37
|
|
|
->setExtra('icon', 'fas fa-pen'); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
if($this->authorizationChecker->isGranted('ROLE_APPOINTMENT_CREATOR')) { |
|
41
|
|
|
$root->addChild('admin.appointments.label', [ |
|
42
|
|
|
'route' => 'admin_appointments' |
|
43
|
|
|
]) |
|
44
|
|
|
->setExtra('icon', 'far fa-calendar'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
if($this->authorizationChecker->isGranted('ROLE_WIKI_ADMIN')) { |
|
48
|
|
|
$root->addChild('admin.wiki.label', [ |
|
49
|
|
|
'route' => 'admin_wiki' |
|
50
|
|
|
]) |
|
51
|
|
|
->setExtra('icon', 'fab fa-wikipedia-w'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
if($this->authorizationChecker->isGranted('ROLE_ADMIN')) { |
|
55
|
|
|
$root->addChild('admin.timetable.label', [ |
|
56
|
|
|
'route' => 'admin_timetable' |
|
57
|
|
|
]) |
|
58
|
|
|
->setExtra('icon', 'far fa-clock'); |
|
59
|
|
|
|
|
60
|
|
|
$root->addChild('admin.resources.label', [ |
|
61
|
|
|
'route' => 'admin_resources' |
|
62
|
|
|
]) |
|
63
|
|
|
->setExtra('icon', 'fas fa-laptop-house'); |
|
64
|
|
|
|
|
65
|
|
|
$root->addChild('admin.teachers.label', [ |
|
66
|
|
|
'route' => 'admin_teachers' |
|
67
|
|
|
]) |
|
68
|
|
|
->setExtra('icon', 'fas fa-sort-alpha-down'); |
|
69
|
|
|
|
|
70
|
|
|
$root->addChild('admin.absence_types.label_students', [ |
|
71
|
|
|
'route' => 'admin_absence_types' |
|
72
|
|
|
]) |
|
73
|
|
|
->setExtra('icon', 'fas fa-user-times'); |
|
74
|
|
|
|
|
75
|
|
|
$root->addChild('admin.absence_types.label_teachers', [ |
|
76
|
|
|
'route' => 'admin_teacher_absence_types' |
|
77
|
|
|
]) |
|
78
|
|
|
->setExtra('icon', 'fas fa-user-times'); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
if($this->authorizationChecker->isGranted('ROLE_ADMIN')) { |
|
82
|
|
|
$root->addChild('admin.subjects.label', [ |
|
83
|
|
|
'route' => 'admin_subjects' |
|
84
|
|
|
]) |
|
85
|
|
|
->setExtra('icon', 'fas fa-graduation-cap'); |
|
86
|
|
|
|
|
87
|
|
|
$root->addChild('admin.displays.label', [ |
|
88
|
|
|
'route' => 'admin_displays' |
|
89
|
|
|
]) |
|
90
|
|
|
->setExtra('icon', 'fas fa-tv'); |
|
91
|
|
|
|
|
92
|
|
|
$root->addChild('admin.tuition_grades.label', [ |
|
93
|
|
|
'route' => 'admin_tuition_grades' |
|
94
|
|
|
]) |
|
95
|
|
|
->setExtra('icon', 'fas fa-user-graduate'); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
if($this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) { |
|
99
|
|
|
$root->addChild('admin.ea.label', [ |
|
100
|
|
|
'uri' => '/admin/ea' |
|
101
|
|
|
]) |
|
102
|
|
|
->setLinkAttribute('target', '_blank') |
|
103
|
|
|
->setExtra('icon', 'fas fa-tools'); |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
return $root; |
|
107
|
|
|
} |
|
108
|
|
|
} |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.