/** * Init data */ protected function prepareForDisplay() { $this->Sport = new Sport($this->sportid); $this->initTimer(); $this->initData(); $this->setAnalysisNavigation(); $this->setSportsNavigation(); $this->setYearsNavigation(true, true, true); $this->setHeader($this->Sport->name() . ' ' . $this->getYearString()); }
/** * Set data to compare training and competition */ private function setDataForCompetitionAndTraining() { $Kilometers = array_fill(0, $this->timerEnd - $this->timerStart + 1, 0); $KilometersCompetition = array_fill(0, $this->timerEnd - $this->timerStart + 1, 0); foreach ($this->RawData as $dat) { if ($dat['timer'] >= $this->timerStart && $dat['timer'] <= $this->timerEnd) { if ($dat['wk'] == 1) { $KilometersCompetition[$dat['timer'] - $this->timerStart] = $dat['sum']; } else { $Kilometers[$dat['timer'] - $this->timerStart] = $dat['sum']; } } } // TODO: currently, only ONE competition type is allowed (and used for running) // if ($this->Sport->hasTypes()) if ($this->Sport->isRunning()) { $this->Data[] = array('label' => __('Competition'), 'data' => $KilometersCompetition); $this->Data[] = array('label' => __('Training'), 'data' => $Kilometers, 'color' => '#E68617'); } else { $this->Data[] = array('label' => $this->Sport->name(), 'data' => $Kilometers, 'color' => '#E68617'); } }
/** * Add sport and year (if set) to header */ protected function setHeaderWithSportAndYear() { $HeaderParts = array(); if ($this->sportid > 0 && $this->ShowSportsNavigation) { $Sport = new Sport($this->sportid); $HeaderParts[] = $Sport->name(); } if ($this->ShowYearsNavigation) { $HeaderParts[] = $this->getYearString(); } if (!empty($HeaderParts)) { $this->setHeader($this->name() . ': ' . implode(', ', $HeaderParts)); } }
$this->Dataset->setActivityData($short); $this->Dataset->displayShortLink(); } echo '</td> <td class="l as-small-as-possible">' . Dataset::getDateString($day['date']) . '</td> <td colspan="' . ($this->Dataset->cols() + $this->showPublicLink) . '"></td> </tr>'; } } echo '</tbody>'; echo '<tbody>'; // Z U S A M M E N F A S S U N G $WhereNotPrivate = FrontendShared::$IS_SHOWN && !\Runalyze\Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : ''; $sports = DB::getInstance()->query('SELECT `id`, `time`, `sportid`, SUM(1) as `num` FROM `' . PREFIX . 'training` WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . ' AND accountid = ' . SessionAccountHandler::getId() . ' ' . $WhereNotPrivate . ' GROUP BY `sportid` ORDER BY `num` DESC')->fetchAll(); foreach ($sports as $i => $sportdata) { $Sport = new Sport($sportdata['sportid']); echo '<tr class="r no-zebra"> <td colspan="' . $this->additionalColumns . '"> <small>' . $sportdata['num'] . 'x</small> ' . $Sport->name() . ' </td>'; $this->Dataset->loadGroupOfTrainings($sportdata['sportid'], $this->timestamp_start, $this->timestamp_end); $this->Dataset->displayTableColumns(); echo ' </tr>'; } ?> </tbody> </table> </div> </div>