/**
  * Head for row
  * @param int $index
  * @return string
  */
 protected function rowHead($index)
 {
     $year = date('Y', $this->TimeEnd - ($index + 0.5) * 366 * DAY_IN_S);
     $start = mktime(0, 0, 1, 1, 1, $year);
     $end = mktime(23, 59, 59, 12, 31, $year);
     return DataBrowserLinker::link($year, $start, $end, '');
 }
Exemplo n.º 2
0
 /**
  * Head for row
  * @param int $index
  * @return string
  */
 protected function rowHead($index)
 {
     $year = $this->Mode == self::MODE_YEAR ? $this->Year : date('Y');
     $month = date('m', $this->TimeEnd - ($index + 0.5) * 31 * DAY_IN_S);
     $start = mktime(0, 0, 1, $month, 1, $year);
     $end = mktime(23, 59, 59, $month + 1, 0, $year);
     return DataBrowserLinker::link(Time::month($month), $start, $end, '');
 }
 /**
  * Head for row
  * @param int $index
  * @return string
  */
 protected function rowHead($index)
 {
     $time = $this->TimeEnd - ($index + 0.5) * 7 * DAY_IN_S;
     $start = Time::weekstart($time);
     $end = Time::weekend($time);
     $week = Icon::$CALENDAR . ' ' . __('Week') . ' ' . date('W', $time);
     return DataBrowserLinker::link($week, $start, $end, '') . '</span>&nbsp;&nbsp;&nbsp;<span class="small">' . date('d.m', $start) . ' - ' . date('d.m', $end);
 }
Exemplo n.º 4
0
 /**
  * Get ajax-link for reload this DataBrowser
  * @return string
  */
 protected function getRefreshLink()
 {
     $Link = DataBrowserLinker::link(Icon::$REFRESH, $this->timestamp_start, $this->timestamp_end);
     return str_replace('<a ', '<a id="' . self::$REFRESH_BUTTON_ID . '" ' . Ajax::tooltip('', __('Reload current datasheet'), false, true), $Link);
 }
 /**
  * Display the table with most kilometer for each year/month/week
  */
 private function displayMostKilometer()
 {
     echo '<table class="fullwidth zebra-style">';
     echo '<thead><tr><th colspan="11" class="l">' . __('Most kilometers') . '</th></tr></thead>';
     echo '<tbody>';
     if (empty($this->weeks)) {
         echo '<tr><td colspan="11"><em>' . __('No data available') . '</em></td></tr>';
         echo HTML::spaceTR(11);
         echo '</tbody>';
         echo '</table>';
         return;
     }
     // Years
     if ($this->year == -1) {
         echo '<tr class="r"><td class="c b">' . __('per year') . '</td>';
         foreach ($this->years as $i => $year) {
             $link = DataBrowserLinker::link(Distance::format($year['km']), mktime(0, 0, 0, 1, 1, $year['year']), mktime(23, 59, 50, 12, 31, $year['year']));
             echo '<td class="small"><span title="' . $year['year'] . '">' . $link . '</span></td>';
         }
         for (; $i < 9; $i++) {
             echo HTML::emptyTD();
         }
         echo '</tr>';
     }
     // Months
     echo '<tr class="r"><td class="c b">' . __('per month') . '</td>';
     foreach ($this->months as $i => $month) {
         $link = DataBrowserLinker::link(Distance::format($month['km']), mktime(0, 0, 0, $month['month'], 1, $month['year']), mktime(23, 59, 50, $month['month'] + 1, 0, $month['year']));
         echo '<td class="small"><span title="' . Time::Month($month['month']) . ' ' . $month['year'] . '">' . $link . '</span></td>';
     }
     for (; $i < 9; $i++) {
         echo HTML::emptyTD();
     }
     echo '</tr>';
     // Weeks
     echo '<tr class="r"><td class="c b">' . __('per week') . '</td>';
     foreach ($this->weeks as $i => $week) {
         $link = DataBrowserLinker::link(Distance::format($week['km']), Time::Weekstart($week['time']), Time::Weekend($week['time']));
         echo '<td class="small"><span title="' . __('Week') . ' ' . $week['week'] . ' ' . $week['year'] . '">' . $link . '</span></td>';
     }
     for (; $i < 9; $i++) {
         echo HTML::emptyTD();
     }
     echo '</tr>';
     echo '</tbody>';
     echo '</table>';
 }
 /**
  * Display table with last week-statistics 
  * @param bool $showAllWeeks
  */
 private function displayWeekTable($showAllWeeks = false)
 {
     if (($this->showsAllYears() || $this->showsSpecificYear() && $this->year != date('Y')) && !$showAllWeeks) {
         return;
     }
     $Dataset = new Dataset();
     if ($this->Configuration()->value('compare_weeks')) {
         $Dataset->activateKilometerComparison();
     }
     $title = $showAllWeeks ? __('All training weeks') : __('Last 10 training weeks');
     echo '<table class="r fullwidth zebra-style">';
     echo '<thead><tr><th colspan="' . ($Dataset->cols() + 1) . '">' . $title . '</th></tr></thead>';
     echo '<tbody>';
     if (!$showAllWeeks) {
         $starttime = time();
         $maxW = 9;
     } else {
         $starttime = $this->year == date("Y") ? time() : mktime(1, 0, 0, 12, 31, $this->year);
         $maxW = ($starttime - mktime(1, 0, 0, 12, 31, $this->year - 1)) / (7 * DAY_IN_S);
     }
     $CompleteData = array();
     $CurrentWeekEnd = Time::Weekend($starttime);
     $CompleteResult = $Dataset->getGroupOfTrainingsForTimerange($this->sportid, 7 * DAY_IN_S, $CurrentWeekEnd - ($maxW + 2) * 7 * DAY_IN_S, $CurrentWeekEnd);
     foreach ($CompleteResult as $Data) {
         $CompleteData[$Data['timerange']] = $Data;
     }
     for ($w = 0; $w <= $maxW; $w++) {
         $time = $starttime - $w * 7 * DAY_IN_S;
         $start = Time::Weekstart($time);
         $end = Time::Weekend($time);
         $week = Icon::$CALENDAR . ' ' . __('Week') . ' ' . date('W', $time);
         //echo '<tr><td class="b l"">'.DataBrowserLinker::link($week, $start, $end).'</td>';
         echo '<tr><td class="l"><span class="b">' . DataBrowserLinker::link($week, $start, $end, '') . '</span>&nbsp;&nbsp;&nbsp;<span class="small">' . date('d.m', $start) . " - " . date('d.m', $end) . '</span></td>';
         if (isset($CompleteData[$w]) && !empty($CompleteData[$w])) {
             $Dataset->setGroupOfTrainings($CompleteData[$w]);
             if (isset($CompleteData[$w + 1])) {
                 $Dataset->setKilometerToCompareTo($CompleteData[$w + 1]['distance']);
             }
             $Dataset->displayTableColumns();
         } else {
             echo HTML::emptyTD($Dataset->cols(), '<em>' . __('No activities') . '</em>', 'c small');
         }
         echo '</tr>';
     }
     echo '</tbody>';
     echo '</table>';
 }