/** * Init toolbar links */ private function initToolbarLinks() { $Linker = new Linker($this->Context->activity()); if ($this->Context->activity()->isPublic()) { $this->ToolbarLinks[] = '<a href="' . $Linker->publicUrl() . '" target="_blank">' . Icon::$ATTACH . ' ' . __('Public link') . '</a>'; } if (!Request::isOnSharedPage()) { $this->ToolbarLinks[] = Ajax::window('<a href="' . ExporterWindow::$URL . '?id=' . $this->Context->activity()->id() . '">' . Icon::$DOWNLOAD . ' ' . __('Export') . '</a> ', 'small'); $this->ToolbarLinks[] = Ajax::window('<a href="' . $Linker->editUrl() . '">' . Icon::$EDIT . ' ' . __('Edit') . '</a> ', 'small'); } $this->ToolbarLinks[] = Ajax::tooltip($Linker->weekLink(), '<em>' . __('Show week') . '</em><br>' . $this->Context->dataview()->weekday() . ', ' . $this->Context->dataview()->dateAndDaytime()); }
/** * Display the images */ private function displayTable() { if ($this->sportid > 0) { $sports_not_short = $this->sportid . ','; } else { $sports_not_short = ''; $sports = DB::getInstance()->query('SELECT `id` FROM `' . PREFIX . 'sport` WHERE `short`=0 AND `accountid` = ' . SessionAccountHandler::getId())->fetchAll(); foreach ($sports as $sport) { $sports_not_short .= $sport['id'] . ','; } } $nights = DB::getInstance()->query('SELECT * FROM ( SELECT id, time, s, sportid, distance, is_track, HOUR(FROM_UNIXTIME(`time`)) as `H`, MINUTE(FROM_UNIXTIME(`time`)) as `MIN` FROM `' . PREFIX . 'training` WHERE `sportid` IN(' . substr($sports_not_short, 0, -1) . ') AND `accountid` = ' . SessionAccountHandler::getId() . ' AND (HOUR(FROM_UNIXTIME(`time`))!=0 OR MINUTE(FROM_UNIXTIME(`time`))!=0) ' . $this->getYearDependenceForQuery() . ' ORDER BY ABS(12-(`H`+10)%24-`MIN`/60) ASC, `MIN` DESC LIMIT 20 ) t ORDER BY (`H`+12)%24 ASC, `MIN` ASC')->fetchAll(); if (empty($nights)) { $this->dataIsMissing = true; return; } echo '<table class="fullwidth zebra-style">'; echo '<thead><tr class="b c"><th colspan="8">' . __('Nightly activities') . '</th></tr></thead>'; echo '<tbody>'; foreach ($nights as $i => $data) { $Activity = new Activity\Entity($data); $Linker = new Linker($Activity); $View = new Dataview($Activity); if ($i % 2 == 0) { echo '<tr">'; } echo '<td class="b">' . $View->daytime() . '</td> <td>' . $Linker->linkWithSportIcon() . '</td> <td>' . $View->distanceOrDuration() . ' ' . SportFactory::name($Activity->sportid()) . '</td> <td>' . $Linker->weekLink() . '</td>'; if ($i % 2 == 1) { echo '</tr>'; } } echo '</tbody></table>'; // TODO: Find a better description. echo '<p class="text">'; echo __('2 a.m. is considered as <em>most extreme</em> time for a training. '); echo __('The 20 trainings being nearest to that time are listed.'); echo '</p>'; }
/** * Display table-row for a competition * @param array $data */ private function displayWKTr(array $data) { $Activity = new Activity\Entity($data); $Linker = new Linker($Activity); $Dataview = new Dataview($Activity); echo '<tr class="r"> <td>' . $this->getIconForCompetition($data['id']) . '</td> <td class="c small">' . $Linker->weekLink() . '</a></td> <td class="l"><strong>' . $Linker->linkWithComment() . '</strong></td> <td>' . $Dataview->distance(1) . '</td> <td>' . $Dataview->duration()->string(Duration::FORMAT_COMPETITION) . '</td> <td class="small">' . $Dataview->pace()->value() . '</td> <td class="small">' . Helper::Unknown($Activity->hrAvg()) . ' / ' . Helper::Unknown($Activity->hrMax()) . ' bpm</td> <td class="small">' . ($Activity->weather()->isEmpty() ? '' : $Activity->weather()->fullString($Activity->isNight())) . '</td> </tr>'; }
/** * Display the table for routes with procentual highest elevation */ private function displayUpwardData() { echo '<table style="width:48%;" style="margin:0 5px;" class="right zebra-style">'; echo '<thead><tr class="b c"><th colspan="4">' . __('Steepest routes') . '</th></tr></thead>'; echo '<tbody>'; if (empty($this->UpwardData)) { echo '<tr><td colspan="4"><em>' . __('No routes found.') . '</em></td></tr>'; } foreach ($this->UpwardData as $Data) { $Activity = new Activity\Object($Data); $Linker = new Linker($Activity); echo '<tr> <td class="small">' . $Linker->weekLink() . '</td> <td>' . $Linker->linkWithSportIcon() . '</td> <td>' . $this->labelFor($Data['route'], $Data['comment']) . '</td> <td class="r"> ' . round($Data['gradient'] / 10, 2) . ' %<br> <small>' . $Data['elevation'] . ' m, ' . $Data['distance'] . ' km</small> </td> </tr>'; } echo '</tbody></table>'; }