-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson.php
More file actions
executable file
·119 lines (90 loc) · 2.02 KB
/
json.php
File metadata and controls
executable file
·119 lines (90 loc) · 2.02 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* json.php
*
* This file is used to make a connection betweeen ajax calls and database queries.
*
*/
include_once 'login.class.php';
include_once 'helper.class.php';
$mylog = new CLogin();
$myhelp = new Helper();
$appcode = $_GET['appcode'];
if ( $appcode == 2) {
if ( !isset( $_POST['week'] ) ) {
echo "error xxx";
die;
}
else {
$week = $_POST['week'];
$syear = $myhelp->getUserStartYear( $mylog->getIdUser() );
$sdate = $myhelp->CalendarWeekStartDate($week, $syear);
$day = substr($sdate, 8, 2);
$month = substr($sdate,5,2);
$year = substr($sdate,0,4);
$ret = $myhelp->getWorkWeek($mylog->getIdUser(), $day, $month, $year);
//print_r($ret);
$ret = json_encode($ret);
//echo json_last_error_msg();
echo $ret;
}
}
if ( $appcode == 3 ) {
echo $mylog->getDisplayName();
}
if ( $appcode == 4) {
if ( !isset($_POST['workyear']) ) {
echo "need year";
die;
}
if ( ! isset($_POST['workmonth'])) {
echo "need month";
die;
}
if ( ! isset($_POST['workday'])) {
echo "need day";
die;
}
$day = $_POST['workday'];
$month = $_POST['workmonth'];
$year = $_POST['workyear'];
$ret = $myhelp->getTimes($mylog->getIdUser(), $day, $month, $year);
$frm = json_encode($ret);
//$to = json_encode($ret['to']);
echo $frm;
//echo $to;
}
if ( $appcode == 5 ) {
$ret = $myhelp->GetWorkfieldsAll($mylog->getIdUser() );
$ret = json_encode($ret);
echo $ret;
}
if ( $appcode == 6 ) {
if ( !isset($_POST['workyear']) ) {
echo "need year";
die;
}
if ( ! isset($_POST['workmonth'])) {
echo "need month";
die;
}
if ( ! isset($_POST['workday'])) {
echo "need day";
die;
}
$day = $_POST['workday'];
$month = $_POST['workmonth'];
$year = $_POST['workyear'];
$ret = $myhelp->getWorkWeek($mylog->getIdUser(), $day, $month, $year);
}
if ( $appcode == 7 ) {
if ( !isset($_POST['workrank']) ) {
echo "need workfield";
die;
}
$rank = $_POST['workrank'];
$ret = $myhelp->getWorkDoneYear($mylog->getIdUser, $rank);
$ret = json_encode($ret);
echo $ret;
}
?>