This repository was archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
334 lines (282 loc) · 12 KB
/
view.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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<?php
include_once 'function.php'; //引用
function get_html($array)
{
$openid = $array['openid'];
$zc = $array['week_num'];
$banji = openid_to_class($openid);
echo <<<eot
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>工商课表</title>
<link rel="stylesheet" href="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fcss%2Fstyle-starter.css">
<link rel="stylesheet" href="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fcss%2Fmessage.min.css">
<link rel="stylesheet" href="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fcss%2Fview.css">
<link rel="icon" href="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Ffavicon.ico">
<script src="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fjs%2Fjquery-3.6.0.min.js"></script>
<script src="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fjs%2Fmessage.min.js"></script>
<script src="https://cloud1.ayano.top/uploads%2F7%2F%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%2F%E4%B8%AA%E4%BA%BA%E9%A1%B9%E7%9B%AE%2Fcqtbi_class%2Fassets%2Fjs%2Fview.js"></script>
</head>
<body class="cbp-spmenu-push">
<nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
<h3>当前班级:$banji</h3>
<ul>
<li><a class="active" href="?openid=$openid">本周课表</a></li>
<li><a href="https://blog.ayano.top">我的博客</a></li>
<li><a href="https://blog.ayano.top/archives/483/">接口文档</a></li>
<li><a href="javascript:void(0)" onclick="msg_about_class()">关于课表</a></li>
<li><a href="javascript:void(0)" onclick="msg_contact()">联系我</a></li>
</ul>
</nav>
<div class="main buttonset">
<!--导航栏-->
<div class="tophny-header">
<div class="container">
<div class="hny-topgds">
<div class="menu-notify">
<button id="showLeftPush"><span class="fa fa-bars" aria-hidden="true"></span></button>
</div>
<div class="logo text-center">
<h1><a class="navbar-brand" href="?openid=$openid">
工商课表
</a></h1>
</div>
<div class="icon-left search-right text-right">
<a href="#search" class="hnysearch-icon" title="search"><span class="fa fa-search"
aria-hidden="true"></span></a>
<!-- search popup -->
<div id="search" class="pop-overlay">
<div class="popup">
<h3 class="hny-title two">查询其他周次</h3>
<form action="index.php" method="get" class="search-box">
<input type="search" placeholder="输入要跳转的周次(1-20)" name="zc"
required="required" autofocus="" pattern="^(1?[0-9]|20)$">
<input type="hidden" name="openid" value="$openid">
<button type="submit" class="btn">跳转</button>
</form>
</div>
<a class="close" href="#close">×</a>
</div>
</div>
</div>
</div>
</div>
<section class="w3l-testimonials" ><!--主体内容-->
<div style="background:#f0f3f4;">
<table width="100%" align="center" id="class"><!--第一行-->
<tr height="20px">
<th bgcolor="#d3eef4" colspan="1" width="12%">$zc 周</th>
<th bgcolor="#f0f3f4" width="13%">周一</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="13%">周二</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="13%">周三</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="13%">周四</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="13%">周五</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="9%">周六</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
<th bgcolor="#f0f3f4" width="9%">周日</th>
<th bgcolor="#f0f3f4" width="0"></th>
</tr>
<tr height="20px">
eot;
$month = get_date_array($zc, 1)['month'];
echo <<<eot
<th bgcolor="#d3eef4" colspan="1" width="9%">$month 月</th>
eot;
for ($i = 1; $i <= 7; ++$i) {
$new_month = get_date_array($zc, $i)['month'];
$day = get_date_array($zc, $i)['day'];
if ($month == $new_month) {
echo <<<eot
<th bgcolor="#f0f3f4" width="12.3%">$day</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
eot;
} else {
echo <<<eot
<th bgcolor="#f0f3f4" width="12.3%">$new_month.$day</th>
<th bgcolor="#f0f3f4" width="0.3%"></th>
eot;
}
}
echo "</tr>";
for ($i = 1; $i <= 5; ++$i) {
echo <<<eot
<tr height="50px">
<th rowspan="1" bgcolor="#d3eef4">$i</th>
eot;
echo fill($array, $i);
echo "</tr>";
}
echo <<<eot
<tr height="5px">
<th colspan="1" bgcolor="#d3eef4"></th>
eot;
for ($i = 1; $i <= 14; ++$i) {
echo <<<eot
<td rowspan="1" bgcolor="#f0f3f4"></td>
eot;
}
echo "</tr>";
for ($i = 6; $i <= 10; ++$i) {
echo <<<eot
<tr height="50px">
<th rowspan="1" bgcolor="#d3eef4">$i</th>
eot;
echo fill($array, $i);
echo "</tr>";
}
echo <<<eot
<tr height="5px">
<th colspan="1" bgcolor="#d3eef4"></th>
eot;
for ($i = 1; $i <= 14; ++$i) {
echo <<<eot
<td rowspan="1" bgcolor="#f0f3f4"></td>
eot;
}
echo '</tr>';
for ($i = 11; $i <= 12; ++$i) {
echo <<<eot
<tr height="50px">
<th rowspan="1" bgcolor="#d3eef4">$i</th>
eot;
echo fill($array, $i);
echo "</tr>";
}
$old_zc = $zc - 1;
$new_zc = $zc + 1;
echo <<<eot
</table>
</div>
</section>
<section >
<div style="text-align:center;margin:15px auto">
<span><a class="btn btn-info" href="index.php?zc=$old_zc&openid=$openid" role="button">上一周</a></span>
<span style="padding:10px;">当前第$zc 周</span>
<span><a class="btn btn-info" href="index.php?zc=$new_zc&openid=$openid" role="button">下一周</a></span>
</div>
</section>
<script>
//展开左滑菜单
var menuLeft = document.getElementById('cbp-spmenu-s1'),
showLeftPush = document.getElementById('showLeftPush'),
body = document.body;
showLeftPush.onclick = function () {
classie.toggle(this, 'active');
classie.toggle(body, 'cbp-spmenu-push-toright');
classie.toggle(menuLeft, 'cbp-spmenu-open');
disableOther('showLeftPush');
};
function disableOther(button) {
if (button !== 'showLeftPush') {
classie.toggle(showLeftPush, 'disabled');
}
}
</script>
</body>
</html>
eot;
}
function fill($array, $c)
{
$classtime = $array['classtime'];
for ($i = 1; $i <= 7; ++$i) {
$color = rand_color();
$msg = "";
for ($ii = 0; $ii < count($classtime); ++$ii) {
$start_time = $classtime[$ii]['start_time'];
$end_time = $classtime[$ii]['end_time'];
$rowspan = $classtime[$ii]['end_class'] - $classtime[$ii]['start_class'] + 1;
$course = $classtime[$ii]['course'];
$place = $classtime[$ii]['place'];
if (($classtime[$ii]['week'] == $i) &&
(
($classtime[$ii]['start_class'] < $c && $classtime[$ii]['end_class'] > $c) ||
($classtime[$ii]['start_class'] == $c) ||
($classtime[$ii]['end_class'] == $c)
)
) {
//填充该节课
$msg = <<<eot
<td rowspan="1" align="center" bgcolor="$color" class="td">
$course</br>
@$place</br>
$start_time-$end_time</br>
</td>
<td rowspan="1" bgcolor="#f0f3f4"></td>
eot;
break;
}
}
if ($msg === "") {
//填充空白行
$msg = <<<eot
<td rowspan="1" bgcolor="#f0f3f4"></td>
<td rowspan="1" bgcolor="#f0f3f4"></td>
eot;
}
echo $msg;
}
}
function rand_color()
{
$bgcolor = ['#FFFFCC', '#CCFFFF', '#FFCCCC', '#CCCCFF'];
//$bgcolor=['#d1e8fa','#def8d2','#c9edfa','#ffffdd','#f7f790'];
return $bgcolor[rand(0, count($bgcolor) - 1)];
}
function get_url_parameter($name)
{ //参数名称 //取url内参数值
parse_str($_SERVER['QUERY_STRING'], $array);
return ($array['name']);
}
function openid_to_class($openid)
{ //将已记录的openid与班级对应,直接显示班级名字
switch ($openid) {
case 'o4Kckt8_djJfQqr1guobMwmlT9ME':
return '19软件2班';
case 'o4Kckt8REbfD7-b-NW4gIeOulfiU':
return '19云计算1班';
case 'o4Kcktyf4erNHbZGbMRdkMBtjM10':
return '20计应1班';
//case 'o4Kckt9KsbzPm8i5GYBIvzqYVhbI':return '20计算机6班';
case 'o4Kckt2XNC1AvmC2HRo1Zphtxeoo':
return '19移动应用1班';
case 'o4Kckt12TkdsMVPEvA4L-23vTvCk':
return '19工业机器人';
case 'o4Kckt3tUp2I9r_ynEvydJ11giuw':
return '19大数据4班';
case 'o4Kckt69QwyzboA6LjHq1Eo83mGs':
return '19软件3班';
case 'o4Kckt2BDRG-suhV2UzCrmuuRMLE':
return '19物联网1班';
case 'o4Kcktz-g4LvBgPOeaxdaTw--j6k':
return '19会计2班';
case 'o4Kckt9uoWCwOoN7lAqtDZnGmPyY':
return '19物联网2班';
case 'o4Kckt-WhMYxQKvmKU9SX-DDfWBU':
return '19软件专本2班';
case 'o4KcktwGM5vhud_5ZJpsztFaTL1I':
return '20前端1班';
case 'o4Kckt56eLcQMfZmoZvQytsnfSVo':
return '20东软6班';
case 'o4Kckt07Is1yJmQD03t6GAI7dUro':
return '20云计算1班';
case 'o4Kckt4YDxbhQYzSV_rq5givC7oU':
return '20云计算2班';
case 'o4Kckt1hrIdf5ajQhsNALLbF_awU':
return '20web3班';
case 'o4Kckt3CW09fU_diVUm1k9EXbmvo':
return '20计应2班';
//case 'o4Kckt8REbfD7-b-NW4gIeOulfiU':return '19云计算1班';
default:
return '未记录班级';
}
}
?>