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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
<?php include_once '../include/DBConnect.php'; ?> <!DOCTYPE html> <?php if (isset($_GET["search"])) { $search_List = array(); $event_id = array(); $sth2 = $dbh->query('select Min(date) startdate,Max(date) enddate,e.event_id eid,e.event_code ec,p.program_code pc,s.sub_code sc from subject s,program p,lesson l,event_lesson el,event e where el.lesson_id=l.lesson_id and e.event_id=el.event_id and el.lesson_id in (SELECT lesson_id FROM `lesson_attendance` WHERE actived=1 and deleted=0 and staff_id like"%'.$_GET['staff_name'].'%") and el.lesson_id in (SELECT lesson_id FROM `lesson_attendance` WHERE `stu_linking_id` like "%' . $_GET['student_name'] . '%" and deleted=0 and actived=1) and p.program_id=e.program_id and e.subject_id=s.subject_id and e.actived=1 and e.deleted=0 and e.event_code like "%' . $_GET['search']['code_id'] . '%" and e.program_id like"%' . $_GET['search']['programme_id'] . '%" and e.subject_id like"%' . $_GET['search']['subject_id'] . '%" group by e.event_id'); while ($ResultSet2 = $sth2->fetch(PDO::FETCH_ASSOC)) { if (!empty($_GET['search']['startdate_id'])) { if ($ResultSet2['startdate'] <= $_GET['search']['startdate_id'] && $ResultSet2['enddate'] >= $_GET['search']['startdate_id']) { array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate'])); continue; } if ($ResultSet2['startdate'] <= $_GET['search']['enddate_id'] && $ResultSet2['enddate'] >= $_GET['search']['enddate_id']) { array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate'])); continue; } if ($ResultSet2['startdate'] >= $_GET['search']['startdate_id'] && $ResultSet2['enddate'] <= $_GET['search']['enddate_id']) { array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate'])); continue; } } else { array_push($search_List, array($ResultSet2['eid'], $ResultSet2['ec'], $ResultSet2['pc'], $ResultSet2['sc'], $ResultSet2['startdate'], $ResultSet2['enddate'])); } } } ?> <?php if (isset($_GET['search']['Submit_delete'])) { foreach ($_GET["event_id"] as $arr) { $dbh->query("UPDATE `event` SET `lastupdate`=now(),`deleted`=1 WHERE `event_id`='" . $arr . "' "); $dbh->query("UPDATE `event_lesson` set`lastupdate`=now(),`deleted`=1 WHERE `event_id`='" . $arr . "'"); $dbh->query("UPDATE `lesson` set `lastupdate`=now(),`deleted`=1 WHERE `lesson_id` in (select lesson_id from event_lesson WHERE `event_id`='" . $arr . "')"); $dbh->query("UPDATE `lesson_attendance` set `lastupdate`=now(),`deleted`=1 WHERE `lesson_id` in (select lesson_id from event_lesson WHERE `event_id`='" . $arr . "')"); } header("Location: Event_List.php"); } ?>
<html> <head> <?php include_once '../include/head.php'; ?> <?php include_once '../include/checkuser.php'; ?> <?php include_once '../include/Nav_bar.php'; ?> <?php if (isset($_GET['search']['code_id'])) { ?> <script> $(function(){ $('#code_id').select2().select2('val','<?= $_GET['search']['code_id'] ?>') ; }); </script> <?php } ?> <script> $(function() { $('.date-picker').datetimepicker({ pickTime: false }); $('#code_id').select2(); $(".student_name").select2(); $('.staff_name').select2(); }); function check_all(){ for(var i=0;i<(document.getElementsByName("event_id[]")).length;i++) (document.getElementsByName("event_id[]"))[i].checked = true; } </script> <style> div.pathways-inline-block{ margin-right: 20px; } </style> </head> <body> <!-- line between nav bar and content --> <div class="text-right"> <ul class="breadcrumb"> <li class="active">Event</li> </ul> </div>
<div class="container-fluid pathways-container"> <a class="btn pull-right" href="Event_AddFrom.php"><i class="icon-plus"></i>Add</a> <h3>Event</h3> <form id="search_form" class="form-inline" action="" method="get"> <div id="2" style="margin: 0;padding: 5px 10px;background-color: #F7F7F7;border: 1px solid #E6E6E6;border-radius: 5px;box-shadow: 0 1px 2px rgba(0,0,0,.05);"> <!-- ## Code ## --> <div class="pathways-inline-block"> <label class="" for="code_id">Code : </label> <select id="code_id" name="search[code_id]" style="width: 200px;"type="text" maxlength="150" placeholder="Code" > <option value=""></option> <?php $sth = $dbh->query("select event_code from event where actived=1 and deleted=0 ") ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <option value="<?= $ResultSet['event_code'] ?>"><?= $ResultSet['event_code'] ?></option> <?php } ?> </select> </div> <!-- ## Program ## -->
<div class="pathways-inline-block"> <?php $sth = $dbh->query('SELECT * FROM `program` WHERE `deleted` = 0 order by `sort`'); ?> <label class="" for="program_id">Programme : </label> <select id="programme_id" class="input-medium" name="search[programme_id]" style="width: 200px"> <?php echo '<option value=""></option>'; ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <option <?php if (isset($_GET['search']['programme_id'])) if ($_GET['search']['programme_id'] == $ResultSet['program_id']) { ?>selected<?php } ?> value="<?= $ResultSet['program_id'] ?>"><?= $ResultSet['program_code'] ?></option> <?php } ?> </select> </div> <!-- ## Subject ## --> <div class="pathways-inline-block"> <?php $sth = $dbh->query('SELECT * FROM `subject` WHERE `deleted` = 0 order by `sort`'); ?> <label class="" for="subject_id">Subject : </label> <select id="subject_id" class="input-medium" name="search[subject_id]"style="width: 200px"> <?php echo '<option value=""></option>'; ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <option <?php if (isset($_GET['search']['subject_id'])) if ($_GET['search']['subject_id'] == $ResultSet['subject_id']) { ?>selected<?php } ?> value="<?= $ResultSet['subject_id'] ?>"><?= $ResultSet['sub_code'] ?></option> <?php } ?> </select> </div>
<!-- ## Start Date ## --> <div class="pathways-inline-block"> <label class="" for="startdate_id">Start Date : </label> <div class="input-append date-picker"> <input id="data_input_date" style="width: 200px" class="dateISO" type="text" maxlength="200" placeholder="Start Date" data-format="yyyy-MM-dd" value="<?= (isset($_GET['search'])) ? $_GET['search']['startdate_id'] : "" ?>" name="search[startdate_id]"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </div> <!-- ## End Date ## --> <div class="pathways-inline-block"> <label class="" for="enddate_id">End Date : </label> <div class="input-append date-picker"> <input id="data_input_date" style="width: 200px" class="dateISO" type="text" maxlength="200" placeholder="End Date" data-format="yyyy-MM-dd" value="<?= (isset($_GET['search'])) ? $_GET['search']['enddate_id'] : "" ?>" name="search[enddate_id]"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> <!-- ## Search Button ## <i class="icon-info-sign" ></i>--> </div>
<div class="pathways-inline-block"> <label>Student Name</label> <select name="student_name" id="student_name" class="student_name" > <option value=""></option> <?php $sth = $dbh->query("SELECT linking_id,`New_stu_ID` id,CONCAT(last_name, ' ', first_name) studentname,`ch_name`FROM `student` WHERE `actived`=1 and`deleted`=0 group by `New_stu_ID`,`Sem_yr`"); ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <option value="<?= $ResultSet['linking_id'] ?>"><?= $ResultSet['studentname'] ?> ( <?= $ResultSet['ch_name'] ?> )</option> <?php } ?> </select> </div>
<div class="pathways-inline-block"> <label>Staff Name</label> <select name="staff_name" id="staff_name" class="staff_name" style="width: 200px"> <option value=""></option> <?php $sth = $dbh->query("SELECT CONCAT(`last_name`,' ',`first_name`) staffname, `ch_name` , `root_id` FROM `staff` WHERE `actived`=1 and `deleted`=0 group by root_id"); ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <option value="<?= $ResultSet['root_id'] ?>" ><?= $ResultSet['staffname'] ?> ( <?= $ResultSet['ch_name'] ?> )</option> <?php } ?> </select> </div>
<button name="search[submit]" class="btn" style="margin-left:30px;" type="submit">Search</button> </div> <div style="height: 15px;"></div> <div style="height: 15px;"></div> <table class="table table-striped table-bordered table-hover table-condensed"> <thead> <tr> <th style="width: 130px"></th> <th>Code</th> <th>Programmme</th> <th>Subject</th> <th>Start Date</th> <th>End Date</th> <th>Details</th> </tr> </thead> <tbody> <?php if (isset($_GET["search"])) { ?> <?php foreach ($search_List as $arr) { ?> <tr> <td style="margin-left:auto;margin-right:auto;"><div class="btn-group" data-toggle="buttons"><a href="<?= 'Event_AddFrom.php?event_id=' . $arr[0]."&view=1" ?>" class="btn"><i class="icon-eye-open"></i> View</a> <a href="<?= 'Event_AddFrom.php?event_id=' . $arr[0] ?>" class="btn">Edit</a></div></td> <td><?= $arr[1] ?></td> <td><?= $arr[2] ?></td> <td><?= $arr[3] ?></td> <?php $sth2 = $dbh->query("Select Min(date) min,Max(date) max from lesson where lesson_id in (SELECT `lesson_id` FROM `event_lesson` WHERE deleted=0 and `event_id` = " . $arr[0] . ")"); ?> <?php while ($ResultSet2 = $sth2->fetch(PDO::FETCH_ASSOC)) { ?> <td><?= $ResultSet2['min'] ?></td> <td><?= $ResultSet2['max'] ?></td> <?php } ?> <td style="width: 80px"><a class="btn" href="Event_DetailFrom.php?event_id=<?= $arr[0] ?>"><i class="icon-info-sign"></i> Detail</a></td> </tr> <?php } ?> <?php } else { /* ?>
<?php $sth = $dbh->query("SELECT `event_id`,`event_code`,program_code pcode,sub_code scode FROM `event`,`program`, `subject` where event.program_id=program.program_id and event.subject_id = subject.subject_id and event.actived = 1 and event.deleted = 0 and subject.actived = 1 and subject.deleted = 0 and program.actived = 1 and program.deleted = 0 order by 1"); ?> <?php while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { ?> <tr> <td style="margin-left:auto;"><a href="<?= 'Event_AddFrom.php?event_id=' . $ResultSet['event_id']."&view=1" ?>" class="btn">View</a></td> <td style="text-align:center;"><a href="<?= 'Event_AddFrom.php?event_id=' . $ResultSet['event_id'] ?>" class="btn">Edit</a></td> <td><?= $ResultSet['event_code'] ?></td> <td><?= $ResultSet['pcode'] ?></td> <td><?= $ResultSet['scode'] ?></td> <?php $sth2 = $dbh->query("Select Min(date) min,Max(date) max from lesson where lesson_id in (SELECT `lesson_id` FROM `event_lesson` WHERE deleted=0 and `event_id` = " . $ResultSet['event_id'] . ")"); ?> <?php while ($ResultSet2 = $sth2->fetch(PDO::FETCH_ASSOC)) { ?> <td><?= $ResultSet2['min'] ?></td> <td><?= $ResultSet2['max'] ?></td> <?php } ?> <td style="width: 80px"><a class="btn" href="Event_DetailFrom.php?event_id=<?= $ResultSet['event_id'] ?>"><i class="icon-info-sign"></i> Detail</a></td> </tr> <?php } ?> <?php */} ?> </tbody> </table> </form> </div> <!-- /container --> <?php /* $rs = $dbh->query("Select * from event"); $rs->setFetchMode(PDO::FETCH_OBJ); $result_arr = $rs->fetchAll(); echo $result_arr[0]->event_id; */ ?> </body> </html>
|