Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 637 | Rev 1056 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 637 Rev 1044
Línea 1... Línea 1...
1
<?php
1
<?php
Línea -... Línea 2...
-
 
2
 
-
 
3
use LeadersLinked\Model\UserType;
2
 
4
 
3
$currentUser            = $this->currentUserHelper();
5
$currentUser            = $this->currentUserHelper();
Línea 4... Línea 6...
4
if( $currentUser->hasIdentity() ) {
6
if( $currentUser->hasIdentity() ) {
5
 
7
 
6
$session_user_id        = $currentUser->getUserId();
8
$session_user_id        = $currentUser->getUserId();
Línea -... Línea 9...
-
 
9
$session_usertype_id    = $currentUser->getUserTypeId();
-
 
10
$user = $currentUser->getUser();
-
 
11
 
-
 
12
$link_admin = $session_usertype_id == UserType::ADMIN ? 1 : 0;
Línea 7... Línea 13...
7
$session_usertype_id    = $currentUser->getUserTypeId();
13
 
Línea -... Línea 14...
-
 
14
 
-
 
15
$container = $this->navigation('menuNavigation')->getContainer();
-
 
16
 
-
 
17
$acl = $this->viewModel()->getCurrent()->getVariable('acl');
-
 
18
 
-
 
19
 
-
 
20
$menu = [];
-
 
21
foreach($container as $page) {
-
 
22
 
-
 
23
    if(!$page || !$page->getRoute() || !$acl->isAllowed($session_usertype_id , $page->getRoute())) {
-
 
24
        continue;
-
 
25
    }
-
 
26
 
-
 
27
 
-
 
28
    $option = [
-
 
29
        'label' => $page->getLabel(),
-
 
30
        'href' => $page->getHref(),
-
 
31
        'childs' => [],
8
$user = $currentUser->getUser();
32
    ];    
-
 
33
    
-
 
34
    
-
 
35
    $childs = $page->getPages();
-
 
36
    if($childs) {
-
 
37
        foreach($childs as $child) {
-
 
38
            if(!$acl->isAllowed($session_usertype_id ,  $child->getRoute())) {
-
 
39
    		      continue;
-
 
40
    	    }
-
 
41
    	    
-
 
42
    	    array_push($option['childs'], [
-
 
43
    	        'label' => $child->getLabel(),
-
 
44
    	        'href' => $child->getLabel()
-
 
45
    	    ]);
-
 
46
    	    
-
 
47
        }
-
 
48
    }				
Línea 9... Línea 49...
9
 
49
    
Línea 10... Línea 50...
10
 
50
    array_push($menu, $option);
11
$acl = $this->viewModel()->getCurrent()->getVariable('acl');
51
}
12
 
52
 
13
 
53
$menu = json_encode($menu);
14
$container = $this->navigation('menuNavigation')->getContainer();
54
 
-
 
55
 
15
 
56
$image = $this->url('storage', ['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image]);
16
$image = $this->url('storage', ['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image]);
57
 
17
 
58
$isChatPage = $this->viewModel()->getCurrent()->getVariable('is_chat');
18
$isChatPage = $this->viewModel()->getCurrent()->getVariable('is_chat');
59
$routeCheckSession = $this->url('check-session');
19
$routeCheckSession = $this->url('check-session');
60
$currentUser    = $this->currentUserHelper();