ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTestRandomQuestionSetConfig Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetConfig:
+ Collaboration diagram for ilTestRandomQuestionSetConfig:

Public Member Functions

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

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 More...
 
 updateDbRecord ($testId)
 updates the record in the database that corresponds to the question set config for the current test More...
 
 insertDbRecord ($testId)
 inserts a new record for the question set config for the current test into the database More...
 
 registerClonedSourcePoolDefinitionIdMapping (ilObjTest $cloneTestOBJ, $definitionIdMap)
 
 buildSourcePoolDefinitionList (ilObjTest $testOBJ)
 
 buildStagingPoolBuilder (ilObjTest $testOBJ)
 

Private Attributes

 $requirePoolsWithHomogeneousScoredQuestions = null
 
 $questionAmountConfigurationMode = null
 
 $questionAmountPerTest = null
 
 $lastQuestionSyncTimestamp = null
 
 $buildableMessages = array()
 

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

◆ __construct()

Member Function Documentation

◆ areDepenciesBroken()

ilTestRandomQuestionSetConfig::areDepenciesBroken ( )

Reimplemented from ilTestQuestionSetConfig.

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

503 {
504 return (bool) $this->testOBJ->isTestFinalBroken();
505 }

◆ arePoolsWithHomogeneousScoredQuestionsRequired()

ilTestRandomQuestionSetConfig::arePoolsWithHomogeneousScoredQuestionsRequired ( )

◆ buildSourcePoolDefinitionList()

ilTestRandomQuestionSetConfig::buildSourcePoolDefinitionList ( ilObjTest  $testOBJ)
private

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

437 {
438 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
439 $sourcePoolDefinitionFactory = new ilTestRandomQuestionSetSourcePoolDefinitionFactory(
440 $this->db,
442 );
443
444 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
445 $sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
446 $this->db,
447 $testOBJ,
448 $sourcePoolDefinitionFactory
449 );
450
451 return $sourcePoolDefinitionList;
452 }

References ilTestQuestionSetConfig\$testOBJ.

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

+ Here is the caller graph for this function:

◆ buildStagingPoolBuilder()

ilTestRandomQuestionSetConfig::buildStagingPoolBuilder ( ilObjTest  $testOBJ)
private

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

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

References ilTestQuestionSetConfig\$testOBJ.

Referenced by cloneQuestionSetRelatedData().

+ Here is the caller graph for this function:

◆ cloneQuestionSetRelatedData()

ilTestRandomQuestionSetConfig::cloneQuestionSetRelatedData ( ilObjTest  $cloneTestOBJ)

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

Parameters
ilObjTest$cloneTestOBJ

Reimplemented from ilTestQuestionSetConfig.

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

395 {
396 // clone general config
397
398 $this->loadFromDb();
399 $this->cloneToDbForTestId($cloneTestOBJ->getTestId());
400
401 // clone source pool definitions (selection rules)
402
403 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
404 $sourcePoolDefinitionList->loadDefinitions();
405 $definitionIdMap = $sourcePoolDefinitionList->cloneDefinitionsForTestId($cloneTestOBJ->getTestId());
406 $this->registerClonedSourcePoolDefinitionIdMapping($cloneTestOBJ, $definitionIdMap);
407
408 // build new question stage for cloned test
409
410 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($cloneTestOBJ);
411 $stagingPool = $this->buildStagingPoolBuilder($cloneTestOBJ);
412
413 $sourcePoolDefinitionList->loadDefinitions();
414 $stagingPool->rebuild($sourcePoolDefinitionList);
415 $sourcePoolDefinitionList->saveDefinitions();
416
417 $this->updateLastQuestionSyncTimestampForTestId($cloneTestOBJ->getTestId(), time());
418 }
getTestId()
Gets the database id of the additional test data.
cloneToDbForTestId($testId)
saves the question set config for test with given id to the database
registerClonedSourcePoolDefinitionIdMapping(ilObjTest $cloneTestOBJ, $definitionIdMap)
loadFromDb()
loads the question set config for current test from the database

References buildSourcePoolDefinitionList(), buildStagingPoolBuilder(), cloneToDbForTestId(), ilObjTest\getTestId(), loadFromDb(), registerClonedSourcePoolDefinitionIdMapping(), and updateLastQuestionSyncTimestampForTestId().

+ Here is the call graph for this function:

