Example #1
0
 protected function getAnswerCountByUserIdsAndEntryIds($entryIds, $inputFilter)
 {
     $userIds = $this->getUserIdsFromFilter($inputFilter);
     $c = new Criteria();
     if (!QuizPlugin::isWithoutValue($userIds)) {
         $c = $this->createGetCuePointByUserIdsCriteria($userIds, $c);
     }
     if (!QuizPlugin::sWithoutValue($entryIds)) {
         $c->add(CuePointPeer::ENTRY_ID, explode(",", $entryIds), Criteria::IN);
     }
     $c->add(CuePointPeer::TYPE, QuizPlugin::getCoreValue('CuePointType', QuizCuePointType::QUIZ_ANSWER));
     $numOfAnswers = 0;
     $answers = CuePointPeer::doSelect($c);
     foreach ($answers as $answer) {
         /**
          * @var AnswerCuePoint $answer
          */
         $quizUserEntryId = $answer->getQuizUserEntryId();
         if ($this->isQuizUserEntrySubmitted($quizUserEntryId)) {
             $numOfAnswers++;
         }
     }
     $res['count_all'] = $numOfAnswers;
     return array($res);
 }