Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4842 Rev 4964
Línea 3... Línea 3...
3
use LeadersLinked\Model\UserType;
3
use LeadersLinked\Model\UserType;
4
use LeadersLinked\Model\User;
4
use LeadersLinked\Model\User;
5
use LeadersLinked\Model\Theme;
5
use LeadersLinked\Model\Theme;
6
use LeadersLinked\Model\Network;
6
use LeadersLinked\Model\Network;
Línea 7... Línea 7...
7
 
7
 
Línea 8... Línea 8...
8
$currentUser            = $this->currentUserHelper();
8
$currentUser = $this->currentUserHelper();
9
 
9
 
Línea 10... Línea 10...
10
$currentNetworkHelper = $this->currentNetworkHelper();
10
$currentNetworkHelper = $this->currentNetworkHelper();
Línea 11... Línea 11...
11
$currentNetwork = $currentNetworkHelper->getNetwork();
11
$currentNetwork = $currentNetworkHelper->getNetwork();
12
 
-
 
13
$logoForNavbar = $this->networkNavbarHelper();
12
 
14
 
13
$logoForNavbar = $this->networkNavbarHelper();
15
if ($currentUser->hasIdentity()) {
14
 
Línea 16... Línea 15...
16
 
15
if ($currentUser->hasIdentity()) {
Línea 17... Línea -...
17
    $session_user_id        = $currentUser->getUserId();
-
 
18
    $session_usertype_id    = $currentUser->getUserTypeId();
16
    $session_user_id        = $currentUser->getUserId();
Línea 19... Línea -...
19
    $user = $currentUser->getUser();
-
 
20
 
17
    $session_usertype_id    = $currentUser->getUserTypeId();
21
    $link_admin = $session_usertype_id == UserType::ADMIN ? 1 : 0;
-
 
22
 
18
    $user = $currentUser->getUser();
Línea 23... Línea -...
23
 
-
 
24
    $link_impersonate = $user->is_super_user == User::IS_SUPER_USER_YES ? 1 : 0;
19
 
25
 
20
    $link_admin = $session_usertype_id == UserType::ADMIN ? 1 : 0;
Línea 26... Línea -...
26
 
-
 
27
    //$container = $this->navigation('menuNavigation')->getContainer();
21
 
28
 
22
    $link_impersonate = $user->is_super_user == User::IS_SUPER_USER_YES ? 1 : 0;
29
    $acl = $this->viewModel()->getCurrent()->getVariable('acl');
23
 
Línea 30... Línea 24...
30
 
24
    //$container = $this->navigation('menuNavigation')->getContainer();
31
 
25
    $acl = $this->viewModel()->getCurrent()->getVariable('acl');
32
    $menu = [];
-
 
33
    foreach ($pages as $page) {
-
 
Línea 34... Línea 26...
34
 
26
 
35
 
27
    $menu = [];
36
        if (!$page || empty($page['route']) || !$acl->isAllowed($session_usertype_id, $page['route'])) {
28
    foreach ($pages as $page) {
37
            continue;
29
 
38
        }
30
        if (!$page || empty($page['route']) || !$acl->isAllowed($session_usertype_id, $page['route'])) {
39
 
31
            continue;
40
        $ajax = false;
-
 
41
        if($page['route'] == 'company' && $currentNetwork->default == Network::DEFAULT_NO) {
32
        }
42
            
-
 
43
            
-
 
44
 
-
 
Línea 45... Línea 33...
45
            if($link_company) {
33
 
46
                $page['route'] = $this->url($link_company['route'], ['id' => $link_company['id'] ]);
34
        $ajax = false;
47
                $ajax = true;
35
        if ($page['route'] == 'company' && $currentNetwork->default == Network::DEFAULT_NO) {
48
            } else {
36
 
49
                continue;
37
            if ($link_company) {
50
            }
38
                $page['route'] = $this->url($link_company['route'], ['id' => $link_company['id']]);
51
            
39
                $ajax = true;
Línea 52... Línea -...
52
        }
-
 
53
        
40
            } else {
54
        
41
                continue;
55
 
42
            }
56
 
43
        }
57
        $option = [
44
 
58
            'label' => $page['label'],
45
        $option = [
Línea 59... Línea -...
59
            'href' => $page['route'],
-
 
60
            'img' => empty($page['class']) ? '' : $page['class'],
-
 
61
            'ajax' => $ajax ? 1 : 0,
-
 
62
            'childs' => [],
-
 
63
        ];
-
 
64
 
46
            'label' => $page['label'],
Línea 65... Línea -...
65
 
-
 
66
        $childs = empty($page['pages']) ? [] : $page['pages'];
47
            'href' => $page['route'],
Línea 67... Línea -...
67
        if ($childs) {
-
 
68
            foreach ($childs as $child) {
-
 
69
                if (!$acl->isAllowed($session_usertype_id,  $child['route'])) {
-
 
70
                    continue;
-
 
71
                }
48
            'img' => empty($page['class']) ? '' : $page['class'],
72
 
49
            'ajax' => $ajax ? 1 : 0,
73
 
50
            'childs' => [],
74
 
51
        ];
75
 
52
 
Línea 96... Línea 73...
96
 
73
 
97
                        ]);
74
                        ]);
98
                    }
75
                    }
Línea 99... Línea -...
99
                }
-
 
100
 
76
                }
101
 
77
 
102
                array_push($option['childs'], [
78
                array_push($option['childs'], [
103
                    'label' => $child['label'],
79
                    'label' => $child['label'],
104
                    'href' => $child['route'],
80
                    'href' => $child['route'],
Línea 108... Línea 84...
108
        }
84
        }
Línea 109... Línea 85...
109
 
85
 
110
        array_push($menu, $option);
86
        array_push($menu, $option);
Línea 111... Línea -...
111
    }
-
 
112
 
-
 
113
    /*
-
 
114
echo '<pre>';
-
 
115
print_r($menu);
-
 
116
echo '</pre>';
-
 
117
exit;
-
 
118
*/
87
    }
119
 
-
 
120
    $menu = json_encode($menu);
88
 
121
 
-
 
122
    $image = $this->url('storage', ['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image]);
-
 
-
 
89
$menu = json_encode($menu);
-
 
90
$image = $this->url('storage', ['type' => 'user', 'code' => $user->uuid, 'filename' => $user->image]);
-
 
91
$isChatPage = $this->viewModel()->getCurrent()->getVariable('is_chat');
Línea 123... Línea -...
123
 
-
 
124
 
-
 
125
 
-
 
126
    $isChatPage = $this->viewModel()->getCurrent()->getVariable('is_chat');
92
$routeCheckSession = $this->url('check-session');
127
    $routeCheckSession = $this->url('check-session');
93
$currentUser    = $this->currentUserHelper();
128
    $currentUser    = $this->currentUserHelper();
94
 
129
    $js = <<<JS
95
$js = <<<JS
130
const navbarVars={
96
const navbarVars={
131
  menu: $menu,
97
  menu: $menu,
Línea 137... Línea 103...
137
  fullName: '$fullname',
103
  fullName: '$fullname',
138
  country: '$country',
104
  country: '$country',
139
  visits: '$visits',
105
  visits: '$visits',
140
  connections: '$connections',
106
  connections: '$connections',
141
  logoForNavbar: '$logoForNavbar',
107
  logoForNavbar: '$logoForNavbar',
-
 
108
  defaultNetwork: '$currentNetwork->default',
142
}
109
}
Línea 143... Línea 110...
143
 
110
 
144
//TODO is_chat
111
//TODO is_chat
145
JS;
112
JS;