16805 |
efrain |
1 |
<?php
|
1 |
www |
2 |
use LeadersLinked\Model\UserType;
|
|
|
3 |
|
|
|
4 |
$currentUserPlugin = $this->currentUserHelper();
|
|
|
5 |
$currentUser = $currentUserPlugin->getUser();
|
16805 |
efrain |
6 |
$currentCompany = $currentUserPlugin->getCompany();
|
1 |
www |
7 |
|
16805 |
efrain |
8 |
|
|
|
9 |
if($currentCompany) {
|
|
|
10 |
$menu = getAclMenuCompany();
|
1 |
www |
11 |
} else {
|
16805 |
efrain |
12 |
$menu = getAclMenuSystem();
|
1 |
www |
13 |
}
|
|
|
14 |
|
4621 |
stevensc |
15 |
|
16805 |
efrain |
16 |
|
|
|
17 |
|
|
|
18 |
$usertype_id = $currentUser->usertype_id;
|
|
|
19 |
|
1 |
www |
20 |
//[REQUEST_URI] => /settings/company-sizes/
|
|
|
21 |
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
|
|
|
22 |
|
16805 |
efrain |
23 |
|
|
|
24 |
if($request_uri) {
|
|
|
25 |
if(substr($request_uri, 0, 1) == '/') {
|
|
|
26 |
$request_uri = substr($request_uri, 1);
|
|
|
27 |
}
|
|
|
28 |
if(substr($request_uri, strlen($request_uri) -1 , 1) == '/') {
|
|
|
29 |
$request_uri = substr($request_uri, 0, strlen($request_uri) -1 );
|
|
|
30 |
}
|
4621 |
stevensc |
31 |
}
|
1 |
www |
32 |
|
16805 |
efrain |
33 |
|
1 |
www |
34 |
$acl = $this->viewModel()->getCurrent()->getVariable('acl');
|
16805 |
efrain |
35 |
|
16806 |
efrain |
36 |
$liCount = 0;
|
|
|
37 |
foreach($menu as $level1) :
|
16805 |
efrain |
38 |
|
16806 |
efrain |
39 |
if(!$level1 || !$level1['route'] || !$acl->isAllowed($usertype_id , $level1['route'])) {
|
|
|
40 |
continue;
|
1 |
www |
41 |
}
|
4633 |
stevensc |
42 |
|
16806 |
efrain |
43 |
$liCount++;
|
16805 |
efrain |
44 |
|
16806 |
efrain |
45 |
if(empty($level1['pages'])) :
|
|
|
46 |
?>
|
|
|
47 |
<li class="nav-item" id="nav-item<?php echo $liCount ?>">
|
|
|
48 |
<a href="/<?php echo $level1['route'] ?>" class="nav-link"><?php echo $level1['label'] ?></a>
|
|
|
49 |
</li>
|
|
|
50 |
<?php else: ?>
|
|
|
51 |
<li class="nav-item dropdown" id="nav-item<?php echo $liCount ?>">
|
|
|
52 |
<a id="dropdownSubMenu<?php echo $liCount ?>" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle"><?php echo $level1['label'] ?></a>
|
|
|
53 |
<ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow" style="left: 0px; right: inherit;">
|
|
|
54 |
|
|
|
55 |
<?php foreach($level1['pages'] as $level2) :
|
|
|
56 |
if(!$level2 || !$level2['route'] || !$acl->isAllowed($usertype_id , $level2['route'])) {
|
|
|
57 |
continue;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
$liCount++;
|
|
|
61 |
if(empty($level2['pages'])) :
|
|
|
62 |
?>
|
|
|
63 |
<li><a href="/<?php echo $level2['route'] ?>" class="dropdown-item"><?php echo $level2['label'] ?></a></li>
|
|
|
64 |
<?php else: ?>
|
|
|
65 |
<li class="dropdown-submenu dropdown-hover">
|
|
|
66 |
<a id="dropdownSubMenu<?php echo $liCount ?>" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-item dropdown-toggle"><?php echo $level2['label'] ?></a>
|
|
|
67 |
<ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow">
|
|
|
68 |
|
|
|
69 |
<?php foreach($level2['pages'] as $level3) :
|
|
|
70 |
if(!$level3 || !$level3['route'] || !$acl->isAllowed($usertype_id , $level3['route'])) {
|
|
|
71 |
continue;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
$liCount++;
|
|
|
75 |
if(empty($level3['pages'])) :
|
|
|
76 |
?>
|
|
|
77 |
<li>
|
|
|
78 |
<a tabindex="-1" href="/<?php echo $level3['route'] ?>" class="dropdown-item"><?php echo $level3['label'] ?></a>
|
|
|
79 |
</li>
|
|
|
80 |
<?php else: ?>
|
|
|
81 |
<li class="dropdown-submenu">
|
|
|
82 |
<a id="dropdownSubMenu<?php echo $liCount ?>" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-item dropdown-toggle"><?php echo $level3['label'] ?></a>
|
|
|
83 |
<ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow">
|
|
|
84 |
<?php foreach($level3['pages'] as $level4) :
|
|
|
85 |
if(!$level4 || !$level4['route'] || !$acl->isAllowed($usertype_id , $level4['route'])) {
|
|
|
86 |
continue;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
$liCount++;
|
|
|
90 |
?>
|
|
|
91 |
<li><a href="/<?php echo $level4['route'] ?>" class="dropdown-item"><?php echo $level4['label'] ?></a></li>
|
|
|
92 |
|
|
|
93 |
<?php endforeach; ?>
|
|
|
94 |
</ul>
|
|
|
95 |
</li>
|
|
|
96 |
<?php endif;?>
|
|
|
97 |
<?php endforeach; ?>
|
16805 |
efrain |
98 |
|
16806 |
efrain |
99 |
</ul>
|
|
|
100 |
<li>
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
<?php endif; ?>
|
|
|
104 |
|
|
|
105 |
<?php endforeach; ?>
|
|
|
106 |
</ul>
|
|
|
107 |
</li>
|
|
|
108 |
<?php endif; ?>
|
16805 |
efrain |
109 |
|
|
|
110 |
|
16806 |
efrain |
111 |
|
|
|
112 |
<?php endforeach; ?>
|
16805 |
efrain |
113 |
|
16806 |
efrain |
114 |
|