3 declare(strict_types=0);
64 $this->main_tpl = $DIC->ui()->mainTemplate();
65 $this->parent_obj = $a_parent_obj;
68 $cs = $DIC->contentStyle();
69 $this->content_style_domain = $cs->domain()->styleForRefId($this->parent_obj->getRefId());
71 $this->
lng = $DIC->language();
72 $this->
ctrl = $DIC->ctrl();
73 $this->tpl = $DIC->ui()->mainTemplate();
74 $this->
tabs = $DIC->tabs();
75 $this->
toolbar = $DIC->toolbar();
76 $this->
logger = $DIC->logger()->crs();
77 $this->
http = $DIC->http();
83 $next_class = $this->
ctrl->getNextClass($this);
84 $cmd = $this->
ctrl->getCmd();
87 switch ($next_class) {
88 case 'ilcourseobjectivesgui':
90 $this->
ctrl->setReturn($this,
'returnFromObjectives');
91 $this->
tabs->clearTargets();
92 $this->
tabs->setBackTarget(
93 $this->
lng->txt(
'back'),
94 $this->
ctrl->getLinkTarget($this,
'listObjectives')
98 $this->
ctrl->forwardCommand($reg_gui);
101 case 'ilcontainerstartobjectsgui':
104 $ret = $this->
ctrl->forwardCommand($stgui);
106 $this->
tabs->activateSubTab(
'start');
107 $this->
tabs->removeSubTab(
'manage');
110 case 'ilconditionhandlergui':
112 $this->
ctrl->saveParameterByClass(
'ilconditionhandlergui',
'objective_id');
114 $this->
tabs->clearTargets();
115 $this->
tabs->setBackTarget(
116 $this->
lng->txt(
'back'),
117 $this->
ctrl->getLinkTarget($this,
'listObjectives')
121 $cond->setBackButtons(array());
122 $cond->setAutomaticValidation(
false);
123 $cond->setTargetType(
"lobj");
129 $cond->setTargetTitle($obj->getTitle());
130 $this->
ctrl->forwardCommand($cond);
134 $this->
ctrl->saveParameterByClass(
'illopagegui',
'objective_id');
136 $this->
tabs->clearTargets();
137 $this->
tabs->setBackTarget(
138 $this->
lng->txt(
'back'),
139 $this->
ctrl->getLinkTarget($this,
'listObjectives')
147 $new_page_object->setParentId($objtv_id);
148 $new_page_object->setId($objtv_id);
149 $new_page_object->createFromXML();
150 unset($new_page_object);
153 $this->
ctrl->setReturn($this,
'listObjectives');
157 $pgui->setStyleId($this->content_style_domain->getEffectiveStyleId());
160 $this->tpl->setCurrentBlock(
"ContentStyle");
161 $this->tpl->setVariable(
162 "LOCATION_CONTENT_STYLESHEET",
165 $this->tpl->parseCurrentBlock();
167 $ret = $this->
ctrl->forwardCommand($pgui);
169 $this->tpl->setContent($ret);
186 if ($this->
http->wrapper()->query()->has(
'objective_id')) {
187 return $this->
http->wrapper()->query()->retrieve(
197 if ($this->
http->wrapper()->post()->has(
'objective')) {
198 return $this->
http->wrapper()->post()->retrieve(
200 $this->
refinery->kindlyTo()->listOf(
210 if ($this->
http->wrapper()->query()->has(
'tt')) {
211 return $this->
http->wrapper()->query()->retrieve(
237 $this->test_type = $a_type;
250 $this->
tabs->activateSubTab(
'settings');
251 $this->tpl->setContent($form->getHTML());
258 foreach ($assignments->getAssignmentsByType($a_type) as $assignment) {
259 $assignment->delete();
298 if ($form->checkInput()) {
342 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'crs_loc_settings_err_qstart'),
true);
351 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
352 $this->
ctrl->redirect($this,
'settings');
356 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
357 $form->setValuesByPost();
367 $form->setFormAction($this->
ctrl->getFormAction($this));
368 $form->setTitle($this->
lng->txt(
'crs_loc_settings_tbl'));
373 $type_selector->setValue((
string) $this->
getSettings()->getInitialTestType());
376 $this->
lng->txt(
'crs_loc_settings_type_it_placement_all'),
379 $type_ipa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_all_info'));
380 $type_selector->addOption($type_ipa);
384 $start_ip->setChecked($this->
getSettings()->isInitialTestStart());
385 $type_ipa->addSubItem($start_ip);
388 $this->
lng->txt(
'crs_loc_settings_type_it_placement_sel'),
391 $type_ips->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_sel_info'));
392 $type_selector->addOption($type_ips);
395 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all'),
398 $type_iqa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all_info'));
399 $type_selector->addOption($type_iqa);
403 $start_iq->setChecked($this->
getSettings()->isInitialTestStart());
404 $type_iqa->addSubItem($start_iq);
407 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel'),
410 $type_iqs->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel_info'));
411 $type_selector->addOption($type_iqs);
414 $this->
lng->txt(
'crs_loc_settings_type_it_none'),
417 $type_ino->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_none_info'));
418 $type_selector->addOption($type_ino);
420 $form->addItem($type_selector);
425 $qt_selector->setValue((
string) $this->
getSettings()->getQualifyingTestType());
428 $this->
lng->txt(
'crs_loc_settings_type_q_all'),
431 $type_qa->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_all_info'));
432 $qt_selector->addOption($type_qa);
436 $start_q->setChecked($this->
getSettings()->isQualifyingTestStart());
437 $type_qa->addSubItem($start_q);
444 $passed_mode->addOption(
446 $this->
lng->txt(
'crs_loc_settings_passed_mode_hide'),
450 $passed_mode->addOption(
452 $this->
lng->txt(
'crs_loc_settings_passed_mode_mark'),
456 $type_qa->addSubItem($passed_mode);
459 $this->
lng->txt(
'crs_loc_settings_type_q_selected'),
462 $type_qs->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_selected_info'));
463 $qt_selector->addOption($type_qs);
465 $form->addItem($qt_selector);
470 $reset->setChecked($this->
getSettings()->isResetResultsEnabled());
471 $reset->setOptionTitle($this->
lng->txt(
'crs_loc_settings_reset_enable'));
472 $reset->setInfo($this->
lng->txt(
'crs_loc_settings_reset_enable_info'));
473 $form->addItem($reset);
475 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
481 $this->
tabs->activateSubTab(
'materials');
484 $gui->setDisabledObjectTypes(array(
"itgr"));
485 #$gui->setAfterCreationCallback($this->getParentObject()->getRefId()); 488 $this->tpl->setOnScreenMessage(
490 $this->
lng->txt(
'crs_objective_status_materials_info')
503 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
505 $this->
lng->txt(
'crs_loc_btn_new_assignment'),
506 $this->
ctrl->getLinkTarget($this,
'testAssignment')
512 $this->
tabs->activateSubTab(
'itests');
516 $this->
tabs->activateSubTab(
'qtests');
529 $table->parseMultipleAssignments();
530 $this->tpl->setContent($table->getHTML());
538 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
568 $this->
tabs->activateSubTab(
'itest');
572 $this->
tabs->activateSubTab(
'qtest');
591 $this->tpl->setContent($table->getHTML());
599 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
627 $this->
tabs->activateSubTab(
'itests');
631 $this->
tabs->activateSubTab(
'qtests');
636 if ($this->
http->wrapper()->post()->has(
'tst')) {
637 $tests = $this->
http->wrapper()->post()->retrieve(
639 $this->
refinery->kindlyTo()->listOf(
644 if (!count($tests)) {
645 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
646 $this->
ctrl->redirect($this,
'testsOverview');
649 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
650 $confirm->setFormAction($this->
ctrl->getFormAction($this));
651 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTests');
652 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testsOverview');
653 foreach ($tests as $assign_id) {
660 $this->tpl->setContent($confirm->getHTML());
680 $this->
tabs->activateSubTab(
'itest');
684 $this->
tabs->activateSubTab(
'qtest');
689 if ($this->
http->wrapper()->post()->has(
'tst')) {
690 $tests = $this->
http->wrapper()->post()->retrieve(
692 $this->
refinery->kindlyTo()->listOf(
697 if (count($tests) === 0) {
698 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
699 $this->
ctrl->redirect($this,
'testOverview');
703 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
704 $confirm->setFormAction($this->
ctrl->getFormAction($this));
705 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTest');
706 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testOverview');
708 foreach ($tests as $tst_id) {
712 $this->tpl->setContent($confirm->getHTML());
729 $this->
tabs->activateSubTab(
'itests');
733 $this->
tabs->activateSubTab(
'qtests');
738 if ($this->
http->wrapper()->post()->has(
'tst')) {
739 $tests = $this->
http->wrapper()->post()->retrieve(
741 $this->
refinery->kindlyTo()->listOf(
746 foreach ($tests as $assign_id) {
748 $assignment->delete();
755 $start->deleteItem($assignment->getTestRefId());
761 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
762 $this->
ctrl->redirect($this,
'testsOverview');
773 $this->
tabs->activateSubTab(
'itest');
777 $this->
tabs->activateSubTab(
'qtest');
782 if ($this->
http->wrapper()->post()->has(
'tst')) {
783 $tests = $this->
http->wrapper()->post()->retrieve(
785 $this->
refinery->kindlyTo()->listOf(
790 foreach ($tests as $tst_id) {
807 $start->deleteItem($tst_id);
813 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
814 $this->
ctrl->redirect($this,
'testOverview');
826 $this->
tabs->activateSubTab(
'itests');
830 $this->
tabs->activateSubTab(
'qtests');
835 $form = $form_helper->initForm(
true);
837 $this->tpl->setContent($form->getHTML());
851 $this->
tabs->activateSubTab(
'itest');
855 $this->
tabs->activateSubTab(
'qtest');
861 $form = $form_helper->initForm(
false);
863 $this->tpl->setContent($form->getHTML());
877 case self::TEST_TYPE_IT:
878 if ($template[
'title'] == self::SETTINGS_TEMPLATE_IT) {
879 $tpl_id = $template[
'id'];
882 case self::TEST_TYPE_QT:
883 if ($template[
'title'] == self::SETTINGS_TEMPLATE_QT) {
884 $tpl_id = $template[
'id'];
898 $template_settings = $template->getSettings();
899 if ($template_settings !== []) {
901 $tst_gui->applyTemplate($template_settings, $tst);
921 $form = $form_helper->initForm(
true);
923 if ($form->checkInput()) {
924 $mode = $form->getInput(
'mode');
926 if ($mode == self::TEST_NEW) {
928 $tst->setType(
'tst');
929 $tst->setTitle($form->getInput(
'title'));
930 $tst->setDescription($form->getInput(
'desc'));
933 $tst->createReference();
940 $tst->setQuestionSetType($form->getInput(
'qtype'));
946 $assignment->setAssignmentType($this->
getTestType());
947 $assignment->setObjectiveId($form->getInput(
'objective'));
948 $assignment->setTestRefId($tst->getRefId());
953 $assignment->setAssignmentType($this->
getTestType());
954 $assignment->setObjectiveId($form->getInput(
'objective'));
955 $assignment->setTestRefId($form->getInput(
'tst'));
958 $tst =
new ilObjTest($form->getInput(
'tst'),
true);
969 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
970 $this->
ctrl->redirect($this,
'testsOverview');
974 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
975 $form->setValuesByPost();
983 foreach ($materials->getMaterials() as $material) {
984 if ($material[
'ref_id'] == $test->
getRefId()) {
985 $materials->delete($material[
'lm_ass_id']);
999 $form = $form_helper->initForm(
false);
1001 if ($form->checkInput()) {
1002 $mode = $form->getInput(
'mode');
1004 if ($mode == self::TEST_NEW) {
1006 $tst->setType(
'tst');
1007 $tst->setTitle($form->getInput(
'title'));
1008 $tst->setDescription($form->getInput(
'desc'));
1011 $tst->createReference();
1018 $tst->setQuestionSetType($form->getInput(
'qtype'));
1023 $this->
getSettings()->setInitialTest($tst->getRefId());
1025 $this->
getSettings()->setQualifiedTest($tst->getRefId());
1030 $this->
getSettings()->setInitialTest($form->getInput(
'tst'));
1032 $this->
getSettings()->setQualifiedTest($form->getInput(
'tst'));
1047 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
1048 $this->
ctrl->redirect($this,
'testOverview');
1052 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
1053 $form->setValuesByPost();
1060 $this->
tabs->activateSubTab(
'objectives');
1073 $this->
lng->txt(
'crs_add_objective'),
1074 $this->
ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
"create")
1078 $table->setTitle($this->
lng->txt(
'crs_objectives'),
'', $this->
lng->txt(
'crs_objectives'));
1080 $this->tpl->setContent($table->getHTML());
1087 $this->
tabs->activateSubTab(
'objectives');
1091 $this->tpl->setContent($form->getHTML());
1098 $form->setTitle($this->
lng->txt(
'crs_loc_form_create_objectives'));
1099 $form->setFormAction($this->
ctrl->getFormAction($this));
1102 $txt->setValues(array(0 =>
''));
1103 $txt->setRequired(
true);
1104 $form->addItem(
$txt);
1106 $form->addCommandButton(
'saveObjectiveCreation', $this->
lng->txt(
'save'));
1113 if ($form->checkInput()) {
1114 foreach ((array) $form->getInput(
'objectives') as $title) {
1116 $obj->setActive(
true);
1117 $obj->setTitle($title);
1120 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1121 $this->
ctrl->redirect($this,
'');
1124 $form->setValuesByPost();
1125 $this->
tabs->activateSubTab(
'objectives');
1132 $post_position = $this->
http->wrapper()->post()->retrieve(
1134 $this->
refinery->kindlyTo()->dictOf(
1135 $this->
refinery->kindlyTo()->string()
1138 asort($post_position, SORT_NUMERIC);
1140 foreach ($post_position as $objective_id => $position) {
1142 $objective->writePosition($counter++);
1144 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objective_saved_sorting'));
1150 $this->
tabs->activateSubTab(
'objectives');
1153 $confirm->setFormAction($this->
ctrl->getFormAction($this));
1154 $confirm->setHeaderText($this->
lng->txt(
'crs_delete_objectve_sure'));
1155 $confirm->setConfirm($this->
lng->txt(
'delete'),
'deleteObjectives');
1156 $confirm->setCancel($this->
lng->txt(
'cancel'),
'listObjectives');
1158 $objective_ids = [];
1159 if ($this->
http->wrapper()->post()->has(
'objective')) {
1160 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1162 $this->
refinery->kindlyTo()->dictOf(
1167 foreach ($objective_ids as $objective_id) {
1169 $name = $obj->getTitle();
1177 $this->tpl->setContent($confirm->getHTML());
1187 if (in_array($objective_id,
$enabled)) {
1188 $objective->setActive(
true);
1189 $objective->update();
1193 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1194 $this->
ctrl->redirect($this,
'listObjectives');
1203 if (in_array($objective_id, $disabled)) {
1204 $objective->setActive(
false);
1205 $objective->update();
1209 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1210 $this->
ctrl->redirect($this,
'listObjectives');
1215 $objective_ids = [];
1216 if ($this->
http->wrapper()->post()->has(
'objective_ids')) {
1217 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1219 $this->
refinery->kindlyTo()->dictOf(
1224 foreach ($objective_ids as $objective_id) {
1226 $objective_obj->delete();
1229 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objectives_deleted'),
true);
1230 $this->
ctrl->redirect($this,
'listObjectives');
1236 $status->setSection($a_section);
1237 $status->setCmdClass($this);
1238 $this->tpl->setRightContent($status->getHTML());
1241 protected function setTabs(
string $a_section =
''): void
1244 $this->
tabs->addSubTab(
1246 $this->
lng->txt(
'settings'),
1247 $this->
ctrl->getLinkTarget($this,
'settings')
1250 $this->
tabs->addSubTab(
1252 $this->
lng->txt(
'crs_loc_tab_objectives'),
1253 $this->
ctrl->getLinkTarget($this,
'listObjectives')
1264 $this->
tabs->addSubTab(
1266 $this->
lng->txt(
'crs_loc_tab_itest'),
1267 $this->
ctrl->getLinkTarget($this,
'testOverview')
1271 $this->
tabs->addSubTab(
1273 $this->
lng->txt(
'crs_loc_tab_itests'),
1274 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1281 $this->
tabs->addSubTab(
1283 $this->
lng->txt(
'crs_loc_tab_qtest'),
1284 $this->
ctrl->getLinkTarget($this,
'testOverview')
1288 $this->
tabs->addSubTab(
1290 $this->
lng->txt(
'crs_loc_tab_qtests'),
1291 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1296 $this->
tabs->addSubTab(
1298 $this->
lng->txt(
'crs_loc_tab_start'),
1299 $this->
ctrl->getLinkTargetByClass(
'ilcontainerstartobjectsgui',
'')
1304 #ilMemberViewGUI::showMemberViewSwitch($this->getParentObject()->getRefId());
static getSettingsTemplateConfig()
Interface GlobalHttpState.
worksWithInitialTest()
Check if the loc is configured for initial tests.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testOverview()
Show test overview.
setInitialTestAsStart(bool $a_type)
initObjectiveIdFromQuery()
class ilConditionHandlerGUI
initObjectiveIdsFromPost()
ilGlobalTemplateInterface $main_tpl
const TYPE_INITIAL_QUALIFYING_SELECTED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveMultiTestAssignment()
confirmDeleteTest()
Show delete confirmation screen.
getTestByType(int $a_type)
Presentation of the status of single steps during the configuration process.
settings(?ilPropertyFormGUI $form=null)
const TYPE_MULTIPLE_ASSIGNMENTS
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
External facade for object content styles.
const TYPE_QUALIFYING_ALL
setTabs(string $a_section='')
initSettingsForm()
Init settings form.
setQualifyingTestType(int $a_type)
setInitialTest(int $a_id)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
showStatus(int $a_section)
showObjectiveCreation(ilPropertyFormGUI $form=null)
initSimpleObjectiveForm()
const HIDE_PASSED_OBJECTIVE_QST
const SETTINGS_TEMPLATE_QT
static _lookupObjId(int $ref_id)
class ilCourseObjectiveMaterials
testSettings(ilPropertyFormGUI $form=null)
ilGlobalTemplateInterface $tpl
static http()
Fetches the global http state from ILIAS.
class ilobjcourseobjectivesgui
updateTestAssignments(ilLOSettings $settings)
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilObject $a_parent)
setTemplate($template_id)
const MARK_PASSED_OBJECTIVE_QST
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateMaterialAssignments(ilObjTest $test)
resetResults(bool $a_status)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
__construct(ilObject $a_parent_obj)
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
const SECTION_OBJECTIVES_NEW
static getAllSettingsTemplates(string $a_type, bool $a_include_auto_generated=false)
Get all settings templates of type.
static getInstanceByObjId(int $a_obj_id)
deleteAssignments(int $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setPassedObjectiveMode(int $a_mode)
const TEST_TYPE_UNDEFINED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setQualifyingTestAsStart(bool $a_type)
static getInstance(int $a_container_id)
ObjectFacade $content_style_domain
const TYPE_INITIAL_QUALIFYING_ALL
const TYPE_TEST_QUALIFIED
const TYPE_INITIAL_PLACEMENT_ALL
const TYPE_QUALIFYING_SELECTED
static deleteTest(int $a_tst_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
confirmDeleteTests()
Show delete test confirmation.
testAssignment(ilPropertyFormGUI $form=null)
worksWithStartObjects()
Check if start objects are enabled.
applySettingsTemplate(ilObjTest $tst)
const TYPE_TEST_UNDEFINED
static set(string $a_var, $a_val)
Set a value.
Settings template application class.
Class ilContainerStartObjectsGUI.
const SETTINGS_TEMPLATE_IT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInitialTestType(int $a_type)
setQualifiedTest(int $a_id)
const TYPE_INITIAL_PLACEMENT_SELECTED