|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
ÁTICA - Aplicación web para la gestión documental de centros educativos |
|
4
|
|
|
|
|
5
|
|
|
Copyright (C) 2015-2016: Luis Ramón López López |
|
6
|
|
|
|
|
7
|
|
|
This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
it under the terms of the GNU Affero General Public License as published by |
|
9
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
10
|
|
|
(at your option) any later version. |
|
11
|
|
|
|
|
12
|
|
|
This program is distributed in the hope that it will be useful, |
|
13
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
GNU Affero General Public License for more details. |
|
16
|
|
|
|
|
17
|
|
|
You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
along with this program. If not, see [http://www.gnu.org/licenses/]. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppBundle\Service; |
|
22
|
|
|
|
|
23
|
|
|
use AppBundle\Menu\MenuItem; |
|
24
|
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; |
|
25
|
|
|
|
|
26
|
|
|
class HeadDepartmentMenu implements MenuBuilderInterface |
|
27
|
|
|
{ |
|
28
|
|
|
private $authorizationChecker; |
|
29
|
|
|
|
|
30
|
|
|
public function __construct(AuthorizationChecker $authorizationChecker) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->authorizationChecker = $authorizationChecker; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function updateMenu(&$menu) |
|
36
|
|
|
{ |
|
37
|
|
|
$isHeadOfDepartment = $this->authorizationChecker->isGranted("ROLE_DEPARTMENT_HEAD"); |
|
38
|
|
|
|
|
39
|
|
|
if (!$isHeadOfDepartment) { |
|
40
|
|
|
return null; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
$mainItem = reset($menu); |
|
44
|
|
|
|
|
45
|
|
|
$item = new MenuItem(); |
|
46
|
|
|
$item |
|
47
|
|
|
->setName('admin.companies') |
|
48
|
|
|
->setRouteName('admin_company') |
|
49
|
|
|
->setCaption('menu.admin.companies') |
|
50
|
|
|
->setDescription('menu.admin.companies.detail') |
|
51
|
|
|
->setColor('cyan') |
|
52
|
|
|
->setIcon('industry'); |
|
53
|
|
|
|
|
54
|
|
|
$mainItem->addChild($item); |
|
55
|
|
|
|
|
56
|
|
|
$item = new MenuItem(); |
|
57
|
|
|
$item |
|
58
|
|
|
->setName('admin.workcenter') |
|
59
|
|
|
->setRouteName('admin_workcenter') |
|
60
|
|
|
->setCaption('menu.admin.workcenters') |
|
61
|
|
|
->setDescription('menu.admin.workcenters.detail') |
|
62
|
|
|
->setColor('dark-cyan') |
|
63
|
|
|
->setIcon('building'); |
|
64
|
|
|
|
|
65
|
|
|
$mainItem->addChild($item); |
|
66
|
|
|
|
|
67
|
|
|
$item = new MenuItem(); |
|
68
|
|
|
$item |
|
69
|
|
|
->setName('admin.agreement') |
|
70
|
|
|
->setRouteName('admin_agreement') |
|
71
|
|
|
->setCaption('menu.admin.agreement') |
|
72
|
|
|
->setDescription('menu.admin.agreement.detail') |
|
73
|
|
|
->setColor('dark-blue') |
|
74
|
|
|
->setIcon('link'); |
|
75
|
|
|
|
|
76
|
|
|
$mainItem->addChild($item); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function getMenuPriority() |
|
80
|
|
|
{ |
|
81
|
|
|
return '0100-FCT-Admin'; |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|