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


PHP Time::Month方法代码示例

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


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

示例1: getXLabels

 /**
  * Get X labels
  * @return array
  */
 protected function getXLabels()
 {
     $months = array();
     $add = $this->Year == parent::LAST_6_MONTHS || $this->Year == parent::LAST_12_MONTHS ? date('m') : 0;
     $i = 0;
     for ($m = $this->timerStart; $m <= $this->timerEnd; $m++) {
         $months[] = array($i, Time::Month($m + $add, true));
         $i++;
     }
     return $months;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:15,代码来源:class.PlotMonthSumData.php

示例2: getXLabels

 /**
  * Get X labels
  * @return array
  */
 protected function getXLabels()
 {
     $weeks = array();
     $add = $this->Year == parent::LAST_6_MONTHS || $this->Year == parent::LAST_12_MONTHS ? 0 : date("W") - $this->timerEnd;
     for ($w = $this->timerStart; $w <= $this->timerEnd; $w++) {
         $time = strtotime("sunday -" . ($this->timerEnd - $w + $add) . " weeks");
         $string = date("d", $time) <= 7 ? Time::Month(date("m", $time), true) : '';
         if ($string != '' && date("m", $time) == 1) {
             $string .= ' \'' . date("y", $time);
         }
         $weeks[] = array($w - $this->timerStart, $string);
     }
     return $weeks;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:18,代码来源:class.PlotWeekSumData.php

示例3: monthTR

 /**
  * Get a tr-tag for a bold header-line containing all month-names
  * @param int $fixedWidth Fixed width for every month-td in percent [set '0' for no fixed width]
  * @param int $emptyTDs Number of empty td before the month-td
  * @return string
  */
 public static function monthTR($fixedWidth = 0, $emptyTDs = 1, $tag = 'td')
 {
     $width = $fixedWidth > 0 ? ' width="' . $fixedWidth . '%"' : '';
     $html = '<tr class="b">';
     for ($i = 1; $i <= $emptyTDs; $i++) {
         $html .= '<' . $tag . '></' . $tag . '>';
     }
     for ($m = 1; $m <= 12; $m++) {
         $html .= '<' . $tag . $width . '>' . Time::Month($m, true) . '</' . $tag . '>';
     }
     $html .= '</tr>';
     return $html;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:19,代码来源:class.HTML.php

示例4: array

<?php

/**
 * Draw weather-plot
 * Call:   include 'Plot.Average.php'
 * @package Runalyze\Plugins\Stats
 */
$Months = array();
$Temperatures = array();
for ($m = 1; $m <= 12; $m++) {
    $Months[] = array($m - 1, Time::Month($m, true));
    for ($y = START_YEAR, $n = date('Y'); $y <= $n; $y++) {
        $Temperatures[$y] = array(null, null, null, null, null, null, null, null, null, null, null, null);
    }
}
$Query = '
	SELECT
		YEAR(FROM_UNIXTIME(`time`)) as `y`,
		MONTH(FROM_UNIXTIME(`time`)) as `m`,
		AVG(`temperature`) as `temp`
	FROM `' . PREFIX . 'training`
	WHERE
		!ISNULL(`temperature`)
	GROUP BY `y`, `m`
	ORDER BY `y` ASC, `m` ASC';
$Data = DB::getInstance()->query($Query)->fetchAll();
foreach ($Data as $dat) {
    $Temperatures[$dat['y']][$dat['m'] - 1] = (int) $dat['temp'];
}
$Plot = new Plot("average", 780, 240);
for ($y = START_YEAR, $n = date('Y'); $y <= $n; $y++) {
开发者ID:n0rthface,项目名称:Runalyze,代码行数:31,代码来源:Plot.Average.php

示例5: 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

示例6: displayTableHeadForTimeRange

 /**
  * Display an empty th and ths for chosen years/months
  * @param bool $prependEmptyTag
  * @param string $width
  */
 protected function displayTableHeadForTimeRange($prependEmptyTag = true, $width = '8%')
 {
     if ($prependEmptyTag) {
         echo '<th></th>';
     }
     if (!empty($width)) {
         $width = ' width="' . $width . '"';
     }
     if ($this->showsAllYears()) {
         $year = date('Y');
         for ($i = START_YEAR; $i <= $year; $i++) {
             echo '<th' . $width . '>' . $i . '</th>';
         }
         echo '<th>' . __('In total') . '</th>';
     } else {
         $num = $this->showsLast6Months() ? 6 : 12;
         $add = $this->showsTimeRange() ? date('m') - $num - 1 + 12 : -1;
         for ($i = 1; $i <= 12; $i++) {
             echo '<th' . $width . '>' . Time::Month(($i + $add) % 12 + 1, true) . '</th>';
         }
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:27,代码来源:class.PluginStat.php

示例7: displayTitle

 /**
  * Display title
  */
 protected function displayTitle()
 {
     $timeForLinks = $this->timestamp_start < time() && time() < $this->timestamp_end ? time() : $this->timestamp_start;
     echo DataBrowserLinker::monthLink(Time::Month(date("m", $timeForLinks)), $timeForLinks) . ', ';
     echo DataBrowserLinker::yearLink(date("Y", $timeForLinks), $timeForLinks) . ', ';
     echo DataBrowserLinker::weekLink(date("W", $timeForLinks) . '. ' . __('week'), $timeForLinks);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:10,代码来源:class.DataBrowser.php


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