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

Public Member Functions

 __construct (ilTree $tree, ilDB $db, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
 setPoolsWithHomogeneousScoredQuestionsRequired ($requirePoolsWithHomogeneousScoredQuestions)
 arePoolsWithHomogeneousScoredQuestionsRequired ()
 setQuestionAmountConfigurationMode ($questionAmountConfigurationMode)
 getQuestionAmountConfigurationMode ()
 isQuestionAmountConfigurationModePerPool ()
 isQuestionAmountConfigurationModePerTest ()
 setQuestionAmountPerTest ($questionAmountPerTest)
 getQuestionAmountPerTest ()
 setLastQuestionSyncTimestamp ($lastQuestionSyncTimestamp)
 getLastQuestionSyncTimestamp ()
 initFromArray ($dataArray)
 initialises the current object instance with values from matching properties within the passed array
 loadFromDb ()
 loads the question set config for current test from the database
 saveToDb ()
 saves the question set config for current test to the database
 cloneToDbForTestId ($testId)
 saves the question set config for test with given id to the database
 deleteFromDb ()
 deletes the question set config for current test from the database
 isQuestionSetConfigured ()
 hasSourcePoolDefinitions ()
 isQuestionSetBuildable ()
 doesQuestionSetRelatedDataExist ()
 checks wether question set config related data exists or not
 removeQuestionSetRelatedData ()
 removes all question set config related data
 resetQuestionSetRelatedTestSettings ()
 resets all test settings that depends on a non changed question set config
 cloneQuestionSetRelatedData ($cloneTestOBJ)
 removes all question set config related data for cloned/copied test
 updateLastQuestionSyncTimestampForTestId ($testId, $timestamp)
 isResultTaxonomyFilterSupported ()
 getSelectableQuestionPools ()
 doesSelectableQuestionPoolsExist ()
 areDepenciesBroken ()
 getDepenciesBrokenMessage (ilLanguage $lng)
 isValidRequestOnBrokenQuestionSetDepencies ($nextClass, $cmd)
 getHiddenTabsOnBrokenDepencies ()
- Public Member Functions inherited from ilTestQuestionSetConfig
 areDepenciesInVulnerableState ()
 getDepenciesInVulnerableStateMessage (ilLanguage $lng)
 getQuestionPoolPathString ($poolId)

Data Fields

const QUESTION_AMOUNT_CONFIG_MODE_PER_TEST = 'TEST'
const QUESTION_AMOUNT_CONFIG_MODE_PER_POOL = 'POOL'

Private Member Functions

 dbRecordExists ($testId)
 checks wether a question set config for current test exists in the database
 updateDbRecord ($testId)
 updates the record in the database that corresponds to the question set config for the current test
 insertDbRecord ($testId)
 inserts a new record for the question set config for the current test into the database
 buildSourcePoolDefinitionList (ilObjTest $testOBJ)
 buildStagingPoolBuilder (ilObjTest $testOBJ)

Private Attributes

 $requirePoolsWithHomogeneousScoredQuestions = null
 $questionAmountConfigurationMode = null
 $questionAmountPerTest = null
 $lastQuestionSyncTimestamp = null

Additional Inherited Members

- Protected Attributes inherited from ilTestQuestionSetConfig
 $tree = null
 $db = null
 $pluginAdmin = null
 $testOBJ = null

Detailed Description

Definition at line 14 of file class.ilTestRandomQuestionSetConfig.php.

Constructor & Destructor Documentation

ilTestRandomQuestionSetConfig::__construct ( ilTree  $tree,
ilDB  $db,
ilPluginAdmin  $pluginAdmin,
ilObjTest  $testOBJ 
)
Parameters
ilTree$tree
ilDB$db
ilPluginAdmin$pluginAdmin
ilObjTest$testOBJ

Reimplemented from ilTestQuestionSetConfig.

Definition at line 45 of file class.ilTestRandomQuestionSetConfig.php.

{
parent::__construct($tree, $db, $pluginAdmin, $testOBJ);
}

Member Function Documentation

ilTestRandomQuestionSetConfig::areDepenciesBroken ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 466 of file class.ilTestRandomQuestionSetConfig.php.

{
return (bool)$this->testOBJ->isTestFinalBroken();
}
ilTestRandomQuestionSetConfig::arePoolsWithHomogeneousScoredQuestionsRequired ( )
Returns
boolean

Definition at line 61 of file class.ilTestRandomQuestionSetConfig.php.

References $requirePoolsWithHomogeneousScoredQuestions.

Referenced by getSelectableQuestionPools(), insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::buildSourcePoolDefinitionList ( ilObjTest  $testOBJ)
private

Definition at line 408 of file class.ilTestRandomQuestionSetConfig.php.

Referenced by cloneQuestionSetRelatedData(), doesQuestionSetRelatedDataExist(), hasSourcePoolDefinitions(), isQuestionSetBuildable(), and removeQuestionSetRelatedData().

{
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
$sourcePoolDefinitionFactory = new ilTestRandomQuestionSetSourcePoolDefinitionFactory(
$this->db, $testOBJ
);
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
$sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
$this->db, $testOBJ, $sourcePoolDefinitionFactory
);
return $sourcePoolDefinitionList;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::buildStagingPoolBuilder ( ilObjTest  $testOBJ)
private

Definition at line 423 of file class.ilTestRandomQuestionSetConfig.php.

Referenced by cloneQuestionSetRelatedData().

{
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
$stagingPool = new ilTestRandomQuestionSetStagingPoolBuilder($this->db, $testOBJ);
return $stagingPool;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::cloneQuestionSetRelatedData (   $cloneTestOBJ)

removes all question set config related data for cloned/copied test

Parameters
ilObjTest$cloneTestOBJ

Reimplemented from ilTestQuestionSetConfig.

Definition at line 383 of file class.ilTestRandomQuestionSetConfig.php.

References buildSourcePoolDefinitionList(), buildStagingPoolBuilder(), cloneToDbForTestId(), loadFromDb(), and updateLastQuestionSyncTimestampForTestId().

{
// clone general config
$this->loadFromDb();
$this->cloneToDbForTestId($cloneTestOBJ->getTestId());
// clone source pool definitions (selection rules)
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
$sourcePoolDefinitionList->loadDefinitions();
$sourcePoolDefinitionList->cloneDefinitionsForTestId($cloneTestOBJ->getTestId());
// build new question stage for cloned test
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($cloneTestOBJ);
$stagingPool = $this->buildStagingPoolBuilder($cloneTestOBJ);
$sourcePoolDefinitionList->loadDefinitions();
$stagingPool->rebuild($sourcePoolDefinitionList);
$sourcePoolDefinitionList->saveDefinitions();
$this->updateLastQuestionSyncTimestampForTestId($cloneTestOBJ->getTestId(), time());
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::cloneToDbForTestId (   $testId)

saves the question set config for test with given id to the database

Parameters
$testId

Reimplemented from ilTestQuestionSetConfig.

Definition at line 196 of file class.ilTestRandomQuestionSetConfig.php.

References insertDbRecord().

Referenced by cloneQuestionSetRelatedData().

{
$this->insertDbRecord($testId);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::dbRecordExists (   $testId)
private

checks wether a question set config for current test exists in the database

Parameters
$testId
Returns
boolean

Definition at line 220 of file class.ilTestRandomQuestionSetConfig.php.

References $res, and $row.

Referenced by doesQuestionSetRelatedDataExist(), and saveToDb().

{
$res = $this->db->queryF(
"SELECT COUNT(*) cnt FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
array('integer'), array($testId)
);
$row = $this->db->fetchAssoc($res);
return (bool)$row['cnt'];
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::deleteFromDb ( )

deletes the question set config for current test from the database

Reimplemented from ilTestQuestionSetConfig.

Definition at line 204 of file class.ilTestRandomQuestionSetConfig.php.

Referenced by removeQuestionSetRelatedData().

{
$this->db->manipulateF(
"DELETE FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
array('integer'), array($this->testOBJ->getTestId())
);
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::doesQuestionSetRelatedDataExist ( )

checks wether question set config related data exists or not

Reimplemented from ilTestQuestionSetConfig.

Definition at line 339 of file class.ilTestRandomQuestionSetConfig.php.

References buildSourcePoolDefinitionList(), and dbRecordExists().

{
if( $this->dbRecordExists($this->testOBJ->getTestId()) )
{
return true;
}
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
if( $sourcePoolDefinitionList->savedDefinitionsExist() )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::doesSelectableQuestionPoolsExist ( )

Definition at line 459 of file class.ilTestRandomQuestionSetConfig.php.

References getSelectableQuestionPools().

{
return (bool)count($this->getSelectableQuestionPools());
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::getDepenciesBrokenMessage ( ilLanguage  $lng)

Reimplemented from ilTestQuestionSetConfig.

Definition at line 471 of file class.ilTestRandomQuestionSetConfig.php.

References ilLanguage\txt().

{
return $lng->txt('tst_old_style_rnd_quest_set_broken');
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::getHiddenTabsOnBrokenDepencies ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 507 of file class.ilTestRandomQuestionSetConfig.php.

{
return array(
'assQuestions', 'settings', 'manscoring', 'scoringadjust', 'statistics', 'history', 'export'
);
}
ilTestRandomQuestionSetConfig::getLastQuestionSyncTimestamp ( )
Returns
integer

Definition at line 125 of file class.ilTestRandomQuestionSetConfig.php.

References $lastQuestionSyncTimestamp.

Referenced by insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::getQuestionAmountPerTest ( )
Returns
integer

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

References $questionAmountPerTest.

Referenced by insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::getSelectableQuestionPools ( )

Definition at line 452 of file class.ilTestRandomQuestionSetConfig.php.

References arePoolsWithHomogeneousScoredQuestionsRequired().

Referenced by doesSelectableQuestionPoolsExist().

{
return $this->testOBJ->getAvailableQuestionpools(
true, $this->arePoolsWithHomogeneousScoredQuestionsRequired(), false, true, true
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::hasSourcePoolDefinitions ( )

Definition at line 318 of file class.ilTestRandomQuestionSetConfig.php.

References buildSourcePoolDefinitionList().

Referenced by isQuestionSetConfigured().

{
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
return $sourcePoolDefinitionList->savedDefinitionsExist();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::initFromArray (   $dataArray)

initialises the current object instance with values from matching properties within the passed array

Parameters
array$dataArray

Definition at line 138 of file class.ilTestRandomQuestionSetConfig.php.

References setLastQuestionSyncTimestamp(), setPoolsWithHomogeneousScoredQuestionsRequired(), setQuestionAmountConfigurationMode(), and setQuestionAmountPerTest().

Referenced by loadFromDb().

{
foreach($dataArray as $field => $value)
{
switch($field)
{
case 'req_pools_homo_scored': $this->setPoolsWithHomogeneousScoredQuestionsRequired($value); break;
case 'quest_amount_cfg_mode': $this->setQuestionAmountConfigurationMode($value); break;
case 'quest_amount_per_test': $this->setQuestionAmountPerTest($value); break;
case 'quest_sync_timestamp': $this->setLastQuestionSyncTimestamp($value); break;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::insertDbRecord (   $testId)
private

inserts a new record for the question set config for the current test into the database

Parameters
$testId

Definition at line 259 of file class.ilTestRandomQuestionSetConfig.php.

References arePoolsWithHomogeneousScoredQuestionsRequired(), getLastQuestionSyncTimestamp(), getQuestionAmountConfigurationMode(), and getQuestionAmountPerTest().

Referenced by cloneToDbForTestId(), and saveToDb().

{
$this->db->insert('tst_rnd_quest_set_cfg', array(
'test_fi' => array('integer', $testId),
'req_pools_homo_scored' => array('integer', (int)$this->arePoolsWithHomogeneousScoredQuestionsRequired()),
'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
'quest_amount_per_test' => array('integer', (int)$this->getQuestionAmountPerTest()),
'quest_sync_timestamp' => array('integer', (int)$this->getLastQuestionSyncTimestamp())
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerPool ( )
Returns
boolean

Definition at line 85 of file class.ilTestRandomQuestionSetConfig.php.

References getQuestionAmountConfigurationMode(), and QUESTION_AMOUNT_CONFIG_MODE_PER_POOL.

Referenced by ilTestRandomQuestionSetBuilder\getInstance().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerTest ( )
Returns
boolean

Definition at line 93 of file class.ilTestRandomQuestionSetConfig.php.

References getQuestionAmountConfigurationMode(), and QUESTION_AMOUNT_CONFIG_MODE_PER_TEST.

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::isQuestionSetBuildable ( )

Definition at line 325 of file class.ilTestRandomQuestionSetConfig.php.

References buildSourcePoolDefinitionList(), and ilTestRandomQuestionSetBuilder\getInstance().

Referenced by isQuestionSetConfigured().

{
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
$sourcePoolDefinitionList->loadDefinitions();
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
$stagingPoolQuestionList = new ilTestRandomQuestionSetStagingPoolQuestionList($this->db, $this->pluginAdmin);
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
$questionSetBuilder = ilTestRandomQuestionSetBuilder::getInstance($this->db, $this->testOBJ, $this, $sourcePoolDefinitionList, $stagingPoolQuestionList);
return $questionSetBuilder->checkBuildable();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::isQuestionSetConfigured ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 272 of file class.ilTestRandomQuestionSetConfig.php.

References hasSourcePoolDefinitions(), and isQuestionSetBuildable().

{
if( !$this->isQuestionAmountConfigComplete() )
{
return false;
}
if( !$this->hasSourcePoolDefinitions() )
{
return false;
}
if( !$this->isQuestionSetBuildable() )
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::isResultTaxonomyFilterSupported ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 445 of file class.ilTestRandomQuestionSetConfig.php.

{
return true;
}
ilTestRandomQuestionSetConfig::isValidRequestOnBrokenQuestionSetDepencies (   $nextClass,
  $cmd 
)

Reimplemented from ilTestQuestionSetConfig.

Definition at line 476 of file class.ilTestRandomQuestionSetConfig.php.

References $cmd.

{
//vd($nextClass, $cmd);
switch( $nextClass )
{
case 'ilmdeditorgui':
case 'ilpermissiongui':
return true;
case 'ilobjtestgui':
case '':
$cmds = array(
'infoScreen', 'participants', 'npSetFilter', 'npResetFilter',
//'deleteAllUserResults', 'confirmDeleteAllUserResults',
//'deleteSingleUserResults', 'confirmDeleteSelectedUserData', 'cancelDeleteSelectedUserData'
);
if( in_array($cmd, $cmds) )
{
return true;
}
break;
}
return false;
}
ilTestRandomQuestionSetConfig::loadFromDb ( )

loads the question set config for current test from the database

Returns
boolean

Reimplemented from ilTestQuestionSetConfig.

Definition at line 157 of file class.ilTestRandomQuestionSetConfig.php.

References $res, $row, and initFromArray().

Referenced by cloneQuestionSetRelatedData().

{
$res = $this->db->queryF(
"SELECT * FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
array('integer'), array($this->testOBJ->getTestId())
);
while( $row = $this->db->fetchAssoc($res) )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::removeQuestionSetRelatedData ( )

removes all question set config related data

Reimplemented from ilTestQuestionSetConfig.

Definition at line 356 of file class.ilTestRandomQuestionSetConfig.php.

References buildSourcePoolDefinitionList(), deleteFromDb(), and resetQuestionSetRelatedTestSettings().

{
$sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
$sourcePoolDefinitionList->deleteDefinitions();
require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
$this->db, $this->testOBJ
);
$stagingPool->reset();
$this->deleteFromDb();
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::resetQuestionSetRelatedTestSettings ( )

resets all test settings that depends on a non changed question set config

Reimplemented from ilTestQuestionSetConfig.

Definition at line 372 of file class.ilTestRandomQuestionSetConfig.php.

Referenced by removeQuestionSetRelatedData().

{
$this->testOBJ->setResultFilterTaxIds(array());
$this->testOBJ->saveToDb(true);
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::saveToDb ( )

saves the question set config for current test to the database

Returns
boolean

Reimplemented from ilTestQuestionSetConfig.

Definition at line 179 of file class.ilTestRandomQuestionSetConfig.php.

References dbRecordExists(), insertDbRecord(), and updateDbRecord().

{
if( $this->dbRecordExists($this->testOBJ->getTestId()) )
{
$this->updateDbRecord($this->testOBJ->getTestId());
}
else
{
$this->insertDbRecord($this->testOBJ->getTestId());
}
}

+ Here is the call graph for this function:

ilTestRandomQuestionSetConfig::setLastQuestionSyncTimestamp (   $lastQuestionSyncTimestamp)
Parameters
integer$lastQuestionSyncTimestamp

Definition at line 117 of file class.ilTestRandomQuestionSetConfig.php.

References $lastQuestionSyncTimestamp.

Referenced by initFromArray().

{
$this->lastQuestionSyncTimestamp = $lastQuestionSyncTimestamp;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::setPoolsWithHomogeneousScoredQuestionsRequired (   $requirePoolsWithHomogeneousScoredQuestions)
Parameters
boolean$requirePoolsWithHomogeneousScoredQuestions

Definition at line 53 of file class.ilTestRandomQuestionSetConfig.php.

References $requirePoolsWithHomogeneousScoredQuestions.

Referenced by initFromArray().

{
$this->requirePoolsWithHomogeneousScoredQuestions = $requirePoolsWithHomogeneousScoredQuestions;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::setQuestionAmountConfigurationMode (   $questionAmountConfigurationMode)
Parameters
string$questionAmountConfigurationMode

Definition at line 69 of file class.ilTestRandomQuestionSetConfig.php.

References $questionAmountConfigurationMode.

Referenced by initFromArray().

{
$this->questionAmountConfigurationMode = $questionAmountConfigurationMode;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::setQuestionAmountPerTest (   $questionAmountPerTest)
Parameters
integer$questionAmountPerTest

Definition at line 101 of file class.ilTestRandomQuestionSetConfig.php.

References $questionAmountPerTest.

Referenced by initFromArray().

{
$this->questionAmountPerTest = $questionAmountPerTest;
}

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::updateDbRecord (   $testId)
private

updates the record in the database that corresponds to the question set config for the current test

Parameters
$testId

Definition at line 238 of file class.ilTestRandomQuestionSetConfig.php.

References arePoolsWithHomogeneousScoredQuestionsRequired(), getLastQuestionSyncTimestamp(), getQuestionAmountConfigurationMode(), and getQuestionAmountPerTest().

Referenced by saveToDb().

{
$this->db->update('tst_rnd_quest_set_cfg',
array(
'req_pools_homo_scored' => array('integer', (int)$this->arePoolsWithHomogeneousScoredQuestionsRequired()),
'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
'quest_amount_per_test' => array('integer', (int)$this->getQuestionAmountPerTest()),
'quest_sync_timestamp' => array('integer', (int)$this->getLastQuestionSyncTimestamp())
),
array(
'test_fi' => array('integer', $testId)
)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestRandomQuestionSetConfig::updateLastQuestionSyncTimestampForTestId (   $testId,
  $timestamp 
)

Definition at line 433 of file class.ilTestRandomQuestionSetConfig.php.

References $timestamp.

Referenced by cloneQuestionSetRelatedData().

{
$this->db->update('tst_rnd_quest_set_cfg',
array(
'quest_sync_timestamp' => array('integer', (int)$timestamp)
),
array(
'test_fi' => array('integer', $testId)
)
);
}

+ Here is the caller graph for this function:

Field Documentation

ilTestRandomQuestionSetConfig::$lastQuestionSyncTimestamp = null
private
ilTestRandomQuestionSetConfig::$questionAmountConfigurationMode = null
private
ilTestRandomQuestionSetConfig::$questionAmountPerTest = null
private
ilTestRandomQuestionSetConfig::$requirePoolsWithHomogeneousScoredQuestions = null
private

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