/** * Full string * * Complete string for the weather conditions with icon, name and temperature. * @return string */ public function fullString($isNight = false) { $icon = $this->Condition->icon(); if ($isNight == true) { $icon->setAsNight(); } return $icon->code() . ' ' . $this->Condition->string() . ' ' . __('at') . ' ' . $this->Temperature->asString(); }
/** * Display month-table for weather */ private function displayMonthTableWeather() { $Condition = new Weather\Condition(0); $Statement = DB::getInstance()->prepare('SELECT SUM(1) as `num`, ' . $this->getTimerIndexForQuery() . ' as `m` FROM `' . PREFIX . 'training` WHERE `sportid`=? AND `weatherid`=? ' . $this->getYearDependenceForQuery() . ' GROUP BY ' . $this->getTimerIndexForQuery() . ' ORDER BY ' . $this->getTimerForOrderingInQuery() . ' ASC LIMIT 12'); foreach (Weather\Condition::completeList() as $id) { $Condition->set($id); $Statement->execute(array(Configuration::General()->mainSport(), $id)); $data = $Statement->fetchAll(); $i = 1; echo '<tr><td>' . $Condition->icon()->code() . '</td>'; if (!empty($data)) { foreach ($data as $dat) { for (; $i < $dat['m']; $i++) { echo HTML::emptyTD(); } $i++; echo $dat['num'] != 0 ? '<td>' . $dat['num'] . 'x</td>' : HTML::emptyTD(); } for (; $i <= 12; $i++) { echo HTML::emptyTD(); } } else { echo HTML::emptyTD(12); } } echo '</tr>'; }
/** * Display statistics for weather */ private function displayWeatherStatistics() { $Condition = new Weather\Condition(0); $Strings = array(); $Weather = DB::getInstance()->query('SELECT SUM(1) as num, weatherid FROM `' . PREFIX . 'training` WHERE `typeid`=' . Configuration::General()->competitionType() . ' AND `weatherid`!=' . Weather\Condition::UNKNOWN . ' AND `accountid` = ' . SessionAccountHandler::getId() . ' GROUP BY `weatherid` ORDER BY `weatherid` ASC')->fetchAll(); foreach ($Weather as $W) { $Condition->set($W['weatherid']); $Strings[] = $W['num'] . 'x ' . $Condition->icon()->code(); } if (!empty($Strings)) { echo '<strong>' . __('Weather statistics') . ':</strong> '; echo implode(', ', $Strings); echo '<br><br>'; } }
/** * @return array */ protected function generateDataForWeatherConditions() { $Rows = array(); $Condition = new Weather\Condition(0); $Statement = $this->createStatementToFetchWeatherConditions(); foreach (Weather\Condition::completeList() as $id) { if ($id == Weather\Condition::UNKNOWN) { continue; } $Statement->execute(array($id)); $Condition->set($id); $rowData = array(); foreach ($Statement->fetchAll() as $data) { $rowData[$data['m']] = $data['num'] . 'x'; } $Rows[$Condition->icon()->code()] = $rowData; } return $Rows; }
/** * Full string * * Complete string for the weather conditions with icon, name and temperature. * @return string */ public function fullString() { return $this->Condition->icon()->code() . ' ' . $this->Condition->string() . ' ' . __('at') . ' ' . $this->Temperature->asString(); }