19 declare(strict_types=1);
62 $this->main_tpl = $DIC->ui()->mainTemplate();
63 $this->parent_obj = $parent_gui->
getObject();
67 $cs = $DIC->contentStyle();
68 $this->content_style_domain = $cs->domain()->styleForRefId($this->parent_obj->getRefId());
70 $this->
lng = $DIC->language();
71 $this->
ctrl = $DIC->ctrl();
72 $this->tpl = $DIC->ui()->mainTemplate();
73 $this->
tabs = $DIC->tabs();
74 $this->
toolbar = $DIC->toolbar();
75 $this->
logger = $DIC->logger()->crs();
76 $this->
http = $DIC->http();
82 $next_class = $this->
ctrl->getNextClass($this);
83 $cmd = $this->
ctrl->getCmd();
86 switch ($next_class) {
87 case 'ilcourseobjectivesgui':
89 $this->
ctrl->setReturn($this,
'returnFromObjectives');
90 $this->
tabs->clearTargets();
91 $this->
tabs->setBackTarget(
92 $this->
lng->txt(
'back'),
93 $this->
ctrl->getLinkTarget($this,
'listObjectives')
97 $this->
ctrl->forwardCommand($reg_gui);
100 case 'ilcontainerstartobjectsgui':
103 $ret = $this->
ctrl->forwardCommand($stgui);
105 $this->
tabs->activateSubTab(
'start');
106 $this->
tabs->removeSubTab(
'manage');
109 case 'ilconditionhandlergui':
111 $this->
ctrl->saveParameterByClass(
'ilconditionhandlergui',
'objective_id');
113 $this->
tabs->clearTargets();
114 $this->
tabs->setBackTarget(
115 $this->
lng->txt(
'back'),
116 $this->
ctrl->getLinkTarget($this,
'listObjectives')
120 $cond->setBackButtons(array());
121 $cond->setAutomaticValidation(
false);
122 $cond->setTargetType(
"lobj");
128 $cond->setTargetTitle($obj->getTitle());
129 $this->
ctrl->forwardCommand($cond);
133 $this->
ctrl->saveParameterByClass(
'illopagegui',
'objective_id');
135 $this->
tabs->clearTargets();
136 $this->
tabs->setBackTarget(
137 $this->
lng->txt(
'back'),
138 $this->
ctrl->getLinkTarget($this,
'listObjectives')
146 $new_page_object->setParentId($objtv_id);
147 $new_page_object->setId($objtv_id);
148 $new_page_object->createFromXML();
149 unset($new_page_object);
152 $this->
ctrl->setReturn($this,
'listObjectives');
156 $pgui->setStyleId($this->content_style_domain->getEffectiveStyleId());
159 $this->tpl->setCurrentBlock(
"ContentStyle");
160 $this->tpl->setVariable(
161 "LOCATION_CONTENT_STYLESHEET",
164 $this->tpl->parseCurrentBlock();
166 $ret = $this->
ctrl->forwardCommand($pgui);
168 $this->tpl->setContent($ret);
185 if ($this->
http->wrapper()->query()->has(
'objective_id')) {
186 return $this->
http->wrapper()->query()->retrieve(
196 if ($this->
http->wrapper()->post()->has(
'objective')) {
197 return $this->
http->wrapper()->post()->retrieve(
199 $this->
refinery->kindlyTo()->listOf(
209 if ($this->
http->wrapper()->query()->has(
'tt')) {
210 return $this->
http->wrapper()->query()->retrieve(
241 $this->test_type = $a_type;
254 $this->
tabs->activateSubTab(
'settings');
255 $this->tpl->setContent($form->getHTML());
262 foreach ($assignments->getAssignmentsByType($a_type) as $assignment) {
263 $assignment->delete();
302 if ($form->checkInput()) {
338 $settings->
resetResults((
bool) $form->getInput(
'reset'));
346 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'crs_loc_settings_err_qstart'),
true);
355 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
356 $this->
ctrl->redirect($this,
'settings');
360 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
361 $form->setValuesByPost();
371 $form->setFormAction($this->
ctrl->getFormAction($this));
372 $form->setTitle($this->
lng->txt(
'crs_loc_settings_tbl'));
377 $type_selector->setValue((
string) $this->
getSettings()->getInitialTestType());
380 $this->
lng->txt(
'crs_loc_settings_type_it_placement_all'),
383 $type_ipa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_all_info'));
384 $type_selector->addOption($type_ipa);
387 $start_ip->setValue((
string) 1);
388 $start_ip->setChecked($this->
getSettings()->isInitialTestStart());
389 $type_ipa->addSubItem($start_ip);
392 $this->
lng->txt(
'crs_loc_settings_type_it_placement_sel'),
395 $type_ips->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_placement_sel_info'));
396 $type_selector->addOption($type_ips);
399 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all'),
402 $type_iqa->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_all_info'));
403 $type_selector->addOption($type_iqa);
406 $start_iq->setValue(
'1');
407 $start_iq->setChecked($this->
getSettings()->isInitialTestStart());
408 $type_iqa->addSubItem($start_iq);
411 $this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel'),
414 $type_iqs->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_qualifying_sel_info'));
415 $type_selector->addOption($type_iqs);
418 $this->
lng->txt(
'crs_loc_settings_type_it_none'),
421 $type_ino->setInfo($this->
lng->txt(
'crs_loc_settings_type_it_none_info'));
422 $type_selector->addOption($type_ino);
424 $form->addItem($type_selector);
429 $qt_selector->setValue((
string) $this->
getSettings()->getQualifyingTestType());
432 $this->
lng->txt(
'crs_loc_settings_type_q_all'),
435 $type_qa->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_all_info'));
436 $qt_selector->addOption($type_qa);
439 $start_q->setValue(
'1');
440 $start_q->setChecked($this->
getSettings()->isQualifyingTestStart());
441 $type_qa->addSubItem($start_q);
448 $passed_mode->addOption(
450 $this->
lng->txt(
'crs_loc_settings_passed_mode_hide'),
454 $passed_mode->addOption(
456 $this->
lng->txt(
'crs_loc_settings_passed_mode_mark'),
460 $type_qa->addSubItem($passed_mode);
463 $this->
lng->txt(
'crs_loc_settings_type_q_selected'),
466 $type_qs->setInfo($this->
lng->txt(
'crs_loc_settings_type_q_selected_info'));
467 $qt_selector->addOption($type_qs);
469 $form->addItem($qt_selector);
473 $reset->setValue(
'1');
474 $reset->setChecked($this->
getSettings()->isResetResultsEnabled());
475 $reset->setOptionTitle($this->
lng->txt(
'crs_loc_settings_reset_enable'));
476 $reset->setInfo($this->
lng->txt(
'crs_loc_settings_reset_enable_info'));
477 $form->addItem($reset);
479 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
485 $this->
tabs->activateSubTab(
'materials');
487 $this->parent_gui->renderAddNewItem(
'itgr');
489 $this->tpl->setOnScreenMessage(
491 $this->
lng->txt(
'crs_objective_status_materials_info')
504 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
506 $this->
lng->txt(
'crs_loc_btn_new_assignment'),
507 $this->
ctrl->getLinkTarget($this,
'testAssignment')
513 $this->
tabs->activateSubTab(
'itests');
517 $this->
tabs->activateSubTab(
'qtests');
530 $table->parseMultipleAssignments();
531 $this->tpl->setContent($table->getHTML());
539 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
569 $this->
tabs->activateSubTab(
'itest');
573 $this->
tabs->activateSubTab(
'qtest');
592 $this->tpl->setContent($table->getHTML());
600 $this->
logger->debug(
': Show new assignment screen because of : ' . $ex->getMessage());
628 $this->
tabs->activateSubTab(
'itests');
632 $this->
tabs->activateSubTab(
'qtests');
637 if ($this->
http->wrapper()->post()->has(
'tst')) {
638 $tests = $this->
http->wrapper()->post()->retrieve(
640 $this->
refinery->kindlyTo()->listOf(
645 if (!count($tests)) {
646 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
647 $this->
ctrl->redirect($this,
'testsOverview');
650 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
651 $confirm->setFormAction($this->
ctrl->getFormAction($this));
652 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTests');
653 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testsOverview');
654 foreach ($tests as $assign_id) {
661 $this->tpl->setContent($confirm->getHTML());
681 $this->
tabs->activateSubTab(
'itest');
685 $this->
tabs->activateSubTab(
'qtest');
690 if ($this->
http->wrapper()->post()->has(
'tst')) {
691 $tests = $this->
http->wrapper()->post()->retrieve(
693 $this->
refinery->kindlyTo()->listOf(
698 if (count($tests) === 0) {
699 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
700 $this->
ctrl->redirect($this,
'testOverview');
704 $confirm->setHeaderText($this->
lng->txt(
'crs_loc_confirm_delete_tst'));
705 $confirm->setFormAction($this->
ctrl->getFormAction($this));
706 $confirm->setConfirm($this->
lng->txt(
'crs_loc_delete_assignment'),
'deleteTest');
707 $confirm->setCancel($this->
lng->txt(
'cancel'),
'testOverview');
709 foreach ($tests as $tst_id) {
713 $this->tpl->setContent($confirm->getHTML());
730 $this->
tabs->activateSubTab(
'itests');
734 $this->
tabs->activateSubTab(
'qtests');
739 if ($this->
http->wrapper()->post()->has(
'tst')) {
740 $tests = $this->
http->wrapper()->post()->retrieve(
742 $this->
refinery->kindlyTo()->listOf(
747 foreach ($tests as $assign_id) {
749 $assignment->delete();
756 $start->deleteItem($assignment->getTestRefId());
762 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
763 $this->
ctrl->redirect($this,
'testsOverview');
774 $this->
tabs->activateSubTab(
'itest');
778 $this->
tabs->activateSubTab(
'qtest');
783 if ($this->
http->wrapper()->post()->has(
'tst')) {
784 $tests = $this->
http->wrapper()->post()->retrieve(
786 $this->
refinery->kindlyTo()->listOf(
791 foreach ($tests as $tst_id) {
808 $start->deleteItem($tst_id);
814 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
815 $this->
ctrl->redirect($this,
'testOverview');
827 $this->
tabs->activateSubTab(
'itests');
831 $this->
tabs->activateSubTab(
'qtests');
836 $form = $form_helper->initForm(
true);
838 $this->tpl->setContent($form->getHTML());
852 $this->
tabs->activateSubTab(
'itest');
856 $this->
tabs->activateSubTab(
'qtest');
862 $form = $form_helper->initForm(
false);
864 $this->tpl->setContent($form->getHTML());
887 $form = $form_helper->initForm(
true);
889 if ($form->checkInput()) {
890 $mode = $form->getInput(
'mode');
892 if ($mode == self::TEST_NEW) {
894 $tst->setType(
'tst');
895 $tst->setTitle($form->getInput(
'title'));
896 $tst->setDescription($form->getInput(
'desc'));
899 $tst->createReference();
902 $general_settings = $tst->getMainSettings()->getGeneralSettings()->withQuestionSetType($form->getInput(
'qtype'));
903 $tst->getMainSettingsRepository()->store(
904 $tst->getMainSettings()->withGeneralSettings($general_settings)
909 $assignment->setAssignmentType($this->
getTestType());
910 $assignment->setObjectiveId((
int) $form->getInput(
'objective'));
911 $assignment->setTestRefId($tst->getRefId());
916 $assignment->setAssignmentType($this->
getTestType());
917 $assignment->setObjectiveId((
int) $form->getInput(
'objective'));
918 $assignment->setTestRefId((
int) $form->getInput(
'tst'));
921 $tst =
new ilObjTest((
int) $form->getInput(
'tst'),
true);
931 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
932 $this->
ctrl->redirect($this,
'testsOverview');
936 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
937 $form->setValuesByPost();
945 foreach ($materials->getMaterials() as $material) {
946 if ($material[
'ref_id'] == $test->
getRefId()) {
947 $materials->delete($material[
'lm_ass_id']);
961 $form = $form_helper->initForm(
false);
963 if ($form->checkInput()) {
964 $mode = $form->getInput(
'mode');
966 if ($mode == self::TEST_NEW) {
968 $tst->setType(
'tst');
969 $tst->setTitle($form->getInput(
'title'));
970 $tst->setDescription($form->getInput(
'desc'));
973 $tst->createReference();
976 $general_settings = $tst->getMainSettings()->getGeneralSettings()->withQuestionSetType($form->getInput(
'qtype'));
977 $tst->getMainSettingsRepository()->store(
978 $tst->getMainSettings()->withGeneralSettings($general_settings)
982 $this->
getSettings()->setInitialTest($tst->getRefId());
984 $this->
getSettings()->setQualifiedTest($tst->getRefId());
989 $this->
getSettings()->setInitialTest((
int) $form->getInput(
'tst'));
991 $this->
getSettings()->setQualifiedTest((
int) $form->getInput(
'tst'));
1005 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
1006 $this->
ctrl->redirect($this,
'testOverview');
1010 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
1011 $form->setValuesByPost();
1018 $this->
tabs->activateSubTab(
'objectives');
1031 $this->
lng->txt(
'crs_add_objective'),
1032 $this->
ctrl->getLinkTargetByClass(
'ilcourseobjectivesgui',
"create")
1036 $table->setTitle($this->
lng->txt(
'crs_objectives'),
'', $this->
lng->txt(
'crs_objectives'));
1038 $this->tpl->setContent($table->getHTML());
1045 $this->
tabs->activateSubTab(
'objectives');
1049 $this->tpl->setContent($form->getHTML());
1056 $form->setTitle($this->
lng->txt(
'crs_loc_form_create_objectives'));
1057 $form->setFormAction($this->
ctrl->getFormAction($this));
1060 $txt->setValues(array(0 =>
''));
1061 $txt->setRequired(
true);
1062 $form->addItem(
$txt);
1064 $form->addCommandButton(
'saveObjectiveCreation', $this->
lng->txt(
'save'));
1071 if ($form->checkInput()) {
1072 foreach ((array) $form->getInput(
'objectives') as $title) {
1074 $obj->setActive(
true);
1075 $obj->setTitle($title);
1078 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1079 $this->
ctrl->redirect($this,
'');
1082 $form->setValuesByPost();
1083 $this->
tabs->activateSubTab(
'objectives');
1090 $post_position = $this->
http->wrapper()->post()->retrieve(
1092 $this->
refinery->kindlyTo()->dictOf(
1093 $this->
refinery->kindlyTo()->string()
1096 asort($post_position, SORT_NUMERIC);
1098 foreach ($post_position as $objective_id => $position) {
1100 $objective->writePosition($counter++);
1102 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objective_saved_sorting'));
1108 $this->
tabs->activateSubTab(
'objectives');
1111 $confirm->setFormAction($this->
ctrl->getFormAction($this));
1112 $confirm->setHeaderText($this->
lng->txt(
'crs_delete_objectve_sure'));
1113 $confirm->setConfirm($this->
lng->txt(
'delete'),
'deleteObjectives');
1114 $confirm->setCancel($this->
lng->txt(
'cancel'),
'listObjectives');
1116 $objective_ids = [];
1117 if ($this->
http->wrapper()->post()->has(
'objective')) {
1118 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1120 $this->
refinery->kindlyTo()->dictOf(
1125 foreach ($objective_ids as $objective_id) {
1127 $name = $obj->getTitle();
1131 (
string) $objective_id,
1135 $this->tpl->setContent($confirm->getHTML());
1145 if (in_array($objective_id, $enabled)) {
1146 $objective->setActive(
true);
1147 $objective->update();
1151 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1152 $this->
ctrl->redirect($this,
'listObjectives');
1161 if (in_array($objective_id, $disabled)) {
1162 $objective->setActive(
false);
1163 $objective->update();
1167 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
1168 $this->
ctrl->redirect($this,
'listObjectives');
1173 $objective_ids = [];
1174 if ($this->
http->wrapper()->post()->has(
'objective_ids')) {
1175 $objective_ids = $this->
http->wrapper()->post()->retrieve(
1177 $this->
refinery->kindlyTo()->dictOf(
1182 foreach ($objective_ids as $objective_id) {
1184 $objective_obj->delete();
1187 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_objectives_deleted'),
true);
1188 $this->
ctrl->redirect($this,
'listObjectives');
1194 $status->setSection($a_section);
1195 $status->setCmdClass($this);
1196 $this->tpl->setRightContent($status->getHTML());
1199 protected function setTabs(
string $a_section =
''): void
1202 $this->
tabs->addSubTab(
1204 $this->
lng->txt(
'settings'),
1205 $this->
ctrl->getLinkTarget($this,
'settings')
1208 $this->
tabs->addSubTab(
1210 $this->
lng->txt(
'crs_loc_tab_objectives'),
1211 $this->
ctrl->getLinkTarget($this,
'listObjectives')
1222 $this->
tabs->addSubTab(
1224 $this->
lng->txt(
'crs_loc_tab_itest'),
1225 $this->
ctrl->getLinkTarget($this,
'testOverview')
1229 $this->
tabs->addSubTab(
1231 $this->
lng->txt(
'crs_loc_tab_itests'),
1232 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1239 $this->
tabs->addSubTab(
1241 $this->
lng->txt(
'crs_loc_tab_qtest'),
1242 $this->
ctrl->getLinkTarget($this,
'testOverview')
1246 $this->
tabs->addSubTab(
1248 $this->
lng->txt(
'crs_loc_tab_qtests'),
1249 $this->
ctrl->getLinkTarget($this,
'testsOverview')
1254 $this->
tabs->addSubTab(
1256 $this->
lng->txt(
'crs_loc_tab_start'),
1257 $this->
ctrl->getLinkTargetByClass(
'ilcontainerstartobjectsgui',
'')
1262 #ilMemberViewGUI::showMemberViewSwitch($this->getParentObject()->getRefId());
worksWithInitialTest()
Check if the loc is configured for initial tests.
This class represents an option in a radio group.
testOverview()
Show test overview.
setInitialTestAsStart(bool $a_type)
initObjectiveIdFromQuery()
initObjectiveIdsFromPost()
testSettings(?ilPropertyFormGUI $form=null)
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...
(Course) learning objective page object
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
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)
__construct(ilObjCourseGUI $parent_gui)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
showStatus(int $a_section)
initSimpleObjectiveForm()
const HIDE_PASSED_OBJECTIVE_QST
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
class ilCourseObjectiveMaterials
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...
Class ilLOTestAssignmentTableGUI.
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)
static lookupObjectiveTitle(int $a_objective_id, bool $a_add_description=false)
(Course) learning objective page GUI class
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)
setPassedObjectiveMode(int $a_mode)
testAssignment(?ilPropertyFormGUI $form=null)
const TEST_TYPE_UNDEFINED
showObjectiveCreation(?ilPropertyFormGUI $form=null)
setQualifyingTestAsStart(bool $a_type)
ilObjCourseGUI $parent_gui
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.
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