function getWeeks($date, $start="") { if ($start == ""){ $start = date("Y-m-d", mktime(0,0,0,1,1,substr($date, 0, 5))); } if ($date < $start) return false; //W:获取周次 //oW:获得包含年份的周次 $startWeeks = date("oW", strtotime($start)); $curWeeks = date("oW", strtotime($date)); //echo $startWeeks."/".$curWeeks."<br/>"; //判断年份是否一致 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; }
public function getSaturday() { $this->load->library("jdf"); echo "<meta charset='utf-8'>"; echo jdate("Y/m/d", getSaturday(1394, 05, 17)) . "<br>"; echo jdate("Y/m/d", jmktime(0, 0, 0, 05, 21, 94)); getWeek(1394, 05, 17); }
public function makeScoreboard() { $bdb = new Database(); // get the week of the season $this->week = getWeek(); // get all the area games from that week $getGames = "SELECT\n\t\t (SELECT name FROM schools WHERE schedule_2015.away_id = schools.school_id) AS away_team, \n\t\t (SELECT name FROM schools WHERE schedule_2015.home_id = schools.school_id) AS home_team,\n\t\t game_date,\n\t\t game_time,\n\t\t q1_away,q2_away,q3_away,q4_away,ot_away,\n\t\t q1_home,q2_home,q3_home,q4_home,ot_home,\n\t\t winner,\n\t\t facility,\n\t\t week,\n\t\t away_final,\n\t\t home_final\n\t\t FROM schedule_2015 \n\t\t WHERE week = {$this->week} AND area = 1\n\t\t ORDER BY winner DESC, game_date, game_time"; $games = $bdb->getData($getGames); /* take array and build scoreboard */ $scores = $this->buildScoreboard($games); /* p2p api key */ $P2Paccesstoken = '874ai9840kqvuyojkyqp4k49o6q56yyfa35'; /* slug of story to update */ $P2Pslug = 'hc-hs-boys-bball-scores-2015'; /* p2p api location of item to update */ $P2Purl = 'http://content-api.p2p.tribuneinteractive.com/content_items/' . $P2Pslug . '.json'; /* update body of array */ $data = array('content_item' => array('body' => $scores)); $data_string = json_encode($data); /* Build the authentication array for CURLOPT_HTTPHEADER. */ $headr = array(); $headr[] = 'Authorization: Bearer ' . $P2Paccesstoken; $headr[] = 'Content-type: application/json'; /* End authentication. */ /* Initiate cURL. */ $ch = curl_init($P2Purl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headr); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); $response = curl_exec($ch); if ((string) $response == '') { //date_default_timezone_set('EST'); $this->barker_message = ' Updated ' . $P2Pslug . ', ' . date('F j, Y, g:i a'); } else { $this->barker_message = ' Error updating ' . $P2Pslug . ' please try again.'; } /* End cURL call. */ }
<?php /** * * @authors siyizhen (1193814298@qq.com) * @date * @version */ $admin_name = $_SESSION['admin_name']; $week = getWeek(); $date = date("Y-m-d H:i:s"); VIEW::assign("date", $date); VIEW::assign("week", $week); VIEW::assign("admin_name", $admin_name);
$value .= <<<EOT \t\t<table style="border: 1px dashed;"><tr><th>日期</th><th>人氣</th></tr> EOT; /* $hitArray = getHitArray($uid,$StartInt,$EndInt); foreach($hitArray as $k => $v){ echo $k."=>".$v; }*/ $analysis = analysisHitsRecord($uid, $StartInt, $EndInt); //get avg,max,min $result = hitPeopleAnalysis($uid, $StartInt, $EndInt); // record size $resultSize = mysql_num_rows($result); while (list($date, $hits) = mysql_fetch_row($result)) { $px = (int) 180 * $hits / 40000; $week = getWeek($date); $class = "length"; if ($week == 6 or $week == 7) { $class = "holiday"; } $value .= <<<EOT \t\t\t<tr> \t\t\t <td class="{$class}" >{$date}</td> \t\t\t <td> \t\t\t <table class="length" cellpadding="0" cellspacing="0" style="width:180px;height:14px;margin-bottom:3px;"> \t\t\t <tr style="background-image:url(/images/storagebar.gif);"> \t\t\t\t<td valign="top" style="width: {$px};padding:0px;"><img src="/images/greenbar.gif" width="{$px}" height="14px"></td> \t\t\t\t<td>{$hits}</td> \t\t\t </tr> \t\t\t </table> \t\t\t </td>
} $week_list = array(); $week_list[0]['name'] = date('m-d', time()); $week_list[0]['week'] = "今天"; $week_list[1]['name'] = date('m-d', strtotime('+1 days')); $week_list[1]['week'] = getWeek(strtotime('+1 days')); $week_list[2]['name'] = date('m-d', strtotime('+2 days')); $week_list[2]['week'] = getWeek(strtotime('+2 days')); $week_list[3]['name'] = date('m-d', strtotime('+3 days')); $week_list[3]['week'] = getWeek(strtotime('+3 days')); $week_list[4]['name'] = date('m-d', strtotime('+4 days')); $week_list[4]['week'] = getWeek(strtotime('+4 days')); $week_list[5]['name'] = date('m-d', strtotime('+5 days')); $week_list[5]['week'] = getWeek(strtotime('+5 days')); $week_list[6]['name'] = date('m-d', strtotime('+6 days')); $week_list[6]['week'] = getWeek(strtotime('+6 days')); foreach ($week_list as $wkey => $week) { $chatimes_11 = strtotime(date('Y') . "-" . $week['name'] . " 09:00") - time(); $chatimes_12 = strtotime(date('Y') . "-" . $week['name'] . " 15:00") - time(); if ($chatimes_11 > $bjtimes || $chatimes_12 > $bjtimes) { $week_list[$wkey]['time1'] = '1'; } else { $week_list[$wkey]['time1'] = '0'; } $chatimes_21 = strtotime(date('Y') . "-" . $week['name'] . " 15:00") - time(); $chatimes_22 = strtotime(date('Y') . "-" . $week['name'] . " 19:00") - time(); if ($chatimes_21 > $bjtimes || $chatimes_22 > $bjtimes) { $week_list[$wkey]['time2'] = '1'; } else { $week_list[$wkey]['time2'] = '0'; }
$scores = $db->getData($getSchedule); } else { $period = getDisplayPeriod($period); $getSchedulePeriod = "Call getSchedulePeriod('{$period['0']}','{$period['1']}')"; $scores = $db->getData($getSchedulePeriod); $league = "All"; } // bring in the sked/results view include 'views/schedule-results.php'; } elseif (isset($_GET['standings'])) { // bring in the standings view include 'views/standings.php'; } else { // on page load // set the period drop down to current period $period_key = getWeek() - 1; // set the league drop down to nothing $league_key = ""; // set the league to all $league = "All"; // set period to today $period = date("Y-m-d"); // get the period that today is in $period = getDisplayPeriod($period); // call the schedule/results for current period $getSchedulePeriod = "Call getSchedulePeriod('{$period['0']}','{$period['1']}')"; // go get the data $scores = $db->getData($getSchedulePeriod); // bring in the sked/results view include 'views/schedule-results.php'; }
<?php session_start(); require_once 'include/db_operator_class.php'; if (isset($_GET['uid'])) { $uid = $_GET['uid']; $user_result = get_UserByUid($uid); if ($user_result != null) { $_SESSION['login'] = 1; $_SESSION['uid'] = $uid; $_SESSION['userid'] = $user_result['id']; $_SESSION['name'] = $user_result['name']; $_SESSION['nickname'] = $user_result['nickname']; $_SESSION['pojname'] = $user_result['POJ_user_name']; $_SESSION['sex'] = $user_result['sex']; $_SESSION['email'] = $user_result['mail']; $_SESSION['week'] = getWeek(); $_SESSION['team'] = $user_result['team']; $_SESSION['photoPath'] = $user_result['photoPath']; header("Location: index.php"); exit; } else { $name = $_GET['name']; header('Location: user_profile.php?uid=' . $uid . '&&name=' . $name . '&&type=insert'); exit; } }
function populateRoutes() { $time_pre = microtime(true); include '../connection.php'; set_time_limit(120); $reportS = 0; $reportW = 0; $thisWeek = getWeek(); $query = "SELECT cID FROM clients WHERE cActive = 1"; $sql = $db->query($query); while ($info = $sql->fetch_array()) { $cID = $info['cID']; // Check if client is in for this week. if (!inForThisWeek($cID, $thisWeek, $db)) { // Today is for ($i = 1; $i <= 5; $i++) { $delDay = date('Y/m/d', time() + ($i - date('w')) * 24 * 3600); $rDay = getTodaysDay($i); //echo $delDay.' '.$info['cID'].' '.$rDay.' '.$thisWeek.'</br>'; $unixDate = unixTime($delDay); $query = "INSERT INTO routes (cID,rDate,unixDate,rDay,rWeek) \n\t\t\t\t\t\t\t\tVALUES ('{$cID}', '{$delDay}','{$unixDate}', '{$rDay}', '{$thisWeek}')"; //echo $query; $db->query($query); $reportS++; } } else { $reportW++; } } $time_post = microtime(true); $exec_time = $time_post - $time_pre; echo "{$reportS} Clients were populated -- {$reportW} Clients were already populated for this week</br>"; echo "Routes has been populated: " . format_period($exec_time) . "</br>"; }
} } </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>
" /> <fieldset class="form-fieldset"> <legend class="form-legend">Weekly Timesheet Posting</legend> <table align=center> <tr> <td colspan=2 align=left class="label-message"><?php echo $form['message']; ?> </td> </td> <tr> <td class="label">Week / Year: </td> <td><?php echo getWeek($form['week']); ?> <input type="text" class="inputtext" id="project_no" name="project" value="<?php echo $form['year']; ?> " size="40" style='width:50px;'/></td> </td> <tr> <td class="label">Date From / To : </td> <td></td> </tr> <tr> <td class="label">Date : </td> <td><input type="text" class="inputtext" id="address" name="descryption" value="<?php echo $form['date'];
function video_dvd_Prem($type = '') { global $SUBS, $MSG; global $tbl_1d_pictures, $tbl_1d_videodvd, $tbl_1d_distr, $tbl_1d_films; ////----[Mrasnika's] Edition 16.10.2002 // prowerka na nowite paramentri if ($type == '') { $type = 'video'; } $query = "SELECT\t{$tbl_1d_films}.ID,\n\t\t\t\n\t\t\t{$tbl_1d_films}.Title,\n\t\t\t{$tbl_1d_films}.Director,\n\t\t\t{$tbl_1d_films}.Actors,\n\t\t\t{$tbl_1d_films}.Description,\n\t\t\t{$tbl_1d_distr}.Distributor,\n\t\t\t\n\t\t\t{$tbl_1d_pictures}.URL,\n\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t{$tbl_1d_pictures}.Height,\n\t\t\t\n\t\t\t{$tbl_1d_films}.Additional,\n\t\t\t{$tbl_1d_films}.Genre,\n\t\t\t\n\t\t\t{$tbl_1d_videodvd}.tsWhen,\n\t\t\t{$tbl_1d_films}.OriginalTitle,\n\t\t\t\n\t\t\t{$tbl_1d_videodvd}.ID\n\n\t\tFROM {$tbl_1d_videodvd}\n\t\tLEFT JOIN {$tbl_1d_films}\n\t\t\tON {$tbl_1d_films}.ID = {$tbl_1d_videodvd}.FilmID\n\t\tLEFT JOIN {$tbl_1d_distr}\n\t\t\tON {$tbl_1d_videodvd}.DistributorID = {$tbl_1d_distr}.ID\n\t\tLEFT JOIN {$tbl_1d_pictures}\n\t\t\tON {$tbl_1d_videodvd}.ID = {$tbl_1d_pictures}.RefID\n\t\t\t\tAND {$tbl_1d_pictures}.RefType = '{$type}'\n\n\t\tWHERE \t{$tbl_1d_videodvd}.tsWhen <= (" . week() . "+604799)\n\t\t\t\tAND {$tbl_1d_videodvd}.Type = '{$type}'\n\n\t\tGROUP BY {$tbl_1d_films}.ID\n\t\t\n\t\tORDER BY\t({$tbl_1d_videodvd}.tsWhen >= " . week() . ") DESC,\n\t\t\t{$tbl_1d_videodvd}.tsWhen DESC,\n\t\t\t{$tbl_1d_distr}.Priority,\n\t\t\t{$tbl_1d_films}.Title"; $result = runQuery($query, 'video_dvd_Prem()', 'GET_VIDEO_PREMS'); $path = getAdmSetting('UPLOAD_DIR'); $mark = 0; while ($row = db_fetch_row($result)) { if ($mark == 0) { $mark = $row[11]; } if (week($mark) != week($row[11])) { break; } $SUBS['FILMID'] = $row[0]; $SUBS['TITLE'] = htmlEncode($row[1]); ////----[Mrasnika's] Edition 31.10.2002 if ($row[2]) { $SUBS['DIRECTOR'] = htmlEncode($MSG[30018] . $row[2]) . "<br>"; } else { $SUBS['DIRECTOR'] = ''; } if ($row[3]) { $SUBS['ACTORS'] = htmlEncode($MSG[30019] . $row[3]) . "<br>"; } else { $SUBS['ACTORS'] = ''; } $SUBS['CAPTION'] = htmlEncode($row[4]); $SUBS['DISTR'] = htmlEncode($row[5]); $SUBS['THUMB'] = $path . $row[6]; $SUBS['VWIDTH'] = $row[7]; $SUBS['VHEIGHT'] = $row[8]; if ($row[9]) { $SUBS['ADDITIONAL'] = htmlEncode($row[9]) . "<br>"; } else { $SUBS['ADDITIONAL'] = ''; } if ($row[10]) { $SUBS['GENRE'] = htmlEncode($row[10]) . "<br>"; } else { $SUBS['GENRE'] = ''; } if ($row[12]) { $SUBS['ORIGINAL'] = htmlEncode($row[12]) . "<br>"; } else { $SUBS['ORIGINAL'] = ''; } $SUBS['ID'] = $row[13]; //prowerka za oschte kartinki $query = "SELECT\t{$tbl_1d_pictures}.URL,\n\t\t\t\t{$tbl_1d_pictures}.Width,\n\t\t\t\t{$tbl_1d_pictures}.Height,\n\t\t\t\t\n\t\t\t\tp1.URL,\n\t\t\t\tp1.Width,\n\t\t\t\tp1.Height\n\t\t\t\t\n\t\t\tFROM\t{$tbl_1d_pictures}\n\t\t\tLEFT JOIN\t{$tbl_1d_pictures} AS p1\n\t\t\t\tON p1.RefID = {$tbl_1d_pictures}.ID\n\t\t\t\t\tAND p1.RefType = 'thumb'\n\t\t\tWHERE {$tbl_1d_pictures}.RefID = {$row['0']}\n\t\t\t\tAND {$tbl_1d_pictures}.RefType = 'film'\n\t\t\tORDER BY RAND()"; $res = runQuery($query, 'video_dvd_Prem()', 'GET_VIDEO_PICS'); $SUBS['ALIGN'] = 'right'; $SUBS['KARTINKI'] = ''; ////----[Mrasnika's] Edition 16.10.2002 $SUBS['KARTINKI2'] = ''; $top = 0; while ($r = db_fetch_row($res)) { $SUBS['URL'] = $path . $r[0]; $SUBS['WIDTH'] = $r[1]; $SUBS['HEIGHT'] = $r[2]; $SUBS['TURL'] = $path . $r[3]; $SUBS['TWIDTH'] = $r[4]; $SUBS['THEIGHT'] = $r[5]; if ($top < 2) { $top++; $SUBS['KARTINKI'] .= fileParse('_index_thumb.htmlt'); } else { $SUBS['ALIGN'] = ''; $SUBS['KARTINKI2'] .= ' ' . fileParse('_index_thumb.htmlt'); } } $SUBS['PREMIERI'] .= fileParse('_index_videodvd.htmlt'); } //dispaly if ($type == 'video') { $SUBS['WEEK'] = getWeek(2); } else { $SUBS['WEEK'] = getWeek(3); } index("_index_" . $type . "prem.htmlt"); }