示例#1
0
 /**
  * Set activity
  * @param \Runalyze\Model\Activity\Entity $object activity object
  */
 public function setActivity(Model\Activity\Entity $object)
 {
     $this->Activity = $object;
     $this->Dataview = new Dataview($object);
     $this->Linker = new Linker($object);
     $this->Sport = $this->Activity->sportid() > 0 ? $this->Factory->sport($this->Activity->sportid()) : null;
     $this->Type = $this->Activity->typeid() > 0 ? $this->Factory->type($this->Activity->typeid()) : null;
     $this->ActivityData = $this->Activity->completeData();
     $this->IsRunning = $this->hasSport() && $this->Sport->id() == \Runalyze\Configuration::General()->runningSport();
 }
示例#2
0
 /**
  * @return string
  */
 public function sportIcon()
 {
     $Icon = $this->Sport->icon();
     $Icon->setTooltip($this->Sport->name());
     return $Icon->code();
 }
示例#3
0
 /**
  * Keys to insert
  * @return array
  */
 protected function keys()
 {
     return array_merge(array(self::ACCOUNTID), Entity::allDatabaseProperties());
 }
    /**
     * 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 $sportData) {
                $Request->bindValue('sportid', $sportData['id']);
                $Request->execute();
                $data = $Request->fetchAll();
                if (!empty($data)) {
                    $Sport = new Sport\Entity($sportData);
                    $output = true;
                    echo '<tr class="r">';
                    echo '<td class="b l">' . $Sport->icon()->code() . ' ' . $Sport->name() . '</td>';
                    $j = 0;
                    foreach ($data as $j => $dat) {
                        if ($rekord['speed']) {
                            $Pace = new Pace($dat['s'], $dat['distance']);
                            $Pace->setUnit($Sport->paceUnit());
                            $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>';
        }
    }