/** * 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; }
/** * Display formular for editing a training * Call: call/call.Training.edit.php?id= */ require '../inc/class.Frontend.php'; use Runalyze\Model\Activity; use Runalyze\View\Activity\Linker; use Runalyze\View\Activity\Dataview; $Frontend = new Frontend(); if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { $Deleter = new Activity\Deleter(DB::getInstance(), Runalyze\Context::Factory()->activity($_GET['delete'])); $Deleter->setAccountID(SessionAccountHandler::getId()); $Deleter->delete(); echo '<div class="panel-content"><p id="submit-info" class="error">' . __('The activity has been removed') . '</p></div>'; echo '<script>$("#multi-edit-' . (int) $_GET['delete'] . '").remove();Runalyze.Statistics.resetUrl();Runalyze.reloadContent();</script>'; exit; } $Training = new TrainingObject(Request::sendId()); $Activity = new Activity\Object($Training->getArray()); $Linker = new Linker($Activity); $Dataview = new Dataview($Activity); echo $Linker->editNavigation(); echo '<div class="panel-heading">'; echo '<h1>' . $Dataview->titleWithComment() . ', ' . $Dataview->dateAndDaytime() . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; $Formular = new TrainingFormular($Training, StandardFormular::$SUBMIT_MODE_EDIT); $Formular->setId('training'); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W50); $Formular->display(); echo '</div>';
* Call: call/call.Training.edit.php?id= */ require '../inc/class.Frontend.php'; use Runalyze\Model\Activity; use Runalyze\View\Activity\Linker; use Runalyze\View\Activity\Dataview; $Frontend = new Frontend(); if (isset($_GET['delete']) && is_numeric($_GET['delete'])) { $Factory = Runalyze\Context::Factory(); $Deleter = new Activity\Deleter(DB::getInstance(), $Factory->activity($_GET['delete'])); $Deleter->setAccountID(SessionAccountHandler::getId()); $Deleter->setEquipmentIDs($Factory->equipmentForActivity($_GET['delete'], true)); $Deleter->delete(); echo '<div class="panel-content"><p id="submit-info" class="error">' . __('The activity has been removed') . '</p></div>'; echo '<script>$("#multi-edit-' . (int) $_GET['delete'] . '").remove();Runalyze.Statistics.resetUrl();Runalyze.reloadContent();</script>'; exit; } $Training = new TrainingObject(Request::sendId()); $Activity = new Activity\Entity($Training->getArray()); $Linker = new Linker($Activity); $Dataview = new Dataview($Activity); echo $Linker->editNavigation(); echo '<div class="panel-heading">'; echo '<h1>' . $Dataview->titleWithComment() . ', ' . $Dataview->dateAndDaytime() . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; $Formular = new TrainingFormular($Training, StandardFormular::$SUBMIT_MODE_EDIT); $Formular->setId('training'); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W50); $Formular->display(); echo '</div>';