当前位置: 首页>>代码示例>>PHP>>正文


PHP Time::Weekend方法代码示例

本文整理汇总了PHP中Time::Weekend方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::Weekend方法的具体用法?PHP Time::Weekend怎么用?PHP Time::Weekend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Time的用法示例。


在下文中一共展示了Time::Weekend方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showValues

 /**
  * Show values
  */
 protected function showValues()
 {
     $ModelQuery = new Performance\ModelQuery();
     $ModelQuery->execute(DB::getInstance());
     $TSBmodel = new Performance\TSB($ModelQuery->data(), Configuration::Trimp()->daysForCTL(), Configuration::Trimp()->daysForATL());
     $TSBmodel->calculate();
     $MonotonyQuery = new Performance\ModelQuery();
     $MonotonyQuery->setRange(time() - (Monotony::DAYS - 1) * DAY_IN_S, time());
     $MonotonyQuery->execute(DB::getInstance());
     $Monotony = new Monotony($MonotonyQuery->data());
     $Monotony->calculate();
     $VDOT = Configuration::Data()->vdot();
     $ATLmax = Configuration::Data()->maxATL();
     $CTLmax = Configuration::Data()->maxCTL();
     $ModelATLmax = $TSBmodel->maxFatigue();
     $ModelCTLmax = $TSBmodel->maxFitness();
     if ($ModelATLmax > $ATLmax) {
         Configuration::Data()->updateMaxATL($ModelATLmax);
         $ATLmax = $ModelATLmax;
     }
     if ($ModelCTLmax > $CTLmax) {
         Configuration::Data()->updateMaxCTL($ModelCTLmax);
         $CTLmax = $ModelCTLmax;
     }
     $ATLabsolute = $TSBmodel->fatigueAt(0);
     $CTLabsolute = $TSBmodel->fitnessAt(0);
     $TSBabsolute = $TSBmodel->performanceAt(0);
     $TrimpValues = array('ATL' => round(100 * $ATLabsolute / $ATLmax), 'ATLstring' => Configuration::Trimp()->showInPercent() ? round(100 * $ATLabsolute / $ATLmax) . ' %' : $ATLabsolute, 'CTL' => round(100 * $CTLabsolute / $CTLmax), 'CTLstring' => Configuration::Trimp()->showInPercent() ? round(100 * $CTLabsolute / $CTLmax) . ' %' : $CTLabsolute, 'TSB' => round(100 * $TSBabsolute / max($ATLabsolute, $CTLabsolute, 1)), 'TSBstring' => Configuration::Trimp()->showTSBinPercent() ? sprintf("%+d", round(100 * $TSBabsolute / max($ATLabsolute, $CTLabsolute))) . ' %' : sprintf("%+d", $TSBabsolute));
     $TSBisPositive = $TrimpValues['TSB'] > 0;
     $maxTrimpToBalanced = ceil($TSBmodel->maxTrimpToBalanced($CTLabsolute, $ATLabsolute));
     $restDays = ceil($TSBmodel->restDays($CTLabsolute, $ATLabsolute));
     $JDQuery = Cache::get(self::CACHE_KEY_JD_POINTS);
     if (is_null($JDQuery)) {
         $JDQueryLastWeek = DB::getInstance()->query('SELECT SUM(`jd_intensity`) FROM `' . PREFIX . 'training` WHERE `time`>=' . Time::Weekstart(time() - 7 * DAY_IN_S) . ' AND `time`<' . Time::Weekend(time() - 7 * DAY_IN_S) . ' AND accountid = ' . SessionAccountHandler::getId());
         $JDQueryThisWeek = DB::getInstance()->query('SELECT SUM(`jd_intensity`) FROM `' . PREFIX . 'training` WHERE `time`>=' . Time::Weekstart(time()) . ' AND `time`<' . Time::Weekend(time()) . ' AND accountid = ' . SessionAccountHandler::getId());
         $JDQuery['LastWeek'] = Helper::Unknown($JDQueryLastWeek->fetchColumn(), 0);
         $JDQuery['ThisWeek'] = Helper::Unknown($JDQueryThisWeek->fetchColumn(), 0);
         Cache::set(self::CACHE_KEY_JD_POINTS, $JDQuery, '600');
     }
     $JDPointsLastWeek = $JDQuery['LastWeek'];
     $JDPointsThisWeek = $JDQuery['ThisWeek'];
     $JDPointsPrognosis = round($JDPointsThisWeek / (7 - (Time::Weekend(time()) - time()) / DAY_IN_S) * 7);
     $Values = array(array('show' => $this->Configuration()->value('show_vdot'), 'bars' => array(new ProgressBarSingle(2 * round($VDOT - 30), ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => '', 'value' => number_format($VDOT, 2), 'title' => __('VDOT'), 'small' => '', 'tooltip' => __('Current average VDOT')), array('show' => $this->Configuration()->value('show_basicendurance'), 'bars' => array(new ProgressBarSingle(BasicEndurance::getConst(), ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => '', 'value' => BasicEndurance::getConst() . '&nbsp;&#37;', 'title' => __('Basic&nbsp;endurance'), 'small' => '', 'tooltip' => __('<em>Experimental value!</em><br>100 &#37; means: you had enough long runs and kilometers per week to run a good marathon, based on your current VDOT.')), array('show' => $this->Configuration()->value('show_trimpvalues'), 'bars' => array(new ProgressBarSingle($TrimpValues['ATL'], ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => sprintf(__('Current value: %s<br>Maximal value: %s<br>as percentage: %s &#37;'), $ATLabsolute, $ATLmax, $TrimpValues['ATL']), 'value' => $TrimpValues['ATLstring'], 'title' => __('Fatigue'), 'small' => '(ATL)', 'tooltip' => __('Actual Training Load<br><small>Average training impulse of the last weeks in relation to your maximal value.</small>')), array('show' => $this->Configuration()->value('show_trimpvalues'), 'bars' => array(new ProgressBarSingle($TrimpValues['CTL'], ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => sprintf(__('Current value: %s<br>Maximal value: %s<br>as percentage: %s &#37;'), $CTLabsolute, $CTLmax, $TrimpValues['CTL']), 'value' => $TrimpValues['CTLstring'], 'title' => __('Fitness&nbsp;level'), 'small' => '(CTL)', 'tooltip' => __('Chronical Training Load<br><small>Average training impulse of the last months in relation to your maximal value.</small>')), array('show' => $this->Configuration()->value('show_trimpvalues'), 'bars' => array(new ProgressBarSingle(abs($TrimpValues['TSB']) / 2, $TSBisPositive ? ProgressBarSingle::$COLOR_GREEN : ProgressBarSingle::$COLOR_RED, $TSBisPositive ? 'right' : 'left')), 'bar-tooltip' => 'TSB = CTL - ATL<br>' . sprintf(__('absolute: %s<br>as percentage: %s &#37;'), $CTLabsolute . ' - ' . $ATLabsolute . ' = ' . sprintf("%+d", $TSBabsolute), $TrimpValues['TSB']), 'value' => $TrimpValues['TSBstring'], 'title' => __('Stress&nbsp;Balance'), 'small' => '(TSB)', 'tooltip' => __('Training Stress Balance (= CTL - ATL)<br>&gt; 0: You are relaxing.<br>' . '&lt; 0: You are training hard.')), array('show' => $this->Configuration()->value('show_trimpvalues') && !$TSBisPositive, 'bars' => array(new ProgressBarSingle(100 * $restDays / 7, ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => '', 'value' => $restDays, 'title' => __('Rest&nbsp;days'), 'small' => '', 'tooltip' => __('Rest days needed to reach TSB = 0')), array('show' => $this->Configuration()->value('show_trimpvalues') && $TSBisPositive, 'bars' => array(new ProgressBarSingle(100 * $maxTrimpToBalanced / 1000, ProgressBarSingle::$COLOR_BLUE)), 'bar-tooltip' => '', 'value' => $maxTrimpToBalanced, 'title' => __('Easy&nbsp;TRIMP'), 'small' => '', 'tooltip' => __('Max TRIMP that will still keep you at TSB = 0')), array('show' => $this->Configuration()->value('show_trimpvalues_extra'), 'bars' => array(new ProgressBarSingle($Monotony->valueAsPercentage(), $Monotony->value() > Monotony::CRITICAL ? ProgressBarSingle::$COLOR_RED : $Monotony->value() > Monotony::WARNING ? ProgressBarSingle::$COLOR_ORANGE : ProgressBarSingle::$COLOR_GREEN)), 'bar-tooltip' => 'Monotony = avg(Trimp)/stddev(Trimp)', 'value' => number_format($Monotony->value(), 2), 'title' => __('Monotony'), 'small' => '', 'tooltip' => __('Monotony<br><small>Monotony of your last seven days.<br>Values below 1.5 are preferable.</small>')), array('show' => $this->Configuration()->value('show_trimpvalues_extra'), 'bars' => array(new ProgressBarSingle($Monotony->trainingStrainAsPercentage(), $Monotony->trainingStrainAsPercentage() >= 75 ? ProgressBarSingle::$COLOR_RED : ($Monotony->trainingStrainAsPercentage() >= 50 ? ProgressBarSingle::$COLOR_ORANGE : ProgressBarSingle::$COLOR_GREEN))), 'bar-tooltip' => 'Training strain = sum(Trimp)*Monotony', 'value' => round($Monotony->trainingStrain()), 'title' => __('Training&nbsp;strain'), 'small' => '', 'tooltip' => __('Training strain<br><small>of your last seven days</small>')), array('show' => $this->Configuration()->value('show_jd_intensity'), 'bars' => array(new ProgressBarSingle($JDPointsPrognosis / 2, ProgressBarSingle::$COLOR_LIGHT), new ProgressBarSingle($JDPointsThisWeek / 2, ProgressBarSingle::$COLOR_RED)), 'bar-goal' => $JDPointsLastWeek / 2, 'bar-tooltip' => sprintf(__('This week: %s training points<br>Prognosis: ca. %s training points<br>Last week: %s training points'), $JDPointsThisWeek, $JDPointsPrognosis, $JDPointsLastWeek), 'value' => $JDPointsThisWeek, 'title' => __('Training&nbsp;points'), 'small' => '', 'tooltip' => __('Training intensity by Jack Daniels.<br>' . 'Jack Daniels considers the following levels:<br>' . '50 points: Beginner<br>' . '100 points: Advanced Runner<br>' . '200 points: Pro Runner')));
     $this->showTableForValues($Values);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:48,代码来源:class.RunalyzePluginPanel_Rechenspiele.php

示例2: displayMostKilometer

 /**
  * Display the table with most kilometer for each year/month/week
  */
 private function displayMostKilometer()
 {
     echo '<table class="fullwidth zebra-style">';
     echo '<thead><tr><th colspan="11" class="l">' . __('Most kilometers') . '</th></tr></thead>';
     echo '<tbody>';
     if (empty($this->weeks)) {
         echo '<tr><td colspan="11"><em>' . __('No data available') . '</em></td></tr>';
         echo HTML::spaceTR(11);
         echo '</tbody>';
         echo '</table>';
         return;
     }
     // Years
     if ($this->year == -1) {
         echo '<tr class="r"><td class="c b">' . __('per year') . '</td>';
         foreach ($this->years as $i => $year) {
             $link = DataBrowserLinker::link(Distance::format($year['km']), mktime(0, 0, 0, 1, 1, $year['year']), mktime(23, 59, 50, 12, 31, $year['year']));
             echo '<td class="small"><span title="' . $year['year'] . '">' . $link . '</span></td>';
         }
         for (; $i < 9; $i++) {
             echo HTML::emptyTD();
         }
         echo '</tr>';
     }
     // Months
     echo '<tr class="r"><td class="c b">' . __('per month') . '</td>';
     foreach ($this->months as $i => $month) {
         $link = DataBrowserLinker::link(Distance::format($month['km']), mktime(0, 0, 0, $month['month'], 1, $month['year']), mktime(23, 59, 50, $month['month'] + 1, 0, $month['year']));
         echo '<td class="small"><span title="' . Time::Month($month['month']) . ' ' . $month['year'] . '">' . $link . '</span></td>';
     }
     for (; $i < 9; $i++) {
         echo HTML::emptyTD();
     }
     echo '</tr>';
     // Weeks
     echo '<tr class="r"><td class="c b">' . __('per week') . '</td>';
     foreach ($this->weeks as $i => $week) {
         $link = DataBrowserLinker::link(Distance::format($week['km']), Time::Weekstart($week['time']), Time::Weekend($week['time']));
         echo '<td class="small"><span title="' . __('Week') . ' ' . $week['week'] . ' ' . $week['year'] . '">' . $link . '</span></td>';
     }
     for (; $i < 9; $i++) {
         echo HTML::emptyTD();
     }
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:50,代码来源:class.RunalyzePluginStat_Rekorde.php

示例3: displayWeekTable

 /**
  * Display table with last week-statistics 
  * @param bool $showAllWeeks
  */
 private function displayWeekTable($showAllWeeks = false)
 {
     if (($this->showsAllYears() || $this->showsSpecificYear() && $this->year != date('Y')) && !$showAllWeeks) {
         return;
     }
     $Dataset = new Dataset();
     if ($this->Configuration()->value('compare_weeks')) {
         $Dataset->activateKilometerComparison();
     }
     $title = $showAllWeeks ? __('All training weeks') : __('Last 10 training weeks');
     echo '<table class="r fullwidth zebra-style">';
     echo '<thead><tr><th colspan="' . ($Dataset->cols() + 1) . '">' . $title . '</th></tr></thead>';
     echo '<tbody>';
     if (!$showAllWeeks) {
         $starttime = time();
         $maxW = 9;
     } else {
         $starttime = $this->year == date("Y") ? time() : mktime(1, 0, 0, 12, 31, $this->year);
         $maxW = ($starttime - mktime(1, 0, 0, 12, 31, $this->year - 1)) / (7 * DAY_IN_S);
     }
     $CompleteData = array();
     $CurrentWeekEnd = Time::Weekend($starttime);
     $CompleteResult = $Dataset->getGroupOfTrainingsForTimerange($this->sportid, 7 * DAY_IN_S, $CurrentWeekEnd - ($maxW + 2) * 7 * DAY_IN_S, $CurrentWeekEnd);
     foreach ($CompleteResult as $Data) {
         $CompleteData[$Data['timerange']] = $Data;
     }
     for ($w = 0; $w <= $maxW; $w++) {
         $time = $starttime - $w * 7 * DAY_IN_S;
         $start = Time::Weekstart($time);
         $end = Time::Weekend($time);
         $week = Icon::$CALENDAR . ' ' . __('Week') . ' ' . date('W', $time);
         //echo '<tr><td class="b l"">'.DataBrowserLinker::link($week, $start, $end).'</td>';
         echo '<tr><td class="l"><span class="b">' . DataBrowserLinker::link($week, $start, $end, '') . '</span>&nbsp;&nbsp;&nbsp;<span class="small">' . date('d.m', $start) . " - " . date('d.m', $end) . '</span></td>';
         if (isset($CompleteData[$w]) && !empty($CompleteData[$w])) {
             $Dataset->setGroupOfTrainings($CompleteData[$w]);
             if (isset($CompleteData[$w + 1])) {
                 $Dataset->setKilometerToCompareTo($CompleteData[$w + 1]['distance']);
             }
             $Dataset->displayTableColumns();
         } else {
             echo HTML::emptyTD($Dataset->cols(), '<em>' . __('No activities') . '</em>', 'c small');
         }
         echo '</tr>';
     }
     echo '</tbody>';
     echo '</table>';
 }
开发者ID:schoch,项目名称:Runalyze,代码行数:51,代码来源:class.RunalyzePluginStat_Statistiken.php

示例4: weekLink

 /**
  * Get a ajax-link to a specified DataBrowser
  * @param string $name Name to be displayed as link
  * @param int $time Timestamp of the week
  * @return string HTML-link
  */
 static function weekLink($name, $time)
 {
     return self::link($name, Time::Weekstart($time), Time::Weekend($time), '', 'week-link');
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:10,代码来源:class.DataBrowserLinker.php

示例5: initTimestamps

 /**
  * Init private timestamps from request
  */
 protected function initTimestamps()
 {
     if (!isset($_GET['start']) || !isset($_GET['end'])) {
         $Mode = Configuration::DataBrowser()->mode();
         if ($Mode->showMonth()) {
             $this->timestamp_start = mktime(0, 0, 0, date("m"), 1, date("Y"));
             $this->timestamp_end = mktime(23, 59, 50, date("m") + 1, 0, date("Y"));
         } else {
             $this->timestamp_start = Time::Weekstart(time());
             $this->timestamp_end = Time::Weekend(time());
         }
     } else {
         $this->timestamp_start = $_GET['start'];
         $this->timestamp_end = $_GET['end'];
     }
     $this->day_count = round(($this->timestamp_end - $this->timestamp_start) / 86400);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:20,代码来源:class.DataBrowser.php


注:本文中的Time::Weekend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。