コード例 #1
0
 /**
  * @param string $authentication A hash of the shared secret and the params.
  * @param string $userIdentifier
  * @param string $subject Which subject to filter by.
  *
  * @throws \Exception
  */
 public function quizListAction($authentication, $userIdentifier, $subject = '')
 {
     if (!$this->verifyAuthentication($authentication, (string) ($userIdentifier . $subject))) {
         throw new AccessDeniedException('Access denied');
     }
     if ($this->requireSecure && !$this->request->getHttpRequest()->isSecure()) {
         throw new \Exception('Connection must be secure', 40);
     }
     $user = $this->userRepository->findByIdentifier($userIdentifier);
     $userQuizzes = $this->quizRepository->findAllByUser($user);
     $publicQuizzes = $this->quizRepository->findAllPublic();
     $out = array();
     foreach ($userQuizzes as $quiz) {
         $outQuiz = $this->makeExportArrayFromQuiz($quiz);
         $out[$this->persistenceManager->getIdentifierByObject($quiz)] = $outQuiz;
     }
     $out2 = array();
     foreach ($publicQuizzes as $quiz) {
         // No duplicates.
         if (isset($out[$this->persistenceManager->getIdentifierByObject($quiz)])) {
             continue;
         }
         $outQuiz = $this->makeExportArrayFromQuiz($quiz);
         $out2[$this->persistenceManager->getIdentifierByObject($quiz)] = $outQuiz;
     }
     $this->view->assign('value', array('userQuizzes' => $out, 'publicQuizzes' => $out2));
 }
コード例 #2
0
 /**
  * @return void
  */
 public function indexAction()
 {
     if ($this->currentUser->isInstructor() || $this->currentUser->isEditor()) {
         if ($this->currentUser->isWorker()) {
             $quizzes = $this->quizRepository->findAllQuiz();
         } else {
             $quizzes = $this->quizRepository->findAllByUser($this->currentUser->getIdentifier());
         }
         $ABO2API = new \_OurBrand_\ABO2API\Api\Abo2Api();
         $teams = $ABO2API->getTeamsForAccountUser($this->currentUser->getIdentifier());
         $sessions = $this->studentQuizSessionRepository->findAll();
         $this->view->assign('quizzes', $quizzes);
         $this->view->assign('teams', $teams);
         $this->view->assign('studentQuizSessions', $sessions);
     } else {
         $this->redirect('studentindex');
     }
 }