/** * Fetch activity for preview * @param int $id * @return array */ protected function fetchActivity($id) { if (is_null($this->FetchStatement)) { $this->FetchStatement = DB::getInstance()->prepare('SELECT ' . implode(',', Preview::keys()) . ' FROM `' . PREFIX . 'training` WHERE `id`=:id LIMIT 1'); } $this->FetchStatement->execute(array(':id' => $id)); return $this->FetchStatement->fetch(); }
/** * Get table row for training * @param TrainingObject $TrainingObject * @param int $i */ private function getTableRowFor(TrainingObject &$TrainingObject, $i) { $TrainingObject->updateAfterParsing(); $Data = urlencode(serialize($TrainingObject->getArray())); $Inputs = HTML::checkBox('training-import[' . $i . ']', true); $Inputs .= HTML::hiddenInput('training-data[' . $i . ']', $Data); $Preview = new Preview(new Activity\Entity(array(Activity\Entity::TIMESTAMP => $TrainingObject->getTimestamp(), Activity\Entity::SPORTID => $TrainingObject->get('sportid'), Activity\Entity::TIME_IN_SECONDS => $TrainingObject->getTimeInSeconds(), Activity\Entity::DISTANCE => $TrainingObject->getDistance(), Activity\Entity::IS_TRACK => $TrainingObject->isTrack(), Activity\Entity::HR_AVG => $TrainingObject->getPulseAvg(), Activity\Entity::SPLITS => $TrainingObject->get('splits'), Activity\Entity::ROUTEID => $TrainingObject->hasPositionData()))); $Row = '<td>' . $Inputs . '</td>'; $Row .= '<td>' . $Preview->dateAndTime() . '</td>'; $Row .= '<td>' . $Preview->duration() . '</td>'; $Row .= '<td>' . $Preview->distance() . '</td>'; $Row .= '<td>' . $Preview->sportIcon() . '</td>'; $Row .= '<td>' . $Preview->hrIcon() . '</td>'; $Row .= '<td>' . $Preview->splitsIcon() . '</td>'; $Row .= '<td>' . $Preview->mapIcon() . '</td>'; return $Row; }