-
Notifications
You must be signed in to change notification settings - Fork 0
/
calendar-ajax.php
executable file
·52 lines (43 loc) · 1.73 KB
/
calendar-ajax.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
require_once('includes/initialize.php');
if( ! isset( $_REQUEST['event'] ) )
{
//Start date...
$xplode = explode( " " , $_REQUEST['start'] );
$string_start = $xplode[3] . "-" . $xplode[1] . "-" . $xplode[2] . " " . $xplode[4];
$date_start = date("Y-m-d H:i:s" , strtotime($string_start) );
//End date...
$xplode = explode( " " , $_REQUEST['start'] );
$string_end = $xplode[3] . "-" . $xplode[1] . "-" . $xplode[2] . " " . $xplode[4];
$date_end = date("Y-m-d H:i:s" , strtotime($string_end) );
$new_schedule = new UserSchedule();
$new_schedule->user_id = $_SESSION['user_id'];
$new_schedule->start_time = $date_start;
$new_schedule->data = $_REQUEST['data'];
$new_schedule->allDay = $_REQUEST['allDay'];
$new_schedule->end_time = $date_end;
$new_schedule->background = $_REQUEST['color'];
$new_schedule->create();
echo $date_start;
}
else
{
//Start date...
$xplode = explode( " " , $_REQUEST['start'] );
$string_start = $xplode[3] . "-" . $xplode[1] . "-" . $xplode[2] . " " . $xplode[4];
$date_start = date("Y-m-d H:i:s" , strtotime($string_start) );
//End date...
$xplode = explode( " " , $_REQUEST['end'] );
$string_end = $xplode[3] . "-" . $xplode[1] . "-" . $xplode[2] . " " . $xplode[4];
$date_end = date("Y-m-d H:i:s" , strtotime($string_end) );
$new_schedule = new UserSchedule();
$new_schedule->id = $_REQUEST['id'];
$new_schedule->user_id = $_SESSION['user_id'];
$new_schedule->start_time = $date_start;
$new_schedule->data = $_REQUEST['data'];
$new_schedule->allDay = $_REQUEST['allDay'];
$new_schedule->end_time = $date_end;
$new_schedule->background = $_REQUEST['color'];
$new_schedule->update();
}
?>