/**
  * 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;
 }
 /**
  * Set activityID if empty
  * Floor must be used because we don't save seconds for activities (historical)
  */
 private function setActivityID()
 {
     if (!$this->TrainingObject->hasActivityId()) {
         $this->TrainingObject->setActivityId((int) floor($this->TrainingObject->getTimestamp() / 60) * 60);
     }
 }