ILIAS  release_8 Revision v8.24
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1<?php
2
20
33{
34 protected \ILIAS\LearningModule\ReadingTime\SettingsGUI $reading_time_gui;
37 protected string $lang_switch_mode;
39 protected ilTabsGUI $tabs;
40 protected ilHelpGUI $help;
41 protected ilDBInterface $db;
42 protected ilLogger $log;
43 protected \ILIAS\DI\UIServices $ui;
45
46 protected bool $to_props = false;
47 protected int $requested_obj_id = 0;
48 protected string $requested_new_type = "";
49 protected string $requested_baseClass = "";
50 protected int $requested_ref_id = 0;
51 protected string $requested_transl = "";
52 protected string $requested_backcmd = "";
53 protected int $requested_menu_entry = 0;
54 protected int $requested_lm_menu_expand = 0;
56 protected bool $requested_hierarchy = false;
57 protected int $requested_root_id = 0;
58 protected int $requested_glo_id = 0;
59 protected int $requested_glo_ref_id = 0;
60 protected string $requested_lang_switch_mode = "";
61 protected int $requested_active_node = 0;
62 protected int $requested_lmexpand = 0;
63 protected int $requested_link_ref_id = 0;
64 protected string $requested_totransl = "";
65 protected bool $requested_lmmovecopy = false;
68 protected \ILIAS\Style\Content\Service $content_style_service;
69
77 public function __construct(
78 $a_data,
79 int $a_id = 0,
80 bool $a_call_by_reference = true,
81 bool $a_prepare_output = false
82 ) {
83 global $DIC;
84
85 $this->lng = $DIC->language();
86 $this->access = $DIC->access();
87 $this->tabs = $DIC->tabs();
88 $this->settings = $DIC->settings();
89 $this->user = $DIC->user();
90 $this->tpl = $DIC["tpl"];
91 $this->toolbar = $DIC->toolbar();
92 $this->rbacsystem = $DIC->rbac()->system();
93 $this->tree = $DIC->repositoryTree();
94 $this->help = $DIC["ilHelp"];
95 $this->locator = $DIC["ilLocator"];
96 $this->db = $DIC->database();
97 $this->log = $DIC["ilLog"];
98 $this->ui = $DIC->ui();
99 $lng = $DIC->language();
100 $ilCtrl = $DIC->ctrl();
101 $this->ctrl = $ilCtrl;
102 $this->component_repository = $DIC["component.repository"];
103 $lng->loadLanguageModule("content");
104 $lng->loadLanguageModule("obj");
105 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
106
107 $this->edit_request = $DIC
108 ->learningModule()
109 ->internal()
110 ->gui()
111 ->editing()
112 ->request();
113
115 $this->to_props = $req->getToProps();
116 $this->requested_obj_id = $req->getObjId();
117 $this->requested_ref_id = $req->getRefId();
118 $this->requested_root_id = $req->getRootId();
119 $this->requested_glo_id = $req->getGlossaryId();
120 $this->requested_glo_ref_id = $req->getGlossaryRefId();
121 $this->requested_menu_entry = $req->getMenuEntry();
122 $this->requested_lm_menu_expand = $req->getLMMenuExpand();
123 $this->requested_search_root_expand = $req->getSearchRootExpand();
124 $this->requested_new_type = $req->getNewType();
125 $this->requested_baseClass = $req->getBaseClass();
126 $this->requested_transl = $req->getTranslation();
127 $this->requested_backcmd = $req->getBackCmd();
128 $this->requested_hierarchy = $req->getHierarchy();
129 $this->lang_switch_mode = $req->getLangSwitchMode();
130 $this->requested_active_node = $req->getActiveNode();
131 $this->requested_lmexpand = $req->getLMExpand();
132 $this->requested_link_ref_id = $req->getLinkRefId();
133 $this->requested_totransl = $req->getToTranslation();
134 $this->requested_lmmovecopy = $req->getLMMoveCopy();
135 $this->content_style_service = $DIC
136 ->contentStyle();
137
138 $id = (isset($this->object))
139 ? $this->object->getId()
140 : 0;
141 $this->reading_time_gui = new \ILIAS\LearningModule\ReadingTime\SettingsGUI($id);
142 }
143
144 protected function checkCtrlPath(): void
145 {
146 if (!$this->getCreationMode()) {
147 $baseclass = strtolower($this->requested_baseClass);
148 $next_class = strtolower($this->ctrl->getNextClass());
149 // all calls must be routed through illmpresentationgui or
150 // illmeditorgui...
151 if (!in_array($baseclass, ["illmpresentationgui", "illmeditorgui"])) {
152 // ...except the comman action handler routes to
153 // activation/condition GUI, see https://mantis.ilias.de/view.php?id=32858
154 if (in_array($next_class, ["ilcommonactiondispatchergui"])) {
155 return;
156 }
157 throw new ilLMException("Wrong ctrl path");
158 }
159 }
160 }
161
166 public function executeCommand(): void
167 {
168 $ilAccess = $this->access;
170 $ilTabs = $this->tabs;
171 $ilCtrl = $this->ctrl;
172
173 $this->checkCtrlPath();
174
175 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
176 throw new ilLMException("No Explorer found.");
177 //$this->explorer();
178 //return "";
179 }
180
181 if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
182 $this->ctrl->setReturn($this, "explorer");
183 }
184
185 // get next class that processes or forwards current command
186 $next_class = $this->ctrl->getNextClass($this);
187
188 // get current command
189 if ($this->to_props) {
190 $cmd = $this->ctrl->getCmd("properties");
191 } else {
192 $cmd = $this->ctrl->getCmd("chapters");
193 }
194
195
196 switch ($next_class) {
197 case 'illtiproviderobjectsettinggui':
198
199 $this->setTabs();
200 $ilTabs->setTabActive("settings");
201 $this->setSubTabs("lti_provider");
202
203 $lti_gui = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
204 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->lm->getRefId()));
205 $lti_gui->offerLTIRolesForSelection(true);
206 $this->ctrl->forwardCommand($lti_gui);
207 break;
208
209
210
211 case "illearningprogressgui":
212 $this->addHeaderAction();
213 $this->addLocations();
214 $this->setTabs("learning_progress");
215
216 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->lm->getRefId());
217 $this->ctrl->forwardCommand($new_gui);
218
219 break;
220
221 case 'ilobjectmetadatagui':
222 if (!$ilAccess->checkAccess('write', '', $this->lm->getRefId())) {
223 throw new ilPermissionException($this->lng->txt('permission_denied'));
224 }
225
226 $this->addHeaderAction();
227 $this->addLocations();
228 $this->setTabs("meta");
229
230 $md_gui = new ilObjectMetaDataGUI($this->lm);
231 $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'Educational'); // #9510
232 $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'General');
233 $this->ctrl->forwardCommand($md_gui);
234 break;
235
236 case "ilobjectcontentstylesettingsgui":
237 $this->checkPermission("write");
238 $this->addHeaderAction();
239 $this->setTitleAndDescription();
240 $this->addLocations();
241 $this->setTabs("settings");
242 $this->setSubTabs("cont_style");
243
244 $settings_gui = $this->content_style_service
245 ->gui()
246 ->objectSettingsGUIForRefId(
247 null,
248 $this->object->getRefId()
249 );
250 $this->ctrl->forwardCommand($settings_gui);
251 break;
252
253
254 case "illmpageobjectgui":
255 $this->setTitleAndDescription();
256 $ilTabs->setBackTarget(
257 $lng->txt("learning module"),
258 $ilCtrl->getLinkTarget($this, "chapters")
259 );
260 $this->ctrl->saveParameter($this, array("obj_id"));
261 $this->addLocations();
262 $this->ctrl->setReturn($this, "chapters");
263
264 $pg_gui = new ilLMPageObjectGUI($this->lm);
265 if ($this->requested_obj_id > 0) {
267 $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
268 $pg_gui->setLMPageObject($obj);
269 }
270 $this->ctrl->forwardCommand($pg_gui);
271 break;
272
273 case "ilstructureobjectgui":
274 $ilTabs->setBackTarget(
275 $lng->txt("learning module"),
276 $ilCtrl->getLinkTarget($this, "chapters")
277 );
278
279 $this->ctrl->saveParameter($this, array("obj_id"));
280 $this->addLocations();
281 $this->ctrl->setReturn($this, "chapters");
282 $st_gui = new ilStructureObjectGUI($this->lm, $this->lm->lm_tree);
283 if ($this->requested_obj_id > 0) {
285 $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
286 $st_gui->setStructureObject($obj);
287 }
288 $this->ctrl->forwardCommand($st_gui);
289 if ($cmd == "save" || $cmd == "cancel") {
290 if ($this->requested_obj_id == 0) {
291 $this->ctrl->redirect($this, "chapters");
292 } else {
293 $this->ctrl->setCmd("subchap");
294 $this->executeCommand();
295 }
296 }
297 break;
298
299 case 'ilpermissiongui':
300 if (strtolower($this->requested_baseClass) == "iladministrationgui") {
301 $this->prepareOutput();
302 } else {
303 $this->addHeaderAction();
304 $this->addLocations(true);
305 $this->setTabs("perm");
306 }
307 $perm_gui = new ilPermissionGUI($this);
308 $this->ctrl->forwardCommand($perm_gui);
309 break;
310
311 // infoscreen
312 case 'ilinfoscreengui':
313 $this->addHeaderAction();
314 $this->addLocations(true);
315 $this->setTabs("info");
316 $info = new ilInfoScreenGUI($this);
317 $info->enablePrivateNotes();
318 $info->enableLearningProgress();
319 $info->enableNews();
320 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
321 $info->enableNewsEditing();
322 $info->setBlockProperty("news", "settings", true);
323 }
324
325 // show standard meta data section
326 $info->addMetaDataSections(
327 $this->lm->getId(),
328 0,
329 $this->lm->getType()
330 );
331
332 $this->ctrl->forwardCommand($info);
333 break;
334
335 case "ilexportgui":
336 // it is important to reset the "transl" parameter here
337 // otherwise it will effect the HTML export and overwrite the selected language
338 $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "transl", "");
339 $this->ctrl->setParameterByClass(ilLMEditorGUI::class, "transl", "");
340 $exp_gui = new ilExportGUI($this);
341 $exp_gui->addFormat("xml");
342 $ot = ilObjectTranslation::getInstance($this->lm->getId());
343 if ($ot->getContentActivated()) {
344 $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("cont_master_language_only") . ")", $this, "export");
345 $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("cont_master_language_only_no_media") . ")", $this, "export");
346
347 $lng->loadLanguageModule("meta");
348 $langs = $ot->getLanguages();
349 foreach ($langs as $l => $ldata) {
350 $exp_gui->addFormat("html_" . $l, "HTML (" . $lng->txt("meta_l_" . $l) . ")", $this, "exportHTML");
351 }
352 $exp_gui->addFormat("html_all", "HTML (" . $lng->txt("cont_all_languages") . ")", $this, "exportHTML");
353 } else {
354 $exp_gui->addFormat("html", "", $this, "exportHTML");
355 }
356
357 $exp_gui->addCustomColumn(
358 $lng->txt("cont_public_access"),
359 $this,
360 "getPublicAccessColValue"
361 );
362 $exp_gui->addCustomMultiCommand(
363 $lng->txt("cont_public_access"),
364 $this,
365 "publishExportFile"
366 );
367 $this->ctrl->forwardCommand($exp_gui);
368 $this->tpl->setOnScreenMessage('info', $this->lng->txt("lm_only_one_download_per_type"));
369 $this->addHeaderAction();
370 $this->addLocations(true);
371 $this->setTabs("export");
372 break;
373
374 case 'ilobjecttranslationgui':
375 $this->addHeaderAction();
376 $this->addLocations(true);
377 $this->setTabs("settings");
378 $this->setSubTabs("obj_multilinguality");
379 $transgui = new ilObjectTranslationGUI($this);
380 $transgui->setTitleDescrOnlyMode(false);
381 $this->ctrl->forwardCommand($transgui);
382 break;
383
384
385 case "ilcommonactiondispatchergui":
387 $this->prepareOutput();
388 $this->ctrl->forwardCommand($gui);
389 break;
390
391 case 'ilobjectcopygui':
392 $this->prepareOutput();
393 $cp = new ilObjectCopyGUI($this);
394 $cp->setType('lm');
395 $this->ctrl->forwardCommand($cp);
396 break;
397
398 case "ilmobmultisrtuploadgui":
399 $this->addHeaderAction();
400 $this->addLocations(true);
401 $this->setTabs("content");
402 $this->setContentSubTabs("srt_files");
403 $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->lm));
404 $this->ctrl->forwardCommand($gui);
405 break;
406
407 case "illmimportgui":
408 $this->addHeaderAction();
409 $this->addLocations(true);
410 $this->setTabs("content");
411 $this->setContentSubTabs("import");
412 $gui = new ilLMImportGUI($this->lm);
413 $this->ctrl->forwardCommand($gui);
414 break;
415
416 case "illmeditshorttitlesgui":
417 $this->addHeaderAction();
418 $this->addLocations(true);
419 $this->setTabs("content");
420 $this->setContentSubTabs("short_titles");
422 $lm_gui = $this;
423 $gui = new ilLMEditShortTitlesGUI(
424 $lm_gui,
425 $this->edit_request->getTranslation()
426 );
427 $this->ctrl->forwardCommand($gui);
428 break;
429
430 default:
431 $new_type = $this->requested_new_type;
432
433 if ($cmd == "create" &&
434 !in_array($new_type, array("lm"))) {
435 switch ($new_type) {
436 case "pg":
437 $this->setTabs();
438 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
439 $this->executeCommand();
440 break;
441
442 case "st":
443 $this->setTabs();
444 $this->ctrl->setCmdClass("ilStructureObjectGUI");
445 $this->executeCommand();
446 break;
447 }
448 } else {
449 // creation of new dbk/lm in repository
450 if ($this->getCreationMode() === true &&
451 $new_type === "lm") {
452 $this->prepareOutput();
453 if ($cmd == "") { // this may be due to too big upload files
454 $cmd = "create";
455 }
456 $cmd .= "Object";
457 } else {
458 $this->addHeaderAction();
459 $this->addLocations();
460 }
461 $this->$cmd();
462 }
463 break;
464 }
465 }
466
470 public function properties(): void
471 {
473
474 $lng->loadLanguageModule("style");
475 $this->setTabs("settings");
476 $this->setSubTabs("settings");
477
478 // lm properties
479 $this->initPropertiesForm();
481
482 // Edit ecs export settings
483 $ecs = new ilECSLearningModuleSettings($this->lm);
484 $ecs->addSettingsToForm($this->form, 'lm');
485
486 $this->tpl->setContent($this->form->getHTML());
487 }
488
492 public function initPropertiesForm(): void
493 {
494 $obj_service = $this->object_service;
495
496 $ilCtrl = $this->ctrl;
499
500 $this->form = new ilPropertyFormGUI();
501
502 // title
503 $ti = new ilTextInputGUI($lng->txt("title"), "title");
504 $ti->setRequired(true);
505 $ti->setMaxLength(255);
506 $this->form->addItem($ti);
507
508 // description
509 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
510 $this->form->addItem($ta);
511
512 $lng->loadLanguageModule("rep");
513 $section = new ilFormSectionHeaderGUI();
514 $section->setTitle($this->lng->txt('rep_activation_availability'));
515 $this->form->addItem($section);
516
517 // online
518 $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
519 $this->form->addItem($online);
520
521 // presentation
522 $section = new ilFormSectionHeaderGUI();
523 $section->setTitle($this->lng->txt('cont_presentation'));
524 $this->form->addItem($section);
525
526 // tile image
527 $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->addTileImage();
528
529 // page header
530 $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
531 $option = array("st_title" => $this->lng->txt("cont_st_title"),
532 "pg_title" => $this->lng->txt("cont_pg_title"),
533 "none" => $this->lng->txt("cont_none"));
534 $page_header->setOptions($option);
535 $this->form->addItem($page_header);
536
537 // chapter numeration
538 $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
539 $this->form->addItem($chap_num);
540
541 // toc mode
542 $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
543 $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
544 "pages" => $this->lng->txt("cont_chapters_and_pages"));
545 $toc_mode->setOptions($option);
546 $this->form->addItem($toc_mode);
547
548 // show progress icons
549 $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
550 $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
551 $this->form->addItem($progr_icons);
552
553 $this->reading_time_gui->addSettingToForm($this->form);
554
555 // self assessment
556 $section = new ilFormSectionHeaderGUI();
557 $section->setTitle($this->lng->txt('cont_self_assessment'));
558 $this->form->addItem($section);
559
560 // tries
561 $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
562 $radg->setValue("0");
563 $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), "0", $lng->txt("cont_tries_reset_on_visit_info"));
564 $radg->addOption($op1);
565 $op2 = new ilRadioOption($lng->txt("cont_tries_store"), "1", $lng->txt("cont_tries_store_info"));
566 $radg->addOption($op2);
567 $this->form->addItem($radg);
568
569 // restrict forward navigation
570 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
571 $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
572 $this->form->addItem($qfeed);
573
574 // notification
575 $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
576 $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
577 $qfeed->addSubItem($not);
578
579 // disable default feedback for questions
580 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
581 $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
582 $this->form->addItem($qfeed);
583
584 // additional features
585 $section = new ilFormSectionHeaderGUI();
586 $section->setTitle($this->lng->txt('obj_features'));
587 $this->form->addItem($section);
588
589 // public notes
590 if (!$ilSetting->get('disable_comments')) {
591 $this->lng->loadLanguageModule("notes");
592 $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
593 $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
594 $this->form->addItem($pub_nodes);
595 }
596
597 // history user comments
598 $com = new ilCheckboxInputGUI($lng->txt("enable_hist_user_comments"), "cobj_user_comments");
599 $com->setInfo($this->lng->txt("enable_hist_user_comments_desc"));
600 $this->form->addItem($com);
601
602 // rating
603 $this->lng->loadLanguageModule('rating');
604 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
605 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
606 $this->form->addItem($rate);
607 $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
608 $this->form->addItem($ratep);
609
610 $this->form->setTitle($lng->txt("cont_lm_properties"));
611 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
612 $this->form->setFormAction($ilCtrl->getFormAction($this));
613
615 $this->object->getId(),
616 $this->form,
617 [
619 ]
620 );
621 }
622
626 public function getPropertiesFormValues(): void
627 {
629
630 $values = array();
631
632 $title = $this->lm->getTitle();
633 $description = $this->lm->getLongDescription();
634 $ot = ilObjectTranslation::getInstance($this->lm->getId());
635 if ($ot->getContentActivated()) {
636 $title = $ot->getDefaultTitle();
637 $description = $ot->getDefaultDescription();
638 }
639
640 $values["title"] = $title;
641 $values["description"] = $description;
642 if (!$this->lm->getOfflineStatus()) {
643 $values["cobj_online"] = true;
644 }
645 //$values["lm_layout"] = $this->lm->getLayout();
646 $values["lm_pg_header"] = $this->lm->getPageHeader();
647 if ($this->lm->isActiveNumbering()) {
648 $values["cobj_act_number"] = true;
649 }
650 $values["toc_mode"] = $this->lm->getTOCMode();
651 if ($this->lm->publicNotes()) {
652 $values["cobj_pub_notes"] = true;
653 }
654 if ($this->lm->cleanFrames()) {
655 $values["cobj_clean_frames"] = true;
656 }
657 if ($this->lm->isActiveHistoryUserComments()) {
658 $values["cobj_user_comments"] = true;
659 }
660 //$values["layout_per_page"] = $this->lm->getLayoutPerPage();
661 $values["rating"] = $this->lm->hasRating();
662 $values["rating_pages"] = $this->lm->hasRatingPages();
663 $values["disable_def_feedback"] = $this->lm->getDisableDefaultFeedback();
664 $values["progr_icons"] = $this->lm->getProgressIcons();
665 $values["store_tries"] = (string) (int) $this->lm->getStoreTries();
666 $values["restrict_forw_nav"] = $this->lm->getRestrictForwardNavigation();
667
668 $values["notification_blocked_users"] = ilNotification::hasNotification(
670 $ilUser->getId(),
671 $this->lm->getId()
672 );
673
674 $values["cont_show_info_tab"] = $this->object->isInfoEnabled();
675 $this->form->setValuesByArray($values, true);
676 }
677
681 public function saveProperties(): void
682 {
686 $obj_service = $this->object_service;
687
688 $add_info = "";
689
690 $valid = false;
691 $this->initPropertiesForm();
692 $form = $this->form;
693 if ($form->checkInput()) {
694 $ot = ilObjectTranslation::getInstance($this->lm->getId());
695 if ($ot->getContentActivated()) {
696 $ot->setDefaultTitle($form->getInput('title'));
697 $ot->setDefaultDescription($form->getInput('description'));
698 $ot->save();
699 }
700
701 $this->lm->setTitle($form->getInput('title'));
702 $this->lm->setDescription($form->getInput('description'));
703 $this->lm->setPageHeader($form->getInput("lm_pg_header"));
704 $this->lm->setTOCMode($form->getInput("toc_mode"));
705 $this->lm->setOfflineStatus(!($form->getInput('cobj_online')));
706 $this->lm->setActiveNumbering((bool) $form->getInput("cobj_act_number"));
707 $this->lm->setCleanFrames((bool) $form->getInput("cobj_clean_frames"));
708 if (!$ilSetting->get('disable_comments')) {
709 $this->lm->setPublicNotes($form->getInput("cobj_pub_notes"));
710 }
711 $this->lm->setHistoryUserComments((bool) $form->getInput("cobj_user_comments"));
712 $this->lm->setRating((bool) $form->getInput("rating"));
713 $this->lm->setRatingPages((bool) $form->getInput("rating_pages"));
714 $this->lm->setDisableDefaultFeedback((int) $form->getInput("disable_def_feedback"));
715 $this->lm->setProgressIcons((int) $form->getInput("progr_icons"));
716 $this->reading_time_gui->saveSettingFromForm($this->form);
717
718 $add_info = "";
719 $store_tries = $form->getInput("store_tries");
720 if ($form->getInput("restrict_forw_nav") && !$form->getInput("store_tries")) {
721 $store_tries = 1;
722 $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
723 $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
724 $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
725 }
726
727 $this->lm->setStoreTries((int) $store_tries);
728 $this->lm->setRestrictForwardNavigation((int) $form->getInput("restrict_forw_nav"));
729 $this->lm->updateProperties();
730 $this->lm->update();
731
732 // tile image
733 $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->saveTileImage();
734
737 $ilUser->getId(),
738 $this->lm->getId(),
739 (bool) $this->form->getInput("notification_blocked_users")
740 );
741
742 // services
744 $this->object->getId(),
745 $this->form,
746 array(
748 )
749 );
750
751
752 // Update ecs export settings
753 $ecs = new ilECSLearningModuleSettings($this->lm);
754 if ($ecs->handleSettingsUpdate()) {
755 $valid = true;
756 }
757 }
758
759 if ($valid) {
760 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified") . $add_info, true);
761 $this->ctrl->redirect($this, "properties");
762 } else {
763 $lng->loadLanguageModule("style");
764 $this->setTabs("settings");
765 $this->setSubTabs("cont_general_properties");
766
767 $this->form->setValuesByPost();
768 $this->tpl->setContent($this->form->getHTML());
769 }
770 }
771
773 {
775 $ilCtrl = $this->ctrl;
776
777 $form = new ilPropertyFormGUI();
778
779 // enable menu
780 $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
781 $menu->setChecked($this->lm->isActiveLMMenu());
782 $form->addItem($menu);
783
784 // toc
785 /*
786 $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
787
788 $toc->setChecked($this->lm->isActiveTOC());
789 $form->addItem($toc);*/
790
791 // print view
792 $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
793 $print->setChecked($this->lm->isActivePrintView());
794 $form->addItem($print);
795
796 // prevent glossary appendix
797 $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
798 $glo->setChecked($this->lm->isActivePreventGlossaryAppendix());
799 $print->addSubItem($glo);
800
801 // hide header and footer in print view
802 $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
803 $hhfp->setChecked($this->lm->getHideHeaderFooterPrint());
804 $print->addSubItem($hhfp);
805
806 // downloads
807 $no_download_file_available =
808 " " . $lng->txt("cont_no_download_file_available") .
809 " <a href='" . $ilCtrl->getLinkTargetByClass("ilexportgui", "") . "'>" . $lng->txt("change") . "</a>";
810 $types = array("xml", "html");
811 foreach ($types as $type) {
812 if ($this->lm->getPublicExportFile($type) != "") {
813 if (is_file($this->lm->getExportDirectory($type) . "/" .
814 $this->lm->getPublicExportFile($type))) {
815 $no_download_file_available = "";
816 }
817 }
818 }
819 $dl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "cobj_act_downloads");
820 $dl->setInfo($this->lng->txt("cont_downloads_desc") . $no_download_file_available);
821 $dl->setChecked($this->lm->isActiveDownloads());
822 $form->addItem($dl);
823
824 // downloads in public area
825 $pdl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads_public_desc"), "cobj_act_downloads_public");
826 $pdl->setChecked($this->lm->isActiveDownloadsPublic());
827 $dl->addSubItem($pdl);
828
829 $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
830
831 $form->setTitle($lng->txt("cont_lm_menu"));
832 $form->setFormAction($ilCtrl->getFormAction($this));
833
834 return $form;
835 }
836
837 public function editMenuProperties(): void
838 {
840 $ilTabs = $this->tabs;
841 $ilCtrl = $this->ctrl;
843 $ilToolbar = $this->toolbar;
844
845 $lng->loadLanguageModule("style");
846 $this->setTabs();
847 $ilTabs->setTabActive("settings");
848 $this->setSubTabs("cont_lm_menu");
849
850 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
851 $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
852 $ilToolbar->setCloseFormTag(false);
853
854 $form = $this->initMenuForm();
855 $form->setOpenTag(false);
856 $form->setCloseTag(false);
857
858 $this->__initLMMenuEditor();
859 $entries = $this->lmme_obj->getMenuEntries();
860 $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
861 $table->setOpenFormTag(false);
862
863 $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
864 }
865
866 public function saveMenuProperties(): void
867 {
868 $form = $this->initMenuForm();
869 if ($form->checkInput()) {
870 $this->lm->setActiveLMMenu((int) $form->getInput("cobj_act_lm_menu"));
871 //$this->lm->setActiveTOC((int) $form->getInput("cobj_act_toc"));
872 $this->lm->setActivePrintView((int) $form->getInput("cobj_act_print"));
873 $this->lm->setActivePreventGlossaryAppendix((int) $form->getInput("cobj_act_print_prev_glo"));
874 $this->lm->setHideHeaderFooterPrint((int) $form->getInput("hide_head_foot_print"));
875 $this->lm->setActiveDownloads((int) $form->getInput("cobj_act_downloads"));
876 $this->lm->setActiveDownloadsPublic((int) $form->getInput("cobj_act_downloads_public"));
877 $this->lm->updateProperties();
878 }
879
880 $this->__initLMMenuEditor();
881 $this->lmme_obj->updateActiveStatus($this->edit_request->getMenuEntries());
882
883 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
884 $this->ctrl->redirect($this, "editMenuProperties");
885 }
886
887 public function proceedDragDrop(): void
888 {
889 $ilCtrl = $this->ctrl;
890
892 $this->lm->executeDragDrop(
893 $req->getHFormPar("source_id"),
894 $req->getHFormPar("target_id"),
895 $req->getHFormPar("fc"),
896 $req->getHFormPar("as_subitem")
897 );
898 $ilCtrl->redirect($this, "chapters");
899 }
900
901 protected function afterSave(ilObject $new_object): void
902 {
903 $new_object->setCleanFrames(true);
904 $new_object->update();
905
906 // create content object tree
907 $new_object->createLMTree();
908
909 // create a first chapter
910 $new_object->addFirstChapterAndPage();
911
912 // always send a message
913 $this->tpl->setOnScreenMessage('success', $this->lng->txt($this->type . "_added"), true);
914 $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "ref_id", $new_object->getRefId());
915 $this->ctrl->redirectByClass([ilLMEditorGUI::class, ilObjLearningModuleGUI::class], "");
916 }
917
918 protected function initImportForm(string $new_type): ilPropertyFormGUI
919 {
920 $form = parent::initImportForm($new_type);
921
922 // validation
923 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
924 $cb->setInfo($this->lng->txt(""));
925 $form->addItem($cb);
926 return $form;
927 }
928
929 protected function importFileObject(int $parent_id = null): void
930 {
932
933 $form = $this->initImportForm("lm");
934
935 try {
936 // the new import
937 parent::importFileObject(null);
938 return;
940 // we just run through in this case.
941 $no_manifest = true;
942 } catch (ilException $e) {
943 // display message and form again
944 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("obj_import_file_error") . " <br />" . $e->getMessage());
947 return;
948 }
949
950 if (!$no_manifest) {
951 return; // something different has gone wrong, but we have a manifest, this is definitely not "the old" import
952 }
953
954 throw new ilLMOldExportFileException("This file seems to be from ILIAS version 5.0.x or lower. Import is not supported anymore.");
955 }
956
960 public function chapters(): void
961 {
963 $ilCtrl = $this->ctrl;
964
965 $this->setTabs();
966 $this->setContentSubTabs("chapters");
967
968 $ilCtrl->setParameter($this, "backcmd", "chapters");
969
970 $form_gui = new ilChapterHierarchyFormGUI($this->lm->getType(), $this->requested_transl);
971 $form_gui->setFormAction($ilCtrl->getFormAction($this));
972 $form_gui->setTitle($this->lm->getTitle());
973 $form_gui->setIcon(ilUtil::getImagePath("icon_lm.svg"));
974 $form_gui->setTree($this->lm_tree);
975 $form_gui->setMaxDepth(0);
976 $this->tree->readRootId();
977 $form_gui->setCurrentTopNodeId($this->tree->getRootId());
978 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
979 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
980 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
981 if ($this->lm->getLayoutPerPage()) {
982 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
983 }
984 $form_gui->setDragIcon(ilUtil::getImagePath("icon_st.svg"));
985 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
986 $up_gui = "ilobjlearningmodulegui";
987
988 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
989 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
990 $ilCtrl->setParameter($this, "obj_id", null);
991
992 $ml_head = self::getMultiLangHeader($this->lm->getId(), $this);
993
994 $this->tpl->setContent($ml_head . $ctpl->get());
995 }
996
997 public static function getMultiLangHeader(
998 int $a_lm_id,
999 object $a_gui_class,
1000 string $a_mode = ""
1001 ): string {
1002 global $DIC;
1003
1004 $lng = $DIC->language();
1005 $ilCtrl = $DIC->ctrl();
1006
1008 ->learningModule()
1009 ->internal()
1010 ->gui()
1011 ->editing()
1012 ->request();
1013
1016
1017 $ml_head = "";
1018
1019 // multi language
1020 $ot = ilObjectTranslation::getInstance($a_lm_id);
1021 if ($ot->getContentActivated()) {
1022 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1023 $lng->loadLanguageModule("meta");
1024
1025 // info
1026 $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1027 $ml_head = $ml_gui->getMultiLangInfo($requested_transl);
1028
1029 // language switch
1030 $list = new ilAdvancedSelectionListGUI();
1031 $list->setListTitle($lng->txt("actions"));
1032 $list->setId("copage_act");
1033 $entries = false;
1034 if (!in_array($requested_transl, array("", "-"))) {
1035 $l = $ot->getMasterLanguage();
1036 $list->addItem(
1037 $lng->txt("cont_edit_language_version") . ": " .
1038 $lng->txt("meta_l_" . $l),
1039 "",
1040 $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1041 );
1042 $entries = true;
1043 }
1044
1045 foreach ($ot->getLanguages() as $al => $lang) {
1046 if ($requested_transl != $al &&
1047 $al != $ot->getMasterLanguage()) {
1048 $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1049 $list->addItem(
1050 $lng->txt("cont_edit_language_version") . ": " .
1051 $lng->txt("meta_l_" . $al),
1052 "",
1053 $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1054 );
1055 $ilCtrl->setParameter($a_gui_class, "totransl", $requested_totransl);
1056 }
1057 $entries = true;
1058 }
1059
1060 if ($entries) {
1061 $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $list->getHTML() . "</div>";
1062 }
1063 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1064 }
1065
1066 return $ml_head;
1067 }
1068
1069 public function pages(): void
1070 {
1071 $tpl = $this->tpl;
1072 $ilToolbar = $this->toolbar;
1073 $ilCtrl = $this->ctrl;
1074 $lng = $this->lng;
1075
1076 $this->setTabs();
1077 $this->setContentSubTabs("pages");
1078
1079 $ilCtrl->setParameter($this, "backcmd", "pages");
1080 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1081 $ilToolbar->addButton(
1082 $lng->txt("pg_add"),
1083 $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1084 );
1085 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1086
1087 $t = new ilLMPagesTableGUI($this, "pages", $this->lm);
1088 $tpl->setContent($t->getHTML());
1089 }
1090
1094 public function listLinks(): void
1095 {
1096 $tpl = $this->tpl;
1097
1098 $this->setTabs();
1099 $this->setContentSubTabs("internal_links");
1100
1101 $table_gui = new ilLinksTableGUI(
1102 $this,
1103 "listLinks",
1104 $this->lm->getId(),
1105 $this->lm->getType()
1106 );
1107
1108 $tpl->setContent($table_gui->getHTML());
1109 }
1110
1114 public function showMaintenance(): void
1115 {
1116 $ilToolbar = $this->toolbar;
1117
1118 $this->setTabs();
1119 $this->setContentSubTabs("maintenance");
1120
1121 $ilToolbar->addButton(
1122 $this->lng->txt("cont_fix_tree"),
1123 $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1124 );
1125 }
1126
1130 public function activatePages(): void
1131 {
1132 $ids = $this->edit_request->getIds();
1133 foreach ($ids as $id) {
1134 $act = ilLMPage::_lookupActive($id, $this->lm->getType());
1135 ilLMPage::_writeActive($id, $this->lm->getType(), !$act);
1136 }
1137
1138 $this->ctrl->redirect($this, "pages");
1139 }
1140
1144 public function pastePage(): void
1145 {
1147 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_page_in_clipboard"), true);
1148 $this->ctrl->redirect($this, "pages");
1149 }
1150
1151 // paste selected object
1153
1154 // copy page, if action is copy
1155 if (ilEditClipboard::getAction() == "copy") {
1156 // check wether page belongs to lm
1158 == $this->lm->getId()) {
1159 $lm_page = new ilLMPageObject($this->lm, $id);
1160 $new_page = $lm_page->copy($this->lm);
1161 $id = $new_page->getId();
1162 } else {
1163 // get page from other content object into current content object
1166 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1167 $lm_page = new ilLMPageObject($lm_obj, $id);
1168 $copied_nodes = array();
1169 $new_page = $lm_page->copyToOtherContObject($this->lm, $copied_nodes);
1170 $id = $new_page->getId();
1171 ilLMObject::updateInternalLinks($copied_nodes);
1172 }
1173 }
1174
1175 // cut is not be possible in "all pages" form yet
1176 if (ilEditClipboard::getAction() == "cut") {
1177 // check wether page belongs not to lm
1179 != $this->lm->getId()) {
1182 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1183 $lm_page = new ilLMPageObject($lm_obj, $id);
1184 $lm_page->setLMId($this->lm->getId());
1185 $lm_page->update();
1186 $page = $lm_page->getPageObject();
1187 $page->buildDom();
1188 $page->setParentId($this->lm->getId());
1189 $page->update();
1190 }
1191 }
1192
1193
1195 $this->ctrl->redirect($this, "pages");
1196 }
1197
1198 public function copyPage(): void
1199 {
1200 $ids = $this->edit_request->getIds();
1201 if (count($ids) == 0) {
1202 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1203 $this->ctrl->redirect($this, "pages");
1204 }
1205
1206 ilLMObject::clipboardCopy($this->lm->getId(), $ids);
1208
1209 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_copied"), true);
1210
1211 $this->ctrl->redirect($this, "pages");
1212 }
1213
1220 public function delete(int $a_parent_subobj_id = 0): void
1221 {
1222 $ids = $this->edit_request->getIds();
1223
1224 if (count($ids) == 0) {
1225 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1226 $this->cancelDelete();
1227 }
1228
1229 if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1230 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"), true);
1231 $this->cancelDelete();
1232 }
1233
1234 if ($a_parent_subobj_id == 0) {
1235 $this->setTabs("content");
1236 }
1237
1238 if ($a_parent_subobj_id != 0) {
1239 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $this->requested_backcmd);
1240 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1241 $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1242 } else {
1243 $this->ctrl->setParameter($this, "backcmd", $this->requested_backcmd);
1244 $form_action = $this->ctrl->getFormAction($this);
1245 }
1246
1247 // display confirmation message
1248 $cgui = new ilConfirmationGUI();
1249 $cgui->setFormAction($form_action);
1250 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1251 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1252 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1253
1254 foreach ($ids as $id) {
1255 if ($id != ilTree::POS_FIRST_NODE) {
1256 $obj = new ilLMObject($this->lm, $id);
1257 $caption = $obj->getTitle();
1258
1259 $cgui->addItem("id[]", $id, $caption);
1260 }
1261 }
1262
1263 $this->tpl->setContent($cgui->getHTML());
1264 }
1265
1266 public function cancelDelete(): void
1267 {
1268 $this->ctrl->redirect($this, $this->requested_backcmd);
1269 }
1270
1278 public function confirmedDelete(int $a_parent_subobj_id = 0): void
1279 {
1280 $tree = new ilLMTree($this->lm->getId());
1281
1282 $ids = $this->edit_request->getIds();
1283
1284 // check number of objects
1285 if (count($ids) == 0) {
1286 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1287 $this->ctrl->redirect($this, "cancelDelete");
1288 }
1289
1290 // delete all selected objects
1291 foreach ($ids as $id) {
1292 if ($id != ilTree::POS_FIRST_NODE) {
1293 $obj = ilLMObjectFactory::getInstance($this->lm, $id, false);
1294 $node_data = $tree->getNodeData($id);
1295 if (is_object($obj)) {
1296 $obj->setLMId($this->lm->getId());
1297
1299 $this->lm->getId(),
1300 "delete_" . $obj->getType(),
1302 $this->lm->getType()
1303 );
1304
1305 $obj->delete();
1306 }
1307 if ($tree->isInTree($id)) {
1308 $tree->deleteTree($node_data);
1309 }
1310 }
1311 }
1312
1313 // check the tree
1314 $this->lm->checkTree();
1315
1316 // feedback
1317 $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
1318
1319 if ($a_parent_subobj_id == 0) {
1320 $this->ctrl->redirect($this, $this->requested_backcmd);
1321 }
1322 }
1323
1324 public function getContextPath(
1325 int $a_endnode_id,
1326 int $a_startnode_id = 1
1327 ): string {
1328 $path = "";
1329
1330 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1331
1332 // count -1, to exclude the learning module itself
1333 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1334 if ($path != "") {
1335 $path .= " > ";
1336 }
1337
1338 $path .= $tmpPath[$i]["title"];
1339 }
1340
1341 return $path;
1342 }
1343
1344 public function showActions(array $a_actions): void
1345 {
1346 $d = null;
1347 foreach ($a_actions as $name => $lng) {
1348 $d[$name] = array("name" => $name, "lng" => $lng);
1349 }
1350
1351 $notoperations = array();
1352
1353 $operations = array();
1354
1355 if (is_array($d)) {
1356 foreach ($d as $row) {
1357 if (!in_array($row["name"], $notoperations)) {
1358 $operations[] = $row;
1359 }
1360 }
1361 }
1362
1363 if (count($operations) > 0) {
1364 foreach ($operations as $val) {
1365 $this->tpl->setCurrentBlock("operation_btn");
1366 $this->tpl->setVariable("BTN_NAME", $val["name"]);
1367 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1368 $this->tpl->parseCurrentBlock();
1369 }
1370
1371 $this->tpl->setCurrentBlock("operation");
1372 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1373 $this->tpl->parseCurrentBlock();
1374 }
1375 }
1376
1377 public function view(): void
1378 {
1379 if (strtolower($this->requested_baseClass) == "iladministrationgui") {
1380 $this->prepareOutput();
1381 parent::viewObject();
1382 } else {
1383 $this->viewObject();
1384 }
1385 }
1386
1387
1391 public function moveChapter(int $a_parent_subobj_id = 0): void
1392 {
1393 $ids = $this->edit_request->getIds();
1394 if (count($ids) == 0) {
1395 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1396 if ($a_parent_subobj_id == 0) {
1397 $this->ctrl->redirect($this, "chapters");
1398 }
1399 return;
1400 }
1401 if (count($ids) > 1) {
1402 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"));
1403 if ($a_parent_subobj_id == 0) {
1404 $this->ctrl->redirect($this, "chapters");
1405 }
1406 return;
1407 }
1408
1409 if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1410 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"));
1411 if ($a_parent_subobj_id == 0) {
1412 $this->ctrl->redirect($this, "chapters");
1413 }
1414 }
1415
1416 // SAVE POST VALUES
1417 ilEditClipboard::storeContentObject("st", $ids[0], "move");
1418
1419 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_chap_select_target_now"), true);
1420
1421 if ($a_parent_subobj_id == 0) {
1422 $this->ctrl->redirect($this, "chapters");
1423 }
1424 }
1425
1426 public function copyChapter(): void
1427 {
1428 $this->copyItems();
1429 }
1430
1431 public function pasteChapter(): void
1432 {
1433 $this->insertChapterClip();
1434 }
1435
1436 public function movePage(): void
1437 {
1438 $ids = $this->edit_request->getIds();
1439 if (count($ids) == 0) {
1440 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1441 $this->ctrl->redirect($this, "pages");
1442 }
1443
1444 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_cut"), true);
1445
1446 ilLMObject::clipboardCut($this->lm->getId(), $ids);
1448
1449 $this->ctrl->redirect($this, "pages");
1450 }
1451
1452 public function cancel(): void
1453 {
1454 if ($this->requested_new_type == "pg") {
1455 $this->ctrl->redirect($this, "pages");
1456 } else {
1457 $this->ctrl->redirect($this, "chapters");
1458 }
1459 }
1460
1461 public function export(): void
1462 {
1463 $ot = ilObjectTranslation::getInstance($this->lm->getId());
1464 $opt = "";
1465 if ($ot->getContentActivated()) {
1466 $format = explode("_", $this->edit_request->getFormat());
1467 $opt = ilUtil::stripSlashes($format[1]);
1468 }
1469
1470
1471 $cont_exp = new ilContObjectExport($this->lm);
1472 $cont_exp->buildExportFile($opt);
1473 }
1474
1479 string $a_type,
1480 string $a_file
1481 ): string {
1482 $lng = $this->lng;
1483 $ilCtrl = $this->ctrl;
1484 $add = "";
1485
1486 $changelink = "<a href='" . $ilCtrl->getLinkTarget($this, "editMenuProperties") . "'>" . $lng->txt("change") . "</a>";
1487 if (!$this->lm->isActiveLMMenu()) {
1488 $add = "<br />" . $lng->txt("cont_download_no_menu") . " " . $changelink;
1489 } elseif (!$this->lm->isActiveDownloads()) {
1490 $add = "<br />" . $lng->txt("cont_download_no_download") . " " . $changelink;
1491 }
1492
1493 $basetype = explode("_", $a_type);
1494 $basetype = $basetype[0];
1495
1496 if ($this->lm->getPublicExportFile($basetype) == $a_file) {
1497 return $lng->txt("yes") . $add;
1498 }
1499
1500 return " ";
1501 }
1502
1503 public function publishExportFile(
1504 ?array $a_files
1505 ): void {
1506 $ilCtrl = $this->ctrl;
1507
1508 if (!isset($a_files)) {
1509 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1510 } else {
1511 foreach ($a_files as $f) {
1512 $file = explode(":", $f);
1513 if (is_int(strpos($file[0], "_"))) {
1514 $file[0] = explode("_", $file[0])[0];
1515 }
1516 $export_dir = $this->lm->getExportDirectory($file[0]);
1517
1518 if ($this->lm->getPublicExportFile($file[0]) ==
1519 $file[1]) {
1520 $this->lm->setPublicExportFile($file[0], "");
1521 } else {
1522 $this->lm->setPublicExportFile($file[0], $file[1]);
1523 }
1524 }
1525 $this->lm->update();
1526 }
1527 $ilCtrl->redirectByClass("ilexportgui");
1528 }
1529
1530 public function fixTreeConfirm(): void
1531 {
1532 $this->setTabs();
1533 $this->setContentSubTabs("maintenance");
1534
1535 // display confirmation message
1536 $cgui = new ilConfirmationGUI();
1537 $cgui->setFormAction($this->ctrl->getFormAction($this));
1538 $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1539 $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1540 $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1541 $issues = $this->lm->checkStructure();
1542 $mess = "";
1543 if (count($issues) > 0) {
1544 $mess = "Found Issues: <br>" . implode("<br>", $issues);
1545 }
1546 $this->tpl->setContent($cgui->getHTML() . $mess);
1547 }
1548
1549 public function fixTree(): void
1550 {
1551 $this->lm->fixTree();
1552 $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_tree_fixed"), true);
1553 $this->ctrl->redirect($this, "showMaintenance");
1554 }
1555
1556 public function exportHTML(): void
1557 {
1558 $ot = ilObjectTranslation::getInstance($this->lm->getId());
1559 $lang = "";
1560 if ($ot->getContentActivated()) {
1561 $format = explode("_", $this->edit_request->getFormat());
1563 }
1564 $cont_exp = new ilContObjectExport($this->lm, "html", $lang);
1565 $cont_exp->buildExportFile();
1566 }
1567
1572 public function addLocations(
1573 bool $a_omit_obj_id = false
1574 ): void {
1575 $locator = $this->locator;
1576
1577 $obj_id = 0;
1578 if (!$a_omit_obj_id) {
1579 $obj_id = $this->requested_obj_id;
1580 }
1581 $lmtree = $this->lm->getTree();
1582 if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
1583 $path = $lmtree->getPathFull($obj_id);
1584 } else {
1585 $path = $lmtree->getPathFull($lmtree->getRootId());
1586 if ($obj_id != 0) {
1587 $path[] = array("type" => "pg", "child" => $this->obj_id,
1588 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
1589 }
1590 }
1591
1592 foreach ($path as $key => $row) {
1593 if ($row["child"] == 1) {
1594 $this->ctrl->setParameter($this, "obj_id", null);
1595 $locator->addItem($this->lm->getTitle(), $this->ctrl->getLinkTarget($this, "chapters"));
1596 } else {
1597 $title = $row["title"];
1598 switch ($row["type"]) {
1599 case "st":
1600 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
1601 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
1602 break;
1603
1604 case "pg":
1605 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
1606 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
1607 break;
1608 }
1609 }
1610 }
1611 if (!$a_omit_obj_id) {
1612 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1613 }
1614 }
1615
1619
1620
1621 public function listQuestions(): void
1622 {
1623 $tpl = $this->tpl;
1624
1625 $this->setTabs("questions");
1626 $this->setQuestionsSubTabs("question_stats");
1627
1628 $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->lm);
1629 $tpl->setContent($table->getHTML());
1630 }
1631
1632 public function listBlockedUsers(): void
1633 {
1634 $tpl = $this->tpl;
1635
1636 $this->setTabs("questions");
1637 $this->setQuestionsSubTabs("blocked_users");
1638
1639 $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->lm);
1640 $tpl->setContent($table->getHTML());
1641 }
1642
1643 public function resetNumberOfTries(): void
1644 {
1645 $lng = $this->lng;
1646 $ilCtrl = $this->ctrl;
1647
1648 $user_q_ids = $this->edit_request->getUserQuestionIds();
1649 if (count($user_q_ids) > 0) {
1650 foreach ($user_q_ids as $uqid) {
1651 $uqid = explode(":", $uqid);
1652 ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
1653 }
1654 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1655 }
1656 $ilCtrl->redirect($this, "listBlockedUsers");
1657 }
1658
1659 public function unlockQuestion(): void
1660 {
1661 $lng = $this->lng;
1662 $ilCtrl = $this->ctrl;
1663
1664 $user_q_ids = $this->edit_request->getUserQuestionIds();
1665 if (count($user_q_ids) > 0) {
1666 foreach ($user_q_ids as $uqid) {
1667 $uqid = explode(":", $uqid);
1668 ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
1669 }
1670 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1671 }
1672 $ilCtrl->redirect($this, "listBlockedUsers");
1673 }
1674
1675 public function sendMailToBlockedUsers(): void
1676 {
1677 $ilCtrl = $this->ctrl;
1678
1679 $user_q_ids = $this->edit_request->getUserQuestionIds();
1680 if (count($user_q_ids) == 0) {
1681 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), 1);
1682 $ilCtrl->redirect($this, "listBlockedUsers");
1683 }
1684
1685 $rcps = array();
1686 foreach ($user_q_ids as $uqid) {
1687 $uqid = explode(":", $uqid);
1688 $login = ilObjUser::_lookupLogin($uqid[1]);
1689 if (!in_array($login, $rcps)) {
1690 $rcps[] = $login;
1691 }
1692 }
1694 $this,
1695 'listBlockedUsers',
1696 array(),
1697 array(
1698 'type' => 'new',
1699 'rcp_to' => implode(',', $rcps),
1700 'sig' => $this->getBlockedUsersMailSignature()
1701 )
1702 ));
1703 }
1704
1705 protected function getBlockedUsersMailSignature(): string
1706 {
1707 $link = chr(13) . chr(10) . chr(13) . chr(10);
1708 $link .= $this->lng->txt('cont_blocked_users_mail_link');
1709 $link .= chr(13) . chr(10) . chr(13) . chr(10);
1710 $link .= ilLink::_getLink($this->lm->getRefId());
1711 return rawurlencode(base64_encode($link));
1712 }
1713
1714
1718
1719 protected function setTabs(string $a_act = ""): void
1720 {
1721 parent::setTitleAndDescription();
1722 $ilHelp = $this->help;
1723 $ilHelp->setScreenIdComponent("lm");
1724 $this->addTabs($a_act);
1725 }
1726
1727 public function setContentSubTabs(string $a_active): void
1728 {
1729 $ilTabs = $this->tabs;
1730 $lng = $this->lng;
1731 $ilCtrl = $this->ctrl;
1732
1733 $lm_set = new ilSetting("lm");
1734
1735 // chapters
1736 $ilTabs->addSubTab(
1737 "chapters",
1738 $lng->txt("cont_chapters"),
1739 $ilCtrl->getLinkTarget($this, "chapters")
1740 );
1741
1742 // all pages
1743 $ilTabs->addSubTab(
1744 "pages",
1745 $lng->txt("cont_all_pages"),
1746 $ilCtrl->getLinkTarget($this, "pages")
1747 );
1748
1749 // all pages
1750 $ilTabs->addSubTab(
1751 "short_titles",
1752 $lng->txt("cont_short_titles"),
1753 $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
1754 );
1755
1756 // export ids
1757 if ($lm_set->get("html_export_ids")) {
1758 if (!ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1759 $ilTabs->addSubTab(
1760 "export_ids",
1761 $lng->txt("cont_html_export_ids"),
1762 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1763 );
1764 }
1765 }
1766 if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1767 $lng->loadLanguageModule("help");
1768 $ilTabs->addSubTab(
1769 "export_ids",
1770 $lng->txt("cont_online_help_ids"),
1771 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1772 );
1773
1774 $ilTabs->addSubTab(
1775 "help_tooltips",
1776 $lng->txt("help_tooltips"),
1777 $ilCtrl->getLinkTarget($this, "showTooltipList")
1778 );
1779 }
1780
1781 // list links
1782 $ilTabs->addSubTab(
1783 "internal_links",
1784 $lng->txt("cont_internal_links"),
1785 $ilCtrl->getLinkTarget($this, "listLinks")
1786 );
1787
1788 $ilTabs->addSubTab(
1789 "history",
1790 $lng->txt("history"),
1791 $this->ctrl->getLinkTarget($this, "history")
1792 );
1793
1794 // maintenance
1795 $ilTabs->addSubTab(
1796 "maintenance",
1797 $lng->txt("cont_maintenance"),
1798 $ilCtrl->getLinkTarget($this, "showMaintenance")
1799 );
1800
1801 // srt files
1802 $ilTabs->addSubTab(
1803 "srt_files",
1804 $lng->txt("cont_subtitle_files"),
1805 $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1806 );
1807
1808 // srt files
1809 $ilTabs->addSubTab(
1810 "import",
1811 $lng->txt("cont_import"),
1812 $ilCtrl->getLinkTargetByClass("illmimportgui", "")
1813 );
1814
1815 $ilTabs->activateSubTab($a_active);
1816 $ilTabs->activateTab("content");
1817 }
1818
1819 public function setQuestionsSubTabs(string $a_active): void
1820 {
1821 $ilTabs = $this->tabs;
1822 $lng = $this->lng;
1823 $ilCtrl = $this->ctrl;
1824
1825 // chapters
1826 $ilTabs->addSubTab(
1827 "question_stats",
1828 $lng->txt("cont_question_stats"),
1829 $ilCtrl->getLinkTarget($this, "listQuestions")
1830 );
1831
1832 // blocked users
1833 $ilTabs->addSubTab(
1834 "blocked_users",
1835 $lng->txt("cont_blocked_users"),
1836 $ilCtrl->getLinkTarget($this, "listBlockedUsers")
1837 );
1838
1839 $ilTabs->activateSubTab($a_active);
1840 }
1841
1842 public function addTabs(string $a_act = ""): void
1843 {
1844 $rbacsystem = $this->rbacsystem;
1845 $ilTabs = $this->tabs;
1846 $lng = $this->lng;
1847
1848 // content
1849 $ilTabs->addTab(
1850 "content",
1851 $lng->txt("content"),
1852 $this->ctrl->getLinkTarget($this, "chapters")
1853 );
1854
1855 // info
1856 if ($this->object->isInfoEnabled()) {
1857 $ilTabs->addTab(
1858 "info",
1859 $lng->txt("info_short"),
1860 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
1861 );
1862 }
1863
1864 // settings
1865 $ilTabs->addTab(
1866 "settings",
1867 $lng->txt("settings"),
1868 $this->ctrl->getLinkTarget($this, 'properties')
1869 );
1870
1871 // questions
1872 $ilTabs->addTab(
1873 "questions",
1874 $lng->txt("objs_qst"),
1875 $this->ctrl->getLinkTarget($this, "listQuestions")
1876 );
1877
1878 // learning progress
1879 if (ilLearningProgressAccess::checkAccess($this->lm->getRefId()) and ($this->lm->getType() == 'lm')) {
1880 $ilTabs->addTab(
1881 'learning_progress',
1882 $lng->txt("learning_progress"),
1883 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
1884 );
1885 }
1886
1887 // meta data
1888 $mdgui = new ilObjectMetaDataGUI($this->lm);
1889 $mdtab = $mdgui->getTab();
1890 if ($mdtab) {
1891 $ilTabs->addTab(
1892 "meta",
1893 $lng->txt("meta_data"),
1894 $mdtab
1895 );
1896 }
1897
1898 // export
1899 $ilTabs->addTab(
1900 "export",
1901 $lng->txt("export"),
1902 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1903 );
1904
1905 // permissions
1906 if ($rbacsystem->checkAccess('edit_permission', $this->lm->getRefId())) {
1907 $ilTabs->addTab(
1908 "perm",
1909 $lng->txt("perm_settings"),
1910 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
1911 );
1912 }
1913
1914 if ($a_act != "") {
1915 $ilTabs->activateTab($a_act);
1916 }
1917
1918 // presentation view
1919 $ilTabs->addNonTabbedLink(
1920 "pres_mode",
1921 $lng->txt("cont_presentation_view"),
1922 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->lm->getRefId(),
1923 "_top"
1924 );
1925 }
1926
1927 public function setSubTabs(string $a_active): void
1928 {
1929 $ilTabs = $this->tabs;
1931
1932 if (in_array(
1933 $a_active,
1934 array("settings", "cont_style", "cont_lm_menu", "public_section",
1935 "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
1936 "lti_provider")
1937 )) {
1938 // general properties
1939 $ilTabs->addSubTabTarget(
1940 "settings",
1941 $this->ctrl->getLinkTarget($this, 'properties'),
1942 "",
1943 ""
1944 );
1945
1946 // style properties
1947 $ilTabs->addSubTabTarget(
1948 "cont_style",
1949 $this->ctrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", ""),
1950 "",
1951 "ilObjectContentStyleSettingsGUI"
1952 );
1953
1954 // menu properties
1955 $ilTabs->addSubTabTarget(
1956 "cont_lm_menu",
1957 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
1958 "",
1959 ""
1960 );
1961
1962 // glossaries
1963 $ilTabs->addSubTabTarget(
1964 "cont_glossaries",
1965 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
1966 "",
1967 ""
1968 );
1969
1970 if ($ilSetting->get("pub_section")) {
1971 // public section
1972 $ilTabs->addSubTabTarget(
1973 "public_section",
1974 $this->ctrl->getLinkTarget($this, 'editPublicSection'),
1975 "",
1976 ""
1977 );
1978 }
1979
1980 $ilTabs->addSubTabTarget(
1981 "obj_multilinguality",
1982 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
1983 );
1984
1985 $lti_settings = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
1986 if ($lti_settings->hasSettingsAccess()) {
1987 $ilTabs->addSubTabTarget(
1988 'lti_provider',
1989 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1990 );
1991 }
1992
1993 $ilTabs->setSubTabActive($a_active);
1994 }
1995 }
1996
1997 public function editPublicSection(): void
1998 {
1999 $ilTabs = $this->tabs;
2000 $ilToolbar = $this->toolbar;
2001 $ilAccess = $this->access;
2002
2003
2004 if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->lm->getRefId())) {
2005 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_anonymous_user_missing_perm"));
2006 }
2007
2008 $this->setTabs();
2009 $this->setSubTabs("public_section");
2010 $ilTabs->setTabActive("settings");
2011
2012 $this->tpl->addBlockFile(
2013 "ADM_CONTENT",
2014 "adm_content",
2015 "tpl.lm_public_selector.html",
2016 "Modules/LearningModule"
2017 );
2018
2019 // get learning module object
2020 $this->lm_obj = new ilObjLearningModule($this->ref_id, true);
2021
2022
2023 // public mode
2024 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
2025 $si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
2026 $si->setOptions($modes);
2027 $si->setValue($this->lm->getPublicAccessMode());
2028 $ilToolbar->addInputItem($si, true);
2029 $ilToolbar->addFormButton($this->lng->txt("save"), "savePublicSectionAccess");
2030 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "savePublicSectionAccess"));
2031
2032 if ($this->lm->getPublicAccessMode() == "selected") {
2033 $this->tpl->setCurrentBlock("select_pages");
2034 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSectionPages"));
2035
2036 $tree = new ilPublicSectionExplorerGUI(
2037 $this,
2038 "editPublicSection",
2039 $this->lm_obj,
2040 $this->edit_request->getTranslation()
2041 );
2042 $tree->setSelectMode("pages", true);
2043 $tree->setSkipRootNode(true);
2044
2045 $this->tpl->setVariable("EXPLORER", $tree->getHTML());
2046 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2047
2048 $this->tpl->parseCurrentBlock();
2049 }
2050 }
2051
2052 public function savePublicSection(): void
2053 {
2054 $this->lm->setPublicAccessMode(
2055 $this->edit_request->getLMPublicMode()
2056 );
2057 $this->lm->updateProperties();
2059 $this->edit_request->getPublicPages(),
2060 $this->lm->getId()
2061 );
2062 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
2063 $this->ctrl->redirect($this, "editPublicSection");
2064 }
2065
2069 public function savePublicSectionAccess(): void
2070 {
2071 $this->lm->setPublicAccessMode(
2072 $this->edit_request->getLMPublicMode()
2073 );
2074 $this->lm->updateProperties();
2075 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
2076 $this->ctrl->redirect($this, "editPublicSection");
2077 }
2078
2082 public function savePublicSectionPages(): void
2083 {
2085 $this->edit_request->getPublicPages(),
2086 $this->lm->getId()
2087 );
2088 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
2089 $this->ctrl->redirect($this, "editPublicSection");
2090 }
2091
2092 public function history(): void
2093 {
2094 $this->setTabs("content");
2095 $this->setContentSubTabs("history");
2096
2097 $hist_gui = new ilHistoryTableGUI(
2098 $this,
2099 "history",
2100 $this->lm->getId(),
2101 $this->lm->getType()
2102 );
2103 $hist_gui->initTable();
2104 $hist_gui->setCommentVisibility($this->lm->isActiveHistoryUserComments());
2105
2106 $this->tpl->setContent($hist_gui->getHTML());
2107 }
2108
2109 public function __initLMMenuEditor(): void
2110 {
2111 $this->lmme_obj = new ilLMMenuEditor();
2112 $this->lmme_obj->setObjId($this->lm->getId());
2113 }
2114
2118 public function addMenuEntry(?ilPropertyFormGUI $form = null): void
2119 {
2120 $ilTabs = $this->tabs;
2121 $ilToolbar = $this->toolbar;
2122 $ilCtrl = $this->ctrl;
2123
2124 $this->setTabs();
2125
2126 $ilTabs->setTabActive("settings");
2127 $this->setSubTabs("cont_lm_menu");
2128
2129 $ilToolbar->addButton(
2130 $this->lng->txt("lm_menu_select_internal_object"),
2131 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2132 );
2133
2134 if (is_null($form)) {
2135 $form = $this->initMenuEntryForm("create");
2136 }
2137 $this->tpl->setContent($form->getHTML());
2138 }
2139
2140 public function initMenuEntryForm(string $a_mode = "edit"): ilPropertyFormGUI
2141 {
2142 $lng = $this->lng;
2143 $ilCtrl = $this->ctrl;
2144
2145 $form = new ilPropertyFormGUI();
2146
2147 // title
2148 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2149 $ti->setMaxLength(255);
2150 $ti->setSize(40);
2151 $ti->setRequired(true);
2152 $form->addItem($ti);
2153
2154 // target
2155 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2156 $ta->setMaxLength(255);
2157 $ta->setSize(40);
2158 $ta->setRequired(true);
2159 $form->addItem($ta);
2160
2161 if ($a_mode == "edit") {
2162 $this->__initLMMenuEditor();
2163 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2164 $ti->setValue($this->lmme_obj->getTitle());
2165 $ta->setValue($this->lmme_obj->getTarget());
2166 }
2167
2168 if ($this->requested_link_ref_id > 0) {
2169 $link_ref_id = $this->requested_link_ref_id;
2170 $obj_type = ilObject::_lookupType($link_ref_id, true);
2171 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2172 $title = ilObject::_lookupTitle($obj_id);
2173
2174 $target_link = $obj_type . "_" . $link_ref_id;
2175 $ti->setValue($title);
2176 $ta->setValue($target_link);
2177
2178 // link ref id
2179 $hi = new ilHiddenInputGUI("link_ref_id");
2180 $hi->setValue($link_ref_id);
2181 $form->addItem($hi);
2182 }
2183
2184
2185 // save and cancel commands
2186 if ($a_mode == "create") {
2187 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2188 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2189 $form->setTitle($lng->txt("lm_menu_new_entry"));
2190 } else {
2191 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
2192 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2193 $form->setTitle($lng->txt("lm_menu_edit_entry"));
2194 }
2195
2196 $form->setFormAction($ilCtrl->getFormAction($this));
2197
2198 return $form;
2199 }
2200
2201 public function saveMenuEntry(): void
2202 {
2203 $form = $this->initMenuEntryForm("create");
2204 if ($form->checkInput()) {
2205 $this->__initLMMenuEditor();
2206 $this->lmme_obj->setTitle($form->getInput("title"));
2207 $this->lmme_obj->setTarget($form->getInput("target"));
2208 $this->lmme_obj->setLinkRefId((int) $form->getInput("link_ref_id"));
2209
2210 if ($form->getInput("link_ref_id")) {
2211 $this->lmme_obj->setLinkType("intern");
2212 }
2213
2214 $this->lmme_obj->create();
2215
2216 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_added"), true);
2217 $this->ctrl->redirect($this, "editMenuProperties");
2218 } else {
2219 $form->setValuesByPost();
2220 $this->addMenuEntry($form);
2221 }
2222 }
2223
2224 public function deleteMenuEntry(): void
2225 {
2226 if (empty($this->requested_menu_entry)) {
2227 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2228 $this->ctrl->redirect($this, "editMenuProperties");
2229 }
2230
2231 $this->__initLMMenuEditor();
2232 $this->lmme_obj->delete($this->requested_menu_entry);
2233
2234 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_removed"), true);
2235 $this->ctrl->redirect($this, "editMenuProperties");
2236 }
2237
2238 public function editMenuEntry(?ilPropertyFormGUI $form = null): void
2239 {
2240 $ilToolbar = $this->toolbar;
2241 $ilCtrl = $this->ctrl;
2242 $ilTabs = $this->tabs;
2243
2244 $this->setTabs();
2245
2246 $ilTabs->setTabActive("settings");
2247 $this->setSubTabs("cont_lm_menu");
2248
2249
2250 if (empty($this->requested_menu_entry)) {
2251 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2252 $this->ctrl->redirect($this, "editMenuProperties");
2253 }
2254
2255 $ilCtrl->saveParameter($this, array("menu_entry"));
2256 $ilToolbar->addButton(
2257 $this->lng->txt("lm_menu_select_internal_object"),
2258 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2259 );
2260
2261 if (is_null($form)) {
2262 $form = $this->initMenuEntryForm("edit");
2263 }
2264 $this->tpl->setContent($form->getHTML());
2265 }
2266
2267 public function updateMenuEntry(): void
2268 {
2269 $form = $this->initMenuEntryForm("edit");
2270 if ($form->checkInput()) {
2271 if ($this->edit_request->getMenuEntry() == "") {
2272 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2273 $this->ctrl->redirect($this, "editMenuProperties");
2274 }
2275
2276 $this->__initLMMenuEditor();
2277 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2278 $this->lmme_obj->setTitle($form->getInput("title"));
2279 $this->lmme_obj->setTarget($form->getInput("target"));
2280 if ($form->getInput("link_ref_id")) {
2281 $this->lmme_obj->setLinkType("intern");
2282 }
2283 if (is_int(strpos($form->getInput("target"), "."))) {
2284 $this->lmme_obj->setLinkType("extern");
2285 }
2286 $this->lmme_obj->update();
2287 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_updated"), true);
2288 $this->ctrl->redirect($this, "editMenuProperties");
2289 } else {
2290 $form->setValuesByPost();
2291 $this->editMenuEntry($form);
2292 }
2293 }
2294
2295 public function showEntrySelector(): void
2296 {
2297 $ilTabs = $this->tabs;
2298 $ilCtrl = $this->ctrl;
2299
2300 $this->setTabs();
2301
2302 $ilTabs->setTabActive("settings");
2303 $this->setSubTabs("cont_lm_menu");
2304
2305 $ilCtrl->saveParameter($this, array("menu_entry"));
2306
2307 $this->tpl->setOnScreenMessage('info', $this->lng->txt("lm_menu_select_object_to_add"));
2308
2310 $this,
2311 "showEntrySelector",
2312 $this,
2313 "addMenuEntry",
2314 "link_ref_id"
2315 );
2316 //$exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "glo", "fold"));
2317 $exp->setClickableTypes(array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs', "crs", "grp", "book", "tst", "file"));
2318 if (!$exp->handleCommand()) {
2319 $this->tpl->setContent($exp->getHTML());
2320 }
2321 }
2322
2326 public function selectHeader(): void
2327 {
2328 $ids = $this->edit_request->getIds();
2329 if (count($ids) == 0) {
2330 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2331 $this->ctrl->redirect($this, "pages");
2332 }
2333 if (count($ids) > 1) {
2334 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2335 $this->ctrl->redirect($this, "pages");
2336 }
2337 if ($ids[0] != $this->lm->getHeaderPage()) {
2338 $this->lm->setHeaderPage($ids[0]);
2339 } else {
2340 $this->lm->setHeaderPage(0);
2341 }
2342 $this->lm->updateProperties();
2343 $this->ctrl->redirect($this, "pages");
2344 }
2345
2349 public function selectFooter(): void
2350 {
2351 $ids = $this->edit_request->getIds();
2352 if (count($ids) == 0) {
2353 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2354 $this->ctrl->redirect($this, "pages");
2355 }
2356 if (count($ids) > 1) {
2357 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2358 $this->ctrl->redirect($this, "pages");
2359 }
2360 if ($ids[0] != $this->lm->getFooterPage()) {
2361 $this->lm->setFooterPage($ids[0]);
2362 } else {
2363 $this->lm->setFooterPage(0);
2364 }
2365 $this->lm->updateProperties();
2366 $this->ctrl->redirect($this, "pages");
2367 }
2368
2372 public function saveAllTitles(): void
2373 {
2374 $ilCtrl = $this->ctrl;
2375
2377 $this->lm,
2378 $this->edit_request->getTitles(),
2379 $this->requested_transl
2380 );
2381
2382 $this->tpl->setOnScreenMessage('success', $this->lng->txt("lm_save_titles"), true);
2383 $ilCtrl->redirect($this, "chapters");
2384 }
2385
2389 public function insertChapter(): void
2390 {
2391 $ilCtrl = $this->ctrl;
2392 $lng = $this->lng;
2393
2396
2397 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
2398 $parent_id = $this->lm_tree->getParentId($node_id);
2399 $target = $node_id;
2400 } else { // insert as first child
2401 $parent_id = $node_id;
2402 $target = ilTree::POS_FIRST_NODE;
2403 }
2404
2405 for ($i = 1; $i <= $num; $i++) {
2406 $chap = new ilStructureObject($this->lm);
2407 $chap->setType("st");
2408 $chap->setTitle($lng->txt("cont_new_chap"));
2409 $chap->setLMId($this->lm->getId());
2410 $chap->create();
2411 ilLMObject::putInTree($chap, $parent_id, $target);
2412 }
2413
2414 $ilCtrl->redirect($this, "chapters");
2415 }
2416
2420 public function insertChapterClip(): void
2421 {
2422 $ilUser = $this->user;
2423 $ilCtrl = $this->ctrl;
2424 $ilLog = $this->log;
2425
2428
2429 if (!$first_child) { // insert after node id
2430 $parent_id = $this->lm_tree->getParentId($node_id);
2431 $target = $node_id;
2432 } else { // insert as first child
2433 $parent_id = $node_id;
2434 $target = ilTree::POS_FIRST_NODE;
2435 }
2436
2437 // copy and paste
2438 $chapters = $ilUser->getClipboardObjects("st", true);
2439 $copied_nodes = array();
2440 foreach ($chapters as $chap) {
2441 $ilLog->write("Call pasteTree, Target LM: " . $this->lm->getId() . ", Chapter ID: " . $chap["id"]
2442 . ", Parent ID: " . $parent_id . ", Target: " . $target);
2443 $cid = ilLMObject::pasteTree(
2444 $this->lm,
2445 $chap["id"],
2446 $parent_id,
2447 $target,
2448 (string) ($chap["insert_time"] ?? ""),
2449 $copied_nodes,
2450 (ilEditClipboard::getAction() == "copy")
2451 );
2452 $target = $cid;
2453 }
2454 ilLMObject::updateInternalLinks($copied_nodes);
2455
2456 if (ilEditClipboard::getAction() == "cut") {
2457 $ilUser->clipboardDeleteObjectsOfType("pg");
2458 $ilUser->clipboardDeleteObjectsOfType("st");
2460 }
2461
2462 $this->lm->checkTree();
2463 $ilCtrl->redirect($this, "chapters");
2464 }
2465
2466 public static function _goto(string $a_target): void
2467 {
2468 global $DIC;
2469 $main_tpl = $DIC->ui()->mainTemplate();
2470
2471 $ilAccess = $DIC->access();
2472 $ilErr = $DIC["ilErr"];
2473 $lng = $DIC->language();
2474 $ctrl = $DIC->ctrl();
2475
2476 if ($ilAccess->checkAccess("read", "", $a_target)) {
2477 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2478 $ctrl->redirectByClass("ilLMPresentationGUI", "resume");
2479 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
2480 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2481 $ctrl->redirectByClass("ilLMPresentationGUI", "infoScreen");
2482 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2483 $main_tpl->setOnScreenMessage('failure', sprintf(
2484 $lng->txt("msg_no_perm_read_item"),
2486 ), true);
2488 }
2489
2490
2491 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
2492 }
2493
2494 public function cutItems(string $a_return = "chapters"): void
2495 {
2496 $ilCtrl = $this->ctrl;
2497 $lng = $this->lng;
2498
2499 $ids = $this->edit_request->getIds();
2500 if (count($ids) == 0) {
2501 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2502 $ilCtrl->redirect($this, $a_return);
2503 }
2504
2505 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2506 foreach ($ids as $k => $item) {
2507 if ($item < 0) {
2508 $todel[] = $k;
2509 }
2510 }
2511 foreach ($todel as $k) {
2512 unset($ids[$k]);
2513 }
2514 ilLMObject::clipboardCut($this->lm->getId(), $ids);
2516 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
2517
2518 $ilCtrl->redirect($this, $a_return);
2519 }
2520
2524 public function copyItems(): void
2525 {
2526 $ilCtrl = $this->ctrl;
2527 $lng = $this->lng;
2528
2529 $ids = $this->edit_request->getIds();
2530 if (count($ids) == 0) {
2531 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2532 $ilCtrl->redirect($this, "chapters");
2533 }
2534
2535 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2536 foreach ($ids as $k => $item) {
2537 if ($item < 0) {
2538 $todel[] = $k;
2539 }
2540 }
2541 foreach ($todel as $k) {
2542 unset($ids[$k]);
2543 }
2544 ilLMObject::clipboardCopy($this->lm->getId(), $ids);
2546 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
2547 $ilCtrl->redirect($this, "chapters");
2548 }
2549
2553 public function cutChapter(): void
2554 {
2555 $this->cutItems("chapters");
2556 }
2557
2561
2562 public function showExportIDsOverview(bool $a_validation = false): void
2563 {
2564 $tpl = $this->tpl;
2565 $ilToolbar = $this->toolbar;
2566 $lng = $this->lng;
2567 $ilCtrl = $this->ctrl;
2568
2569 $this->setTabs();
2570 $this->setContentSubTabs("export_ids");
2571
2572 if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
2573 // toolbar
2574 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2575 $lm_tree = $this->lm->getTree();
2576 $childs = $lm_tree->getChilds($lm_tree->readRootId());
2577 $options = array("" => $lng->txt("all"));
2578 foreach ($childs as $c) {
2579 $options[$c["child"]] = $c["title"];
2580 }
2581 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
2582 $si->setOptions($options);
2583 $si->setValue(ilSession::get("help_chap"));
2584 $ilToolbar->addInputItem($si, true);
2585 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
2586
2587 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation);
2588 } else {
2589 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
2590 }
2591
2592 $tpl->setContent($tbl->getHTML());
2593 }
2594
2595 public function filterHelpChapters(): void
2596 {
2597 $ilCtrl = $this->ctrl;
2598 ilSession::set("help_chap", $this->edit_request->getHelpChap());
2599 $ilCtrl->redirect($this, "showExportIDsOverview");
2600 }
2601
2602 public function saveExportIds(): void
2603 {
2604 $ilCtrl = $this->ctrl;
2605 $lng = $this->lng;
2606
2607 // check all export ids
2608 $ok = true;
2609 foreach ($this->edit_request->getExportIds() as $exp_id) {
2610 if ($exp_id != "" && !preg_match(
2611 "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
2612 trim($exp_id)
2613 )) {
2614 $ok = false;
2615 }
2616 }
2617 if (!$ok) {
2618 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
2619 $lng->txt("cont_exp_ids_not_resp_format3") . " " .
2620 $lng->txt("cont_exp_ids_not_resp_format2"));
2621 $this->showExportIDsOverview(true);
2622 return;
2623 }
2624
2625
2626 foreach ($this->edit_request->getExportIds() as $pg_id => $exp_id) {
2628 $this->lm->getId(),
2629 $pg_id,
2630 ilUtil::stripSlashes($exp_id),
2632 );
2633 }
2634
2635 $this->tpl->setOnScreenMessage('success', $lng->txt("cont_saved_export_ids"), true);
2636 $ilCtrl->redirect($this, "showExportIdsOverview");
2637 }
2638
2639 public function saveHelpMapping(): void
2640 {
2641 $lng = $this->lng;
2642 $ilCtrl = $this->ctrl;
2643
2644 foreach ($this->edit_request->getScreenIds() as $chap => $ids) {
2645 $ids = explode("\n", $ids);
2647 }
2648 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2649 $ilCtrl->redirect($this, "showExportIdsOverview");
2650 }
2651
2655
2656 public function showTooltipList(): void
2657 {
2658 $tpl = $this->tpl;
2659 $ilToolbar = $this->toolbar;
2660 $ilCtrl = $this->ctrl;
2661 $lng = $this->lng;
2662
2663 $this->setTabs();
2664 $this->setContentSubTabs("help_tooltips");
2665
2666 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2667 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
2668 $ti->setMaxLength(200);
2669 $ti->setSize(20);
2670 $ilToolbar->addInputItem($ti, true);
2671 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
2672 $ilToolbar->addSeparator();
2673
2674 $options = ilHelp::getTooltipComponents();
2675 if (ilSession::get("help_tt_comp") != "") {
2676 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
2677 }
2678 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
2679 $si->setOptions($options);
2680 $si->setValue(ilSession::get("help_tt_comp"));
2681 $ilToolbar->addInputItem($si, true);
2682 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
2683
2684 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", (string) ilSession::get("help_tt_comp"));
2685
2686 $tpl->setContent($tbl->getHTML());
2687 }
2688
2689 public function addTooltip(): void
2690 {
2691 $lng = $this->lng;
2692 $ilCtrl = $this->ctrl;
2693
2694 $tt_id = $this->edit_request->getTooltipId();
2695 if (trim($tt_id) != "") {
2696 if (is_int(strpos($tt_id, "_"))) {
2697 ilHelp::addTooltip(trim($tt_id), "");
2698 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2699
2700 $fu = strpos($tt_id, "_");
2701 $comp = substr($tt_id, 0, $fu);
2702 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
2703 } else {
2704 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_help_no_valid_tooltip_id"), true);
2705 }
2706 }
2707 $ilCtrl->redirect($this, "showTooltipList");
2708 }
2709
2710 public function filterTooltips(): void
2711 {
2712 $ilCtrl = $this->ctrl;
2713
2715 "help_tt_comp",
2716 $this->edit_request->getTooltipComponent()
2717 );
2718 $ilCtrl->redirect($this, "showTooltipList");
2719 }
2720
2721 public function saveTooltips(): void
2722 {
2723 $ilCtrl = $this->ctrl;
2724 $lng = $this->lng;
2725
2726 $tooltip_ids = $this->edit_request->getTooltipIds();
2727 foreach ($this->edit_request->getTooltipTexts() as $id => $text) {
2729 (int) $id,
2730 $text,
2731 $tooltip_ids[(int) $id]
2732 );
2733 }
2734 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2735 $ilCtrl->redirect($this, "showTooltipList");
2736 }
2737
2738 public function deleteTooltips(): void
2739 {
2740 $lng = $this->lng;
2741 $ilCtrl = $this->ctrl;
2742
2743 $ids = $this->edit_request->getIds();
2744 if (count($ids) > 0) {
2745 foreach ($ids as $id) {
2747 }
2748 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2749 }
2750 $ilCtrl->redirect($this, "showTooltipList");
2751 }
2752
2756
2757 public static function getLayoutOption(
2758 string $a_txt,
2759 string $a_var,
2760 string $a_def_option = ""
2762 global $DIC;
2763
2764 $im_tag = "";
2765
2766 $lng = $DIC->language();
2767
2768 // default layout
2769 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
2770 if ($a_def_option != "") {
2771 if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
2772 $im_tag = ilUtil::img($im, $a_def_option);
2773 }
2774 $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><b>" .
2775 $lng->txt("cont_lm_default_layout") .
2776 "</b>: " . $lng->txt("cont_layout_" . $a_def_option) .
2777 "</td></tr></table>", ""));
2778 }
2779 foreach (ilObjContentObject::getAvailableLayouts() as $l) {
2780 $im_tag = "";
2781 if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
2782 $im_tag = ilUtil::img($im, $l);
2783 }
2784 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
2785 $im_tag . "</td><td style='padding:5px;'><b>" . $lng->txt("cont_layout_" . $l) . "</b>: " .
2786 $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
2787 }
2788
2789 return $layout;
2790 }
2791
2795 public function setPageLayoutInHierarchy(): void
2796 {
2797 $ilCtrl = $this->ctrl;
2798 $ilCtrl->setParameter($this, "hierarchy", "1");
2799 $this->setPageLayout(true);
2800 }
2801
2802
2806 public function setPageLayout(
2807 bool $a_in_hierarchy = false
2808 ): void {
2809 $tpl = $this->tpl;
2810 $ilCtrl = $this->ctrl;
2811 $lng = $this->lng;
2812
2813 $ids = $this->edit_request->getIds();
2814 if (count($ids) == 0) {
2815 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2816
2817 if ($a_in_hierarchy) {
2818 $ilCtrl->redirect($this, "chapters");
2819 } else {
2820 $ilCtrl->redirect($this, "pages");
2821 }
2822 }
2823
2824 $this->initSetPageLayoutForm();
2825
2826 $tpl->setContent($this->form->getHTML());
2827 }
2828
2829 public function initSetPageLayoutForm(): void
2830 {
2831 $lng = $this->lng;
2832 $ilCtrl = $this->ctrl;
2833
2834 $this->form = new ilPropertyFormGUI();
2835
2836 $ids = $this->edit_request->getIds();
2837 foreach ($ids as $id) {
2838 $hi = new ilHiddenInputGUI("id[]");
2839 $hi->setValue($id);
2840 $this->form->addItem($hi);
2841 }
2842 $layout = self::getLayoutOption(
2843 $lng->txt("cont_layout"),
2844 "layout",
2845 $this->lm->getLayout()
2846 );
2847 $this->form->addItem($layout);
2848
2849 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
2850 $this->form->addCommandButton("pages", $lng->txt("cancel"));
2851
2852 $this->form->setTitle($lng->txt("cont_set_layout"));
2853 $this->form->setFormAction($ilCtrl->getFormAction($this));
2854 }
2855
2856 public function savePageLayout(): void
2857 {
2858 $lng = $this->lng;
2859 $ilCtrl = $this->ctrl;
2860
2861 $ilCtrl->setParameter($this, "hierarchy", $this->requested_hierarchy);
2862
2863 $ids = $this->edit_request->getIds();
2864 foreach ($ids as $id) {
2866 $id,
2867 $this->edit_request->getLayout(),
2868 $this->lm
2869 );
2870 }
2871 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2872
2873 if ($this->requested_hierarchy) {
2874 $ilCtrl->redirect($this, "chapters");
2875 } else {
2876 $ilCtrl->redirect($this, "pages");
2877 }
2878 }
2879
2880 //
2881 // Auto glossaries
2882 //
2883
2887 public function editGlossaries(): void
2888 {
2889 $tpl = $this->tpl;
2890 $ilToolbar = $this->toolbar;
2891 $lng = $this->lng;
2892 $ilCtrl = $this->ctrl;
2893 $ilTabs = $this->tabs;
2894
2895 $this->setTabs();
2896 $ilTabs->setTabActive("settings");
2897 $this->setSubTabs("cont_glossaries");
2898
2899 $ilToolbar->addButton(
2900 $lng->txt("add"),
2901 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
2902 );
2903
2904 $tab = new ilLMGlossaryTableGUI($this->lm, $this, "editGlossaries");
2905
2906 $tpl->setContent($tab->getHTML());
2907 }
2908
2909 public function showLMGlossarySelector(): void
2910 {
2911 $tpl = $this->tpl;
2912 $ilCtrl = $this->ctrl;
2913 $tree = $this->tree;
2914 $ilTabs = $this->tabs;
2915
2916 $this->setTabs();
2917 $ilTabs->setTabActive("settings");
2918 $this->setSubTabs("cont_glossaries");
2919
2920 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2921 $exp->setExpand($this->requested_search_root_expand ?: $tree->readRootId());
2922 $exp->setPathOpen($this->object->getRefId());
2923 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2924 $exp->setTargetClass(get_class($this));
2925 $exp->setCmd('confirmGlossarySelection');
2926 $exp->setClickableTypes(array("glo"));
2927 $exp->addFilter("glo");
2928
2929 // build html-output
2930 $exp->setOutput(0);
2931 $tpl->setContent($exp->getOutput());
2932 }
2933
2934 public function confirmGlossarySelection(): void
2935 {
2936 $ilCtrl = $this->ctrl;
2937 $tpl = $this->tpl;
2938 $lng = $this->lng;
2939
2940 $cgui = new ilConfirmationGUI();
2941 $ilCtrl->setParameter($this, "glo_ref_id", $this->requested_root_id);
2942 $cgui->setFormAction($ilCtrl->getFormAction($this));
2943 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
2944 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
2945 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
2946 $tpl->setContent($cgui->getHTML());
2947 }
2948
2949 public function selectLMGlossaryLink(): void
2950 {
2951 $glo_ref_id = $this->requested_glo_ref_id;
2952 $this->lm->autoLinkGlossaryTerms($glo_ref_id);
2953 $this->selectLMGlossary();
2954 }
2955
2956 public function selectLMGlossary(): void
2957 {
2958 $ilCtrl = $this->ctrl;
2959 $lng = $this->lng;
2960
2961 $glos = $this->lm->getAutoGlossaries();
2962 $glo_ref_id = $this->requested_glo_ref_id;
2963 $glo_id = ilObject::_lookupObjId($glo_ref_id);
2964 if (!in_array($glo_id, $glos)) {
2965 $glos[] = $glo_id;
2966 }
2967 $this->lm->setAutoGlossaries($glos);
2968 $this->lm->update();
2969
2970 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2971 $ilCtrl->redirect($this, "editGlossaries");
2972 }
2973
2974 public function removeLMGlossary(): void
2975 {
2976 $ilCtrl = $this->ctrl;
2977 $lng = $this->lng;
2978
2979 $this->lm->removeAutoGlossary($this->requested_glo_id);
2980 $this->lm->update();
2981
2982 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2983 $ilCtrl->redirect($this, "editGlossaries");
2984 }
2985
2986 public function editMasterLanguage(): void
2987 {
2988 $ilCtrl = $this->ctrl;
2989
2990 $ilCtrl->setParameter($this, "transl", "-");
2991 if ($this->lang_switch_mode == "short_titles") {
2992 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2993 }
2994 $ilCtrl->redirect($this, "chapters");
2995 }
2996
2997 public function switchToLanguage(): void
2998 {
2999 $ilCtrl = $this->ctrl;
3000
3001 $ilCtrl->setParameter($this, "transl", $this->requested_totransl);
3002 if ($this->lang_switch_mode == "short_titles") {
3003 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
3004 }
3005 $ilCtrl->redirect($this, "chapters");
3006 }
3007
3008 public function redrawHeaderAction(): void
3009 {
3010 // #12281
3011 parent::redrawHeaderActionObject();
3012 }
3013
3017 protected function learningProgress(): void
3018 {
3019 $this->ctrl->redirectByClass(array('illearningprogressgui'), '');
3020 }
3021}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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 class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
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 storeContentObject(string $a_type, int $a_id, string $a_action="cut")
static setAction(string $a_action)
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...
setFormAction(string $a_formaction)
setCloseTag(bool $a_val)
setOpenTag(bool $a_open)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static saveScreenIdsForChapter(int $a_chap, array $a_ids)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static updateTooltip(int $a_id, string $a_text, string $a_tt_id)
static deleteTooltip(int $a_id)
static getTooltipComponents(int $a_module_id=0)
Get all tooltip components.
static addTooltip(string $a_tt_id, string $a_text, int $a_module_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPostNodeId()
Get node ID of _POST input.
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false)
static getPostMulti()
Get multi number of _POST input.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object.
Class ilInfoScreenGUI.
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...
Import related features for learning modules.
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(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static saveExportId(int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects.
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _lookupTitle(int $a_obj_id)
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static _writePublicAccessStatus(array $a_pages, int $a_cont_obj_id)
update public access flags in lm_data for all pages of a content object
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
static _lookupType(int $a_obj_id, int $a_lm_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for Learning Module Page Objects Editing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
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...
Component logger with individual log levels by component id.
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
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 setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
Class ilObjContentObjectGUI.
static getMultiLangHeader(int $a_lm_id, object $a_gui_class, string $a_mode="")
afterSave(ilObject $new_object)
Post (successful) object creation hook.
static _goto(string $a_target)
ILIAS Style Content Service $content_style_service
selectHeader()
select page as header
savePublicSectionPages()
Saves public lm pages.
ilComponentRepository $component_repository
savePublicSectionAccess()
Saves lm access mode.
initMenuEntryForm(string $a_mode="edit")
editMenuEntry(?ilPropertyFormGUI $form=null)
insertChapter()
Insert (multiple) chapters at node.
getContextPath(int $a_endnode_id, int $a_startnode_id=1)
setPageLayout(bool $a_in_hierarchy=false)
Set layout for multiple pages.
saveAllTitles()
Save all titles of chapters/pages.
__construct( $a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=false)
copyItems()
Copy items to clipboard.
initPropertiesForm()
Init properties form.
confirmedDelete(int $a_parent_subobj_id=0)
delete page object or structure objects
addMenuEntry(?ilPropertyFormGUI $form=null)
display add menu entry form
static getLayoutOption(string $a_txt, string $a_var, string $a_def_option="")
getPropertiesFormValues()
Get values for properties form.
moveChapter(int $a_parent_subobj_id=0)
move a single chapter (selection)
listLinks()
List all broken links.
getPublicAccessColValue(string $a_type, string $a_file)
Get public access value for export table.
selectFooter()
select page as footer
ILIAS LearningModule ReadingTime SettingsGUI $reading_time_gui
cutItems(string $a_return="chapters")
showExportIDsOverview(bool $a_validation=false)
setPageLayoutInHierarchy()
Set layout for multiple pages.
importFileObject(int $parent_id=null)
addLocations(bool $a_omit_obj_id=false)
display locator
insertChapterClip()
Insert Chapter from clipboard.
activatePages()
activates or deactivates pages
editGlossaries()
Edit automatically linked glossaries.
static getAvailableLayouts()
get all available lm layouts
static isOnlineHelpModule(int $a_id, bool $a_as_obj_id=false)
Is module an online module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupLogin(int $a_user_id)
GUI class for the workflow of copying objects.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
ilAccessHandler $access
ilGlobalTemplateInterface $tpl
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilObjectService $object_service
ilSetting $settings
addHeaderAction()
Add header action menu.
setTabs()
set admin tabs
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static unlock(int $a_q_id, int $a_user_id)
Unlock question for user.
static resetTries(int $a_q_id, int $a_user_id)
Reset tries for user and question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Explorer for selecting repository items.
This class represents a selection list property in a property form.
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for Structure Objects Editing.
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...
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
const POS_FIRST_NODE
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static redirect(string $a_script)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$c
Definition: cli.php:38
const ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$valid
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
Readable part of repository interface to ilComponentDataDB.
Interface ilDBInterface.
setContent(string $a_html)
Sets content for standard template.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$path
Definition: ltiservices.php:32
if($format !==null) $name
Definition: metadata.php:247
$format
Definition: metadata.php:235
$i
Definition: metadata.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
string $key
Consumer key/client ID value.
Definition: System.php:193
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
form( $class_path, string $cmd)
catch(\Exception $e) $req
Definition: xapiproxy.php:93
global $ilSetting
Definition: privfeed.php:17
$ilErr
Definition: raiseError.php:17
$log
Definition: result.php:33
$lng
$lm_set
$lang
Definition: xapiexit.php:26