-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschedule.php
More file actions
141 lines (130 loc) · 5.74 KB
/
Copy pathschedule.php
File metadata and controls
141 lines (130 loc) · 5.74 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
@ob_start();
session_start();
date_default_timezone_set('Asia/Singapore');
if (!isset( $_SESSION['NUSEmail'] ) ) {
// Redirect them to the login page
if ($_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] =='443'){
header("Location: http://localhost/orbital/signup.php");
}
else{
header("Location: http://localhost:8080/orbital/signup.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="img\studylah_logo.jpg" type="image/jpg">
<title>Calendar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
<link rel="stylesheet" href="css\schedule.css">
<link rel="stylesheet" href="css\navbar.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.4.0/fullcalendar.min.js"></script>
<script>
$(document).ready(function() { //add calendar plug in
var calendar = $('#calendar').fullCalendar({
editable:true, //allow to drop and resize event
header:{ //buttons
left:'prev,next today',
center:'title',
right:'month,agendaWeek,agendaDay'
},
events: 'load.php', //to load all the events that is available in this page
selectable:true, //highlight multiple dates
selectHelper:true,
select: function(start, end, allDay){ //prompt to add new event
var title = prompt("Enter Event Title");
var venue = prompt("Enter Event Location\n ");
if(title){
var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss"); //store current date and time
var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");
$.ajax({
url:"insert.php",
type:"POST",
data:{title:title, venue:venue, start:start, end:end}, //sent data to server
success:function(){
calendar.fullCalendar('refetchEvents');
alert("Event Added");
}
})
}
},
editable:true,
eventResize:function(event){
var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
var title = event.title;
var ScheduleID = event.ScheduleID;
$.ajax({
url:"update.php",
type:"POST",
data:{title:title, start:start, end:end, ScheduleID:ScheduleID},
success:function(){
calendar.fullCalendar('refetchEvents');
alert('Event Update');
}
})
},
eventDrop:function(event){
var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");
var title = event.title;
var ScheduleID = event.ScheduleID;
$.ajax({
url:"update.php",
type:"POST",
data:{title:title, start:start, end:end, ScheduleID:ScheduleID},
success:function(){
calendar.fullCalendar('refetchEvents');
alert("Event Updated");
}
});
},
eventClick:function(event){
if(confirm("Are you sure you want to remove it?")){
var ScheduleID = event.ScheduleID;
$.ajax({
url:"delete.php",
type:"POST",
data:{ScheduleID:ScheduleID},
success:function(){
calendar.fullCalendar('refetchEvents');
alert("Event Removed");
}
})
}
},
});
});
</script>
</head>
<style>
.reco{
margin-left:50px;
margin-bottom:20px;
}
.reco a{
color: #5d4954;
}
</style>
<body>
<!--navbar-->
<?php include('header.php');?>
<br/>
<div class="reco">
<a href="recommendations.php">See Location Recommendations</a>
</div>
<div class="container">
<div id="calendar"></div> <!--add calendar plug-->
</div>
<br/>
<div class="end">
<button class="nav_contact" >Contact Us</button>
</div>
</body>
</html>