ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestRandomQuestionSetBuilderWithAmountPerTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
5 
13 {
17  public function checkBuildable()
18  {
19  $questionStage = $this->getSrcPoolDefListRelatedQuestUniqueCollection($this->sourcePoolDefinitionList);
20 
21  if ($questionStage->isSmallerThan($this->questionSetConfig->getQuestionAmountPerTest())) {
22  return false;
23  }
24 
25  return true;
26  }
27 
31  public function performBuild(ilTestSession $testSession)
32  {
33  $questionStage = $this->getSrcPoolDefListRelatedQuestUniqueCollection($this->sourcePoolDefinitionList);
34 
35  $questionSet = $this->fetchQuestionsFromStageRandomly(
36  $questionStage,
37  $this->questionSetConfig->getQuestionAmountPerTest()
38  );
39 
40  $this->handleQuestionOrdering($questionSet);
41 
42  $this->storeQuestionSet($testSession, $questionSet);
43  }
44 }
getSrcPoolDefListRelatedQuestUniqueCollection(ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList)
handleQuestionOrdering(ilTestRandomQuestionSetQuestionCollection $questionSet)
Test session handler.
fetchQuestionsFromStageRandomly(ilTestRandomQuestionSetQuestionCollection $questionStage, $requiredQuestionAmount)
storeQuestionSet(ilTestSession $testSession, $questionSet)