◆ cloneToDbForTestId()

ilTestRandomQuestionSetConfig::cloneToDbForTestId (   $testId)

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

Parameters
$testId

Reimplemented from ilTestQuestionSetConfig.

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

215 {
216 $this->insertDbRecord($testId);
217 }
insertDbRecord($testId)
inserts a new record for the question set config for the current test into the database

References insertDbRecord().

Referenced by cloneQuestionSetRelatedData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dbRecordExists()

ilTestRandomQuestionSetConfig::dbRecordExists (   $testId)
private

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

Parameters
$testId
Returns
boolean

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

240 {
241 $res = $this->db->queryF(
242 "SELECT COUNT(*) cnt FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
243 array('integer'),
244 array($testId)
245 );
246
247 $row = $this->db->fetchAssoc($res);
248
249 return (bool) $row['cnt'];
250 }
foreach($_POST as $key=> $value) $res

References $res.

Referenced by doesQuestionSetRelatedDataExist(), and saveToDb().

+ Here is the caller graph for this function:

◆ deleteFromDb()

ilTestRandomQuestionSetConfig::deleteFromDb ( )

deletes the question set config for current test from the database

Reimplemented from ilTestQuestionSetConfig.

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

223 {
224 $this->db->manipulateF(
225 "DELETE FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
226 array('integer'),
227 array($this->testOBJ->getTestId())
228 );
229 }

Referenced by removeQuestionSetRelatedData().

+ Here is the caller graph for this function:

◆ doesQuestionSetRelatedDataExist()

ilTestRandomQuestionSetConfig::doesQuestionSetRelatedDataExist ( )

checks wether question set config related data exists or not

Reimplemented from ilTestQuestionSetConfig.

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

352 {
353 if ($this->dbRecordExists($this->testOBJ->getTestId())) {
354 return true;
355 }
356
357 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
358
359 if ($sourcePoolDefinitionList->savedDefinitionsExist()) {
360 return true;
361 }
362
363 return false;
364 }
dbRecordExists($testId)
checks wether a question set config for current test exists in the database

References buildSourcePoolDefinitionList(), and dbRecordExists().

+ Here is the call graph for this function:

◆ doesSelectableQuestionPoolsExist()

ilTestRandomQuestionSetConfig::doesSelectableQuestionPoolsExist ( )

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

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

References getSelectableQuestionPools().

+ Here is the call graph for this function:

◆ getBuildableMessages()

ilTestRandomQuestionSetConfig::getBuildableMessages ( )

◆ getCommaSeparatedSourceQuestionPoolLinks()

ilTestRandomQuestionSetConfig::getCommaSeparatedSourceQuestionPoolLinks ( )

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

551 {
552 $definitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
553 $definitionList->loadDefinitions();
554
555 $poolTitles = array();
556
557 foreach ($definitionList as $definition) {
558 /* @var ilTestRandomQuestionSetSourcePoolDefinition $definition */
559
560 $refId = current(ilObject::_getAllReferences($definition->getPoolId()));
561 $href = ilLink::_getLink($refId, 'qpl');
562 $title = $definition->getPoolTitle();
563
564 $poolTitles[$definition->getPoolId()] = "<a href=\"$href\" alt=\"$title\">$title</a>";
565 }
566
567 return implode(', ', $poolTitles);
568 }
static _getAllReferences($a_id)
get all reference ids of object
$refId
Definition: xapitoken.php:40

References $refId, ilObject\_getAllReferences(), ilLink\_getLink(), and buildSourcePoolDefinitionList().

+ Here is the call graph for this function:

◆ getDepenciesBrokenMessage()

ilTestRandomQuestionSetConfig::getDepenciesBrokenMessage ( ilLanguage  $lng)

Reimplemented from ilTestQuestionSetConfig.

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

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

References $lng.

◆ getHiddenTabsOnBrokenDepencies()

ilTestRandomQuestionSetConfig::getHiddenTabsOnBrokenDepencies ( )

Reimplemented from ilTestQuestionSetConfig.

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

542 {
543 return array(
544 'assQuestions', 'settings', 'manscoring', 'scoringadjust', 'statistics', 'history', 'export'
545 );
546 }

◆ getLastQuestionSyncTimestamp()

ilTestRandomQuestionSetConfig::getLastQuestionSyncTimestamp ( )
Returns
integer

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

