ILIAS  Release_4_4_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 ($questionStage, $requiredQuestionAmount)
 handleQuestionOrdering ($questionSet)

Protected Attributes

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

Private Member Functions

 hasTaxonomyFilter (ilTestRandomQuestionSetSourcePoolDefinition $definition)
 storeQuestion (ilTestSession $testSession, $questionId, $sequencePosition)
 getRandomArrayKeys ($array, $numKeys)

Detailed Description

Definition at line 10 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 44 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::checkBuildable ( )
abstract
ilTestRandomQuestionSetBuilder::fetchQuestionsFromStageRandomly (   $questionStage,
  $requiredQuestionAmount 
)
protected

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

References getRandomArrayKeys().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

{
$randomKeys = $this->getRandomArrayKeys($questionStage, $requiredQuestionAmount);
$questionSet = array();
foreach($randomKeys as $randomKey)
{
$questionSet[] = $questionStage[$randomKey];
}
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 177 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::getQuestionStageForSourcePoolDefinition ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
protected

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

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

{
$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:

ilTestRandomQuestionSetBuilder::getRandomArrayKeys (   $array,
  $numKeys 
)
private

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

Referenced by fetchQuestionsFromStageRandomly().

{
if( $numKeys < 1 )
{
return array();
}
if( $numKeys > 1 )
{
return array_rand($array, $numKeys);
}
return array( array_rand($array, $numKeys) );
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetBuilder::handleQuestionOrdering (   $questionSet)
protected

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

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

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

+ Here is the caller graph for this function:

ilTestRandomQuestionSetBuilder::hasTaxonomyFilter ( ilTestRandomQuestionSetSourcePoolDefinition  $definition)
private

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

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

Referenced by getQuestionStageForSourcePoolDefinition().

{
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,
  $questionId,
  $sequencePosition 
)
private

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

References ilTestSession\getActiveId(), and ilTestSession\getPass().

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', $questionId),
'sequence' => array('integer', $sequencePosition),
'pass' => array('integer', $testSession->getPass()),
'tstamp' => array('integer', time())
));
}

+ 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 114 of file class.ilTestRandomQuestionSetBuilder.php.

References storeQuestion().

Referenced by ilTestRandomQuestionSetBuilderWithAmountPerTest\performBuild().

{
foreach($questionSet as $sequencePosition => $questionId)
{
$this->storeQuestion($testSession, $questionId, $sequencePosition);
}
}

+ 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 15 of file class.ilTestRandomQuestionSetBuilder.php.

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$questionSetConfig = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$sourcePoolDefinitionList = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$stagingPoolQuestionList = null
protected

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

Referenced by __construct().

ilTestRandomQuestionSetBuilder::$testOBJ = null
protected

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

Referenced by __construct().


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