ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestRandomQuestionSetBuilder Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetBuilder:
+ Collaboration diagram for ilTestRandomQuestionSetBuilder:

Public Member Functions

 checkBuildable ()
 
 performBuild (ilTestSession $testSession)
 

Static Public Member Functions

static getInstance (ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
 

Protected Member Functions

 __construct (ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
 
 getQuestionStageForSourcePoolDefinition (ilTestRandomQuestionSetSourcePoolDefinition $definition)
 
 storeQuestionSet (ilTestSession $testSession, $questionSet)
 
 fetchQuestionsFromStageRandomly (ilTestRandomQuestionSetQuestionCollection $questionStage, $requiredQuestionAmount)
 
 handleQuestionOrdering (ilTestRandomQuestionSetQuestionCollection $questionSet)
 

Protected Attributes

 $db = null
 
 $testOBJ = null
 
 $questionSetConfig = null
 
 $sourcePoolDefinitionList = null
 
 $stagingPoolQuestionList = null
 

Private Member Functions

 getQuestionIdsForSourcePoolDefinitionIds (ilTestRandomQuestionSetSourcePoolDefinition $definition)
 
 buildSetQuestionCollection (ilTestRandomQuestionSetSourcePoolDefinition $definition, $questionIds)
 
 hasTaxonomyFilter (ilTestRandomQuestionSetSourcePoolDefinition $definition)
 
 storeQuestion (ilTestSession $testSession, ilTestRandomQuestionSetQuestion $setQuestion)
 

Detailed Description

Definition at line 12 of file class.ilTestRandomQuestionSetBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetBuilder::__construct ( ilDBInterface  $db,
ilObjTest  $testOBJ,
ilTestRandomQuestionSetConfig  $questionSetConfig,
ilTestRandomQuestionSetSourcePoolDefinitionList  $sourcePoolDefinitionList,
ilTestRandomQuestionSetStagingPoolQuestionList  $stagingPoolQuestionList 
)
protected

Member Function Documentation

◆ buildSetQuestionCollection()

ilTestRandomQuestionSetBuilder::buildSetQuestionCollection ( ilTestRandomQuestionSetSourcePoolDefinition  $definition,
  $questionIds 
)
private

Definition at line 109 of file class.ilTestRandomQuestionSetBuilder.php.

References ilTestRandomQuestionSetSourcePoolDefinition\getId().

Referenced by getQuestionStageForSourcePoolDefinition().

110  {
111  $setQuestionCollection = new ilTestRandomQuestionSetQuestionCollection();
112 
113  foreach($questionIds as $questionId)
114  {
115  $setQuestion = new ilTestRandomQuestionSetQuestion();
116 
117  $setQuestion->setQuestionId($questionId);
118  $setQuestion->setSourcePoolDefinitionId($definition->getId());
119 
120  $setQuestionCollection->addQuestion($setQuestion);
121  }
122 
123  return $setQuestionCollection;
124  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkBuildable()

ilTestRandomQuestionSetBuilder::checkBuildable ( )
abstract

Referenced by __construct().

+ Here is the caller graph for this function:

◆ fetchQuestionsFromStageRandomly()

ilTestRandomQuestionSetBuilder::fetchQuestionsFromStageRandomly ( ilTestRandomQuestionSetQuestionCollection  $questionStage,
  $requiredQuestionAmount 
)
protected

Definition at line 170 of file class.ilTestRandomQuestionSetBuilder.php.

References ilTestRandomQuestionSetQuestionCollection\getRandomQuestionCollection().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerPool\checkBuildable(), and ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

171  {
172  $questionSet = $questionStage->getRandomQuestionCollection($requiredQuestionAmount);
173 
174  return $questionSet;
175  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilTestRandomQuestionSetBuilder::getInstance ( ilDBInterface  $db,
ilObjTest  $testOBJ,
ilTestRandomQuestionSetConfig  $questionSetConfig,
ilTestRandomQuestionSetSourcePoolDefinitionList  $sourcePoolDefinitionList,
ilTestRandomQuestionSetStagingPoolQuestionList  $stagingPoolQuestionList 
)
staticfinal

Definition at line 187 of file class.ilTestRandomQuestionSetBuilder.php.

References ilTestRandomQuestionSetConfig\isQuestionAmountConfigurationModePerPool().

Referenced by ilTestOutputGUI\generateRandomTestPassForActiveUser(), and ilTestRandomQuestionSetConfig\isQuestionSetBuildable().

192  {
193  if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
194  {
195  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
196 
198  $db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList
199  );
200  }
201 
202  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerTest.php';
203 
205  $db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList
206  );
207  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionIdsForSourcePoolDefinitionIds()

ilTestRandomQuestionSetBuilder::getQuestionIdsForSourcePoolDefinitionIds ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
private

Definition at line 89 of file class.ilTestRandomQuestionSetBuilder.php.

References array, ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxId(), ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxNodeId(), ilTestRandomQuestionSetSourcePoolDefinition\getPoolId(), and hasTaxonomyFilter().

Referenced by getQuestionStageForSourcePoolDefinition().

90  {
91  $this->stagingPoolQuestionList->resetQuestionList();
92 
93  $this->stagingPoolQuestionList->setTestObjId( $this->testOBJ->getId() );
94  $this->stagingPoolQuestionList->setTestId( $this->testOBJ->getTestId() );
95  $this->stagingPoolQuestionList->setPoolId( $definition->getPoolId() );
96 
97  if( $this->hasTaxonomyFilter($definition) )
98  {
99  $this->stagingPoolQuestionList->addTaxonomyFilter(
100  $definition->getMappedFilterTaxId(), array($definition->getMappedFilterTaxNodeId())
101  );
102  }
103 
104  $this->stagingPoolQuestionList->loadQuestions();
105 
106  return $this->stagingPoolQuestionList->getQuestions();
107  }
hasTaxonomyFilter(ilTestRandomQuestionSetSourcePoolDefinition $definition)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionStageForSourcePoolDefinition()

ilTestRandomQuestionSetBuilder::getQuestionStageForSourcePoolDefinition ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
protected

Definition at line 81 of file class.ilTestRandomQuestionSetBuilder.php.

References buildSetQuestionCollection(), and getQuestionIdsForSourcePoolDefinitionIds().

Referenced by __construct(), and ilTestRandomQuestionSetBuilderWithAmountPerPool\checkBuildable().

82  {
83  $questionIds = $this->getQuestionIdsForSourcePoolDefinitionIds($definition);
84  $questionStage = $this->buildSetQuestionCollection($definition, $questionIds);
85 
86  return $questionStage;
87  }
buildSetQuestionCollection(ilTestRandomQuestionSetSourcePoolDefinition $definition, $questionIds)
getQuestionIdsForSourcePoolDefinitionIds(ilTestRandomQuestionSetSourcePoolDefinition $definition)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleQuestionOrdering()

ilTestRandomQuestionSetBuilder::handleQuestionOrdering ( ilTestRandomQuestionSetQuestionCollection  $questionSet)
protected

Definition at line 177 of file class.ilTestRandomQuestionSetBuilder.php.

References ilTestRandomQuestionSetQuestionCollection\shuffleQuestions().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerPool\checkBuildable(), and ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

178  {
179  if( $this->testOBJ->getShuffleQuestions() )
180  {
181  $questionSet->shuffleQuestions();
182  }
183  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasTaxonomyFilter()

ilTestRandomQuestionSetBuilder::hasTaxonomyFilter ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
private

Definition at line 126 of file class.ilTestRandomQuestionSetBuilder.php.

References ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxId(), and ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxNodeId().

Referenced by getQuestionIdsForSourcePoolDefinitionIds().

127  {
128  if( !(int)$definition->getMappedFilterTaxId() )
129  {
130  return false;
131  }
132 
133  if( !(int)$definition->getMappedFilterTaxNodeId() )
134  {
135  return false;
136  }
137 
138  return true;
139  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performBuild()

ilTestRandomQuestionSetBuilder::performBuild ( ilTestSession  $testSession)
abstract

Referenced by __construct(), and ilTestRandomQuestionSetBuilderWithAmountPerPool\checkBuildable().

+ Here is the caller graph for this function:

◆ storeQuestion()

ilTestRandomQuestionSetBuilder::storeQuestion ( ilTestSession  $testSession,
ilTestRandomQuestionSetQuestion  $setQuestion 
)
private

Definition at line 155 of file class.ilTestRandomQuestionSetBuilder.php.

References array, ilTestSession\getActiveId(), ilTestSession\getPass(), ilTestRandomQuestionSetQuestion\getQuestionId(), ilTestRandomQuestionSetQuestion\getSequencePosition(), ilTestRandomQuestionSetQuestion\getSourcePoolDefinitionId(), and time.

Referenced by storeQuestionSet().

156  {
157  $nextId = $this->db->nextId('tst_test_rnd_qst');
158 
159  $this->db->insert('tst_test_rnd_qst', array(
160  'test_random_question_id' => array('integer', $nextId),
161  'active_fi' => array('integer', $testSession->getActiveId()),
162  'question_fi' => array('integer', $setQuestion->getQuestionId()),
163  'sequence' => array('integer', $setQuestion->getSequencePosition()),
164  'pass' => array('integer', $testSession->getPass()),
165  'tstamp' => array('integer', time()),
166  'src_pool_def_fi' => array('integer', $setQuestion->getSourcePoolDefinitionId())
167  ));
168  }
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeQuestionSet()

ilTestRandomQuestionSetBuilder::storeQuestionSet ( ilTestSession  $testSession,
  $questionSet 
)
protected

Definition at line 141 of file class.ilTestRandomQuestionSetBuilder.php.

References storeQuestion().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerPool\checkBuildable(), and ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

142  {
143  $position = 0;
144 
145  foreach($questionSet->getQuestions() as $setQuestion)
146  {
147  /* @var ilTestRandomQuestionSetQuestion $setQuestion */
148 
149  $setQuestion->setSequencePosition($position++);
150 
151  $this->storeQuestion($testSession, $setQuestion);
152  }
153  }
storeQuestion(ilTestSession $testSession, ilTestRandomQuestionSetQuestion $setQuestion)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilTestRandomQuestionSetBuilder::$db = null
protected

Definition at line 17 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().

◆ $questionSetConfig

ilTestRandomQuestionSetBuilder::$questionSetConfig = null
protected

Definition at line 27 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().

◆ $sourcePoolDefinitionList

ilTestRandomQuestionSetBuilder::$sourcePoolDefinitionList = null
protected

Definition at line 32 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().

◆ $stagingPoolQuestionList

ilTestRandomQuestionSetBuilder::$stagingPoolQuestionList = null
protected

Definition at line 37 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().

◆ $testOBJ

ilTestRandomQuestionSetBuilder::$testOBJ = null
protected

Definition at line 22 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().


The documentation for this class was generated from the following file: