19 declare(strict_types=1);
72 switch ($amountMode) {
73 case self::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL:
74 case self::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST:
109 foreach ($data_array as $field => $value) {
125 $res = $this->db->queryF(
126 "SELECT * FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
128 [$this->test_obj->getTestId()]
131 $row = $this->db->fetchAssoc(
$res);
154 $this->db->manipulateF(
155 "DELETE FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
157 [$this->test_obj->getTestId()]
163 $res = $this->db->queryF(
164 "SELECT COUNT(*) cnt FROM tst_rnd_quest_set_cfg WHERE test_fi = %s",
169 $row = $this->db->fetchAssoc(
$res);
171 return (
bool) $row[
'cnt'];
177 'tst_rnd_quest_set_cfg',
185 'test_fi' => [
'integer', $test_id]
193 'tst_rnd_quest_set_cfg',
195 'test_fi' => [
'integer', $test_id],
217 $sourcePoolDefinitionList->loadDefinitions();
219 foreach ($sourcePoolDefinitionList as $definition) {
220 if ($definition->getQuestionAmount() < 1) {
235 return $sourcePoolDefinitionList->savedDefinitionsExist();
241 $sourcePoolDefinitionList->loadDefinitions();
251 $sourcePoolDefinitionList,
252 $stagingPoolQuestionList
255 $buildable = $questionSetBuilder->checkBuildable();
256 $this->buildableMessages = $questionSetBuilder->getCheckMessages();
268 if ($sourcePoolDefinitionList->savedDefinitionsExist()) {
278 $sourcePoolDefinitionList->deleteDefinitions();
285 $stagingPool->reset();
298 $source_pool_definition_list_orig->loadDefinitions();
299 $definition_id_map = $source_pool_definition_list_orig->cloneDefinitionsForTestId($clone_test_obj->
getTestId());
307 $source_pool_definition_list_clone->loadDefinitions();
308 $staging_pool->rebuild($source_pool_definition_list_clone);
309 $source_pool_definition_list_clone->saveDefinitions();
318 foreach ($definitionIdMap as $originalDefinitionId => $cloneDefinitionId) {
319 $originalKey = $this->test_obj->getRefId() .
'_rndSelDef_' . $originalDefinitionId;
320 $mappedKey = $cloneTestOBJ->
getRefId() .
'_rndSelDef_' . $cloneDefinitionId;
321 $cwo->appendMapping($originalKey, $mappedKey);
322 $this->
logger->info(__METHOD__ .
": Added random selection definition id mapping $originalKey <-> $mappedKey");
348 'tst_rnd_quest_set_cfg',
350 'quest_sync_timestamp' => [
'integer', (
int) $timestamp]
353 'test_fi' => [
'integer', $test_id]
365 return $this->test_obj->getAvailableQuestionpools(
382 $definitionList->loadDefinitions();
386 foreach ($definitionList as $definition) {
388 $href = ilLink::_getLink(
$refId,
'qpl');
389 $title = $definition->getPoolTitle();
391 $poolTitles[$definition->getPoolId()] =
"<a href=\"$href\" alt=\"$title\">$title</a>";
394 return implode(
', ', $poolTitles);
setQuestionAmountPerTest(?int $questionAmountPerTest)
getCommaSeparatedSourceQuestionPoolLinks()
isValidQuestionAmountConfigurationMode(string $amountMode)
updateDbRecord(int $test_id)
int $questionAmountPerTest
isResultTaxonomyFilterSupported()
bool $requirePoolsWithHomogeneousScoredQuestions
cloneQuestionSetRelatedData(ilObjTest $clone_test_obj)
doesSelectableQuestionPoolsExist()
updateLastQuestionSyncTimestampForTestId(int $test_id, int $timestamp)
static _getAllReferences(int $id)
get all reference ids for object ID
getTestId()
Gets the database id of the additional test data.
static getInstance(ilDBInterface $db, ilLanguage $lng, TestLogger $logger, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
isQuestionAmountConfigurationModePerPool()
isQuestionAmountConfigurationModePerTest()
setLastQuestionSyncTimestamp(int $lastQuestionSyncTimestamp)
const QUESTION_AMOUNT_CONFIG_MODE_PER_POOL
registerClonedSourcePoolDefinitionIdMapping(ilObjTest $cloneTestOBJ, array $definitionIdMap)
getSelectableQuestionPools()
arePoolsWithHomogeneousScoredQuestionsRequired()
string $questionAmountConfigurationMode
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
buildSourcePoolDefinitionList(ilObjTest $test_obj)
setPoolsWithHomogeneousScoredQuestionsRequired(bool $requirePoolsWithHomogeneousScoredQuestions)
dbRecordExists(int $test_id)
getQuestionAmountPerTest()
isQuestionSetConfigured()
setQuestionAmountConfigurationMode(?string $questionAmountConfigurationMode)
getQuestionAmountConfigurationMode()
removeQuestionSetRelatedData()
doesQuestionSetRelatedDataExist()
getLastQuestionSyncTimestamp()
insertDbRecord(int $test_id)
foreach($mandatory_scripts as $file) $timestamp
int $lastQuestionSyncTimestamp
hasSourcePoolDefinitions()
initFromArray(array $data_array)
cloneToDbForTestId(int $test_id)
const QUESTION_AMOUNT_CONFIG_MODE_PER_TEST
static _getInstance(int $a_copy_id)
isQuestionAmountConfigComplete()
buildStagingPoolBuilder(ilObjTest $test_obj)