ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestRandomQuestionSetConfig Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetConfig:
+ Collaboration diagram for ilTestRandomQuestionSetConfig:

Public Member Functions

 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 ()
 
 isQuestionAmountConfigComplete ()
 
 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, ilComponentRepository $component_repository, 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
ilTree $tree
 
ilDBInterface $db
 
ilComponentRepository $component_repository
 
ilObjTest $testOBJ
 

Detailed Description

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

Member Function Documentation

◆ areDepenciesBroken()

ilTestRandomQuestionSetConfig::areDepenciesBroken ( )

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

498  : bool
499  {
500  return $this->testOBJ->isTestFinalBroken();
501  }

◆ arePoolsWithHomogeneousScoredQuestionsRequired()

ilTestRandomQuestionSetConfig::arePoolsWithHomogeneousScoredQuestionsRequired ( )
Returns
boolean

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

References $requirePoolsWithHomogeneousScoredQuestions.

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

+ Here is the caller graph for this function:

◆ buildSourcePoolDefinitionList()

◆ buildStagingPoolBuilder()

ilTestRandomQuestionSetConfig::buildStagingPoolBuilder ( ilObjTest  $testOBJ)
private

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

Referenced by cloneQuestionSetRelatedData().

451  {
452  require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
453  $stagingPool = new ilTestRandomQuestionSetStagingPoolBuilder($this->db, $testOBJ);
454 
455  return $stagingPool;
456  }
+ 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 396 of file class.ilTestRandomQuestionSetConfig.php.

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

397  {
398  // clone general config
399 
400  $this->loadFromDb();
401  $this->cloneToDbForTestId($cloneTestOBJ->getTestId());
402 
403  // clone source pool definitions (selection rules)
404 
405  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
406  $sourcePoolDefinitionList->loadDefinitions();
407  $definitionIdMap = $sourcePoolDefinitionList->cloneDefinitionsForTestId($cloneTestOBJ->getTestId());
408  $this->registerClonedSourcePoolDefinitionIdMapping($cloneTestOBJ, $definitionIdMap);
409 
410  // build new question stage for cloned test
411 
412  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($cloneTestOBJ);
413  $stagingPool = $this->buildStagingPoolBuilder($cloneTestOBJ);
414 
415  $sourcePoolDefinitionList->loadDefinitions();
416  $stagingPool->rebuild($sourcePoolDefinitionList);
417  $sourcePoolDefinitionList->saveDefinitions();
418 
419  $this->updateLastQuestionSyncTimestampForTestId($cloneTestOBJ->getTestId(), time());
420  }
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
+ 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 218 of file class.ilTestRandomQuestionSetConfig.php.

References insertDbRecord().

Referenced by cloneQuestionSetRelatedData().

219  {
220  $this->insertDbRecord($testId);
221  }
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 243 of file class.ilTestRandomQuestionSetConfig.php.

References $res.

Referenced by doesQuestionSetRelatedDataExist(), and saveToDb().

243  : bool
244  {
245  $res = $this->db->queryF(
246  "SELECT COUNT(*) cnt FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
247  array('integer'),
248  array($testId)
249  );
250 
251  $row = $this->db->fetchAssoc($res);
252 
253  return (bool) $row['cnt'];
254  }
$res
Definition: ltiservices.php:69
+ 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 226 of file class.ilTestRandomQuestionSetConfig.php.

Referenced by removeQuestionSetRelatedData().

227  {
228  $this->db->manipulateF(
229  "DELETE FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
230  array('integer'),
231  array($this->testOBJ->getTestId())
232  );
233  }
+ Here is the caller graph for this function:

◆ doesQuestionSetRelatedDataExist()

ilTestRandomQuestionSetConfig::doesQuestionSetRelatedDataExist ( )

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

References buildSourcePoolDefinitionList(), and dbRecordExists().

351  : bool
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
+ Here is the call graph for this function:

◆ doesSelectableQuestionPoolsExist()

ilTestRandomQuestionSetConfig::doesSelectableQuestionPoolsExist ( )

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

References getSelectableQuestionPools().

491  : bool
492  {
493  return (bool) count($this->getSelectableQuestionPools());
494  }
+ Here is the call graph for this function:

◆ getBuildableMessages()

ilTestRandomQuestionSetConfig::getBuildableMessages ( )

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

References $buildableMessages.

149  : array
150  {
152  }

◆ getCommaSeparatedSourceQuestionPoolLinks()

ilTestRandomQuestionSetConfig::getCommaSeparatedSourceQuestionPoolLinks ( )

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

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

546  : string
547  {
548  $definitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
549  $definitionList->loadDefinitions();
550 
551  $poolTitles = array();
552 
553  foreach ($definitionList as $definition) {
554  /* @var ilTestRandomQuestionSetSourcePoolDefinition $definition */
555 
556  $refId = current(ilObject::_getAllReferences($definition->getPoolId()));
557  $href = ilLink::_getLink($refId, 'qpl');
558  $title = $definition->getPoolTitle();
559 
560  $poolTitles[$definition->getPoolId()] = "<a href=\"$href\" alt=\"$title\">$title</a>";
561  }
562 
563  return implode(', ', $poolTitles);
564  }
static _getAllReferences(int $id)
get all reference ids for object ID
$refId
Definition: xapitoken.php:58
+ Here is the call graph for this function:

