/** * Display formular for one training * @param TrainingObject $SingleObject */ protected function displaySingleFormularFor(TrainingObject $SingleObject) { if ($SingleObject->Weather()->isEmpty()) { $SingleObject->setWeatherForecast(); } $Formular = new TrainingFormular($SingleObject, StandardFormular::$SUBMIT_MODE_CREATE); $Formular->setId('training'); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W50); $Formular->display(); }
/** * 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>';