/** * Checks what controller to instansiate and return value of to HTMLView. */ public function doControll() { $controller; try { switch (\view\NavigationView::getAction()) { case \view\NavigationView::$actionAddUser: $controller = new ParticipantController(); return $controller->addUser(); break; case \view\NavigationView::$actionShowUser: $controller = new ParticipantController(); return $controller->show(); break; case \view\NavigationView::$actionAddProject: $controller = new ParticipantController(); return $controller->addProject(); default: $controller = new ParticipantController(); return $controller->showAll(); break; } } catch (\Exception $e) { error_log($e->getMessage() . "\n", 3, \Settings::$ERROR_LOG); if (\Settings::$DO_DEBUG) { throw $e; } else { \view\NavigationView::RedirectToErrorPage(); die; } } }
ParticipantController::competitor_participations($id); }); $routes->post('/participant', function () { ParticipantController::store(); }); $routes->get('/competition/:id/participants/new', function ($id) { ParticipantController::create($id); }); $routes->get('/participant/:id/edit', function ($id) { ParticipantController::edit($id); }); $routes->post('/participant/:id/edit', function ($id) { ParticipantController::update($id); }); $routes->post('/participant/:id/destroy', function ($id) { ParticipantController::destroy($id); }); $routes->get('/competition/:id/splits', function ($id) { SplitController::competition_splits($id); }); $routes->post('/split', function () { SplitController::store(); }); $routes->get('/participant/:id/splits/new', function ($id) { SplitController::create($id); }); $routes->get('/participant/:id/splits/edit', function ($id) { SplitController::edit($id); }); $routes->post('/split/edit', function () { SplitController::update();