-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshift_request.php
55 lines (39 loc) · 1008 Bytes
/
shift_request.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
<?php
$callback = $_REQUEST["callback"];
$model = $_REQUEST["models"];
if(!isset($callback) || !isset($model)){
die('Missing callback or model');
}
$data = json_decode($model, TRUE);
$deleteReq = array();
$createReq = array();
for($i=0; $i<count($data); $i++){
$req = $data[$i];
$is_part = $req['part'];
unset($req['part']);
if($is_part == true)
array_push($createReq, $req);
else{
$tmp = $req;
unset($tmp['request_time']);
array_push($deleteReq, $tmp);
}
}
if(count($deleteReq) == 0)
$deleteReq = null;
if(count($createReq) == 0)
$createReq = null;
include('dal.php');
$dal = new DAL();
$result = $dal->handleUserRequests($createReq, $deleteReq);
echo sprintf('%s(%s)',$callback,$model);
/*
include('dal.php');
$dal = new DAL();
$cols = array("id","name","phone");
$noam = array("1","noam","2134");
$reut = array("2","reut","2134");
$vals = array($noam, $reut);
$dal->delete_statement('users', array('id','shift'), array(array('id1','s1'),array('d2','s2')),null);
*/
?>