References $lastQuestionSyncTimestamp.

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

+ Here is the caller graph for this function:

◆ getQuestionAmountConfigurationMode()

ilTestRandomQuestionSetConfig::getQuestionAmountConfigurationMode ( )

◆ getQuestionAmountPerTest()

ilTestRandomQuestionSetConfig::getQuestionAmountPerTest ( )
Returns
integer

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

References $questionAmountPerTest.

Referenced by insertDbRecord(), and updateDbRecord().

+ Here is the caller graph for this function:

◆ getSelectableQuestionPools()

ilTestRandomQuestionSetConfig::getSelectableQuestionPools ( )

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

485 {
486 return $this->testOBJ->getAvailableQuestionpools(
487 true,
489 false,
490 true,
491 true
492 );
493 }

References arePoolsWithHomogeneousScoredQuestionsRequired().

Referenced by doesSelectableQuestionPoolsExist().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasSourcePoolDefinitions()

ilTestRandomQuestionSetConfig::hasSourcePoolDefinitions ( )

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

325 {
326 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
327
328 return $sourcePoolDefinitionList->savedDefinitionsExist();
329 }

References buildSourcePoolDefinitionList().

Referenced by isQuestionSetConfigured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFromArray()

ilTestRandomQuestionSetConfig::initFromArray (   $dataArray)

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

Parameters
array$dataArray

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

162 {
163 foreach ($dataArray as $field => $value) {
164 switch ($field) {
165 case 'req_pools_homo_scored': $this->setPoolsWithHomogeneousScoredQuestionsRequired($value); break;
166 case 'quest_amount_cfg_mode': $this->setQuestionAmountConfigurationMode($value); break;
167 case 'quest_amount_per_test': $this->setQuestionAmountPerTest($value); break;
168 case 'quest_sync_timestamp': $this->setLastQuestionSyncTimestamp($value); break;
169 }
170 }
171 }
setQuestionAmountConfigurationMode($questionAmountConfigurationMode)
setLastQuestionSyncTimestamp($lastQuestionSyncTimestamp)
setPoolsWithHomogeneousScoredQuestionsRequired($requirePoolsWithHomogeneousScoredQuestions)

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

Referenced by loadFromDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertDbRecord()

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 280 of file class.ilTestRandomQuestionSetConfig.php.

281 {
282 $this->db->insert('tst_rnd_quest_set_cfg', array(
283 'test_fi' => array('integer', $testId),
284 'req_pools_homo_scored' => array('integer', (int) $this->arePoolsWithHomogeneousScoredQuestionsRequired()),
285 'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
286 'quest_amount_per_test' => array('integer', (int) $this->getQuestionAmountPerTest()),
287 'quest_sync_timestamp' => array('integer', (int) $this->getLastQuestionSyncTimestamp())
288 ));
289 }

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

Referenced by cloneToDbForTestId(), and saveToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionAmountConfigurationModePerPool()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerPool ( )

◆ isQuestionAmountConfigurationModePerTest()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerTest ( )
Returns
boolean

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

References getQuestionAmountConfigurationMode(), and QUESTION_AMOUNT_CONFIG_MODE_PER_TEST.

+ Here is the call graph for this function:

◆ isQuestionSetBuildable()

ilTestRandomQuestionSetConfig::isQuestionSetBuildable ( )

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

332 {
333 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
334 $sourcePoolDefinitionList->loadDefinitions();
335
336 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
337 $stagingPoolQuestionList = new ilTestRandomQuestionSetStagingPoolQuestionList($this->db, $this->pluginAdmin);
338
339 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
340 $questionSetBuilder = ilTestRandomQuestionSetBuilder::getInstance($this->db, $this->testOBJ, $this, $sourcePoolDefinitionList, $stagingPoolQuestionList);
341
342 //fau: fixRandomTestBuildable - get messages if set is not buildable
343 $buildable = $questionSetBuilder->checkBuildable();
344 $this->buildableMessages = $questionSetBuilder->getCheckMessages();
345 return $buildable;
346 // fau.
347
348 return $questionSetBuilder->checkBuildable();
349 }
static getInstance(ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)

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

Referenced by isQuestionSetConfigured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionSetConfigured()

ilTestRandomQuestionSetConfig::isQuestionSetConfigured ( )

Reimplemented from ilTestQuestionSetConfig.

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