◆ getDepenciesBrokenMessage()

ilTestRandomQuestionSetConfig::getDepenciesBrokenMessage ( ilLanguage  $lng)

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

References ilLanguage\txt().

503  : string
504  {
505  return $lng->txt('tst_old_style_rnd_quest_set_broken');
506  }
txt(string $a_topic, string $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 537 of file class.ilTestRandomQuestionSetConfig.php.

537  : array
538  {
539  return array(
540  'assQuestions', 'settings', 'manscoring', 'scoringadjust', 'statistics', 'history', 'export'
541  );
542  }

◆ getLastQuestionSyncTimestamp()

ilTestRandomQuestionSetConfig::getLastQuestionSyncTimestamp ( )
Returns
integer

Definition at line 143 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 127 of file class.ilTestRandomQuestionSetConfig.php.

References $questionAmountPerTest.

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

+ Here is the caller graph for this function:

◆ getSelectableQuestionPools()

ilTestRandomQuestionSetConfig::getSelectableQuestionPools ( )

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

References arePoolsWithHomogeneousScoredQuestionsRequired().

Referenced by doesSelectableQuestionPoolsExist().

480  : array
481  {
482  return $this->testOBJ->getAvailableQuestionpools(
483  true,
485  false,
486  true,
487  true
488  );
489  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasSourcePoolDefinitions()

ilTestRandomQuestionSetConfig::hasSourcePoolDefinitions ( )

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

References buildSourcePoolDefinitionList().

Referenced by isQuestionSetConfigured().

326  : bool
327  {
328  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
329 
330  return $sourcePoolDefinitionList->savedDefinitionsExist();
331  }
+ 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 163 of file class.ilTestRandomQuestionSetConfig.php.

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

Referenced by loadFromDb().

164  {
165  foreach ($dataArray as $field => $value) {
166  switch ($field) {
167  case 'req_pools_homo_scored': $this->setPoolsWithHomogeneousScoredQuestionsRequired($value);
168  break;
169  case 'quest_amount_cfg_mode': $this->setQuestionAmountConfigurationMode($value);
170  break;
171  case 'quest_amount_per_test': $this->setQuestionAmountPerTest($value);
172  break;
173  case 'quest_sync_timestamp': $this->setLastQuestionSyncTimestamp($value);
174  break;
175  }
176  }
177  }
setQuestionAmountConfigurationMode($questionAmountConfigurationMode)
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 284 of file class.ilTestRandomQuestionSetConfig.php.

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

Referenced by cloneToDbForTestId(), and saveToDb().

285  {
286  $this->db->insert('tst_rnd_quest_set_cfg', array(
287  'test_fi' => array('integer', $testId),
288  'req_pools_homo_scored' => array('integer', (int) $this->arePoolsWithHomogeneousScoredQuestionsRequired()),
289  'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
290  'quest_amount_per_test' => array('integer', (int) $this->getQuestionAmountPerTest()),
291  'quest_sync_timestamp' => array('integer', (int) $this->getLastQuestionSyncTimestamp())
292  ));
293  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionAmountConfigComplete()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigComplete ( )

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

References buildSourcePoolDefinitionList(), getQuestionAmountPerTest(), and isQuestionAmountConfigurationModePerPool().

Referenced by isQuestionSetConfigured().

307  : bool
308  {
310  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
311 
312  $sourcePoolDefinitionList->loadDefinitions();
313 
314  foreach ($sourcePoolDefinitionList as $definition) {
315  if ($definition->getQuestionAmount() < 1) {
316  return false;
317  }
318  }
319  } elseif ($this->getQuestionAmountPerTest() < 1) {
320  return false;
321  }
322 
323  return true;
324  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionAmountConfigurationModePerPool()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerPool ( )
Returns
boolean

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

References getQuestionAmountConfigurationMode().

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

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

◆ isQuestionAmountConfigurationModePerTest()

ilTestRandomQuestionSetConfig::isQuestionAmountConfigurationModePerTest ( )
Returns
boolean

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

References getQuestionAmountConfigurationMode().

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

◆ isQuestionSetBuildable()

ilTestRandomQuestionSetConfig::isQuestionSetBuildable ( )

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

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

Referenced by isQuestionSetConfigured().

333  : bool
334  {
335  $sourcePoolDefinitionList = $this->buildSourcePoolDefinitionList($this->testOBJ);
336  $sourcePoolDefinitionList->loadDefinitions();
337 
338  $stagingPoolQuestionList = new ilTestRandomQuestionSetStagingPoolQuestionList($this->db, $this->component_repository);
339 
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionSetConfigured()

ilTestRandomQuestionSetConfig::isQuestionSetConfigured ( )

◆ isResultTaxonomyFilterSupported()

ilTestRandomQuestionSetConfig::isResultTaxonomyFilterSupported ( )

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

473  : bool
474  {
475  return true;
476  }

◆ isValidQuestionAmountConfigurationMode()

ilTestRandomQuestionSetConfig::isValidQuestionAmountConfigurationMode (   $amountMode)

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

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

◆ isValidRequestOnBrokenQuestionSetDepencies()

ilTestRandomQuestionSetConfig::isValidRequestOnBrokenQuestionSetDepencies (   $nextClass,
  $cmd 
)

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

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

◆ loadFromDb()

ilTestRandomQuestionSetConfig::loadFromDb ( )

loads the question set config for current test from the database

Returns
boolean

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

References $res, and initFromArray().

Referenced by cloneQuestionSetRelatedData().

184  : bool
185  {
186  $res = $this->db->queryF(
187  "SELECT * FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
188  array('integer'),
189  array($this->testOBJ->getTestId())
190  );
191 
192  while ($row = $this->db->fetchAssoc($res)) {
193  $this->initFromArray($row);
194 
195  return true;
196  }
197 
198  return false;
199  }
$res
Definition: ltiservices.php:69
initFromArray($dataArray)
initialises the current object instance with values from matching properties within the passed array ...
+ 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 422 of file class.ilTestRandomQuestionSetConfig.php.

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

Referenced by cloneQuestionSetRelatedData().

423  {
424  global $DIC;
425  $ilLog = $DIC['ilLog'];
426 
427  require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
429 
430  foreach ($definitionIdMap as $originalDefinitionId => $cloneDefinitionId) {
431  $originalKey = $this->testOBJ->getRefId() . '_rndSelDef_' . $originalDefinitionId;
432  $mappedKey = $cloneTestOBJ->getRefId() . '_rndSelDef_' . $cloneDefinitionId;
433  $cwo->appendMapping($originalKey, $mappedKey);
434  $ilLog->write(__METHOD__ . ": Added random selection definition id mapping $originalKey <-> $mappedKey");
435  }
436  }
global $DIC
Definition: feed.php:28
static _getInstance(int $a_copy_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeQuestionSetRelatedData()

ilTestRandomQuestionSetConfig::removeQuestionSetRelatedData ( )

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

References buildSourcePoolDefinitionList(), and deleteFromDb().

366  : void
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 
378  $this->deleteFromDb();
379  }
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 381 of file class.ilTestRandomQuestionSetConfig.php.

382  {
383  $this->testOBJ->getScoreSettingsRepository()->store(
384  $this->testOBJ->getScoreSettings()->withResultDetailsSettings(
385  $this->testOBJ->getScoreSettings()->getResultDetailsSettings()->withTaxonomyFilterIds(array())
386  )
387  );
388  $this->testOBJ->saveToDb(true);
389  }

◆ saveToDb()

ilTestRandomQuestionSetConfig::saveToDb ( )

saves the question set config for current test to the database

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

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

205  {
206  if ($this->dbRecordExists($this->testOBJ->getTestId())) {
207  $this->updateDbRecord($this->testOBJ->getTestId());
208  } else {
209  $this->insertDbRecord($this->testOBJ->getTestId());
210  }
211  }
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 135 of file class.ilTestRandomQuestionSetConfig.php.

References $lastQuestionSyncTimestamp.

Referenced by initFromArray().

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

◆ setPoolsWithHomogeneousScoredQuestionsRequired()

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

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

References $requirePoolsWithHomogeneousScoredQuestions.

Referenced by initFromArray().

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

◆ setQuestionAmountConfigurationMode()

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

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

References $questionAmountConfigurationMode.

Referenced by initFromArray().

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

◆ setQuestionAmountPerTest()

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

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

References $questionAmountPerTest.

Referenced by initFromArray().

120  {
121  $this->questionAmountPerTest = $questionAmountPerTest;
122  }
+ 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 262 of file class.ilTestRandomQuestionSetConfig.php.

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

Referenced by saveToDb().

263  {
264  $this->db->update(
265  'tst_rnd_quest_set_cfg',
266  array(
267  'req_pools_homo_scored' => array('integer', (int) $this->arePoolsWithHomogeneousScoredQuestionsRequired()),
268  'quest_amount_cfg_mode' => array('text', $this->getQuestionAmountConfigurationMode()),
269  'quest_amount_per_test' => array('integer', (int) $this->getQuestionAmountPerTest()),
270  'quest_sync_timestamp' => array('integer', (int) $this->getLastQuestionSyncTimestamp())
271  ),
272  array(
273  'test_fi' => array('integer', $testId)
274  )
275  );
276  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLastQuestionSyncTimestampForTestId()

ilTestRandomQuestionSetConfig::updateLastQuestionSyncTimestampForTestId (   $testId,
  $timestamp 
)

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

References $timestamp.

Referenced by cloneQuestionSetRelatedData().

461  {
462  $this->db->update(
463  'tst_rnd_quest_set_cfg',
464  array(
465  'quest_sync_timestamp' => array('integer', (int) $timestamp)
466  ),
467  array(
468  'test_fi' => array('integer', $testId)
469  )
470  );
471  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
+ Here is the caller graph for this function:

Field Documentation

◆ $buildableMessages

ilTestRandomQuestionSetConfig::$buildableMessages = array()
private

Definition at line 53 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: