19 declare(strict_types=1);
61 $this->main_tpl = $DIC->ui()->mainTemplate();
62 $this->parent_obj = $a_parent_obj;
65 $cs = $DIC->contentStyle();
66 $this->content_style_domain = $cs->domain()->styleForRefId($this->parent_obj->getRefId());
68 $this->
lng = $DIC->language();
69 $this->
ctrl = $DIC->ctrl();
70 $this->tpl = $DIC->ui()->mainTemplate();
71 $this->
tabs = $DIC->tabs();
72 $this->
toolbar = $DIC->toolbar();
73 $this->
logger = $DIC->logger()->crs();
74 $this->
http = $DIC->http();
80 $next_class = $this->
ctrl->getNextClass($this);
81 $cmd = $this->
ctrl->getCmd();
84 switch ($next_class) {
85 case 'ilcourseobjectivesgui':
87 $this->
ctrl->setReturn($this,
'returnFromObjectives');
88 $this->
tabs->clearTargets();
89 $this->
tabs->setBackTarget(
90 $this->
lng->txt(
'back'),
91 $this->
ctrl->getLinkTarget($this,
'listObjectives')
95 $this->
ctrl->forwardCommand($reg_gui);
98 case 'ilcontainerstartobjectsgui':
101 $ret = $this->
ctrl->forwardCommand($stgui);
103 $this->
tabs->activateSubTab(
'start');
104 $this->
tabs->removeSubTab(
'manage');
107 case 'ilconditionhandlergui':
109 $this->
ctrl->saveParameterByClass(
'ilconditionhandlergui',
'objective_id');
111 $this->
tabs->clearTargets();
112 $this->
tabs->setBackTarget(
113 $this->
lng->txt(
'back'),
114 $this->
ctrl->getLinkTarget($this,
'listObjectives')
118 $cond->setBackButtons(array());
119 $cond->setAutomaticValidation(
false);
120 $cond->setTargetType(
"lobj");
126 $cond->setTargetTitle($obj->getTitle());
127 $this->
ctrl->forwardCommand($cond);
131 $this->
ctrl->saveParameterByClass(
'illopagegui',
'objective_id');
133 $this->
tabs->clearTargets();
134 $this->
tabs->setBackTarget(
135 $this->
lng->txt(
'back'),
136 $this->
ctrl->getLinkTarget($this,
'listObjectives')
144 $new_page_object->setParentId($objtv_id);
145 $new_page_object->setId($objtv_id);
146 $new_page_object->createFromXML();
147 unset($new_page_object);
150 $this->
ctrl->setReturn($this,
'listObjectives');
154 $pgui->setStyleId($this->content_style_domain->getEffectiveStyleId());
157 $this->tpl->setCurrentBlock(
"ContentStyle");
158 $this->tpl->setVariable(
159 "LOCATION_CONTENT_STYLESHEET",
162 $this->tpl->parseCurrentBlock();
164 $ret = $this->
ctrl->forwardCommand($pgui);
166 $this->tpl->setContent($ret);
183 if ($this->
http->wrapper()->query()->has(
'objective_id')) {
184 return $this->
http->wrapper()->query()->retrieve(
194 if ($this->
http->wrapper()->post()->has(
'objective')) {
195 return $this->
http->wrapper()->post()->retrieve(
197 $this->
refinery->kindlyTo()->listOf(
207 if ($this->
http->wrapper()->query()->has(
'tt')) {
208 return $this->
http->wrapper()->query()->retrieve(
234 $this->test_type = $a_type;
247 $this->
tabs->activateSubTab(
'settings');
248 $this->tpl->setContent($form->getHTML());
255 foreach ($assignments->getAssignmentsByType($a_type) as $assignment) {
256 $assignment->delete();
295 if ($form->checkInput()) {
331 $settings->
resetResults((
bool) $form->getInput(
'reset'));
339 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'crs_loc_settings_err_qstart'),
true);
348 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
349 $this->
ctrl->redirect($this,
'settings');
353 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
354 $form->setValuesByPost();
364 $form->setFormAction($this->
ctrl->getFormAction($this));
365 $form->setTitle($this->
lng->txt(
'crs_loc_settings_tbl'));
370 $type_selector->setValue((
string) $this->
getSettings()->getInitialTestType());
373 $this->
lng->txt(
'crs_loc_settings_type_it_placement_all'),
376 $type_ipa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_all_info'));
377 $type_selector->addOption($type_ipa);
380 $start_ip->setValue((
string) 1);
381 $start_ip->setChecked($this->
getSettings()->isInitialTestStart());
382 $type_ipa->addSubItem($start_ip);
385 $this->
lng->txt(
'crs_loc_settings_type_it_placement_sel'),
388 $type_ips->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_sel_info'));
389 $type_selector->addOption($type_ips);
392 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all'),
395 $type_iqa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all_info'));
396 $type_selector->addOption($type_iqa);
399 $start_iq->setValue(
'1');
400 $start_iq->setChecked($this->
getSettings()->isInitialTestStart());
401 $type_iqa->addSubItem($start_iq);
404 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel'),
407 $type_iqs->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel_info'));
408 $type_selector->addOption($type_iqs);
411 $this->
lng->txt(
'crs_loc_settings_type_it_none'),
414 $type_ino->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_none_info'));
415 $type_selector->addOption($type_ino);
417 $form->addItem($type_selector);
422 $qt_selector->setValue((
string) $this->
getSettings()->getQualifyingTestType());
425 $this->
lng->txt(
'crs_loc_settings_type_q_all'),
428 $type_qa->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_all_info'));
429 $qt_selector->addOption($type_qa);
432 $start_q->setValue(
'1');
433 $start_q->setChecked($this->
getSettings()->isQualifyingTestStart());
434 $type_qa->addSubItem($start_q);
441 $passed_mode->addOption(
443 $this->
lng->txt(
'crs_loc_settings_passed_mode_hide'),
447 $passed_mode->addOption(
449 $this->
lng->txt(
'crs_loc_settings_passed_mode_mark'),
453 $type_qa->addSubItem($passed_mode);
456 $this->
lng->txt(
'crs_loc_settings_type_q_selected'),
459 $type_qs->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_selected_info'));
460 $qt_selector->addOption($type_qs);
462 $form->addItem($qt_selector);
466 $reset->setValue(
'1');
467 $reset->setChecked($this->
getSettings()->isResetResultsEnabled());
468 $reset->setOptionTitle($this->
lng->txt(
'crs_loc_settings_reset_enable'));
469 $reset->setInfo($this->
lng->txt(
'crs_loc_settings_reset_enable_info'));
470 $form->addItem($reset);
472 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
478 $this->
tabs->activateSubTab(
'materials');
481 $gui->setDisabledObjectTypes(array(
"itgr"));
482 #$gui->setAfterCreationCallback($this->getParentObject()->getRefId()); 485 $this->tpl->setOnScreenMessage(
487 $this->
lng->txt(
'crs_objective_status_materials_info')
500 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
502 $this->
lng->txt(
'crs_loc_btn_new_assignment'),
503 $this->
ctrl->getLinkTarget($this,
'testAssignment')
509 $this->
tabs->activateSubTab(
'itests');
513 $this->
tabs->activateSubTab(
'qtests');
526 $table->parseMultipleAssignments();
527 $this->tpl->setContent($table->getHTML());
535 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
565 $this->
tabs->activateSubTab(
'itest');
569 $this->
tabs->activateSubTab(
'qtest');
588 $this->tpl->setContent($table->getHTML());
596 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
624 $this->
tabs->activateSubTab(
'itests');
628 $this->
tabs->activateSubTab(
'qtests');
633 if ($this->
http->wrapper()->post()->has(
'tst')) {
634 $tests = $this->
http->wrapper()->post()->retrieve(
636 $this->
refinery->kindlyTo()->listOf(
641 if (!count($tests)) {
642 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
643 $this->
ctrl->redirect($this,
'testsOverview');
646 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
647 $confirm->setFormAction($this->
ctrl->getFormAction($this));
648 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTests');
649 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testsOverview');
650 foreach ($tests as $assign_id) {
657 $this->tpl->setContent($confirm->getHTML());
677 $this->
tabs->activateSubTab(
'itest');
681 $this->
tabs->activateSubTab(
'qtest');
686 if ($this->
http->wrapper()->post()->has(
'tst')) {
687 $tests = $this->
http->wrapper()->post()->retrieve(
689 $this->
refinery->kindlyTo()->listOf(
694 if (count($tests) === 0) {
695 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
696 $this->
ctrl->redirect($this,
'testOverview');
700 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
701 $confirm->setFormAction($this->
ctrl->getFormAction($this));
702 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTest');
703 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testOverview');
705 foreach ($tests as $tst_id) {
709 $this->tpl->setContent($confirm->getHTML());
726 $this->
tabs->activateSubTab(
'itests');
730 $this->
tabs->activateSubTab(
'qtests');
735 if ($this->
http->wrapper()->post()->has(
'tst')) {
736 $tests = $this->
http->wrapper()->post()->retrieve(
738 $this->
refinery->kindlyTo()->listOf(
743 foreach ($tests as $assign_id) {
745 $assignment->delete();
752 $start->deleteItem($assignment->getTestRefId());
758 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
759 $this->
ctrl->redirect($this,
'testsOverview');
770 $this->
tabs->activateSubTab(
'itest');
774 $this->
tabs->activateSubTab(
'qtest');
779 if ($this->
http->wrapper()->post()->has(
'tst')) {
780 $tests = $this->
http->wrapper()->post()->retrieve(
782 $this->
refinery->kindlyTo()->listOf(
787 foreach ($tests as $tst_id) {
804 $start->deleteItem($tst_id);
810 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
811 $this->
ctrl->redirect($this,
'testOverview');
823 $this->
tabs->activateSubTab(
'itests');
827 $this->
tabs->activateSubTab(
'qtests');
832 $form = $form_helper->initForm(
true);
834 $this->tpl->setContent($form->getHTML());
848 $this->
tabs->activateSubTab(
'itest');
852 $this->
tabs->activateSubTab(
'qtest');
858 $form = $form_helper->initForm(
false);
860 $this->tpl->setContent($form->getHTML());
883 $form = $form_helper->initForm(
true);
885 if ($form->checkInput()) {
886 $mode = $form->getInput(
'mode');
888 if ($mode == self::TEST_NEW) {
890 $tst->setType(
'tst');
891 $tst->setTitle($form->getInput(
'title'));
892 $tst->setDescription($form->getInput(
'desc'));
895 $tst->createReference();
898 $general_settings = $tst->getMainSettings()->getGeneralSettings()->withQuestionSetType($form->getInput(
'qtype'));
899 $tst->getMainSettingsRepository()->store(
900 $tst->getMainSettings()->withGeneralSettings($general_settings)
905 $assignment->setAssignmentType($this->
getTestType());
906 $assignment->setObjectiveId((
int) $form->getInput(
'objective'));
907 $assignment->setTestRefId($tst->getRefId());
912 $assignment->setAssignmentType($this->
getTestType());
913 $assignment->setObjectiveId((
int) $form->getInput(
'objective'));
914 $assignment->setTestRefId((
int) $form->getInput(
'tst'));
917 $tst =
new ilObjTest((
int) $form->getInput(
'tst'),
true);
927 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
928 $this->
ctrl->redirect($this,
'testsOverview');
932 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
933 $form->setValuesByPost();
941 foreach ($materials->getMaterials() as $material) {
942 if ($material[
'ref_id'] == $test->
getRefId()) {
943 $materials->delete($material[
'lm_ass_id']);
957 $form = $form_helper->initForm(
false);
959 if ($form->checkInput()) {
960 $mode = $form->getInput(
'mode');
962 if ($mode == self::TEST_NEW) {
964 $tst->setType(
'tst');
965 $tst->setTitle($form->getInput(
'title'));
966 $tst->setDescription($form->getInput(
'desc'));
969 $tst->createReference();
972 $general_settings = $tst->getMainSettings()->getGeneralSettings()->withQuestionSetType($form->getInput(
'qtype'));
973 $tst->getMainSettingsRepository()->store(
974 $tst->getMainSettings()->withGeneralSettings($general_settings)
978 $this->
getSettings()->setInitialTest($tst->getRefId());
980 $this->
getSettings()->setQualifiedTest($tst->getRefId());
985 $this->
getSettings()->setInitialTest((
int) $form->getInput(
'tst'));
987 $this->
getSettings()->setQualifiedTest((
int) $form->getInput(
'tst'));
1001 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
1002 $this->
ctrl->redirect($this,
'testOverview');
1006 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
1007 $form->setValuesByPost();
1014 $this->
tabs->activateSubTab(
'objectives');
1027 $this->
lng->txt(
'crs_add_objective'),
1028 $this->
ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
"create")
1032 $table->setTitle($this->
lng->txt(
'crs_objectives'),
'', $this->
lng->txt(
'crs_objectives'));
1034 $this->tpl->setContent($table->getHTML());
1041 $this->
tabs->activateSubTab(
'objectives');
1045 $this->tpl->setContent($form->getHTML());
1052 $form->setTitle($this->
lng->txt(
'crs_loc_form_create_objectives'));
1053 $form->setFormAction($this->
ctrl->getFormAction($this));
1056 $txt->setValues(array(0 =>
''));
1057 $txt->setRequired(
true);
1058 $form->addItem(
$txt);
1060 $form->addCommandButton(
'saveObjectiveCreation', $this->
lng->txt(
'save'));
1067 if ($form->checkInput()) {
1068 foreach ((array) $form->getInput(
'objectives') as $title) {
1070 $obj->setActive(
true);
1071 $obj->setTitle($title);
1074 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1075 $this->
ctrl->redirect($this,
'');
1078 $form->setValuesByPost();
1079 $this->
tabs->activateSubTab(
'objectives');
1086 $post_position = $this->
http->wrapper()->post()->retrieve(
1088 $this->
refinery->kindlyTo()->dictOf(
1089 $this->
refinery->kindlyTo()->string()
1092 asort($post_position, SORT_NUMERIC);
1094 foreach ($post_position as $objective_id => $position) {
1096 $objective->writePosition($counter++);
1098 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objective_saved_sorting'));
1104 $this->
tabs->activateSubTab(
'objectives');
1107 $confirm->setFormAction($this->
ctrl->getFormAction($this));
1108 $confirm->setHeaderText($this->
lng->txt(
'crs_delete_objectve_sure'));
1109 $confirm->setConfirm($this->
lng->txt(
'delete'),
'deleteObjectives');
1110 $confirm->setCancel($this->
lng->txt(
'cancel'),
'listObjectives');
1112 $objective_ids = [];
1113 if ($this->
http->wrapper()->post()->has(
'objective')) {
1114 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1116 $this->
refinery->kindlyTo()->dictOf(
1121 foreach ($objective_ids as $objective_id) {
1123 $name = $obj->getTitle();
1127 (
string) $objective_id,
1131 $this->tpl->setContent($confirm->getHTML());
1141 if (in_array($objective_id,
$enabled)) {
1142 $objective->setActive(
true);
1143 $objective->update();
1147 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1148 $this->
ctrl->redirect($this,
'listObjectives');
1157 if (in_array($objective_id, $disabled)) {
1158 $objective->setActive(
false);
1159 $objective->update();
1163 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1164 $this->
ctrl->redirect($this,
'listObjectives');
1169 $objective_ids = [];
1170 if ($this->
http->wrapper()->post()->has(
'objective_ids')) {
1171 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1173 $this->
refinery->kindlyTo()->dictOf(
1178 foreach ($objective_ids as $objective_id) {
1180 $objective_obj->delete();
1183 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objectives_deleted'),
true);
1184 $this->
ctrl->redirect($this,
'listObjectives');
1190 $status->setSection($a_section);
1191 $status->setCmdClass($this);
1192 $this->tpl->setRightContent($status->getHTML());
1195 protected function setTabs(
string $a_section =
''): void
1198 $this->
tabs->addSubTab(
1200 $this->
lng->txt(
'settings'),
1201 $this->
ctrl->getLinkTarget($this,
'settings')
1204 $this->
tabs->addSubTab(
1206 $this->
lng->txt(
'crs_loc_tab_objectives'),
1207 $this->
ctrl->getLinkTarget($this,
'listObjectives')
1218 $this->
tabs->addSubTab(
1220 $this->
lng->txt(
'crs_loc_tab_itest'),
1221 $this->
ctrl->getLinkTarget($this,
'testOverview')
1225 $this->
tabs->addSubTab(
1227 $this->
lng->txt(
'crs_loc_tab_itests'),
1228 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1235 $this->
tabs->addSubTab(
1237 $this->
lng->txt(
'crs_loc_tab_qtest'),
1238 $this->
ctrl->getLinkTarget($this,
'testOverview')
1242 $this->
tabs->addSubTab(
1244 $this->
lng->txt(
'crs_loc_tab_qtests'),
1245 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1250 $this->
tabs->addSubTab(
1252 $this->
lng->txt(
'crs_loc_tab_start'),
1253 $this->
ctrl->getLinkTargetByClass(
'ilcontainerstartobjectsgui',
'')
1258 #ilMemberViewGUI::showMemberViewSwitch($this->getParentObject()->getRefId());
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
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)
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 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 class represents a text wizard property in a property form.
confirmDeleteTests()
Show delete test confirmation.
testAssignment(ilPropertyFormGUI $form=null)
worksWithStartObjects()
Check if start objects are enabled.
const TYPE_TEST_UNDEFINED
static set(string $a_var, $a_val)
Set a value.
Class ilContainerStartObjectsGUI.
setInitialTestType(int $a_type)
setQualifiedTest(int $a_id)
const TYPE_INITIAL_PLACEMENT_SELECTED