/** * Weekday * @return string */ public function weekday() { if (!is_numeric($this->Activity->timestamp())) { return ''; } return Time::weekday(date('w', $this->Activity->timestamp())); }
<?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'];
/** * 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; }
/** * Weekday * @return string */ public function weekday() { return Time::weekday(date('w', $this->Activity->timestamp())); }