4 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
5 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
6 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
7 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolBuilder.php';
8 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfigStateMessageHandler.php';
10 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
140 $this->objDefinition =
$GLOBALS[
'DIC'][
'objDefinition'];
158 $this->sourcePoolDefinitionFactory
161 $this->sourcePoolDefinitionList->loadDefinitions();
173 $this->configStateMessageHandler->setTargetGUI($this);
174 $this->configStateMessageHandler->setQuestionSetConfig($this->questionSetConfig);
175 $this->configStateMessageHandler->setParticipantDataExists($this->testOBJ->participantDataExist());
176 $this->configStateMessageHandler->setLostPools($this->sourcePoolDefinitionList->getLostPools());
181 if (!$this->access->checkAccess(
"write",
"", $this->testOBJ->getRefId())) {
183 $this->ctrl->redirectByClass(
'ilObjTestGUI',
"infoScreen");
187 ilUtil::sendFailure($this->lng->txt(
"tst_msg_cannot_modify_random_question_set_conf_due_to_part"),
true);
188 $this->ctrl->redirect($this);
193 $nextClass = $this->ctrl->getNextClass();
195 switch ($nextClass) {
196 case 'iltestrandomquestionsetpooldefinitionformgui':
197 $this->questionSetConfig->loadFromDb();
202 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
204 $this->ctrl->forwardCommand($form);
209 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM) .
'Cmd';
230 if ($this->testOBJ->participantDataExist()) {
234 if ($this->sourcePoolDefinitionList->hasLostPool()) {
243 switch ($this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM)) {
244 case self::CMD_SAVE_GENERAL_CONFIG_FORM:
245 case self::CMD_SAVE_SRC_POOL_DEF_LIST:
246 case self::CMD_DELETE_SINGLE_SRC_POOL_DEF:
247 case self::CMD_DELETE_MULTI_SRC_POOL_DEFS:
248 case self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM:
249 case self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM:
250 case self::CMD_SAVE_AND_NEW_CREATE_SRC_POOL_DEF_FORM:
251 case self::CMD_BUILD_QUESTION_STAGE:
261 $this->tabs->activateTab(
'assQuestions');
263 $this->tabs->addSubTab(
264 'tstRandQuestSetGeneralConfig',
266 $this->ctrl->getLinkTarget($this, self::CMD_SHOW_GENERAL_CONFIG_FORM)
269 $this->tabs->addSubTab(
270 'tstRandQuestSetPoolConfig',
272 $this->ctrl->getLinkTarget($this, self::CMD_SHOW_SRC_POOL_DEF_LIST)
275 switch ($this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM)) {
276 case self::CMD_SHOW_GENERAL_CONFIG_FORM:
277 case self::CMD_SAVE_GENERAL_CONFIG_FORM:
279 $this->tabs->activateSubTab(
'tstRandQuestSetGeneralConfig');
282 case self::CMD_SHOW_SRC_POOL_DEF_LIST:
283 case self::CMD_SAVE_SRC_POOL_DEF_LIST:
284 case self::CMD_DELETE_SINGLE_SRC_POOL_DEF:
285 case self::CMD_DELETE_MULTI_SRC_POOL_DEFS:
286 case self::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM:
287 case self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM:
288 case self::CMD_SHOW_EDIT_SRC_POOL_DEF_FORM:
289 case self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM:
291 $this->tabs->activateSubTab(
'tstRandQuestSetPoolConfig');
294 default: $this->tabs->activateSubTab(
'nonTab');
300 if ($this->sourcePoolDefinitionList->areAllUsedPoolsAvailable()) {
301 $this->stagingPool->rebuild($this->sourcePoolDefinitionList);
302 $this->sourcePoolDefinitionList->saveDefinitions();
304 $this->questionSetConfig->loadFromDb();
305 $this->questionSetConfig->setLastQuestionSyncTimestamp(time());
306 $this->questionSetConfig->saveToDb();
308 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
310 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_random_question_set_synced"),
true);
318 if (!isset(
$_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD])) {
319 return self::CMD_SHOW_GENERAL_CONFIG_FORM;
322 if (!strlen(
$_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD])) {
323 return self::CMD_SHOW_GENERAL_CONFIG_FORM;
326 return $_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD];
331 if (
$form === null) {
332 $this->questionSetConfig->loadFromDb();
336 $this->tpl->setContent($this->ctrl->getHTML(
$form));
338 $this->configStateMessageHandler->setContext(
342 $this->configStateMessageHandler->handle();
344 if ($this->configStateMessageHandler->hasValidationReports()) {
345 if ($this->configStateMessageHandler->isValidationFailed()) {
347 $this->configStateMessageHandler->getValidationReportHtml()
350 ilUtil::sendInfo($this->configStateMessageHandler->getValidationReportHtml());
354 if (isset(
$_GET[
'modified']) && (int)
$_GET[
'modified']) {
361 $this->questionSetConfig->loadFromDb();
366 $form->setValuesByPost();
374 $this->questionSetConfig->setLastQuestionSyncTimestamp(0);
375 $this->questionSetConfig->saveToDb();
377 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
379 $this->ctrl->setParameter($this,
'modified', 1);
380 $this->ctrl->redirect($this, self::CMD_SHOW_GENERAL_CONFIG_FORM);
385 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetGeneralConfigFormGUI.php';
392 $this->questionSetConfig
404 $this->questionSetConfig->loadFromDb();
410 $content .= $this->ctrl->getHTML($toolbar);
414 $table->init($this->sourcePoolDefinitionList);
415 $content .= $this->ctrl->getHTML(
$table);
417 if (!$this->sourcePoolDefinitionList->areAllUsedPoolsAvailable()) {
419 $table->init($this->sourcePoolDefinitionList);
420 $content .= $this->ctrl->getHTML(
$table);
423 $this->tpl->setContent($content);
425 $this->configStateMessageHandler->setContext(
429 $this->configStateMessageHandler->handle();
431 if ($this->configStateMessageHandler->hasValidationReports()) {
432 if ($this->configStateMessageHandler->isValidationFailed()) {
434 $this->configStateMessageHandler->getValidationReportHtml()
437 ilUtil::sendInfo($this->configStateMessageHandler->getValidationReportHtml());
441 if (isset(
$_GET[
'modified']) && (int)
$_GET[
'modified']) {
448 $this->questionSetConfig->loadFromDb();
452 $table->applySubmit($this->sourcePoolDefinitionList);
454 $this->sourcePoolDefinitionList->reindexPositions();
455 $this->sourcePoolDefinitionList->saveDefinitions();
458 #$this->stagingPool->rebuild( $this->sourcePoolDefinitionList ); 459 #$this->sourcePoolDefinitionList->saveDefinitions(); 460 #$this->questionSetConfig->setLastQuestionSyncTimestamp(time()); 461 $this->questionSetConfig->setLastQuestionSyncTimestamp(0);
463 $this->questionSetConfig->saveToDb();
465 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
467 $this->ctrl->setParameter($this,
'modified', 1);
468 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
473 require_once
'Modules/Test/classes/toolbars/class.ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI.php';
479 $this->questionSetConfig
489 require_once
'Modules/Test/classes/tables/class.ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI.php';
495 self::CMD_SHOW_SRC_POOL_DEF_LIST
499 $table->setDefinitionEditModeEnabled(
true);
502 $table->setQuestionAmountColumnEnabled(
503 $this->questionSetConfig->isQuestionAmountConfigurationModePerPool()
507 $table->setShowMappedTaxonomyFilter(
508 $this->questionSetConfig->getLastQuestionSyncTimestamp() != 0
512 require_once
'Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
514 $translater->loadLabels($this->sourcePoolDefinitionList);
515 $table->setTaxonomyFilterLabelTranslater($translater);
524 require_once
'Modules/Test/classes/tables/class.ilTestRandomQuestionSetNonAvailablePoolsTableGUI.php';
530 self::CMD_SHOW_SRC_POOL_DEF_LIST
543 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_source_pool_definitions_deleted"),
true);
544 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
552 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_source_pool_definitions_deleted"),
true);
553 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
558 foreach ($definitionIds as $definitionId) {
559 $definition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($definitionId);
560 $definition->deleteFromDb();
563 $this->sourcePoolDefinitionList->reindexPositions();
564 $this->sourcePoolDefinitionList->saveDefinitions();
566 $this->questionSetConfig->loadFromDb();
567 $this->questionSetConfig->setLastQuestionSyncTimestamp(0);
568 $this->questionSetConfig->saveToDb();
570 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
576 $this->questionSetConfig->loadFromDb();
578 require_once
'Services/Repository/classes/class.ilTestQuestionPoolSelectorExplorer.php';
581 self::CMD_SHOW_POOL_SELECTOR_EXPLORER,
582 self::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM
585 $selector->setAvailableQuestionPools(
586 array_keys($this->questionSetConfig->getSelectableQuestionPools())
589 if ($selector->handleCommand()) {
593 $this->tpl->setContent($selector->getHTML());
599 $this->questionSetConfig->loadFromDb();
606 if (
$form === null) {
608 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
611 $this->tpl->setContent($this->ctrl->getHTML(
$form));
624 $this->questionSetConfig->loadFromDb();
631 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
633 $errors = !$form->checkInput();
634 $form->setValuesByPost();
640 $form->applySubmit($sourcePoolDefinition, $availableTaxonomyIds);
642 $sourcePoolDefinition->setSequencePosition($this->sourcePoolDefinitionList->getNextPosition());
643 $sourcePoolDefinition->saveToDb();
644 $this->sourcePoolDefinitionList->addDefinition($sourcePoolDefinition);
646 $this->sourcePoolDefinitionList->saveDefinitions();
648 $this->questionSetConfig->setLastQuestionSyncTimestamp(0);
649 $this->questionSetConfig->saveToDb();
651 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
653 if ($redirect_back_to_form) {
654 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_random_qsc_modified_add_new_rule"),
true);
655 $this->ctrl->setParameter($this,
'src_pool_def_id', $sourcePoolDefinition->getId());
656 $this->ctrl->setParameter($this,
'quest_pool_id', $sourcePoolDefinition->getPoolId());
657 $this->ctrl->redirect($this, self::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM);
659 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_random_question_set_config_modified"),
true);
660 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
666 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php';
673 $this->questionSetConfig
676 $form->setSaveCommand(self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM);
677 $form->setSaveAndNewCommand(self::CMD_SAVE_AND_NEW_CREATE_SRC_POOL_DEF_FORM);
684 $this->questionSetConfig->loadFromDb();
687 $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId);
690 if (
$form === null) {
692 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
695 $this->tpl->setContent($this->ctrl->getHTML(
$form));
700 $this->questionSetConfig->loadFromDb();
703 $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId);
707 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
709 $errors = !$form->checkInput();
710 $form->setValuesByPost();
716 $form->applySubmit($sourcePoolDefinition, $availableTaxonomyIds);
718 $sourcePoolDefinition->saveToDb();
720 $this->questionSetConfig->setLastQuestionSyncTimestamp(0);
721 $this->questionSetConfig->saveToDb();
723 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
725 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_random_question_set_config_modified"),
true);
726 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
731 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php';
738 $this->questionSetConfig
741 $form->setSaveCommand(self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM);
748 if (isset(
$_POST[
'quest_pool_id']) && (
int)
$_POST[
'quest_pool_id']) {
749 return (
int) $_POST[
'quest_pool_id'];
752 if (isset(
$_GET[
'quest_pool_id']) && (
int)
$_GET[
'quest_pool_id']) {
753 return (
int) $_GET[
'quest_pool_id'];
756 if (isset($_GET[
'quest_pool_ref']) && (
int) $_GET[
'quest_pool_ref']) {
759 $objCache = $DIC[
'ilObjDataCache'];
761 return $objCache->lookupObjId((
int) $_GET[
'quest_pool_ref']);
764 require_once
'Modules/Test/exceptions/class.ilTestMissingQuestionPoolIdParameterException.php';
770 if (isset(
$_POST[
'src_pool_def_id']) && (
int)
$_POST[
'src_pool_def_id']) {
771 return (
int) $_POST[
'src_pool_def_id'];
774 if (isset(
$_GET[
'src_pool_def_id']) && (
int)
$_GET[
'src_pool_def_id']) {
775 return (
int) $_GET[
'src_pool_def_id'];
778 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
784 if (!isset(
$_POST[
'src_pool_def_ids']) || !is_array(
$_POST[
'src_pool_def_ids'])) {
785 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
789 $definitionIds = array();
791 foreach (
$_POST[
'src_pool_def_ids'] as $definitionId) {
792 $definitionId = (int) $definitionId;
794 if (!$definitionId) {
795 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
799 $definitionIds[] = $definitionId;
802 return $definitionIds;
807 $availablePools = $this->testOBJ->getAvailableQuestionpools(
809 $this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(),
815 if (isset($availablePools[$poolId])) {
816 $originalPoolData = $availablePools[$poolId];
818 $originalPoolData[
'qpl_path'] = $this->questionSetConfig->getQuestionPoolPathString($poolId);
819 $originalPoolData[
'qpl_ref_id'] = $this->questionSetConfig->getFirstQuestionPoolRefIdByObjId($poolId);
821 return $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByOriginalPoolData($originalPoolData);
824 require_once
'Modules/Test/exceptions/class.ilTestQuestionPoolNotAvailableAsSourcePoolException.php';
830 if (isset(
$_POST[
'derive_pool_ids']) && is_array(
$_POST[
'derive_pool_ids'])) {
833 foreach (
$_POST[
'derive_pool_ids'] as $poolId) {
834 $poolIds[] = (int) $poolId;
836 } elseif (isset(
$_GET[
'derive_pool_ids']) && preg_match(
'/^\d+(\:\d+)*$/',
$_GET[
'derive_pool_ids'])) {
837 $poolIds = explode(
':',
$_GET[
'derive_pool_ids']);
838 } elseif (isset(
$_GET[
'derive_pool_id']) && (
int)
$_GET[
'derive_pool_id']) {
839 $poolIds = array( (
int) $_GET[
'derive_pool_id'] );
847 if (isset(
$_GET[
'target_ref']) && (
int)
$_GET[
'target_ref']) {
848 return (
int) $_GET[
'target_ref'];
858 require_once
'Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php';
861 self::CMD_SELECT_DERIVATION_TARGET,
863 self::CMD_DERIVE_NEW_POOLS,
866 $explorer->setClickableTypes($this->objDefinition->getExplorerContainerTypes());
867 $explorer->setSelectableTypes(array());
869 if (!$explorer->handleCommand()) {
870 ilUtil::sendInfo($this->lng->txt(
'tst_please_select_target_for_pool_derives'));
871 $this->tpl->setContent($this->ctrl->getHTML($explorer));
880 if (count($poolIds)) {
881 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetPoolDeriver.php';
883 foreach ($poolIds as $poolId) {
884 $lostPool = $this->sourcePoolDefinitionList->getLostPool($poolId);
887 $deriver->setSourcePoolDefinitionList($this->sourcePoolDefinitionList);
888 $deriver->setTargetContainerRef($targetRef);
889 $deriver->setOwnerId(
$GLOBALS[
'DIC'][
'ilUser']->getId());
890 $newPool = $deriver->derive($lostPool);
892 $srcPoolDefinition = $this->sourcePoolDefinitionList->getDefinitionBySourcePoolId($newPool->getId());
893 $srcPoolDefinition->setPoolTitle($newPool->getTitle());
894 $srcPoolDefinition->setPoolPath($this->questionSetConfig->getQuestionPoolPathString($newPool->getId()));
895 $srcPoolDefinition->setPoolRefId($this->questionSetConfig->getFirstQuestionPoolRefIdByObjId((
int) $newPool->getId()));
896 $srcPoolDefinition->saveToDb();
899 $this->testOBJ->getTestId(),
905 ilUtil::sendSuccess($this->lng->txt(
'tst_non_available_pool_newly_derived'),
true);
908 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
916 return $this->lng->txt(
"tst_msg_random_question_set_config_modified");
924 return $this->lng->txt(
'tst_rnd_quest_cfg_tab_general');
932 return $this->lng->txt(
'tst_rnd_quest_cfg_tab_pool');
buildGeneralConfigFormGUI()
fetchMultiSourcePoolDefinitionIdsParameter()
buildNonAvailablePoolsTableGUI()
This class provides processing control methods.
saveEditSourcePoolDefinitionFormCmd()
saveSourcePoolDefinitionListCmd()
Explorer for selecting repository items.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
buildSourcePoolDefinitionListTableGUI()
showPoolSelectorExplorerCmd()
const CMD_SHOW_EDIT_SRC_POOL_DEF_FORM
const CMD_SAVE_AND_NEW_CREATE_SRC_POOL_DEF_FORM
getSourcePoolDefinitionByAvailableQuestionPoolId($poolId)
const CMD_SELECT_DERIVATION_TARGET
const CONTEXT_POOL_SELECTION
const CMD_DELETE_SINGLE_SRC_POOL_DEF
selectPoolDerivationTargetCmd()
isAvoidManipulationRedirectRequired()
fetchTargetRefParameter()
fetchQuestionPoolIdParameter()
Interface ilAccessHandler.
saveGeneralConfigFormCmd()
Administration class for plugins.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const CMD_SHOW_SRC_POOL_DEF_LIST
showEditSourcePoolDefinitionFormCmd(ilTestRandomQuestionSetPoolDefinitionFormGUI $form=null)
Exception for invalid parameters (e.g.
$configStateMessageHandler
deleteMultipleSourcePoolDefinitionsCmd()
if(isset($_POST['submit'])) $form
$sourcePoolDefinitionFactory
const CONTEXT_GENERAL_CONFIG
getGeneralConfigTabLabel()
special template class to simplify handling of ITX/PEAR
const CMD_SHOW_POOL_SELECTOR_EXPLORER
const CMD_SAVE_GENERAL_CONFIG_FORM
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CMD_SAVE_SRC_POOL_DEF_LIST
saveCreateSourcePoolDefinitionFormCmd($redirect_back_to_form=false)
buildEditSourcePoolDefinitionFormGUI()
fetchAfterRebuildQuestionStageCmdParameter()
buildSourcePoolDefinitionListToolbarGUI()
const CMD_SAVE_EDIT_SRC_POOL_DEF_FORM
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilLanguage $lng, ilTemplate $tpl, ilDBInterface $db, ilTree $tree, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
const HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD
const CMD_SHOW_GENERAL_CONFIG_FORM
fetchSingleSourcePoolDefinitionIdParameter()
saveCreateAndNewSourcePoolDefinitionFormCmd()
deleteSourcePoolDefinitions($definitionIds)
showSourcePoolDefinitionListCmd()
const CMD_SAVE_CREATE_SRC_POOL_DEF_FORM
if(empty($password)) $table
getGeneralModificationSuccessMessage()
buildCreateSourcePoolDefinitionFormGUI()
showGeneralConfigFormCmd(ilTestRandomQuestionSetGeneralConfigFormGUI $form=null)
showCreateSourcePoolDefinitionFormCmd(ilTestRandomQuestionSetPoolDefinitionFormGUI $form=null)
$sourcePoolDefinitionList
deleteSingleSourcePoolDefinitionCmd()
const CMD_SHOW_CREATE_SRC_POOL_DEF_FORM
static updateSourceQuestionPoolId($testId, $oldPoolId, $newPoolId)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
const CMD_DERIVE_NEW_POOLS
const CMD_DELETE_MULTI_SRC_POOL_DEFS
const CMD_BUILD_QUESTION_STAGE