293 : bool
294 {
295 return (
296 $this->getLastQuestionSyncTimestamp() != 0
297 && $this->isQuestionAmountConfigComplete()
298 && $this->hasSourcePoolDefinitions()
299 && $this->isQuestionSetBuildable()
300 );
301 }

References getLastQuestionSyncTimestamp(), hasSourcePoolDefinitions(), and isQuestionSetBuildable().

+ Here is the call graph for this function:

◆ isResultTaxonomyFilterSupported()

ilTestRandomQuestionSetConfig::isResultTaxonomyFilterSupported ( )

Reimplemented from ilTestQuestionSetConfig.

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

478 {
479 return true;
480 }

◆ isValidQuestionAmountConfigurationMode()

ilTestRandomQuestionSetConfig::isValidQuestionAmountConfigurationMode (   $amountMode)

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

103 {
104 switch ($amountMode) {
107
108 return true;
109 }
110
111 return false;
112 }

References QUESTION_AMOUNT_CONFIG_MODE_PER_POOL, and QUESTION_AMOUNT_CONFIG_MODE_PER_TEST.

◆ isValidRequestOnBrokenQuestionSetDepencies()

ilTestRandomQuestionSetConfig::isValidRequestOnBrokenQuestionSetDepencies (   $nextClass,
  $cmd 
)

Reimplemented from ilTestQuestionSetConfig.

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

513 {
514 //vd($nextClass, $cmd);
515
516 switch ($nextClass) {
517 case 'ilobjectmetadatagui':
518 case 'ilpermissiongui':
519
520 return true;
521
522 case 'ilobjtestgui':
523 case '':
524
525 $cmds = array(
526 'infoScreen', 'participants', 'npSetFilter', 'npResetFilter',
527 //'deleteAllUserResults', 'confirmDeleteAllUserResults',
528 //'deleteSingleUserResults', 'confirmDeleteSelectedUserData', 'cancelDeleteSelectedUserData'
529 );
530
531 if (in_array($cmd, $cmds)) {
532 return true;
533 }
534
535 break;
536 }
537
538 return false;
539 }

◆ loadFromDb()

ilTestRandomQuestionSetConfig::loadFromDb ( )

loads the question set config for current test from the database

Returns
boolean

Reimplemented from ilTestQuestionSetConfig.

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

179 {
180 $res = $this->db->queryF(
181 "SELECT * FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
182 array('integer'),
183 array($this->testOBJ->getTestId())
184 );
185
186 while ($row = $this->db->fetchAssoc($res)) {
187 $this->initFromArray($row);
188
189 return true;
190 }
191
192 return false;
193 }
initFromArray($dataArray)
initialises the current object instance with values from matching properties within the passed array

References $res, and initFromArray().

Referenced by cloneQuestionSetRelatedData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerClonedSourcePoolDefinitionIdMapping()

ilTestRandomQuestionSetConfig::registerClonedSourcePoolDefinitionIdMapping ( ilObjTest  $cloneTestOBJ,
  $definitionIdMap 
)
private

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

421 {
422 global $DIC;
423 $ilLog = $DIC['ilLog'];
424
425 require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
427
428 foreach ($definitionIdMap as $originalDefinitionId => $cloneDefinitionId) {
429 $originalKey = $this->testOBJ->getRefId() . '_rndSelDef_' . $originalDefinitionId;
430 $mappedKey = $cloneTestOBJ->getRefId() . '_rndSelDef_' . $cloneDefinitionId;
431 $cwo->appendMapping($originalKey, $mappedKey);
432 $ilLog->write(__METHOD__ . ": Added random selection definition id mapping $originalKey <-> $mappedKey");
433 }
434 }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getRefId()
get reference id @access public
global $DIC
Definition: goto.php:24

References $DIC, ilCopyWizardOptions\_getInstance(), ilObject\getRefId(), and ilObjTest\getTmpCopyWizardCopyId().

Referenced by cloneQuestionSetRelatedData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionSetRelatedData()

ilTestRandomQuestionSetConfig::removeQuestionSetRelatedData ( )

removes all question set config related data

Reimplemented from ilTestQuestionSetConfig.

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

367 {
368 $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
369 $sourcePoolDefinitionList->deleteDefinitions();
370
371 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
373 $this->db,
374 $this->testOBJ
375 );
376 $stagingPool->reset();
377
379
380 $this->deleteFromDb();
381 }
resetQuestionSetRelatedTestSettings()
resets all test settings that depends on a non changed question set config
deleteFromDb()
deletes the question set config for current test from the database

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

