-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
188 lines (126 loc) · 6.36 KB
/
index.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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
require_once 'knobs.php';
require_once 'header.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Add Speakers</title>
<script src="scripts/jquery-1.7.2.js" ></script>
<script type="text/javascript" >
function postSpeaker()
{
$("#sessions_table").html("<thead><tr><th>Title</th><th>Attendies</th><th>Select</th><th>Remove</th></tr></thead>");
$.post("ajax_speaker_handler.php", {mode : "list_sessions", speaker : $("#speakerid").val()}, function(data){
for(var key in data)
{
var temp = "<tr>";
temp += "<td>" + data[key].title + "</td>";
temp += "<td>" + data[key].attendies + "</td>";
temp += '<td><input type="checkbox" name="user_session" value="' + data[key].id + '" /></td>';
temp += "</tr>";
$("#sessions_table").append(temp);
}
var temp = "<br><br>" + '<input type="submit" name="submit" value="submit" />';
$("#sessions_table").append(temp);
}, "json");
}
function postSessionList()
{
var senddata = new Object();
var sessions = new Array();
senddata.mode = "register_sessions";
$('#sessions_table input[name="user_session"]:checked').each(function(){
//
sessions.push($(this).val());
// alert($(this).val());
});
senddata.sessions = sessions;
$.post("ajax_speaker_handler.php", senddata, function(data){
refresh_currentpool();
}, "text");
}
function remove_session(id)
{
$.post("ajax_speaker_handler.php", {mode : "remove_session", session: id}, function(data){
if (data != "OK")
{
alert("Error in deletion");
}
refresh_currentpool();
}, "text");
}
function refresh_currentpool()
{
$.post("ajax_speaker_handler.php", {mode : "refresh_pool"}, function(data){
if (data.status == "OK")
{
var temp = "<thead><tr>";
temp += "<td>S. No.</td>";
temp += "<td>Author</td>";
temp += "<td>Title</td>";
temp += "<td>Post Id</td>";
temp += '<td>Remove</td>';
temp += "</tr></thead>";
$("#currentpool_table").html("");
var i=0;
for (var key in data.sessions)
{
var temp = "<tr>";
temp += "<td>" + (++i) + "</td>";
temp += "<td>" + data.sessions[key].author + "</td>";
temp += "<td>" + data.sessions[key].post_title + "</td>";
temp += "<td>" + data.sessions[key].post_id + "</td>";
temp += '<td><a href="javascript:remove_session(' + data.sessions[key].post_id +')">Remove</a></td>';
temp += "</tr>";
$("#currentpool_table").append(temp);
}
$("#currentpool_count").html(i);
// if (i != <?php echo $NUM_CELLS; ?> )
// {
// $("#scheduling_link").hide();
// }
// else
// {
// $("#scheduling_link").show();
// }
}
}, "json");
}
$(function(){
$("#refreshpool_button").click(function(){
refresh_currentpool();
});
refresh_currentpool();
});
</script>
</head>
<body>
<?php include 'nav.php'; ?>
<br><br>
<form action="javascript:postSpeaker()">
Enter Speaker username <input type="text" name="speakerid" id="speakerid" />
<input type="submit" name="submit" value="submit" />
</form>
<br><br>
<div id="session_list">
<form id="sessions_form" action="javascript:postSessionList()">
<table id="sessions_table" border="1">
<thead>
<tr>
<th>Title</th>
<th>Attendies</th>
<th>Select</th>
</tr>
</thead>
</table>
</form>
</div>
<hr>
<h2>Current Pool - <span id="currentpool_count"></span></h2> <button id="refreshpool_button">Refresh</button>
<table id="currentpool_table" border="1" >
</table>
<a href="prepare_data.php" id="scheduling_link">Start Scheduling</a>
</body>
</html>