ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 removeQuestionSetRelatedData ()
 
 resetQuestionSetRelatedTestSettings ()
 
 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)
 
 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()

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

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

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

Member Function Documentation

◆ areDepenciesBroken()

ilTestRandomQuestionSetConfig::areDepenciesBroken ( )

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

515  {
516  return (bool) $this->testOBJ->isTestFinalBroken();
517  }

◆ arePoolsWithHomogeneousScoredQuestionsRequired()

ilTestRandomQuestionSetConfig::arePoolsWithHomogeneousScoredQuestionsRequired ( )
Returns
boolean

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

References $requirePoolsWithHomogeneousScoredQuestions.

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

+ Here is the caller graph for this function:

◆ buildSourcePoolDefinitionList()

ilTestRandomQuestionSetConfig::buildSourcePoolDefinitionList ( ilObjTest  $testOBJ)
private

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

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

449  {
450  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
451  $sourcePoolDefinitionFactory = new ilTestRandomQuestionSetSourcePoolDefinitionFactory(
452  $this->db,
453  $testOBJ
454  );
455 
456  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
457  $sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList(
458  $this->db,
459  $testOBJ,
460  $sourcePoolDefinitionFactory
461  );
462 
463  return $sourcePoolDefinitionList;
464  }
+ Here is the caller graph for this function:

◆ buildStagingPoolBuilder()

ilTestRandomQuestionSetConfig::buildStagingPoolBuilder ( ilObjTest  $testOBJ)
private

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

Referenced by cloneQuestionSetRelatedData().

467  {
468  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
469  $stagingPool = new ilTestRandomQuestionSetStagingPoolBuilder($this->db, $testOBJ);
470 
471  return $stagingPool;
472  }
+ 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

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

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

408  {
409  // clone general config
410 
411  $this->loadFromDb();
412  $this->cloneToDbForTestId($cloneTestOBJ->getTestId());
413 
414  // clone source pool definitions (selection rules)
415 
416  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
417  $sourcePoolDefinitionList->loadDefinitions();
418  $definitionIdMap = $sourcePoolDefinitionList->cloneDefinitionsForTestId($cloneTestOBJ->getTestId());
419  $this->registerClonedSourcePoolDefinitionIdMapping($cloneTestOBJ, $definitionIdMap);
420 
421  // build new question stage for cloned test
422 
423  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($cloneTestOBJ);
424  $stagingPool = $this->buildStagingPoolBuilder($cloneTestOBJ);
425 
426  $sourcePoolDefinitionList->loadDefinitions();
427  $stagingPool->rebuild($sourcePoolDefinitionList);
428  $sourcePoolDefinitionList->saveDefinitions();
429 
430  $this->updateLastQuestionSyncTimestampForTestId($cloneTestOBJ->getTestId(), time());
431  }
getTestId()
Gets the database id of the additional test data.
registerClonedSourcePoolDefinitionIdMapping(ilObjTest $cloneTestOBJ, $definitionIdMap)
loadFromDb()
loads the question set config for current test from the database
cloneToDbForTestId($testId)
saves the question set config for test with given id to the database
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:

◆ cloneToDbForTestId()

ilTestRandomQuestionSetConfig::cloneToDbForTestId (   $testId)

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

Parameters
$testId

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

References insertDbRecord().

Referenced by cloneQuestionSetRelatedData().

215  {
216  $this->insertDbRecord($testId);
217  }
insertDbRecord($testId)
inserts a new record for the question set config for the current test into the database ...
+ 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.

References $res, $row, and array.

Referenced by doesQuestionSetRelatedDataExist(), and saveToDb().

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
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ deleteFromDb()

ilTestRandomQuestionSetConfig::deleteFromDb ( )

deletes the question set config for current test from the database

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

References array.

Referenced by removeQuestionSetRelatedData().

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  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ doesQuestionSetRelatedDataExist()

ilTestRandomQuestionSetConfig::doesQuestionSetRelatedDataExist ( )

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

References buildSourcePoolDefinitionList(), and dbRecordExists().

