예제 #1
0
 /**
  * Weekday
  * @return string
  */
 public function weekday()
 {
     if (!is_numeric($this->Activity->timestamp())) {
         return '';
     }
     return Time::weekday(date('w', $this->Activity->timestamp()));
 }
예제 #2
0
<?php

/**
 * Draw total time of training for each day of a week for the user
 * Include:   inc/draw/Plot.Weekday.php
 * @package Runalyze\Plugins\Stats
 */
use Runalyze\Util\Time;
$titleCenter = __('Activity [in h] by weekday');
$yAxis = array();
$xAxis = array();
for ($w = 1; $w <= 7; $w++) {
    $xAxis[] = array($w - 1, Time::weekday($w, true));
}
if ($this->sportid > 0) {
    $Sports = array(SportFactory::DataFor((int) $this->sportid));
} else {
    $Sports = SportFactory::AllSports();
}
$Query = DB::getInstance()->prepare('SELECT
		SUM(`s`) as `value`,
		(DAYOFWEEK(FROM_UNIXTIME(`time`))-1) as `day`
	FROM `' . PREFIX . 'training`
	WHERE
		`sportid`=:id
		' . $this->getYearDependenceForQuery() . '
	GROUP BY `day`
	ORDER BY ((`day`+6)%7) ASC');
// TODO: Should be possible with one query?
foreach ($Sports as $sport) {
    $id = $sport['name'];
예제 #3
0
 /**
  * Get date string for given timestamp
  * @param int $timestamp
  * @return string
  */
 protected function dateString($timestamp)
 {
     $date = date('d.m.', $timestamp);
     $addLink = '';
     $weekDay = Time::weekday(date('w', $timestamp), true);
     if (Configuration::DataBrowser()->showCreateLink() && !FrontendShared::$IS_SHOWN) {
         $addLink = ImporterWindow::linkForDate($timestamp);
     }
     if (Time::isToday($timestamp)) {
         $weekDay = '<strong>' . $weekDay . '</strong>';
     }
     return $date . ' ' . $addLink . ' ' . $weekDay;
 }
예제 #4
0
파일: Dataview.php 프로젝트: 9x/Runalyze
 /**
  * Weekday
  * @return string
  */
 public function weekday()
 {
     return Time::weekday(date('w', $this->Activity->timestamp()));
 }