/** * @param \_OurBrand_\Quiz\Domain\Model\Quiz $quiz * * @throws \Exception */ public function editAction($quiz) { if (!$this->accessHelper->canUserEditQuiz($this->currentUser, $quiz)) { $this->throwStatus(403); } if ($quiz->getSnapshotOf() instanceof Quiz) { $this->redirect('edit', 'quiz', '_OurBrand_.quiz', array('quiz' => $quiz->getSnapshotOf())); } // TODO: Work over $sessions = $this->studentQuizSessionRepository->findByQuiz($quiz); if ($sessions->count() > 0) { throw new \Exception('Can not edit quiz that has been assigned'); } $this->view->assign('quiz', $quiz); $this->view->assign('isEditingQuiz', 1); $this->view->assign('defaultDuration', $this->defaultDuration / 60); $this->view->assign('typeOptions', $this->typeOptions); $this->view->assign('subjectOptions', $this->subjectRepository->findAll()); $this->view->assign('teamLevelOptions', $this->teamLevelRepository->findAll()); $this->view->assign('teamLevelPlaceholder', $this->translateById('quiz.placeholder.teamLevel')); $this->view->assign('typePlaceholder', $this->translateById('quiz.placeholder.type')); $this->view->assign('subjectPlaceholder', $this->translateById('quiz.placeholder.subject')); $this->view->assign('introductionPlaceholder', $this->translateById('quiz.placeholder.introduction')); }
/** * Generate a new TeamLevel * * This command inserts a new TeamLevel record into the database. Mostly used for development while management * tools for levels are not yet available * * @param string $name The name of the level to generate * @return void */ public function levelCommand($name, $level) { $teamLevel = new TeamLevel($name, $level); $this->teamLevelRepository->add($teamLevel); $this->outputLine('TeamLevel with name "%s" added to the database.', array($name)); }