ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
14  public function checkBuildable()
15  {
16  $questionStage = $this->getQuestionStageForSourcePoolDefinitionList($this->sourcePoolDefinitionList);
17 
18  if( $questionStage->isSmallerThan($this->questionSetConfig->getQuestionAmountPerTest()) )
19  {
20  return false;
21  }
22 
23  return true;
24  }
25 
26  public function performBuild(ilTestSession $testSession)
27  {
28  $questionStage = $this->getQuestionStageForSourcePoolDefinitionList($this->sourcePoolDefinitionList);
29 
30  $questionSet = $this->fetchQuestionsFromStageRandomly(
31  $questionStage, $this->questionSetConfig->getQuestionAmountPerTest()
32  );
33 
34  $this->handleQuestionOrdering($questionSet);
35 
36  $this->storeQuestionSet($testSession, $questionSet);
37  }
38 }
handleQuestionOrdering(ilTestRandomQuestionSetQuestionCollection $questionSet)
Test session handler.
fetchQuestionsFromStageRandomly(ilTestRandomQuestionSetQuestionCollection $questionStage, $requiredQuestionAmount)
storeQuestionSet(ilTestSession $testSession, $questionSet)