365  {
366  if ($this->dbRecordExists($this->testOBJ->getTestId())) {
367  return true;
368  }
369 
370  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
371 
372  if ($sourcePoolDefinitionList->savedDefinitionsExist()) {
373  return true;
374  }
375 
376  return false;
377  }
dbRecordExists($testId)
checks wether a question set config for current test exists in the database
+ Here is the call graph for this function:

◆ doesSelectableQuestionPoolsExist()

ilTestRandomQuestionSetConfig::doesSelectableQuestionPoolsExist ( )

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

References getSelectableQuestionPools().

508  {
509  return (bool) count($this->getSelectableQuestionPools());
510  }
+ Here is the call graph for this function:

◆ getBuildableMessages()

ilTestRandomQuestionSetConfig::getBuildableMessages ( )

◆ getCommaSeparatedSourceQuestionPoolLinks()

ilTestRandomQuestionSetConfig::getCommaSeparatedSourceQuestionPoolLinks ( )

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

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

563  {
564  $definitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
565  $definitionList->loadDefinitions();
566 
567  $poolTitles = array();
568 
569  foreach ($definitionList as $definition) {
570  /* @var ilTestRandomQuestionSetSourcePoolDefinition $definition */
571 
572  $refId = current(ilObject::_getAllReferences($definition->getPoolId()));
573  $href = ilLink::_getLink($refId, 'qpl');
574  $title = $definition->getPoolTitle();
575 
576  $poolTitles[$definition->getPoolId()] = "<a href=\"$href\" alt=\"$title\">$title</a>";
577  }
578 
579  return implode(', ', $poolTitles);
580  }
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getDepenciesBrokenMessage()

ilTestRandomQuestionSetConfig::getDepenciesBrokenMessage ( ilLanguage  $lng)

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

References ilLanguage\txt().

520  {
521  return $lng->txt('tst_old_style_rnd_quest_set_broken');
522  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ getHiddenTabsOnBrokenDepencies()

ilTestRandomQuestionSetConfig::getHiddenTabsOnBrokenDepencies ( )

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

References array.

554  {
555  return array(
556  'assQuestions', 'settings', 'manscoring', 'scoringadjust', 'statistics', 'history', 'export'
557  );
558  }
Create styles array
The data for the language used.

◆ 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()

◆ getQuestionAmountPerTest()

ilTestRandomQuestionSetConfig::getQuestionAmountPerTest ( )
Returns
integer

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

References $questionAmountPerTest.

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

+ Here is the caller graph for this function:

◆ getSelectableQuestionPools()

ilTestRandomQuestionSetConfig::getSelectableQuestionPools ( )

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

References arePoolsWithHomogeneousScoredQuestionsRequired().

Referenced by doesSelectableQuestionPoolsExist().

497  {
498  return $this->testOBJ->getAvailableQuestionpools(
499  true,
501  false,
502  true,
503  true
504  );
505  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasSourcePoolDefinitions()

ilTestRandomQuestionSetConfig::hasSourcePoolDefinitions ( )

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

References buildSourcePoolDefinitionList().

Referenced by isQuestionSetConfigured().

338  {
339  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
340 
341  return $sourcePoolDefinitionList->savedDefinitionsExist();
342  }
+ 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.

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

Referenced by loadFromDb().

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)
$dataArray
setLastQuestionSyncTimestamp($lastQuestionSyncTimestamp)
setPoolsWithHomogeneousScoredQuestionsRequired($requirePoolsWithHomogeneousScoredQuestions)
+ 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.

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

Referenced by cloneToDbForTestId(), and saveToDb().

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  }
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:

◆ isQuestionAmountConfigurationModePerPool()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerPool ( )
Returns
boolean

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

References getQuestionAmountConfigurationMode().

Referenced by ilTestRandomQuestionSetBuilder\getInstance(), and isQuestionSetConfigured().

90  {
91  return $this->getQuestionAmountConfigurationMode() == self::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL;
92  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionAmountConfigurationModePerTest()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerTest ( )
Returns
boolean

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

References getQuestionAmountConfigurationMode().

98  {
99  return $this->getQuestionAmountConfigurationMode() == self::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST;
100  }
+ Here is the call graph for this function:

◆ isQuestionSetBuildable()

ilTestRandomQuestionSetConfig::isQuestionSetBuildable ( )

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

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

Referenced by isQuestionSetConfigured().

345  {
346  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
347  $sourcePoolDefinitionList->loadDefinitions();
348 
349  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
350  $stagingPoolQuestionList = new ilTestRandomQuestionSetStagingPoolQuestionList($this->db, $this->pluginAdmin);
351 
352  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
353  $questionSetBuilder = ilTestRandomQuestionSetBuilder::getInstance($this->db, $this->testOBJ, $this, $sourcePoolDefinitionList, $stagingPoolQuestionList);
354 
355  //fau: fixRandomTestBuildable - get messages if set is not buildable
356  $buildable = $questionSetBuilder->checkBuildable();
357  $this->buildableMessages = $questionSetBuilder->getCheckMessages();
358  return $buildable;
359  // fau.
360 
361  return $questionSetBuilder->checkBuildable();
362  }
static getInstance(ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionSetConfigured()

ilTestRandomQuestionSetConfig::isQuestionSetConfigured ( )

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

References buildSourcePoolDefinitionList(), getLastQuestionSyncTimestamp(), getQuestionAmountPerTest(), hasSourcePoolDefinitions(), isQuestionAmountConfigurationModePerPool(), and isQuestionSetBuildable().

294  {
295  // fau: delayCopyRandomQuestions - question set is not configured if date of last synchronisation is empty
296  if ($this->getLastQuestionSyncTimestamp() == 0) {
297  return false;
298  }
299  // fau.
300 
301  if (!$this->isQuestionAmountConfigComplete()) {
302  return false;
303  }
304 
305  if (!$this->hasSourcePoolDefinitions()) {
306  return false;
307  }
308 
309  if (!$this->isQuestionSetBuildable()) {
310  return false;
311  }
312 
313  return true;
314  }
+ Here is the call graph for this function:

◆ isResultTaxonomyFilterSupported()

ilTestRandomQuestionSetConfig::isResultTaxonomyFilterSupported ( )

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

490  {
491  return true;
492  }

◆ isValidQuestionAmountConfigurationMode()

ilTestRandomQuestionSetConfig::isValidQuestionAmountConfigurationMode (   $amountMode)

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

103  {
104  switch ($amountMode) {
105  case self::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL:
106  case self::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST:
107 
108  return true;
109  }
110 
111  return false;
112  }

◆ isValidRequestOnBrokenQuestionSetDepencies()

ilTestRandomQuestionSetConfig::isValidRequestOnBrokenQuestionSetDepencies (   $nextClass,
  $cmd 
)

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

References array.

525  {
526  //vd($nextClass, $cmd);
527 
528  switch ($nextClass) {
529  case 'ilobjectmetadatagui':
530  case 'ilpermissiongui':
531 
532  return true;
533 
534  case 'ilobjtestgui':
535  case '':
536 
537  $cmds = array(
538  'infoScreen', 'participants', 'npSetFilter', 'npResetFilter',
539  //'deleteAllUserResults', 'confirmDeleteAllUserResults',
540  //'deleteSingleUserResults', 'confirmDeleteSelectedUserData', 'cancelDeleteSelectedUserData'
541  );
542 
543  if (in_array($cmd, $cmds)) {
544  return true;
545  }
546 
547  break;
548  }
549 
550  return false;
551  }
Create styles array
The data for the language used.

◆ loadFromDb()

ilTestRandomQuestionSetConfig::loadFromDb ( )

loads the question set config for current test from the database

Returns
boolean

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

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

Referenced by cloneQuestionSetRelatedData().

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 ...
foreach($_POST as $key=> $value) $res
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:

◆ registerClonedSourcePoolDefinitionIdMapping()

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

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

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

Referenced by cloneQuestionSetRelatedData().

434  {
435  global $ilLog;
436 
437  require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
439 
440  foreach ($definitionIdMap as $originalDefinitionId => $cloneDefinitionId) {
441  $originalKey = $this->testOBJ->getRefId() . '_rndSelDef_' . $originalDefinitionId;
442  $mappedKey = $cloneTestOBJ->getRefId() . '_rndSelDef_' . $cloneDefinitionId;
443  $cwo->appendMapping($originalKey, $mappedKey);
444  $ilLog->write(__METHOD__ . ": Added random selection definition id mapping $originalKey <-> $mappedKey");
445  }
446  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getRefId()
get reference id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionSetRelatedData()

ilTestRandomQuestionSetConfig::removeQuestionSetRelatedData ( )

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

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

380  {
381  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
382  $sourcePoolDefinitionList->deleteDefinitions();
383 
384  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
386  $this->db,
387  $this->testOBJ
388  );
389  $stagingPool->reset();
390 
392 
393  $this->deleteFromDb();
394  }
deleteFromDb()
deletes the question set config for current test from the database
+ Here is the call graph for this function:

◆ resetQuestionSetRelatedTestSettings()

ilTestRandomQuestionSetConfig::resetQuestionSetRelatedTestSettings ( )

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

References array.

Referenced by removeQuestionSetRelatedData().

397  {
398  $this->testOBJ->setResultFilterTaxIds(array());
399  $this->testOBJ->saveToDb(true);
400  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ saveToDb()

ilTestRandomQuestionSetConfig::saveToDb ( )

saves the question set config for current test to the database

Returns
boolean

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

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

201  {
202  if ($this->dbRecordExists($this->testOBJ->getTestId())) {
203  $this->updateDbRecord($this->testOBJ->getTestId());
204  } else {
205  $this->insertDbRecord($this->testOBJ->getTestId());
206  }
207  }
insertDbRecord($testId)
inserts a new record for the question set config for the current test into the database ...
updateDbRecord($testId)
updates the record in the database that corresponds to the question set config for the current test ...
dbRecordExists($testId)
checks wether a question set config for current test exists in the database
+ Here is the call graph for this function:

◆ setLastQuestionSyncTimestamp()

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

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

References $lastQuestionSyncTimestamp.

Referenced by initFromArray().

134  {
135  $this->lastQuestionSyncTimestamp = $lastQuestionSyncTimestamp;
136  }
+ Here is the caller graph for this function:

◆ setPoolsWithHomogeneousScoredQuestionsRequired()

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

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

References $requirePoolsWithHomogeneousScoredQuestions.

Referenced by initFromArray().

58  {
59  $this->requirePoolsWithHomogeneousScoredQuestions = $requirePoolsWithHomogeneousScoredQuestions;
60  }
+ Here is the caller graph for this function:

◆ setQuestionAmountConfigurationMode()

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

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

References $questionAmountConfigurationMode.

Referenced by initFromArray().

74  {
75  $this->questionAmountConfigurationMode = $questionAmountConfigurationMode;
76  }
+ Here is the caller graph for this function:

◆ setQuestionAmountPerTest()

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

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

References $questionAmountPerTest.

Referenced by initFromArray().

118  {
119  $this->questionAmountPerTest = $questionAmountPerTest;
120  }
+ 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.

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

Referenced by saveToDb().

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  }
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:

◆ updateLastQuestionSyncTimestampForTestId()

ilTestRandomQuestionSetConfig::updateLastQuestionSyncTimestampForTestId (   $testId,
  $timestamp 
)

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

References $timestamp, and array.

Referenced by cloneQuestionSetRelatedData().

477  {
478  $this->db->update(
479  'tst_rnd_quest_set_cfg',
480  array(
481  'quest_sync_timestamp' => array('integer', (int) $timestamp)
482  ),
483  array(
484  'test_fi' => array('integer', $testId)
485  )
486  );
487  }
Create styles array
The data for the language used.
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
+ 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: