-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_task.php
52 lines (35 loc) · 990 Bytes
/
add_task.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
<?php
include_once '../blu/ControllerFactory.php';
$controller = ControllerFactory::getInstance()->getTaskController();
$data="";
$taskObj = new Task;
$taskObj->processRequest();
// print_r($taskObj);
// print_r($_REQUEST);
// die();
// die();
/*
$dtz = new DateTimeZone('Asia/kolkata');
$time_in_asia = new DateTime('now', $dtz);
// echo $dtz->getOffset( $time_in_asia );
$offset = $dtz->getOffset( $time_in_asia ) / 3600;
echo "GMT" . ($offset < 0 ? $offset : "+".$offset);
exit;
*/
if(FALSE == $taskObj->validateAddTask()){
$arr_result = array(RESULT => FAILED,
MESSAGE => "Please provide the data.",
DATA => "");
echo json_encode($arr_result);
exit;
}else{
$TASK_ID = $controller->addTask($taskObj);
$resObj = $controller->getTask($TASK_ID);
$arr_result = array(RESULT => SUCCESS,
MESSAGE => "Task added Successfully..!",
DATA => $resObj);
$json = json_encode($arr_result);
echo preg_replace("/null/", '""', $json);
exit;
}
?>