Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 14903 | Rev 15143 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
11565 efrain 2
$currentUserHelper    = $this->currentUserHelper();
3
$user = $currentUserHelper->getUser();
4
$company = $currentUserHelper->getCompany();
1 www 5
 
6
$notify = '';
7
$messages = $this->flashMessenger()->getInfoMessages();
4686 stevensc 8
foreach ($messages as $message) {
9
	$notify .= "$.fn.showInfo('$message')";
1 www 10
}
11
 
12
$messages = $this->flashMessenger()->getSuccessMessages();
4686 stevensc 13
foreach ($messages as $message) {
14
	$notify .= "$.fn.showSuccess('$message')";
1 www 15
}
16
 
17
$messages = $this->flashMessenger()->getWarningMessages();
4686 stevensc 18
foreach ($messages as $message) {
19
	$notify .= " $.fn.showWarning('$message')";
1 www 20
}
21
 
22
$messages = $this->flashMessenger()->getErrorMessages();
4686 stevensc 23
foreach ($messages as $message) {
24
	$notify .= " $.fn.showError('$message')";
1 www 25
}
26
 
4686 stevensc 27
if ($notify) {
28
	$this->inlineScript()->captureStart();
29
	echo " jQuery( document ).ready(function( $ ) { $notify }); ";
30
	$this->inlineScript()->captureEnd();
1 www 31
}
32
 
15089 efrain 33
 
34
$menu = [];
35
 
9056 stevensc 36
if ($company) {
15089 efrain 37
	$baseMenu = getAclMenuCompany();
9056 stevensc 38
} else {
15089 efrain 39
	$baseMenu= getAclMenuSystem();
9056 stevensc 40
}
8922 stevensc 41
 
9056 stevensc 42
if ($company) {
43
	$names = explode(' ', $company->name);
44
	$companyId = $company->uuid;
45
	$companyName = $company->name;
46
	$companyImg = $company->image;
47
}
8922 stevensc 48
 
15089 efrain 49
$session_usertype_id = $user->usertype_id;
50
$acl = $this->viewModel()->getCurrent()->getVariable('acl');
9056 stevensc 51
 
15089 efrain 52
 
53
foreach($baseMenu as $menuLevel1)
54
{
55
    if(!$acl->isAllowed($session_usertype_id ,  $menuLevel1['route'])) {
56
        continue;
57
    }
58
 
59
 
60
    $optionLevel1 = [
61
        'label' => $menuLevel1['label'],
62
        'route' => $menuLevel1['route'],
63
        'class' => empty($menuLevel1['class']) ? '' :  $menuLevel1['class'],
64
 
65
    ];
66
 
67
 
68
    if(!empty($menuLevel1['pages'])) {
69
 
70
 
71
 
72
 
73
        $optionLevel1['pages'] = [];
74
 
75
 
76
 
77
        foreach($menuLevel1['pages'] as $menuLevel2)
78
        {
79
 
80
            $optionLevel2 = [
81
                'label' => $menuLevel2['label'],
82
                'route' => $menuLevel2['route'],
83
                'class' => empty($menuLevel2['class']) ? '' :  $menuLevel2['class'],
84
            ];
85
 
86
            if(!$acl->isAllowed($session_usertype_id ,  $menuLevel2['route'])) {
87
               continue;
88
            }
89
 
90
            if(!empty($menuLevel2['pages'])) {
91
                $optionLevel2['pages'] = [];
92
 
93
                foreach($menuLevel2['pages'] as $menuLevel3)
94
                {
95
 
96
                    $optionLevel3 = [
97
                        'label' => $menuLevel3['label'],
98
                        'route' => $menuLevel3['route'],
99
                        'class' => empty($menuLevel3['class']) ? '' :  $menuLevel3['class'],
100
                    ];
101
 
102
                    if(!$acl->isAllowed($session_usertype_id ,  $menuLevel3['route'])) {
103
                        continue;
104
                    }
105
 
106
                    array_push($optionLevel2['pages'], $optionLevel3);
107
 
108
                }
109
            }
110
 
111
 
112
            array_push($optionLevel1['pages'], $optionLevel2);
113
 
114
        }
115
 
116
 
117
    }
118
 
119
 
120
 
121
 
122
    array_push($menu, $optionLevel1);
123
}
124
 
125
 
9056 stevensc 126
//[REQUEST_URI] => /settings/company-sizes/
127
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
128
 
129
if ($request_uri) {
14575 stevensc 130
	if (substr($request_uri, 0, 1) == '/') {
131
		$request_uri = substr($request_uri, 1);
132
	}
133
	if (substr($request_uri, strlen($request_uri) - 1, 1) == '/') {
134
		$request_uri = substr($request_uri, 0, strlen($request_uri) - 1);
135
	}
9056 stevensc 136
}
137
 
138
 
15089 efrain 139
 
9056 stevensc 140
$jsonMenu = json_encode($menu);
14575 stevensc 141
 
