private function get_where() { $where = array(); $this->where = ''; $tmp = ''; $tmp2 = ''; if (isset($_GET['name']) && !empty($_GET['name'])) { array_push($where, "(`name` like '%" . $_GET['name'] . "%')"); } if (isset($_GET['week']) && !empty($_GET['week'])) { $tmp = explode(',', $_GET['week']); $tmp2 = ''; foreach ($tmp as $v) { if (empty($v) || !is_numeric($v)) { continue; } if ($v > $this->system->info['all_week']) { array_push($this->error, "学期最大周期为" . $this->system->info['all_week']); continue; } if ($v < 1) { array_push($this->error, "学期最小周期为 1 "); continue; } $tmp2 .= "(`week` like '%," . $v . ",%') OR "; } if (!empty($tmp2)) { array_push($where, substr($tmp2, 0, -4)); } } if (isset($_GET['time']) && !empty($_GET['time'])) { $tmp = explode(',', $_GET['time']); $tmp2 = ''; foreach ($tmp as $v) { if (empty($v)) { continue; } $tmp2 .= "(`time` like '%," . $v . ",%') OR "; } array_push($where, substr($tmp2, 0, -4)); } if (isset($_GET['week2']) && !empty($_GET['week2'])) { $tmp = explode(',', $_GET['week2']); $tmp2 = ''; foreach ($tmp as $v) { if (empty($v)) { continue; } if (!is_numeric($v)) { $v = number_to_week($v, true); } $tmp2 .= "(`week2` like '%" . $v . "%') OR "; } if (!empty($tmp2)) { array_push($where, substr($tmp2, 0, -4)); } } if (isset($_GET['classroom']) && !empty($_GET['classroom'])) { $tmp = explode(',', $_GET['classroom']); $tmp2 = ''; foreach ($tmp as $v) { if (empty($v)) { continue; } $tmp2 .= "(`classroom` like '%" . $v . "%') OR "; } if (!empty($tmp2)) { array_push($where, substr($tmp2, 0, -4)); } } if (isset($_GET['teacher']) && !empty($_GET['teacher'])) { $tmp = explode(',', $_GET['teacher']); $tmp2 = ''; foreach ($tmp as $v) { if (empty($v)) { continue; } $tmp2 .= "(`teacher` like '%" . $v . "%') OR "; } if (!empty($tmp2)) { array_push($where, substr($tmp2, 0, -4)); } } foreach ($where as $v) { $this->where .= "(" . $v . ") AND "; } if (!empty($this->where)) { $this->where = substr($this->where, 0, -5); } else { $this->where = '1'; } }
<table width="730" border="1" align="center" cellpadding="6" cellspacing="0"> <tbody align="center"> <tr><th colspan="2">课程</th><th>星期</th><th>教室</th><th>老师</th><th><a href="time.php" target="_blank" title="查看作息时间表">时间</a></th><th>周次</th><th>学分</th><th>学时</th></tr> <?php foreach ($get as $n => $v) { ?> <tr><td><?php echo $n + 1; ?> </td><td><?php echo $v['name']; ?> </td><td><?php echo number_to_week($v['week2']); ?> </td><td><?php echo $v['classroom']; ?> </td><td><?php echo $v['teacher']; ?> </td><td><?php echo substr($v['time'], 1, -1); ?> 节</td><td><?php echo long_list_to_short($v['week']), "周"; ?> </td><td><?php echo $v['credit'];
年级:<span><?php echo $system->group['grade']; ?> </span> <a href="setting.php">修改设置</a> </p> <p> 当前课程日期:<span><?php echo substr($system->info['now_date'], 0, 4), "-", substr($system->info['now_date'], 4, 2), "-", substr($system->info['now_date'], 6, 2), " "; ?> </span> 课程周:<span><?php echo $system->info['now_week']; ?>  (<?php echo number_to_week($system->info['week2'], false, "星期"); ?> )</span> </p> </div> <div id="today"> <a href="today.php">今日课程</a> </div> <div id="search"> <a href="search.php">搜索课程</a> </div> <div id="week"> <a href="week.php">本周课程</a>