/**
  * Add GPX to object
  */
 protected function addGPXtoObject()
 {
     if ($this->GPXImporter->failed()) {
         return;
     }
     foreach ($this->GPXImporter->object()->getArray() as $key => $value) {
         if ($this->TrainingObject->get($key) == '' || $this->TrainingObject->get($key) == 0) {
             $this->setFromGPX($key, $value);
         }
     }
     if (!$this->TrainingObject->Splits()->areEmpty()) {
         $this->fillSplitsFromGPX();
     }
 }
 /**
  * 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;
 }