ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestRandomQuestionSetBuilder Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetBuilder:
+ Collaboration diagram for ilTestRandomQuestionSetBuilder:

Public Member Functions

 checkBuildable ()
 performBuild (ilTestSession $testSession)

Static Public Member Functions

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

Protected Member Functions

 __construct (ilDB $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

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

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

References $db, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList, and $testOBJ.

{
$this->db = $db;
$this->testOBJ = $testOBJ;
$this->questionSetConfig = $questionSetConfig;
$this->sourcePoolDefinitionList = $sourcePoolDefinitionList;
$this->stagingPoolQuestionList = $stagingPoolQuestionList;
}

Member Function Documentation

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

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

References ilTestRandomQuestionSetSourcePoolDefinition\getId().

Referenced by getQuestionStageForSourcePoolDefinition().

{
$setQuestionCollection = new ilTestRandomQuestionSetQuestionCollection();
foreach($questionIds as $questionId)
{
$setQuestion = new ilTestRandomQuestionSetQuestion();
$setQuestion->setQuestionId($questionId);
$setQuestion->setSourcePoolDefinitionId($definition->getId());
$setQuestionCollection->addQuestion($setQuestion);
}
return $setQuestionCollection;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References ilTestRandomQuestionSetQuestionCollection\getRandomQuestionCollection().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

{
$questionSet = $questionStage->getRandomQuestionCollection($requiredQuestionAmount);
return $questionSet;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilTestRandomQuestionSetBuilder::getInstance ( ilDB  $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().

{
if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
{
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
$db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList
);
}
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerTest.php';
$db, $testOBJ, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetBuilder::getQuestionIdsForSourcePoolDefinitionIds ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
private

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

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

Referenced by getQuestionStageForSourcePoolDefinition().

{
$this->stagingPoolQuestionList->resetQuestionList();
$this->stagingPoolQuestionList->setTestObjId( $this->testOBJ->getId() );
$this->stagingPoolQuestionList->setTestId( $this->testOBJ->getTestId() );
$this->stagingPoolQuestionList->setPoolId( $definition->getPoolId() );
if( $this->hasTaxonomyFilter($definition) )
{
$this->stagingPoolQuestionList->addTaxonomyFilter(
$definition->getMappedFilterTaxId(), array($definition->getMappedFilterTaxNodeId())
);
}
$this->stagingPoolQuestionList->loadQuestions();
return $this->stagingPoolQuestionList->getQuestions();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetBuilder::getQuestionStageForSourcePoolDefinition ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
protected

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

References buildSetQuestionCollection(), and getQuestionIdsForSourcePoolDefinitionIds().

{
$questionIds = $this->getQuestionIdsForSourcePoolDefinitionIds($definition);
$questionStage = $this->buildSetQuestionCollection($definition, $questionIds);
return $questionStage;
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetBuilder::handleQuestionOrdering ( ilTestRandomQuestionSetQuestionCollection  $questionSet)
protected

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

References ilTestRandomQuestionSetQuestionCollection\shuffleQuestions().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

{
if( $this->testOBJ->getShuffleQuestions() )
{
$questionSet->shuffleQuestions();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetBuilder::hasTaxonomyFilter ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
private

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

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

Referenced by getQuestionIdsForSourcePoolDefinitionIds().

{
if( !(int)$definition->getMappedFilterTaxId() )
{
return false;
}
if( !(int)$definition->getMappedFilterTaxNodeId() )
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by storeQuestionSet().

{
$nextId = $this->db->nextId('tst_test_rnd_qst');
$this->db->insert('tst_test_rnd_qst', array(
'test_random_question_id' => array('integer', $nextId),
'active_fi' => array('integer', $testSession->getActiveId()),
'question_fi' => array('integer', $setQuestion->getQuestionId()),
'sequence' => array('integer', $setQuestion->getSequencePosition()),
'pass' => array('integer', $testSession->getPass()),
'tstamp' => array('integer', time()),
'src_pool_def_fi' => array('integer', $setQuestion->getSourcePoolDefinitionId())
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References storeQuestion().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

{
$position = 0;
foreach($questionSet->getQuestions() as $setQuestion)
{
/* @var ilTestRandomQuestionSetQuestion $setQuestion */
$setQuestion->setSequencePosition($position++);
$this->storeQuestion($testSession, $setQuestion);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTestRandomQuestionSetBuilder::$db = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$questionSetConfig = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$sourcePoolDefinitionList = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$stagingPoolQuestionList = null
protected

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

Referenced by __construct().

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: