//print_r($season_types); //foreach($users as $user) { // $i = $user['user_id']; // echo $user['user_name'].getUserWins($db,$i,$this_season_year)."<br>"; //} //print_r($wins); //foreach($users as $user) { // echo $user['user_name'].getSeasonPoints($db,$user['user_id'],$this_season_year)."<br>"; //} echo "\n<h3>Results By Week</h3>\n"; echo ' <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">'; $season_types = getGroupSeasonTypes($db, $this_group_id, $this_season_year); foreach ($season_types as $display_type) { echo "<h4>{$display_type} <small>({$this_season_year})</small></h4>\n"; $season_weeks = getWeeks($this_season_year, $display_type); $i = 1; foreach ($season_weeks as $display_week) { if ($display_week < $current_week) { //$wins[] = getWeeklyWinner($db,$this_season_year,$display_type,$display_week); echo ' <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingWeek' . $display_type . $display_week . '"> <h4 class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseWeek' . $display_type . $display_week . '" aria-expanded="true" aria-controls="collapseWeek' . $display_type . $display_week . '">Week ' . $display_week . ' <small>(' . $display_type . ' ' . $this_season_year . ')</small></a> </h4> </div> <div id="collapseWeek' . $display_type . $display_week . '" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"> <div class="panel-body">'; displayWeeklyStandings($db, $users, $this_season_year, $display_type, $display_week); echo '
</script> <?php $query = "select * from edu_jiaoxueriji_shixun where 学期='$_GET[学期]' and 班级='$_GET[班级]' and 教师='$_SESSION[LOGIN_USER_NAME]' and 编号='$_GET[编号]' "; //echo $query; $rs = $db->Execute($query); $rs_a = $rs->GetArray(); //dump($rs_a); if ($rs_a['0']['日期'] == '') { $curDate = date("Y-m-d", time()); $curWeek = getWeek($curDate); $curWeek = $weekArray[$curWeek-1]; $curWeeks = getWeeks($curDate, $startDate); $rs_a['0']['周次'] = $curWeeks; $rs_a['0']['星期'] = $curWeek; } $节次array = explode("-",$rs_a['0']['节次']); ?> <FORM name=form1 onSubmit="return FormCheck(this);" action="?action=<?=$_GET['type'];?>&pageid=1" method=post encType=multipart/form-data> <table class=TableBlock align=center width=100%> <TR class=TableContent> <td ><font color=green >注意:周次、节次、课时应填写纯数字.举例:第1周 星期1 自第1节起至第6节止</font></td> </TR></table>
if (substr($startWeeks, 0, 4) == substr($curWeeks, 0, 4)) { $weeks = substr($curWeeks, 4) - substr($startWeeks, 4) + 1; } //开始年份小于查询年份 else if (substr($startWeeks, 0, 4) < substr($curWeeks, 0, 4)) { //开始年份的最后一天的星期和周次 $endDate = substr($startWeeks, 0, 4)."-12-31"; $endWeek = getWeek($endDate); $endWeeks = date("oW", strtotime($endDate)); //echo $endWeeks."<br/>"; if ($endWeek < 4) { $weeks = 52 - substr($startWeeks, 4) + 1 + substr($curWeeks, 4); } else { $weeks = 53 - substr($startWeeks, 4) + 1 + substr($curWeeks, 4) - 1; } } else { return false; } return $weeks; } if ($date != "") { $result['week'] = getWeek($date); $result['weeks'] = getWeeks($date, $start); echo json_encode($result); //echo preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", json_encode($result)); } ?>
function setWeek($week, $year) { $week = intval($week); $year = intval($year); // If a valid week and year are given then show that week. if ($year < 2000 || $week < 1 || $week > getWeeks($year)) { $week = kbdate('W'); $year = kbdate('o'); } $this->week = $week; if ($this->week < 10) { $this->week = '0' . $this->week; } $this->year = $year; if ($this->week == 1) { $this->pyear = $this->year - 1; $this->pweek = getWeeks($this->pyear); } else { $this->pyear = $this->year; $this->pweek = $this->week - 1; } if ($this->week == getWeeks($this->year)) { $this->nweek = 1; $this->nyear = $this->year + 1; } else { $this->nweek = $this->week + 1; $this->nyear = $this->year; } $this->periodName = 'Week'; $this->period = 'Week ' . $this->week . ', ' . $this->year; $this->currentTime = $this->week == kbdate('W') && $this->year == kbdate('o'); $this->previousPeriodLink = 'w=' . $this->pweek . '&y=' . $this->pyear; $this->nextPeriodLink = 'w=' . $this->nweek . '&y=' . $this->nyear; $this->currentPeriodLink = 'w=' . $this->week . '&y=' . $this->year; }
/** * * @param integer $week * @param integer $year */ function setWeek($week, $year) { $week = (int) $week; $year = (int) $year; // If a valid week and year are given then show that week. if ($year < 2000 || $week < 1 || $week > getWeeks($year)) { $week = kbdate('W'); $year = kbdate('o'); } $this->week = $week; if ($this->week < 10) { $this->week = '0' . $this->week; } $this->year = $year; if ($this->week == 1) { $pyear = $this->year - 1; $pweek = getWeeks($pyear); } else { $pyear = $this->year; $pweek = $this->week - 1; } if ($this->week == getWeeks($this->year)) { $nweek = 1; $nyear = $this->year + 1; } else { $nweek = $this->week + 1; $nyear = $this->year; } $this->periodName = 'Week'; $this->period = 'Week ' . $this->week . ', ' . $this->year; $this->currentTime = $this->week == kbdate('W') && $this->year == kbdate('o'); $this->pargs = $this->nargs = $this->cargs = array(); if (config::get('show_monthly')) { $this->pargs[] = array('period', 'week', true); $this->nargs[] = array('period', 'week', true); $this->cargs[] = array('period', 'week', true); } $this->pargs[] = array('y', $pyear, true); $this->pargs[] = array('w', $pweek, true); $this->nargs[] = array('y', $nyear, true); $this->nargs[] = array('w', $nweek, true); $this->cargs[] = array('y', $this->year, true); $this->cargs[] = array('w', $this->week, true); }
<?php $season_types = getSeasonTypes(); foreach ($season_types as $display_type) { echo "<li><a href=\"" . $THIS_PAGE . "?group_id={$this_group_id}&season_type={$display_type}&season_year={$this_season_year}&week={$this_week}\">{$display_type}</a></li>"; } ?> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Week <?php echo $this_week; ?> <span class="caret"></span></a> <ul class="dropdown-menu"> <li class="dropdown-header">Season Weeks</li> <?php $season_weeks = getWeeks($this_season_year, $this_season_type); foreach ($season_weeks as $display_week) { echo "<li><a href=\"" . $THIS_PAGE . "?group_id={$this_group_id}&season_type={$this_season_type}&season_year={$this_season_year}&week={$display_week}\">{$display_week}</a></li>"; } ?> </ul> </li> </ul> </div><!--/.nav-collapse --> </div><!--/container --> </nav>