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';
133 $this->objDefinition =
$GLOBALS[
'DIC'][
'objDefinition'];
137 $this->tree, $this->db, $this->pluginAdmin, $this->testOBJ
141 $this->db, $this->testOBJ
145 $this->db, $this->testOBJ, $this->sourcePoolDefinitionFactory
149 $this->db, $this->testOBJ
153 $this->lng, $this->ctrl
156 $this->configStateMessageHandler->setTargetGUI($this);
157 $this->configStateMessageHandler->setQuestionSetConfig($this->questionSetConfig);
158 $this->configStateMessageHandler->setParticipantDataExists($this->testOBJ->participantDataExist());
163 if (!$this->access->checkAccess(
"write",
"", $this->testOBJ->getRefId()))
166 $this->ctrl->redirectByClass(
'ilObjTestGUI',
"infoScreen");
171 ilUtil::sendFailure($this->lng->txt(
"tst_msg_cannot_modify_random_question_set_conf_due_to_part"),
true);
172 $this->ctrl->redirect($this);
177 $nextClass = $this->ctrl->getNextClass();
181 case 'iltestrandomquestionsetpooldefinitionformgui':
182 $this->questionSetConfig->loadFromDb();
187 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
189 $this->ctrl->forwardCommand($form);
194 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM).
'Cmd';
217 if( $this->testOBJ->participantDataExist() )
222 $this->sourcePoolDefinitionList->loadDefinitions();
224 if( $this->sourcePoolDefinitionList->hasLostPool() )
234 switch( $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM) )
236 case self::CMD_SAVE_GENERAL_CONFIG_FORM:
237 case self::CMD_SAVE_SRC_POOL_DEF_LIST:
238 case self::CMD_DELETE_SINGLE_SRC_POOL_DEF:
239 case self::CMD_DELETE_MULTI_SRC_POOL_DEFS:
240 case self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM:
241 case self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM:
242 case self::CMD_SAVE_AND_NEW_CREATE_SRC_POOL_DEF_FORM:
243 case self::CMD_BUILD_QUESTION_STAGE:
253 $this->tabs->activateTab(
'assQuestions');
255 $this->tabs->addSubTab(
256 'tstRandQuestSetGeneralConfig',
257 $this->lng->txt(
'tst_rnd_quest_cfg_tab_general'),
258 $this->ctrl->getLinkTarget($this, self::CMD_SHOW_GENERAL_CONFIG_FORM)
261 $this->tabs->addSubTab(
262 'tstRandQuestSetPoolConfig',
263 $this->lng->txt(
'tst_rnd_quest_cfg_tab_pool'),
264 $this->ctrl->getLinkTarget($this, self::CMD_SHOW_SRC_POOL_DEF_LIST)
267 switch( $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM) )
269 case self::CMD_SHOW_GENERAL_CONFIG_FORM:
270 case self::CMD_SAVE_GENERAL_CONFIG_FORM:
272 $this->tabs->activateSubTab(
'tstRandQuestSetGeneralConfig');
275 case self::CMD_SHOW_SRC_POOL_DEF_LIST:
276 case self::CMD_SAVE_SRC_POOL_DEF_LIST:
277 case self::CMD_DELETE_SINGLE_SRC_POOL_DEF:
278 case self::CMD_DELETE_MULTI_SRC_POOL_DEFS:
279 case self::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM:
280 case self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM:
281 case self::CMD_SHOW_EDIT_SRC_POOL_DEF_FORM:
282 case self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM:
284 $this->tabs->activateSubTab(
'tstRandQuestSetPoolConfig');
287 default: $this->tabs->activateSubTab(
'nonTab');
293 $this->sourcePoolDefinitionList->loadDefinitions();
294 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
295 $this->sourcePoolDefinitionList->saveDefinitions();
297 $this->questionSetConfig->loadFromDb();
298 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
299 $this->questionSetConfig->saveToDb();
301 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
309 if( !isset(
$_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD]) )
311 return self::CMD_SHOW_GENERAL_CONFIG_FORM;
314 if( !strlen(
$_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD]) )
316 return self::CMD_SHOW_GENERAL_CONFIG_FORM;
319 return $_GET[self::HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD];
326 $this->questionSetConfig->loadFromDb();
330 $this->tpl->setContent( $this->ctrl->getHTML($form) );
332 $this->configStateMessageHandler->setContext(
336 $this->configStateMessageHandler->setLostPools(
337 $this->sourcePoolDefinitionList->getLostPools()
340 $this->configStateMessageHandler->handle();
345 $this->questionSetConfig->loadFromDb();
349 $errors = !$form->checkInput();
350 $form->setValuesByPost();
359 $this->sourcePoolDefinitionList->loadDefinitions();
360 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
361 $this->sourcePoolDefinitionList->saveDefinitions();
363 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
364 $this->questionSetConfig->saveToDb();
366 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
369 $this->ctrl->redirect($this, self::CMD_SHOW_GENERAL_CONFIG_FORM);
374 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetGeneralConfigFormGUI.php';
377 $this->ctrl, $this->lng, $this->testOBJ, $this, $this->questionSetConfig
389 $this->questionSetConfig->loadFromDb();
390 $this->sourcePoolDefinitionList->loadDefinitions();
397 $content .= $this->ctrl->getHTML($toolbar);
401 $table->init( $this->sourcePoolDefinitionList);
402 $content .= $this->ctrl->getHTML($table);
404 if( !$this->sourcePoolDefinitionList->areAllUsedPoolsAvailable() )
407 $table->init($this->sourcePoolDefinitionList);
408 $content .= $this->ctrl->getHTML($table);
411 $this->tpl->setContent($content);
413 $this->configStateMessageHandler->setContext(
417 $this->configStateMessageHandler->setLostPools(
418 $this->sourcePoolDefinitionList->getLostPools()
421 $this->configStateMessageHandler->handle();
426 $this->questionSetConfig->loadFromDb();
430 $this->sourcePoolDefinitionList->loadDefinitions();
432 $table->applySubmit($this->sourcePoolDefinitionList);
434 $this->sourcePoolDefinitionList->reindexPositions();
435 $this->sourcePoolDefinitionList->saveDefinitions();
437 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
438 $this->sourcePoolDefinitionList->saveDefinitions();
440 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
441 $this->questionSetConfig->saveToDb();
443 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
446 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
451 require_once
'Modules/Test/classes/toolbars/class.ilTestRandomQuestionSetSourcePoolDefinitionListToolbarGUI.php';
454 $this->ctrl, $this->lng, $this, $this->questionSetConfig
464 require_once
'Modules/Test/classes/tables/class.ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI.php';
467 $this->ctrl, $this->lng, $this, self::CMD_SHOW_SRC_POOL_DEF_LIST
472 $table->setDefinitionEditModeEnabled(
true);
475 $table->setQuestionAmountColumnEnabled(
476 $this->questionSetConfig->isQuestionAmountConfigurationModePerPool()
479 require_once
'Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
481 $translater->loadLabels($this->sourcePoolDefinitionList);
482 $table->setTaxonomyFilterLabelTranslater($translater);
491 require_once
'Modules/Test/classes/tables/class.ilTestRandomQuestionSetNonAvailablePoolsTableGUI.php';
494 $this->ctrl, $this->lng, $this, self::CMD_SHOW_SRC_POOL_DEF_LIST
508 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
517 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
522 foreach($definitionIds as $definitionId)
524 $definition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($definitionId);
525 $definition->deleteFromDb();
528 $this->sourcePoolDefinitionList->loadDefinitions();
529 $this->sourcePoolDefinitionList->reindexPositions();
530 $this->sourcePoolDefinitionList->saveDefinitions();
532 $this->sourcePoolDefinitionList->loadDefinitions();
533 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
534 $this->sourcePoolDefinitionList->saveDefinitions();
537 $this->questionSetConfig->loadFromDb();
538 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
539 $this->questionSetConfig->saveToDb();
541 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
546 $this->questionSetConfig->loadFromDb();
556 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
559 $this->tpl->setContent( $this->ctrl->getHTML($form) );
572 $this->questionSetConfig->loadFromDb();
579 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
581 $errors = !$form->checkInput();
582 $form->setValuesByPost();
589 $form->applySubmit( $sourcePoolDefinition, $availableTaxonomyIds );
591 $this->sourcePoolDefinitionList->loadDefinitions();
592 $sourcePoolDefinition->setSequencePosition( $this->sourcePoolDefinitionList->getNextPosition() );
593 $sourcePoolDefinition->saveToDb();
594 $this->sourcePoolDefinitionList->addDefinition($sourcePoolDefinition);
596 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
597 $this->sourcePoolDefinitionList->saveDefinitions();
599 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
600 $this->questionSetConfig->saveToDb();
602 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
604 if($redirect_back_to_form)
607 $this->ctrl->setParameter($this,
'src_pool_def_id', $sourcePoolDefinition->getId());
608 $this->ctrl->setParameter($this,
'quest_pool_id', $sourcePoolDefinition->getPoolId());
609 $this->ctrl->redirect($this, self::CMD_SHOW_CREATE_SRC_POOL_DEF_FORM);
614 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
620 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php';
623 $this->ctrl, $this->lng, $this->testOBJ, $this, $this->questionSetConfig
626 $form->setSaveCommand(self::CMD_SAVE_CREATE_SRC_POOL_DEF_FORM);
627 $form->setSaveAndNewCommand(self::CMD_SAVE_AND_NEW_CREATE_SRC_POOL_DEF_FORM);
634 $this->questionSetConfig->loadFromDb();
637 $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId);
643 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
646 $this->tpl->setContent( $this->ctrl->getHTML($form) );
651 $this->questionSetConfig->loadFromDb();
654 $sourcePoolDefinition = $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByDefinitionId($defId);
658 $form->build($sourcePoolDefinition, $availableTaxonomyIds);
660 $errors = !$form->checkInput();
661 $form->setValuesByPost();
668 $form->applySubmit($sourcePoolDefinition, $availableTaxonomyIds);
670 $sourcePoolDefinition->saveToDb();
672 $this->sourcePoolDefinitionList->loadDefinitions();
673 $this->stagingPool->rebuild( $this->sourcePoolDefinitionList );
675 $this->questionSetConfig->setLastQuestionSyncTimestamp(
time());
676 $this->questionSetConfig->saveToDb();
678 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
681 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
686 require_once
'Modules/Test/classes/forms/class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php';
689 $this->ctrl, $this->lng, $this->testOBJ, $this, $this->questionSetConfig
692 $form->setSaveCommand(self::CMD_SAVE_EDIT_SRC_POOL_DEF_FORM);
699 if( isset(
$_POST[
'quest_pool_id']) && (
int)
$_POST[
'quest_pool_id'] )
701 return (
int)$_POST[
'quest_pool_id'];
704 if( isset(
$_GET[
'quest_pool_id']) && (
int)
$_GET[
'quest_pool_id'] )
706 return (
int)$_GET[
'quest_pool_id'];
709 require_once
'Modules/Test/exceptions/class.ilTestMissingQuestionPoolIdParameterException.php';
715 if( isset(
$_POST[
'src_pool_def_id']) && (
int)
$_POST[
'src_pool_def_id'] )
717 return (
int)$_POST[
'src_pool_def_id'];
720 if( isset(
$_GET[
'src_pool_def_id']) && (
int)
$_GET[
'src_pool_def_id'] )
722 return (
int)$_GET[
'src_pool_def_id'];
725 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
731 if( !isset(
$_POST[
'src_pool_def_ids']) || !is_array(
$_POST[
'src_pool_def_ids']) )
733 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
737 $definitionIds =
array();
739 foreach(
$_POST[
'src_pool_def_ids'] as $definitionId)
741 $definitionId = (int)$definitionId;
745 require_once
'Modules/Test/exceptions/class.ilTestMissingSourcePoolDefinitionParameterException.php';
749 $definitionIds[] = $definitionId;
752 return $definitionIds;
757 $availablePools = $this->testOBJ->getAvailableQuestionpools(
758 true, $this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired(),
false,
true, true
761 if( isset($availablePools[$poolId]) )
763 $originalPoolData = $availablePools[$poolId];
765 $originalPoolData[
'qpl_path'] = $this->questionSetConfig->getQuestionPoolPathString($poolId);
767 return $this->sourcePoolDefinitionFactory->getSourcePoolDefinitionByOriginalPoolData($originalPoolData);
770 require_once
'Modules/Test/exceptions/class.ilTestQuestionPoolNotAvailableAsSourcePoolException.php';
776 if( isset(
$_POST[
'derive_pool_ids']) && is_array(
$_POST[
'derive_pool_ids']) )
780 foreach(
$_POST[
'derive_pool_ids'] as $poolId)
782 $poolIds[] = (int)$poolId;
785 elseif( isset(
$_GET[
'derive_pool_ids']) && preg_match(
'/^\d+(\:\d+)*$/',
$_GET[
'derive_pool_ids']))
787 $poolIds = explode(
':',
$_GET[
'derive_pool_ids']);
789 elseif( isset(
$_GET[
'derive_pool_id']) && (
int)
$_GET[
'derive_pool_id'])
791 $poolIds =
array( (
int)$_GET[
'derive_pool_id'] );
799 if( isset(
$_GET[
'target_ref']) && (
int)
$_GET[
'target_ref'] )
801 return (
int)$_GET[
'target_ref'];
811 require_once
'Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php';
813 $this, self::CMD_SHOW_SRC_POOL_DEF_LIST, $this, self::CMD_DERIVE_NEW_POOLS,
'target_ref' 815 $explorer->setClickableTypes($this->objDefinition->getExplorerContainerTypes());
816 $explorer->setSelectableTypes(
array());
818 ilUtil::sendInfo($this->lng->txt(
'tst_please_select_target_for_pool_derives'));
820 $this->tpl->setContent($this->ctrl->getHTML($explorer));
828 if( count($poolIds) )
830 $this->sourcePoolDefinitionList->loadDefinitions();
832 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetPoolDeriver.php';
834 foreach($poolIds as $poolId)
836 $lostPool = $this->sourcePoolDefinitionList->getLostPool($poolId);
839 $deriver->setSourcePoolDefinitionList($this->sourcePoolDefinitionList);
840 $deriver->setTargetContainerRef($targetRef);
841 $deriver->setOwnerId(
$GLOBALS[
'DIC'][
'ilUser']->getId());
842 $newPool = $deriver->derive($lostPool);
844 $srcPoolDefinition = $this->sourcePoolDefinitionList->getDefinitionBySourcePoolId($newPool->getId());
845 $srcPoolDefinition->setPoolTitle($newPool->getTitle());
846 $srcPoolDefinition->setPoolPath($this->questionSetConfig->getQuestionPoolPathString($newPool->getId()));
847 $srcPoolDefinition->saveToDb();
850 $this->testOBJ->getTestId(), $lostPool->getId(), $newPool->getId()
857 $this->ctrl->redirect($this, self::CMD_SHOW_SRC_POOL_DEF_LIST);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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()
const CMD_SHOW_EDIT_SRC_POOL_DEF_FORM
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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()
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()
$sourcePoolDefinitionFactory
const CONTEXT_GENERAL_CONFIG
special template class to simplify handling of ITX/PEAR
const CMD_SAVE_GENERAL_CONFIG_FORM
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
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
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
buildCreateSourcePoolDefinitionFormGUI()
showGeneralConfigFormCmd(ilTestRandomQuestionSetGeneralConfigFormGUI $form=null)
showCreateSourcePoolDefinitionFormCmd(ilTestRandomQuestionSetPoolDefinitionFormGUI $form=null)
$sourcePoolDefinitionList
deleteSingleSourcePoolDefinitionCmd()
const CMD_SHOW_CREATE_SRC_POOL_DEF_FORM
static updateSourceQuestionPoolId($testId, $oldPoolId, $newPoolId)
const CMD_DERIVE_NEW_POOLS
const CMD_DELETE_MULTI_SRC_POOL_DEFS
const CMD_BUILD_QUESTION_STAGE