Proyectos de Subversion LeadersLinked - Backend

Rev

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