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
|
<?php
include_once '../include/DBConnect.php'; $deleted = 0;
$EachDate = 60*60*24; $start_date=''; $end_date=''; if($_GET){ $search = $_GET['search']; $Staff_ID = $search['Staff_ID']; $date=date("Y-m-d", strtotime($search['date'])); // var_dump(date("N", strtotime($search['date']))); // var_dump(date("Y-m-d", strtotime($date)-60*60*24)); while (date("N", strtotime($date)) != 1) { $date=date("Y-m-d", strtotime($date)-$EachDate); //var_dump($date); } $start_date = $date; $end_date = date("Y-m-d", strtotime($date)+5*$EachDate); //var_dump($end_date); $query="select start_time,end_time,date,e.event_code from lesson l,event_lesson el,event e where l.lesson_id in ( SELECT lesson_id FROM `lesson_attendance` WHERE `event_teach_id`='$Staff_ID' and `date`>= '$start_date' and `date`<= '$end_date' ) and el.lesson_id = l.lesson_id and el.event_id in (select event_id from event where actived=1 and deleted =0) and e.event_id = el.event_id"; $result = $dbh->prepare($query); $result->execute(); while ($ResultSet = $result->fetch(PDO::FETCH_ASSOC)) { $content = $ResultSet['date']."\n".$ResultSet['start_time']." to ".$ResultSet['end_time']."\n".$ResultSet['event_code']; var_dump($content); } } ?> <!DOCTYPE html> <html> <head> <?php require_once '../include/head.php'; ?> <?php require_once '../include/checkuser.php'; ?>
<?php require_once '../include/Nav_bar.php'; ?> <script> $(document).ready(function() { $('.date-picker').datetimepicker({pickTime: false}); $("#myselect").select2({ placeholder: "Select a Name", minimumInputLength: 2, allowClear: true }); $("#myselect").on("select2-selecting", function(e) { alert("selecting val=" + e.val); //var rows = $('tr.result-row'); //rows.hide("slow"); //var Rshow = rows.filter('#row_staff_'+e.val).show(); //$('#row_staff_' + e.val).show("slow"); $('#Staff_ID').val(e.val); //rows.not(Rshow).hide(); }); $(".select2-input").keyup(function() { var input1 = $(this).val(); $.ajax({ url: 'list.php', //This is the current doc type: "POST", data: {Data: input1, Data2: input1 * 10}, success: function(data) { var obj = $.parseJSON(data); $.each(obj, function(key, value) { $("#staff_" + value['staff_id'] + "").remove(); $("#myselect").append("<option id=staff_" + value['staff_id'] + " value=" + value['staff_id'] + ">" + value['last_name'] + "\n" + value['first_name'] + "\n\n" + value['ch_name'] + "</option>");
}); } }); }); }); $("#showALL").click(function() { var rows = $('tr.result-row'); rows.show("slow"); }); </script>
</head> <body> <!-- line between nav bar and content <div class="text-right"> <ul class="breadcrumb"> <li class="active"></li> </ul> </div> --> <div class="text-right"> <ul class="breadcrumb"> <li><a href="#">Master</a> <span class="divider">></span></li> <li class="active">Teaching Records</li> </ul> </div>
<div class="container-fluid pathways-container"> <div class="pathways-search"> <form id="search_form" class="form-inline" action="" method=""> <div class="pathways-inline-block"> Search by Name: <select id="myselect" style="width:300px">
</select> </div> <button type="button" class="btn" id="showALL" style="margin-left:30px">Show All</button>
<div class="pathways-inline-block"> <input type="hidden" id="Staff_ID" name="search[Staff_ID]" value="0" /> <label class="" for="date">Date</label> <div class="input-append date-picker"> <input type="text" id="date" name="search[date]" class="dateISO input-small" style="width:90px" value="" data-format="yyyy-MM-dd" placeholder="Date" maxlength="200" /> <span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> </div> <button type="submit" class="btn" style="margin-left:30px">GO</button> </div> </form> </div>
<table class="table table-striped table-bordered table-hover table-condensed"> <thead> <tr> <th>Time</th> <th style="width:15%">Monday</th> <th style="width:15%">Tuesday</th> <th style="width:15%">Wednesday</th> <th style="width:15%">Thursday</th> <th style="width:15%">Friday</th> <th style="width:15%">Saturday</th> </tr> </thead> <tbody> <?php $StartTime = 9.0; $CurrentTime; for ($StartTime; $StartTime < 17; $StartTime+=0.5) { $CurrentHour = ($StartTime < 10 ? "0" . (int) $StartTime : (int) $StartTime) ; $CurrentMins = ($StartTime > (int) $StartTime ? '30' : '00'); $CurrentTime = $CurrentHour.':'.$CurrentMins; ?> <tr> <td><?= $CurrentTime ?></td> <?php for($i=0; $i<6; $i++){ echo '<td id="'.date("Y-m-d", strtotime($start_date)+$EachDate*$i).'_'.$CurrentTime.'"></td>'; } ?> </tr> <tr> <td>1</td> <?php for($i=0; $i<6; $i++){ echo '<td id="'.date("Y-m-d", strtotime($start_date)+$EachDate*$i).'_'.$CurrentHour.':'.($CurrentMins+15).'"></td>'; } ?> </tr> <?php } ?> </tbody> </table>
</div>
</body>
|