-
Notifications
You must be signed in to change notification settings - Fork 0
/
includes.inc.php
81 lines (70 loc) · 3.18 KB
/
includes.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
include ("include.common.php");
if(defined('MODULE_PATH')){
saveSessionObject("modulePath", MODULE_PATH);
}
define('CLIENT_PATH',__DIR__);
include (CLIENT_PATH."/include.common.php");
include (CLIENT_PATH."/server.includes.inc.php");
$user = getSessionObject('user');
$employeeCurrent = null;
$employeeSwitched = null;
if(!empty($user->employee)){
$employeeCurrent = $baseService->getElement('Employee',$user->employee);
if(!empty($employeeCurrent)){
$employeeCurrent = $fileService->updateEmployeeImage($employeeCurrent);
}
}
if($user->user_level == 'Admin'){
$switchedEmpId = $baseService->getCurrentEmployeeId();
if($switchedEmpId != $user->employee && !empty($switchedEmpId)){
$employeeSwitched = $baseService->getElement('Employee',$switchedEmpId);
if(!empty($employeeSwitched)){
$employeeSwitched = $fileService->updateEmployeeImage($employeeSwitched);
}
}
}
include 'modules.php';
//read field templates
$fieldTemplates = array();
$fieldTemplates['hidden'] = file_get_contents(CLIENT_PATH.'/templates/fields/hidden.html');
$fieldTemplates['text'] = file_get_contents(CLIENT_PATH.'/templates/fields/text.html');
$fieldTemplates['textarea'] = file_get_contents(CLIENT_PATH.'/templates/fields/textarea.html');
$fieldTemplates['select'] = file_get_contents(CLIENT_PATH.'/templates/fields/select.html');
$fieldTemplates['date'] = file_get_contents(CLIENT_PATH.'/templates/fields/date.html');
$fieldTemplates['time'] = file_get_contents(CLIENT_PATH.'/templates/fields/time.html');
$templates = array();
$templates['formTemplate'] = file_get_contents(CLIENT_PATH.'/templates/form_template.html');
//include module templates
if(file_exists(MODULE_PATH.'/templates/fields/hidden.html')){
$fieldTemplates['hidden'] = file_get_contents(MODULE_PATH.'/templates/fields/hidden.html');
}
if(file_exists(MODULE_PATH.'/templates/fields/text.html')){
$fieldTemplates['text'] = file_get_contents(MODULE_PATH.'/templates/fields/text.html');
}
if(file_exists(MODULE_PATH.'/templates/fields/textarea.html')){
$fieldTemplates['textarea'] = file_get_contents(MODULE_PATH.'/templates/fields/textarea.html');
}
if(file_exists(MODULE_PATH.'/templates/fields/select.html')){
$fieldTemplates['select'] = file_get_contents(MODULE_PATH.'/templates/fields/select.html');
}
if(file_exists(MODULE_PATH.'/templates/fields/date.html')){
$fieldTemplates['date'] = file_get_contents(MODULE_PATH.'/templates/fields/date.html');
}
if(file_exists(MODULE_PATH.'/templates/fields/time.html')){
$fieldTemplates['time'] = file_get_contents(MODULE_PATH.'/templates/fields/time.html');
}
if(file_exists(MODULE_PATH.'/templates/form_template.html')){
$templates['orig_formTemplate'] = $templates['formTemplate'];
$templates['formTemplate'] = file_get_contents(MODULE_PATH.'/templates/form_template.html');
}
//Read module custom templates
$customTemplates = array();
if(is_dir(MODULE_PATH.'/customTemplates/')){
$ams = scandir(MODULE_PATH.'/customTemplates/');
foreach($ams as $am){
if(!is_dir(MODULE_PATH.'/customTemplates/'.$am) && $am != '.' && $am != '..'){
$customTemplates[$am] = file_get_contents(MODULE_PATH.'/customTemplates/'.$am);
}
}
}