142
if ($company) {
143
	$js = <<<JS
9056 stevensc 144
	const backendVars= {
145
		menu:JSON.parse('$jsonMenu'),
146
		companyId: "$company->uuid",
147
		companyImg: "$companyImg",
148
		companyName: "$companyName",
149
		name: "$names[0]",
150
	}
151
JS;
152
} else {
153
	$js = <<<JS
154
	const backendVars= {
155
		menu:JSON.parse('$jsonMenu'),
156
		companyId: "",
157
		companyImg: "",
158
		companyName: "",
159
		name: "",
160
	}
161
JS;
162
}
163
$this->inlineScript()->appendScript($js);
164
$this->inlineScript()->appendFile('/react-bundles/menu/menuBundle.js');
165
 
1 www 166
?>
167
<!DOCTYPE html>
168
<html lang="es">
169
 
4686 stevensc 170
<head>
171
	<?php
172
	echo $this->headTitle();
173
	echo $this->headMeta()->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
174
		->appendHttpEquiv('expires', '0')
175
		->appendHttpEquiv('expires', 'Tue, 01 Jan 1980 1:00:00 GMT')
176
		->appendHttpEquiv('pragma', 'no-cache')
177
		->appendHttpEquiv('Cache-Control', 'no-store')
178
		->appendHttpEquiv('Cache-Control', 'max-age=0')
179
		->appendHttpEquiv('Cache-Control', 'no-cache')
180
		->appendHttpEquiv('charset', 'UTF-8')
181
		->appendName('viewport', 'width=device-width, initial-scale=1.0');
182
	?>
1 www 183
 
14575 stevensc 184
	<!-- Google Font: Source Sans Pro -->
185
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
186
	<!-- Font Awesome -->
187
	<link rel="stylesheet" href="<?php echo $this->basePath('plugins/font-awesome/css/font-awesome.css') ?>">
4686 stevensc 188
	<!-- Theme style -->
189
	<link rel="stylesheet" href="<?php echo $this->basePath('css/adminlte.min.css') ?>">
190
	<!-- App style -->
191
	<link rel="stylesheet" href="<?php echo $this->basePath('css/app.css') ?>">
192
	<link rel="stylesheet" href="<?php echo $this->basePath('/react-bundles/menu/main.css') ?>">
9002 stevensc 193
	<script src="<?php echo $this->basePath('plugins/ckeditor/ckeditor.js') ?>"></script>
1 www 194
 
11578 nelberth 195
	<?php if ($currentUserHelper->hasIdentity()) :  ?>
14575 stevensc 196
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/icons.css') ?>" />
197
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/smiley/assets/sprites/emojione.sprites.css') ?>" />
198
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/uploader/jquery.ui.plupload/css/jquery-ui.css') ?>" />
199
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('vendors/uploader/jquery.ui.plupload/css/jquery.ui.plupload.css') ?>" />
200
 
201
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/chat.css') ?>" />
202
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/style.css') ?>" />
203
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/style-cesa.css') ?>" />
14900 stevensc 204
		<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('css/responsive-cesa.css') ?>" />
11565 efrain 205
	<?php endif; ?>
11578 nelberth 206
	<?php
207
	echo $this->headStyle();
208
	echo $this->headLink();
209
	echo $this->headScript();
210
	?>
14903 stevensc 211
 
4686 stevensc 212
</head>
213
 
214
<body class="hold-transition sidebar-mini">
215
	<!-- Site wrapper -->
14150 stevensc 216
	<div class="wrapper">
14575 stevensc 217
 
14150 stevensc 218
		<div id="menu-sidebar"></div>
8759 stevensc 219
 
4686 stevensc 220
		<!-- Content Wrapper. Contains page content -->
14143 stevensc 221
		<div class="content-wrapper">
4686 stevensc 222
			<section class="content">
223
				<?php echo $this->content ?>
224
			</section>
14575 stevensc 225
 
226
 
227
			<?php
11565 efrain 228
			if ($currentUserHelper->hasIdentity()) {
14575 stevensc 229
				echo $this->chatHelper($user->id);
11565 efrain 230
			}
231
			?>
14575 stevensc 232
 
4686 stevensc 233
			<!-- /.content -->
234
		</div>
235
		<!-- /.content-wrapper -->
236
	</div>
237
	<!-- jQuery -->
238
	<script src="<?php echo $this->basePath('plugins/jquery/jquery.js') ?>"></script>
239
	<!-- Bootstrap 4 -->
240
	<script src="<?php echo $this->basePath('plugins/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>
241
	<!-- AdminLTE App -->
8906 stevensc 242
	<script src="<?php echo $this->basePath('js/adminlte.min.js') ?>"></script>
4686 stevensc 243
	<!--  Aplicacion -->
244
	<script src="<?php echo $this->basePath('plugins/bootstrap-notify/bootstrap-notify.min.js') ?>"></script>
245
	<script src="<?php echo $this->basePath('js/app.js') ?>"></script>
11577 nelberth 246
	<?php if ($currentUserHelper->hasIdentity()) :  ?>
247
		<script type="text/javascript" src="<?php echo $this->basePath('vendors/smiley/smiley.js') ?>"></script>
248
		<script type="text/javascript" src="<?php echo $this->basePath('vendors/smiley/js/emojione.min.js') ?>"></script>
249
	<?php endif; ?>
4686 stevensc 250
	<?php
251
	echo $this->inlineScript();
252
	?>
14575 stevensc 253
 
254
 
4686 stevensc 255
</body>
256
 
1 www 257
</html>