4 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetQuestion.php';
31 $this->questions[] = $question;
38 return current($this->questions);
43 return next($this->questions);
48 return key($this->questions);
53 return key($this->questions) !== null;
58 return reset($this->questions);
64 return count($this->questions) > $amount;
69 return count($this->questions) < $amount;
79 $difference = $requiredAmount - count($this->questions);
80 $missingCount = $difference < 0 ? 0 : $difference;
87 shuffle($this->questions);
92 $this->questions = array_merge($this->questions, $questionCollection->getQuestions());
97 $uniqueQuestions = array();
102 if (!isset($uniqueQuestions[$question->getQuestionId()])) {
103 $uniqueQuestions[$question->getQuestionId()] = $question;
107 $uniqueQuestionCollection =
new self();
108 $uniqueQuestionCollection->setQuestions($uniqueQuestions);
110 return $uniqueQuestionCollection;
127 $questionIds = array_flip($questionCollection->getInvolvedQuestionIds());
129 $relativeComplementCollection =
new self();
132 if (!isset($questionIds[$question->getQuestionId()])) {
133 $relativeComplementCollection->addQuestion($question);
137 return $relativeComplementCollection;
147 $questionIds = array_flip($questionCollection->getInvolvedQuestionIds());
149 $intersectionCollection =
new self();
152 if (!isset($questionIds[$question->getQuestionId()])) {
156 $intersectionCollection->addQuestion($question);
159 return $intersectionCollection;
173 $questionIds = array();
176 $questionIds[] = $question->getQuestionId();
186 $randomQuestionCollection =
new self();
188 foreach ($randomKeys as $randomKey) {
189 $randomQuestionCollection->addQuestion($this->questions[$randomKey]);
192 return $randomQuestionCollection;
202 return array_rand($array, $numKeys);
205 return array( array_rand($array, $numKeys) );
getIntersectionCollection(self $questionCollection)
mergeQuestionCollection(self $questionCollection)
getRandomArrayKeys($array, $numKeys)
getMissingCount($requiredAmount)
getRelativeComplementCollection(self $questionCollection)
getRandomQuestionCollection($requiredAmount)
addQuestion(ilTestRandomQuestionSetQuestion $question)
getUniqueQuestionCollection()