+ Here is the call graph for this function:

◆ resetQuestionSetRelatedTestSettings()

ilTestRandomQuestionSetConfig::resetQuestionSetRelatedTestSettings ( )

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

Reimplemented from ilTestQuestionSetConfig.

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

384 {
385 $this->testOBJ->setResultFilterTaxIds(array());
386 $this->testOBJ->saveToDb(true);
387 }

Referenced by removeQuestionSetRelatedData().

+ Here is the caller graph for this function:

◆ saveToDb()

ilTestRandomQuestionSetConfig::saveToDb ( )

saves the question set config for current test to the database

Returns
boolean

Reimplemented from ilTestQuestionSetConfig.

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

201 {
202 if ($this->dbRecordExists($this->testOBJ->getTestId())) {
203 $this->updateDbRecord($this->testOBJ->getTestId());
204 } else {
205 $this->insertDbRecord($this->testOBJ->getTestId());
206 }
207 }
updateDbRecord($testId)
updates the record in the database that corresponds to the question set config for the current test

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

+ Here is the call graph for this function:

◆ setLastQuestionSyncTimestamp()

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

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

134 {
135 $this->lastQuestionSyncTimestamp = $lastQuestionSyncTimestamp;
136 }

References $lastQuestionSyncTimestamp.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ setPoolsWithHomogeneousScoredQuestionsRequired()

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

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

58 {
59 $this->requirePoolsWithHomogeneousScoredQuestions = $requirePoolsWithHomogeneousScoredQuestions;
60 }

References $requirePoolsWithHomogeneousScoredQuestions.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ setQuestionAmountConfigurationMode()

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

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

74 {
75 $this->questionAmountConfigurationMode = $questionAmountConfigurationMode;
76 }

References $questionAmountConfigurationMode.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ setQuestionAmountPerTest()

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

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

118 {
119 $this->questionAmountPerTest = $questionAmountPerTest;
120 }

References $questionAmountPerTest.

Referenced by initFromArray().

+ Here is the caller graph for this function:

◆ updateDbRecord()

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 258 of file class.ilTestRandomQuestionSetConfig.php.

259 {
260 $this->db->update(
261 'tst_rnd_quest_set_cfg',
262 array(
263 'req_pools_homo_scored' => array('integer', (int) $this->arePoolsWithHomogeneousScoredQuestionsRequired()),
264 'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
265 'quest_amount_per_test' => array('integer', (int) $this->getQuestionAmountPerTest()),
266 'quest_sync_timestamp' => array('integer', (int) $this->getLastQuestionSyncTimestamp())
267 ),
268 array(
269 'test_fi' => array('integer', $testId)
270 )
271 );
272 }

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

Referenced by saveToDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLastQuestionSyncTimestampForTestId()

ilTestRandomQuestionSetConfig::updateLastQuestionSyncTimestampForTestId (   $testId,
  $timestamp 
)

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

465 {
466 $this->db->update(
467 'tst_rnd_quest_set_cfg',
468 array(
469 'quest_sync_timestamp' => array('integer', (int) $timestamp)
470 ),
471 array(
472 'test_fi' => array('integer', $testId)
473 )
474 );
475 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

References $timestamp.

Referenced by cloneQuestionSetRelatedData().

+ Here is the caller graph for this function:

Field Documentation

◆ $buildableMessages

ilTestRandomQuestionSetConfig::$buildableMessages = array()
private

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

Referenced by getBuildableMessages().

◆ $lastQuestionSyncTimestamp

ilTestRandomQuestionSetConfig::$lastQuestionSyncTimestamp = null
private

◆ $questionAmountConfigurationMode

ilTestRandomQuestionSetConfig::$questionAmountConfigurationMode = null
private

◆ $questionAmountPerTest

ilTestRandomQuestionSetConfig::$questionAmountPerTest = null
private

◆ $requirePoolsWithHomogeneousScoredQuestions

ilTestRandomQuestionSetConfig::$requirePoolsWithHomogeneousScoredQuestions = null
private

◆ QUESTION_AMOUNT_CONFIG_MODE_PER_POOL

◆ QUESTION_AMOUNT_CONFIG_MODE_PER_TEST


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