-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathajaxEmployee.php
87 lines (70 loc) · 2.44 KB
/
ajaxEmployee.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
82
83
84
85
86
87
<?php
/*
* As a work of the United States government, this project is in the public domain within the United States.
*/
/*
Index for everything
Date: September 11, 2007
*/
/* TODO:
1. prevent double submits
2. clean up
*/
error_reporting(E_ERROR);
require_once getenv('APP_LIBS_PATH') . '/loaders/Leaf_autoloader.php';
$oc_login->loginUser();
if ($oc_login)
{
}
$employee = new Orgchart\Employee($oc_db, $oc_login);
$action = isset($_GET['a']) ? $_GET['a'] : '';
$uid = isset($_GET['empUID']) && is_numeric($_GET['empUID']) ? $_GET['empUID'] : 0;
$indicatorID = isset($_GET['indicatorID']) && is_numeric($_GET['indicatorID']) ? $_GET['indicatorID'] : 0;
switch ($action) {
case 'getForm':
$t_form = new Smarty;
$t_form->left_delimiter = '<!--{';
$t_form->right_delimiter = '}-->';
$t_form->assign('form', $employee->getAllData($uid));
$t_form->assign('uid', $uid);
$t_form->assign('categoryID', $employee->getDataTableCategoryID());
$t_form->display('print_subindicators.tpl');
break;
case 'getFormContent':
if (is_numeric($_GET['indicatorID']))
{
$t_form = new Smarty;
$t_form->left_delimiter = '<!--{';
$t_form->right_delimiter = '}-->';
if (is_numeric($_GET['empUID']))
{
$t_form->assign('uid', $uid);
$t_form->assign('categoryID', $employee->getDataTableCategoryID());
$indicator = $employee->getAllData($uid, $indicatorID);
$t_form->assign('indicator', $indicator[$indicatorID]);
$t_form->display('print_subindicators_ajax.tpl');
}
}
break;
case 'getindicator':
$t_form = new Smarty;
$t_form->left_delimiter = '<!--{';
$t_form->right_delimiter = '}-->';
$t_form->assign('form', $employee->getAllData($uid, $indicatorID));
$t_form->assign('UID', $uid);
$t_form->assign('categoryID', $employee->getDataTableCategoryID());
$t_form->assign('CSRFToken', $_SESSION['CSRFToken']);
$t_form->display('ajaxForm.tpl');
break;
default:
/*
echo "Action: $action<br /><br />Catchall...<br /><br />POST: <pre>";
print_r($_POST);
echo "</pre><br /><br />GET:<pre>";
print_r($_GET);
echo "</pre><br /><br />FILES:<pre>";
print_r($_FILES);
echo "</pre>";
*/
break;
}