/**
     * Display the table with general records
     */
    private function displayRekorde()
    {
        foreach ($this->rekorde as $rekord) {
            echo '<table class="fullwidth zebra-style">';
            echo '<thead><tr><th colspan="11" class="l">' . $rekord['name'] . '</th></tr></thead>';
            echo '<tbody>';
            $output = false;
            $sports = DB::getInstance()->query($rekord['sportquery'])->fetchAll();
            $Request = DB::getInstance()->prepare($rekord['datquery']);
            foreach ($sports as $sport) {
                $Request->bindValue('sportid', $sport['id']);
                $Request->execute();
                $data = $Request->fetchAll();
                if (!empty($data)) {
                    $output = true;
                    echo '<tr class="r">';
                    echo '<td class="b l">' . Icon::getSportIconForGif($sport['img'], $sport['name']) . ' ' . $sport['name'] . '</td>';
                    $j = 0;
                    foreach ($data as $j => $dat) {
                        if ($rekord['speed']) {
                            $Pace = new Pace($dat['s'], $dat['distance'], SportFactory::getSpeedUnitFor($sport['id']));
                            $code = $Pace->valueWithAppendix();
                        } else {
                            $code = $dat['distance'] != 0 ? Distance::format($dat['distance']) : Duration::format($dat['s']);
                        }
                        echo '<td class="small"><span title="' . date("d.m.Y", $dat['time']) . '">
								' . Ajax::trainingLink($dat['id'], $code) . '
							</span></td>';
                    }
                    for (; $j < 9; $j++) {
                        echo HTML::emptyTD();
                    }
                    echo '</tr>';
                }
            }
            if (!$output) {
                echo '<tr><td colspan="11"><em>' . __('No data available') . '</em></td></tr>';
            }
            echo '</tbody>';
            echo '</table>';
        }
    }
Esempio n. 2
0
 /**
  * Get icon for this sport
  * @param string $tooltip optional parameter for tooltip
  * @return string
  */
 public function Icon($tooltip = '')
 {
     return Icon::getSportIconForGif($this->data['img'], $tooltip);
 }