ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1<?php
2
24use ILIAS\LearningModule\Question\Usage\TableBuilder as QuestionUsageTableBuilder;
25
40{
41 protected \ILIAS\LearningModule\InternalGUIService $gui;
42 protected \ILIAS\LearningModule\InternalDomainService $domain;
44 protected \ILIAS\LearningModule\ReadingTime\SettingsGUI $reading_time_gui;
47 protected string $lang_switch_mode;
49 protected ilTabsGUI $tabs;
50 protected ilHelpGUI $help;
51 protected ilDBInterface $db;
52 protected ilLogger $log;
53 protected \ILIAS\DI\UIServices $ui;
55
56 protected bool $to_props = false;
57 protected int $requested_obj_id = 0;
58 protected string $requested_new_type = "";
59 protected string $requested_baseClass = "";
60 protected int $requested_ref_id = 0;
61 protected string $requested_transl = "";
62 protected string $requested_backcmd = "";
63 protected int $requested_menu_entry = 0;
64 protected int $requested_lm_menu_expand = 0;
66 protected bool $requested_hierarchy = false;
67 protected int $requested_root_id = 0;
68 protected int $requested_glo_id = 0;
69 protected int $requested_glo_ref_id = 0;
70 protected string $requested_lang_switch_mode = "";
71 protected int $requested_active_node = 0;
72 protected int $requested_lmexpand = 0;
73 protected int $requested_link_ref_id = 0;
74 protected string $requested_totransl = "";
75 protected bool $requested_lmmovecopy = false;
78 protected \ILIAS\Style\Content\Service $content_style_service;
79
80 protected ilLMTree $lm_tree;
81
89 public function __construct(
90 $a_data,
91 int $a_id = 0,
92 bool $a_call_by_reference = true,
93 bool $a_prepare_output = false
94 ) {
95 global $DIC;
96
97 $this->lng = $DIC->language();
98 $this->access = $DIC->access();
99 $this->tabs = $DIC->tabs();
100 $this->settings = $DIC->settings();
101 $this->user = $DIC->user();
102 $this->tpl = $DIC["tpl"];
103 $this->toolbar = $DIC->toolbar();
104 $this->rbacsystem = $DIC->rbac()->system();
105 $this->tree = $DIC->repositoryTree();
106 $this->help = $DIC["ilHelp"];
107 $this->locator = $DIC["ilLocator"];
108 $this->db = $DIC->database();
109 $this->log = $DIC["ilLog"];
110 $this->ui = $DIC->ui();
111 $lng = $DIC->language();
112 $ilCtrl = $DIC->ctrl();
113 $this->ctrl = $ilCtrl;
114 $this->component_repository = $DIC["component.repository"];
115 $lng->loadLanguageModule("content");
116 $lng->loadLanguageModule("obj");
117 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
118
119 $this->edit_request = $DIC
120 ->learningModule()
121 ->internal()
122 ->gui()
123 ->editing()
124 ->request();
125
127 $this->to_props = $req->getToProps();
128 $this->requested_obj_id = $req->getObjId();
129 $this->requested_ref_id = $req->getRefId();
130 $this->requested_root_id = $req->getRootId();
131 $this->requested_glo_id = $req->getGlossaryId();
132 $this->requested_glo_ref_id = $req->getGlossaryRefId();
133 $this->requested_menu_entry = $req->getMenuEntry();
134 $this->requested_lm_menu_expand = $req->getLMMenuExpand();
135 $this->requested_search_root_expand = $req->getSearchRootExpand();
136 $this->requested_new_type = $req->getNewType();
137 $this->requested_baseClass = $req->getBaseClass();
138 $this->requested_transl = $req->getTranslation();
139 $this->requested_backcmd = $req->getBackCmd();
140 $this->requested_hierarchy = $req->getHierarchy();
141 $this->lang_switch_mode = $req->getLangSwitchMode();
142 $this->requested_active_node = $req->getActiveNode();
143 $this->requested_lmexpand = $req->getLMExpand();
144 $this->requested_link_ref_id = $req->getLinkRefId();
145 $this->requested_totransl = $req->getToTranslation();
146 $this->requested_lmmovecopy = $req->getLMMoveCopy();
147 $this->content_style_service = $DIC
148 ->contentStyle();
149
150 $id = (isset($this->object))
151 ? $this->object->getId()
152 : 0;
153 $this->reading_time_gui = new \ILIAS\LearningModule\ReadingTime\SettingsGUI($id);
154 $this->domain = $DIC->learningModule()->internal()->domain();
155 $this->gui = $DIC->learningModule()->internal()->gui();
156 }
157
158 protected function checkCtrlPath(): void
159 {
160 if (!$this->getCreationMode()) {
161 $baseclass = strtolower($this->requested_baseClass);
162 $next_class = strtolower($this->ctrl->getNextClass());
163 // all calls must be routed through illmpresentationgui or
164 // illmeditorgui...
165 if (!in_array($baseclass, ["illmpresentationgui", "illmeditorgui"])) {
166 // ...except the comman action handler routes to
167 // activation/condition GUI, see https://mantis.ilias.de/view.php?id=32858
168 if (in_array($next_class, ["ilcommonactiondispatchergui"])) {
169 return;
170 }
171 throw new ilLMException("Wrong ctrl path");
172 }
173 }
174 }
175
180 public function executeCommand(): void
181 {
182 $ilAccess = $this->access;
184 $ilTabs = $this->tabs;
185 $ilCtrl = $this->ctrl;
186
187 $this->checkCtrlPath();
188
189 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
190 throw new ilLMException("No Explorer found.");
191 //$this->explorer();
192 //return "";
193 }
194
195 if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
196 $this->ctrl->setReturn($this, "explorer");
197 }
198
199 // get next class that processes or forwards current command
200 $next_class = $this->ctrl->getNextClass($this);
201
202 // get current command
203 if ($this->to_props) {
204 $cmd = $this->ctrl->getCmd("properties");
205 } else {
206 $cmd = $this->ctrl->getCmd("chapters");
207 }
208
209 switch ($next_class) {
210 case 'illtiproviderobjectsettinggui':
211
212 $this->setTabs();
213 $ilTabs->setTabActive("settings");
214 $this->setSubTabs("lti_provider");
215
216 $lti_gui = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
217 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->lm->getRefId()));
218 $lti_gui->offerLTIRolesForSelection(true);
219 $this->ctrl->forwardCommand($lti_gui);
220 break;
221
222
223
224 case "illearningprogressgui":
225 $this->addHeaderAction();
226 $this->addLocations();
227 $this->setTabs("learning_progress");
228
229 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->lm->getRefId());
230 $this->ctrl->forwardCommand($new_gui);
231
232 break;
233
234 case 'ilobjectmetadatagui':
235 if (!$ilAccess->checkAccess('write', '', $this->lm->getRefId())) {
236 throw new ilPermissionException($this->lng->txt('permission_denied'));
237 }
238
239 $this->addHeaderAction();
240 $this->addLocations();
241 $this->setTabs("meta");
242
243 $md_gui = new ilObjectMetaDataGUI($this->lm);
244 $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'Educational'); // #9510
245 $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'General');
246 $this->ctrl->forwardCommand($md_gui);
247 break;
248
249 case "ilobjectcontentstylesettingsgui":
250 $this->checkPermission("write");
251 $this->addHeaderAction();
252 $this->setTitleAndDescription();
253 $this->addLocations();
254 $this->setTabs("settings");
255 $this->setSubTabs("cont_style");
256
257 $settings_gui = $this->content_style_service
258 ->gui()
259 ->objectSettingsGUIForRefId(
260 null,
261 $this->object->getRefId()
262 );
263 $this->ctrl->forwardCommand($settings_gui);
264 break;
265
266
267 case "illmpageobjectgui":
268 $this->setTitleAndDescription();
269 $ilTabs->setBackTarget(
270 $lng->txt("learning module"),
271 $ilCtrl->getLinkTarget($this, "chapters")
272 );
273 $this->ctrl->saveParameter($this, array("obj_id"));
274 $this->addLocations();
275 $this->ctrl->setReturn($this, "chapters");
276
277 $pg_gui = new ilLMPageObjectGUI($this->lm);
278 if ($this->requested_obj_id > 0) {
280 $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
281 $pg_gui->setLMPageObject($obj);
282 }
283 $this->ctrl->forwardCommand($pg_gui);
284 break;
285
286 case "ilstructureobjectgui":
287 $ilTabs->setBackTarget(
288 $lng->txt("learning module"),
289 $ilCtrl->getLinkTarget($this, "chapters")
290 );
291
292 $this->ctrl->saveParameter($this, array("obj_id"));
293 $this->addLocations();
294 $this->ctrl->setReturn($this, "chapters");
295 $st_gui = new ilStructureObjectGUI($this->lm, $this->lm->lm_tree);
296 if ($this->requested_obj_id > 0) {
298 $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
299 $st_gui->setStructureObject($obj);
300 }
301 $this->ctrl->forwardCommand($st_gui);
302 if ($cmd == "save" || $cmd == "cancel") {
303 if ($this->requested_obj_id == 0) {
304 $this->ctrl->redirect($this, "chapters");
305 } else {
306 // $this->ctrl->setCmd("subchap");
307 $this->executeCommand();
308 }
309 }
310 break;
311
312 case 'ilpermissiongui':
313 if (strtolower($this->requested_baseClass) == "iladministrationgui") {
314 $this->prepareOutput();
315 } else {
316 $this->addHeaderAction();
317 $this->addLocations(true);
318 $this->setTabs("perm");
319 }
320 $perm_gui = new ilPermissionGUI($this);
321 $this->ctrl->forwardCommand($perm_gui);
322 break;
323
324 // infoscreen
325 case 'ilinfoscreengui':
326 if (!$this->object->isInfoEnabled()) {
327 return;
328 }
329 $this->addHeaderAction();
330 $this->addLocations(true);
331 $this->setTabs("info");
332 $info = new ilInfoScreenGUI($this);
333 $info->enablePrivateNotes();
334 $info->enableLearningProgress();
335 $info->enableNews();
336 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
337 $info->enableNewsEditing();
338 $info->setBlockProperty("news", "settings", true);
339 }
340
341 // show standard meta data section
342 $info->addMetaDataSections(
343 $this->lm->getId(),
344 0,
345 $this->lm->getType()
346 );
347
348 $this->ctrl->forwardCommand($info);
349 break;
350
351 case "ilexportgui":
352 switch ($cmd) {
353 case "doExportXML":
354 case "doExportHTML":
355 case "showExportOptionsXML":
356 case "showExportOptionsHTML":
357 $this->$cmd();
358 break;
359 default:
360 // it is important to reset the "transl" parameter here
361 // otherwise it will effect the HTML export and overwrite the selected language
362 $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "transl", "");
363 $this->ctrl->setParameterByClass(ilLMEditorGUI::class, "transl", "");
364 $exp_gui = new ilExportGUI($this);
365 $this->ctrl->forwardCommand($exp_gui);
366 $this->addHeaderAction();
367 $this->addLocations(true);
368 $this->setTabs("export");
369 }
370 break;
371
372 case strtolower(TranslationGUI::class):
373 $this->addHeaderAction();
374 $this->addLocations(true);
375 $this->setTabs("settings");
376 $this->setSubTabs("obj_multilinguality");
377 $transgui = new TranslationGUI(
378 $this->getObject(),
379 $this->lng,
380 $this->access,
381 $this->user,
382 $this->ctrl,
383 $this->tpl,
384 $this->ui_factory,
385 $this->ui_renderer,
386 $this->http,
387 $this->refinery,
388 $this->toolbar
389 );
390 $transgui->forceContentTranslation();
391 $this->ctrl->forwardCommand($transgui);
392 break;
393
394
395 case "ilcommonactiondispatchergui":
397 $this->prepareOutput();
398 $this->ctrl->forwardCommand($gui);
399 break;
400
401 case 'ilobjectcopygui':
402 $this->prepareOutput();
403 $cp = new ilObjectCopyGUI($this);
404 $cp->setType('lm');
405 $this->ctrl->forwardCommand($cp);
406 break;
407
408 case "ilmobmultisrtuploadgui":
409 $this->addHeaderAction();
410 $this->addLocations(true);
411 $this->setTabs("media");
412 $this->setMediaSubTabs("srt_files");
413 $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->lm));
414 $this->ctrl->forwardCommand($gui);
415 break;
416
417 case "illmimportgui":
418 $this->addHeaderAction();
419 $this->addLocations(true);
420 $this->setTabs("content");
421 $this->setContentSubTabs("import");
422 $gui = new ilLMImportGUI($this->lm);
423 $this->ctrl->forwardCommand($gui);
424 break;
425
426 case "illmeditshorttitlesgui":
427 $this->addHeaderAction();
428 $this->addLocations(true);
429 $this->setTabs("content");
430 $this->setContentSubTabs("short_titles");
432 $lm_gui = $this;
434 $lm_gui,
435 $this->edit_request->getTranslation()
436 );
437 $this->ctrl->forwardCommand($gui);
438 break;
439
440 case strtolower(EditSubObjectsGUI::class):
441 $this->addHeaderAction();
442 $this->addLocations(true);
443 $this->setTabs("content");
444 if ($this->edit_request->getSubType() === "pg") {
445 $this->setContentSubTabs("sub_pages");
446 } else {
447 $this->setContentSubTabs("sub_chapters");
448 }
449
450 $gui = $this->gui->editing()->editSubObjectsGUI(
451 $this->edit_request->getSubType(),
452 $this->lm,
453 $this->lng->txt("cont_chapters")
454 );
455 $this->ctrl->forwardCommand($gui);
456 break;
457
458 case strtolower(ilMediaObjectOverviewGUI::class):
459 if (!$ilAccess->checkAccess('write', '', $this->lm->getRefId())) {
460 throw new ilPermissionException($this->lng->txt('permission_denied'));
461 }
462
463 $this->addHeaderAction();
464 $this->addLocations();
465 $this->setTabs("media");
466 $this->setMediaSubTabs("usages");
467
468 $page_retrieval = new PageRetrieval($this->lm->getId(), $this->ctrl);
469 $gui = new ilMediaObjectOverviewGUI($page_retrieval);
470 $this->ctrl->forwardCommand($gui);
471 break;
472
473 default:
474 $new_type = $this->requested_new_type;
475
476 if ($cmd == "create" &&
477 !in_array($new_type, array("lm"))) {
478 switch ($new_type) {
479 case "pg":
480 $this->ctrl->redirectByClass(ilLMPageObjectGUI::class, $this->ctrl->getCmd());
481 break;
482
483 case "st":
484 $this->ctrl->redirectByClass(ilStructureObjectGUI::class, $this->ctrl->getCmd());
485 break;
486 }
487 } else {
488 // creation of new dbk/lm in repository
489 if ($this->getCreationMode() === true &&
490 $new_type === "lm") {
491 $this->prepareOutput();
492 if ($cmd == "") { // this may be due to too big upload files
493 $cmd = "create";
494 }
495 $cmd .= "Object";
496 } else {
497 $this->addHeaderAction();
498 $this->addLocations();
499 }
500 $this->$cmd();
501 }
502 break;
503 }
504 }
505
506 protected function buildExportOptionsFormHTML(): ILIAS\UI\Component\Input\Container\Form\Standard
507 {
508 $this->lng->loadLanguageModule('exp');
509 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
510 $items = [];
511 if ($ot->getContentTranslationActivated()) {
512 $this->lng->loadLanguageModule("meta");
513 $langs = $ot->getLanguages();
514 foreach ($langs as $l => $ldata) {
515 $items["html_" . $l] = $this->lng->txt("meta_l_" . $l);
516 }
517 $items["html_all"] = $this->lng->txt("cont_all_languages");
518 }
519 if (!$ot->getContentTranslationActivated()) {
520 $items["exportHTML"] = "HTML";
521 }
522 $select = $this->ui->factory()->input()->field()->select($this->lng->txt("language"), $items)
523 ->withRequired(true);
524 $section = $this->ui->factory()->input()->field()->section(
525 [$select],
526 $this->lng->txt("export_options")
527 );
528 return $this->ui->factory()->input()->container()->form()->standard(
529 $this->ctrl->getLinkTargetByClass(ilObjContentObjectGUI::class, "doExportHTML"),
530 [$section]
531 )->withSubmitLabel($this->lng->txt("export"));
532 }
533
534 protected function buildExportOptionsFormXML(): ILIAS\UI\Component\Input\Container\Form\Standard
535 {
536 $this->lng->loadLanguageModule('exp');
537 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
538 $items = [];
539 if ($ot->getContentTranslationActivated()) {
540 $items["xml_master"] = $this->lng->txt("cont_master_language_only");
541 $items["xml_masternomedia"] = $this->lng->txt("cont_master_language_only_no_media");
542 $this->lng->loadLanguageModule("meta");
543 $langs = $ot->getLanguages();
544 }
545 $select = $this->ui->factory()->input()->field()->select($this->lng->txt("export_type"), $items)
546 ->withRequired(true);
547 $section = $this->ui->factory()->input()->field()->section(
548 [$select],
549 $this->lng->txt("export_options")
550 );
551 return $this->ui->factory()->input()->container()->form()->standard(
552 $this->ctrl->getLinkTargetByClass(ilObjContentObjectGUI::class, "doExportXML"),
553 [$section]
554 )->withSubmitLabel($this->lng->txt("export"));
555 }
556
557 protected function showExportOptionsXML(): void
558 {
559 $this->addHeaderAction();
560 $this->addLocations(true);
561 $this->setTabs("export");
562 $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($this->buildExportOptionsFormXML()));
563 }
564
565 protected function showExportOptionsHTML(): void
566 {
567 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
568 if ($ot->getContentTranslationActivated()) {
569 $this->addHeaderAction();
570 $this->addLocations(true);
571 $this->setTabs("export");
572 $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($this->buildExportOptionsFormHTML()));
573 }
574 if (!$ot->getContentTranslationActivated()) {
575 $this->doExportHTML();
576 }
577 }
578
579 protected function doExportXML(): void
580 {
581 $form = $this->buildExportOptionsFormXML()->withRequest($this->request);
582 $format = "";
583 if (!is_null($form->getData())) {
584 $format = explode("_", $form->getData()[0][0]);
585 }
586 if (is_null($form->getData())) {
587 $this->addHeaderAction();
588 $this->addLocations(true);
589 $this->setTabs("export");
590 $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($form));
591 return;
592 }
593 $opt = ilUtil::stripSlashes($format[1]);
594 $cont_exp = new ilContObjectExport($this->lm);
595 $cont_exp->buildExportFile($opt);
596 $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
597 }
598
599 protected function doExportHTML(): void
600 {
601 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
602 $form = $this->buildExportOptionsFormHTML()->withRequest($this->request);
603 $lang = "";
604 if ($ot->getContentTranslationActivated() and !is_null($form->getData())) {
605 $format = explode("_", $form->getData()[0][0]);
606 $lang = ilUtil::stripSlashes($format[1]);
607 }
608 if ($ot->getContentTranslationActivated() and is_null($form->getData())) {
609 $this->addHeaderAction();
610 $this->addLocations(true);
611 $this->setTabs("export");
612 $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($form));
613 return;
614 }
615 $cont_exp = new ilContObjectExport($this->lm, "html", $lang);
616 $cont_exp->buildExportFile();
617 $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
618 }
619
623 public function properties(): void
624 {
626
627 $lng->loadLanguageModule("style");
628 $this->setTabs("settings");
629 $this->setSubTabs("settings");
630
631 // lm properties
632 $this->initPropertiesForm();
634
635 // Edit ecs export settings
636 $ecs = new ilECSLearningModuleSettings($this->lm);
637 $ecs->addSettingsToForm($this->form, 'lm');
638
639 $this->tpl->setContent($this->form->getHTML());
640 }
641
645 public function initPropertiesForm(): void
646 {
647 $obj_service = $this->object_service;
648
649 $ilCtrl = $this->ctrl;
652
653 $this->form = new ilPropertyFormGUI();
654
655 // title
656 $ti = new ilTextInputGUI($lng->txt("title"), "title");
657 $ti->setRequired(true);
658 $this->form->addItem($ti);
659
660 // description
661 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
662 $this->form->addItem($ta);
663
664 $lng->loadLanguageModule("rep");
665 $section = new ilFormSectionHeaderGUI();
666 $section->setTitle($this->lng->txt('rep_activation_availability'));
667 $this->form->addItem($section);
668
669 // online
670 $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
671 $this->form->addItem($online);
672
673 // presentation
674 $section = new ilFormSectionHeaderGUI();
675 $section->setTitle($this->lng->txt('cont_presentation'));
676 $this->form->addItem($section);
677
678 // tile image
679 $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->addTileImage();
680
681 // page header
682 $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
683 $option = array("st_title" => $this->lng->txt("cont_st_title"),
684 "pg_title" => $this->lng->txt("cont_pg_title"),
685 "none" => $this->lng->txt("cont_none"));
686 $page_header->setOptions($option);
687 $this->form->addItem($page_header);
688
689 // chapter numeration
690 $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
691 $this->form->addItem($chap_num);
692
693 // toc mode
694 $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
695 $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
696 "pages" => $this->lng->txt("cont_chapters_and_pages"));
697 $toc_mode->setOptions($option);
698 $this->form->addItem($toc_mode);
699
700 // show progress icons
701 $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
702 $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
703 $this->form->addItem($progr_icons);
704
705 $this->reading_time_gui->addSettingToForm($this->form);
706
707 // self assessment
708 $section = new ilFormSectionHeaderGUI();
709 $section->setTitle($this->lng->txt('cont_self_assessment'));
710 $this->form->addItem($section);
711
712 // tries
713 $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
714 $radg->setValue("0");
715 $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), "0", $lng->txt("cont_tries_reset_on_visit_info"));
716 $radg->addOption($op1);
717 $op2 = new ilRadioOption($lng->txt("cont_tries_store"), "1", $lng->txt("cont_tries_store_info"));
718 $radg->addOption($op2);
719 $this->form->addItem($radg);
720
721 // restrict forward navigation
722 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
723 $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
724 $this->form->addItem($qfeed);
725
726 // notification
727 $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
728 $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
729 $qfeed->addSubItem($not);
730
731 // disable default feedback for questions
732 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
733 $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
734 $this->form->addItem($qfeed);
735
736 // additional features
737 $section = new ilFormSectionHeaderGUI();
738 $section->setTitle($this->lng->txt('obj_features'));
739 $this->form->addItem($section);
740
741 // public notes
742 if (!$ilSetting->get('disable_comments')) {
743 $this->lng->loadLanguageModule("notes");
744 $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
745 $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
746 $this->form->addItem($pub_nodes);
747 }
748
749 // rating
750 $this->lng->loadLanguageModule('rating');
751 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
752 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
753 $this->form->addItem($rate);
754 $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
755 $this->form->addItem($ratep);
756
757 $this->form->setTitle($lng->txt("cont_lm_properties"));
758 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
759 $this->form->setFormAction($ilCtrl->getFormAction($this));
760
762 $this->object->getId(),
763 $this->form,
764 [
766 ]
767 );
768 }
769
773 public function getPropertiesFormValues(): void
774 {
775 $ilUser = $this->user;
776
777 $values = array();
778
779 $title = $this->lm->getTitle();
780 $description = $this->lm->getLongDescription();
781 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
782 if ($ot->getContentTranslationActivated()) {
783 $title = $ot->getDefaultTitle();
784 $description = $ot->getDefaultDescription();
785 }
786
787 $values["title"] = $title;
788 $values["description"] = $description;
789 if (!$this->lm->getOfflineStatus()) {
790 $values["cobj_online"] = true;
791 }
792 //$values["lm_layout"] = $this->lm->getLayout();
793 $values["lm_pg_header"] = $this->lm->getPageHeader();
794 if ($this->lm->isActiveNumbering()) {
795 $values["cobj_act_number"] = true;
796 }
797 $values["toc_mode"] = $this->lm->getTOCMode();
798 if ($this->lm->publicNotes()) {
799 $values["cobj_pub_notes"] = true;
800 }
801 if ($this->lm->cleanFrames()) {
802 $values["cobj_clean_frames"] = true;
803 }
804 //$values["layout_per_page"] = $this->lm->getLayoutPerPage();
805 $values["rating"] = $this->lm->hasRating();
806 $values["rating_pages"] = $this->lm->hasRatingPages();
807 $values["disable_def_feedback"] = $this->lm->getDisableDefaultFeedback();
808 $values["progr_icons"] = $this->lm->getProgressIcons();
809 $values["store_tries"] = (string) (int) $this->lm->getStoreTries();
810 $values["restrict_forw_nav"] = $this->lm->getRestrictForwardNavigation();
811
812 $values["notification_blocked_users"] = ilNotification::hasNotification(
814 $ilUser->getId(),
815 $this->lm->getId()
816 );
817
818 $values["cont_show_info_tab"] = $this->object->isInfoEnabled();
819 $this->form->setValuesByArray($values, true);
820 }
821
825 public function saveProperties(): void
826 {
828 $ilUser = $this->user;
830 $obj_service = $this->object_service;
831
832 $add_info = "";
833
834 $valid = false;
835 $this->initPropertiesForm();
836 $form = $this->form;
837 if ($form->checkInput()) {
838 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
839 if ($ot->getContentTranslationActivated()) {
840 $this->lm->getObjectProperties()->storePropertyTranslations(
841 $ot->withDefaultTitle($form->getInput('title'))
842 ->withDefaultDescription($form->getInput('description'))
843 );
844 }
845
846 $this->lm->setTitle($form->getInput('title'));
847 $this->lm->setDescription($form->getInput('description'));
848 $this->lm->setPageHeader($form->getInput("lm_pg_header"));
849 $this->lm->setTOCMode($form->getInput("toc_mode"));
850 $this->lm->setOfflineStatus(!($form->getInput('cobj_online')));
851 $this->lm->setActiveNumbering((bool) $form->getInput("cobj_act_number"));
852 $this->lm->setCleanFrames((bool) $form->getInput("cobj_clean_frames"));
853 if (!$ilSetting->get('disable_comments')) {
854 $this->lm->setPublicNotes($form->getInput("cobj_pub_notes"));
855 }
856 $this->lm->setRating((bool) $form->getInput("rating"));
857 $this->lm->setRatingPages((bool) $form->getInput("rating_pages"));
858 $this->lm->setDisableDefaultFeedback((int) $form->getInput("disable_def_feedback"));
859 $this->lm->setProgressIcons((int) $form->getInput("progr_icons"));
860 $this->reading_time_gui->saveSettingFromForm($this->form);
861
862 $add_info = "";
863 $store_tries = $form->getInput("store_tries");
864 if ($form->getInput("restrict_forw_nav") && !$form->getInput("store_tries")) {
865 $store_tries = 1;
866 $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
867 $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
868 $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
869 }
870
871 $this->lm->setStoreTries((int) $store_tries);
872 $this->lm->setRestrictForwardNavigation((int) $form->getInput("restrict_forw_nav"));
873 $this->lm->updateProperties();
874 $this->lm->update();
875
876 // tile image
877 $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->saveTileImage();
878
881 $ilUser->getId(),
882 $this->lm->getId(),
883 (bool) $this->form->getInput("notification_blocked_users")
884 );
885
886 // services
888 $this->object->getId(),
889 $this->form,
890 array(
892 )
893 );
894
895
896 // Update ecs export settings
897 $ecs = new ilECSLearningModuleSettings($this->lm);
898 if ($ecs->handleSettingsUpdate($form)) {
899 $valid = true;
900 }
901 }
902
903 if ($valid) {
904 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified") . $add_info, true);
905 $this->ctrl->redirect($this, "properties");
906 } else {
907 $lng->loadLanguageModule("style");
908 $this->setTabs("settings");
909 $this->setSubTabs("cont_general_properties");
910
911 $this->form->setValuesByPost();
912 $this->tpl->setContent($this->form->getHTML());
913 }
914 }
915
917 {
919 $ilCtrl = $this->ctrl;
920
921 $form = new ilPropertyFormGUI();
922
923 // enable menu
924 $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
925 $menu->setChecked($this->lm->isActiveLMMenu());
926 $form->addItem($menu);
927
928 // toc
929 /*
930 $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
931
932 $toc->setChecked($this->lm->isActiveTOC());
933 $form->addItem($toc);*/
934
935 // print view
936 $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
937 $print->setChecked($this->lm->isActivePrintView());
938 $form->addItem($print);
939
940 // prevent glossary appendix
941 $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
942 $glo->setChecked($this->lm->isActivePreventGlossaryAppendix());
943 $print->addSubItem($glo);
944
945 // hide header and footer in print view
946 $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
947 $hhfp->setChecked($this->lm->getHideHeaderFooterPrint());
948 $print->addSubItem($hhfp);
949
950 $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
951
952 $form->setTitle($lng->txt("cont_lm_menu"));
953 $form->setFormAction($ilCtrl->getFormAction($this));
954
955 return $form;
956 }
957
958 public function editMenuProperties(): void
959 {
961 $ilTabs = $this->tabs;
962 $ilCtrl = $this->ctrl;
964 $ilToolbar = $this->toolbar;
965
966 $lng->loadLanguageModule("style");
967 $this->setTabs();
968 $ilTabs->setTabActive("settings");
969 $this->setSubTabs("cont_lm_menu");
970
971 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
972 $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
973 $ilToolbar->setCloseFormTag(false);
974
975 $form = $this->initMenuForm();
976 $form->setOpenTag(false);
977 $form->setCloseTag(false);
978
979 $this->__initLMMenuEditor();
980 $entries = $this->lmme_obj->getMenuEntries();
981 $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
982 $table->setOpenFormTag(false);
983
984 $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
985 }
986
987 public function saveMenuProperties(): void
988 {
989 $form = $this->initMenuForm();
990 if ($form->checkInput()) {
991 $this->lm->setActiveLMMenu((int) $form->getInput("cobj_act_lm_menu"));
992 //$this->lm->setActiveTOC((int) $form->getInput("cobj_act_toc"));
993 $this->lm->setActivePrintView((int) $form->getInput("cobj_act_print"));
994 $this->lm->setActivePreventGlossaryAppendix((int) $form->getInput("cobj_act_print_prev_glo"));
995 $this->lm->setHideHeaderFooterPrint((int) $form->getInput("hide_head_foot_print"));
996 $this->lm->updateProperties();
997 }
998
999 $this->__initLMMenuEditor();
1000 $this->lmme_obj->updateActiveStatus($this->edit_request->getMenuEntries());
1001
1002 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1003 $this->ctrl->redirect($this, "editMenuProperties");
1004 }
1005
1006 public function proceedDragDrop(): void
1007 {
1008 $ilCtrl = $this->ctrl;
1009
1011 $this->lm->executeDragDrop(
1012 $req->getHFormPar("source_id"),
1013 $req->getHFormPar("target_id"),
1014 $req->getHFormPar("fc"),
1015 $req->getHFormPar("as_subitem")
1016 );
1017 $ilCtrl->redirect($this, "chapters");
1018 }
1019
1020 protected function afterSave(ilObject $new_object): void
1021 {
1022 $new_object->setCleanFrames(true);
1023 $new_object->update();
1024
1025 // create content object tree
1026 $new_object->createLMTree();
1027
1028 // create a first chapter
1029 $new_object->addFirstChapterAndPage();
1030
1031 // always send a message
1032 $this->tpl->setOnScreenMessage('success', $this->lng->txt($this->type . "_added"), true);
1033 $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "ref_id", $new_object->getRefId());
1034 $this->ctrl->redirectByClass([ilLMEditorGUI::class, ilObjLearningModuleGUI::class], "");
1035 }
1036
1040 public function delete(int $a_parent_subobj_id = 0): void
1041 {
1042 $ids = $this->edit_request->getIds();
1043
1044 if (count($ids) == 0) {
1045 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1046 $this->cancelDelete();
1047 }
1048
1049 if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1050 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"), true);
1051 $this->cancelDelete();
1052 }
1053
1054 if ($a_parent_subobj_id == 0) {
1055 $this->setTabs("content");
1056 }
1057
1058 if ($a_parent_subobj_id != 0) {
1059 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $this->requested_backcmd);
1060 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1061 $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1062 } else {
1063 $this->ctrl->setParameter($this, "backcmd", $this->requested_backcmd);
1064 $form_action = $this->ctrl->getFormAction($this);
1065 }
1066
1067 // display confirmation message
1068 $cgui = new ilConfirmationGUI();
1069 $cgui->setFormAction($form_action);
1070 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1071 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1072 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1073
1074 foreach ($ids as $id) {
1075 if ($id != ilTree::POS_FIRST_NODE) {
1076 $obj = new ilLMObject($this->lm, $id);
1077 $caption = $obj->getTitle();
1078
1079 $cgui->addItem("id[]", $id, $caption);
1080 }
1081 }
1082
1083 $this->tpl->setContent($cgui->getHTML());
1084 }
1085
1086 public function cancelDelete(): void
1087 {
1088 $this->ctrl->redirect($this, $this->requested_backcmd);
1089 }
1090
1098 public function confirmedDelete(int $a_parent_subobj_id = 0): void
1099 {
1100 $tree = new ilLMTree($this->lm->getId());
1101
1102 $ids = $this->edit_request->getIds();
1103
1104 // check number of objects
1105 if (count($ids) == 0) {
1106 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1107 $this->ctrl->redirect($this, "cancelDelete");
1108 }
1109
1110 // delete all selected objects
1111 foreach ($ids as $id) {
1112 if ($id != ilTree::POS_FIRST_NODE) {
1113 $obj = ilLMObjectFactory::getInstance($this->lm, $id, false);
1114 $node_data = $tree->getNodeData($id);
1115 if (is_object($obj)) {
1116 $obj->setLMId($this->lm->getId());
1117 $obj->delete();
1118 }
1119 if ($tree->isInTree($id)) {
1120 $tree->deleteTree($node_data);
1121 }
1122 }
1123 }
1124
1125 // check the tree
1126 $this->lm->checkTree();
1127
1128 // feedback
1129 $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
1130
1131 if ($a_parent_subobj_id == 0) {
1132 $this->ctrl->redirect($this, $this->requested_backcmd);
1133 }
1134 }
1135
1136
1140 public function chapters(): void
1141 {
1142 $this->gui->ctrl()->setParameterByClass(EditSubObjectsGUI::class, "sub_type", "st");
1143 $this->gui->ctrl()->redirectByClass(EditSubObjectsGUI::class);
1144 }
1145
1146 public static function getMultiLangHeader(
1147 int $a_lm_id,
1148 object $a_gui_class,
1149 string $a_mode = ""
1150 ): string {
1151 global $DIC;
1152
1153 $lng = $DIC->language();
1154 $ilCtrl = $DIC->ctrl();
1155 $ilDB = $DIC->database();
1156
1158 ->learningModule()
1159 ->internal()
1160 ->gui()
1161 ->editing()
1162 ->request();
1163
1164 $ui_renderer = $DIC->ui()->renderer();
1165 $ui_factory = $DIC->ui()->factory();
1166
1169
1170 $ml_head = "";
1171
1172 // multi language
1173 $ot = (new TranslationsRepository($ilDB))->getFor($a_lm_id);
1174 if ($ot->getContentTranslationActivated()) {
1175 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1176 $lng->loadLanguageModule("meta");
1177
1178 // info
1179 $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1180 $ml_head = $ml_gui->getMultiLangInfo($requested_transl);
1181
1182 $actions = [];
1183
1184 // language switch
1185 $entries = false;
1186 if (!in_array($requested_transl, array("", "-"))) {
1187 $l = $ot->getBaseLanguage();
1188 $actions[] = $ui_factory->link()->standard(
1189 $lng->txt("cont_edit_language_version") . ": " .
1190 $lng->txt("meta_l_" . $l),
1191 $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1192 );
1193 $entries = true;
1194 }
1195
1196 foreach ($ot->getLanguages() as $al => $lang) {
1197 if ($requested_transl != $al &&
1198 $al != $ot->getBaseLanguage()) {
1199 $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1200 $actions[] = $ui_factory->link()->standard(
1201 $lng->txt("cont_edit_language_version") . ": " .
1202 $lng->txt("meta_l_" . $al),
1203 $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1204 );
1205 $ilCtrl->setParameter($a_gui_class, "totransl", $requested_totransl);
1206 }
1207 $entries = true;
1208 }
1209
1210 if ($entries) {
1211 $dd = $ui_factory->dropdown()->standard($actions)->withLabel($lng->txt("actions"));
1212
1213 $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $ui_renderer->render($dd) . "</div>";
1214 }
1215 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1216 }
1217
1218 return $ml_head;
1219 }
1220
1221 public function pages(): void
1222 {
1223 $tpl = $this->tpl;
1224 $ilToolbar = $this->toolbar;
1225 $ilCtrl = $this->ctrl;
1226 $lng = $this->lng;
1227
1228 $this->setTabs();
1229 $this->setContentSubTabs("pages");
1230
1231 $ilCtrl->setParameter($this, "backcmd", "pages");
1232 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1233 $ilToolbar->addButton(
1234 $lng->txt("pg_add"),
1235 $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1236 );
1237 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1238
1239 $t = new ilLMPagesTableGUI($this, "pages", $this->lm);
1240 $tpl->setContent($t->getHTML());
1241 }
1242
1246 public function listLinks(): void
1247 {
1248 $tpl = $this->tpl;
1249
1250 $this->setTabs();
1251 $this->setContentSubTabs("internal_links");
1252
1253 $table_gui = new ilLinksTableGUI(
1254 $this,
1255 "listLinks",
1256 $this->lm->getId(),
1257 $this->lm->getType()
1258 );
1259
1260 $tpl->setContent($table_gui->getHTML());
1261 }
1262
1266 public function showMaintenance(): void
1267 {
1268 $ilToolbar = $this->toolbar;
1269
1270 $this->setTabs();
1271 $this->setContentSubTabs("maintenance");
1272
1273 $ilToolbar->addButton(
1274 $this->lng->txt("cont_fix_tree"),
1275 $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1276 );
1277 }
1278
1282 public function activatePages(): void
1283 {
1284 $ids = $this->edit_request->getIds();
1285 foreach ($ids as $id) {
1286 $act = ilLMPage::_lookupActive($id, $this->lm->getType());
1287 ilLMPage::_writeActive($id, $this->lm->getType(), !$act);
1288 }
1289
1290 $this->ctrl->redirect($this, "pages");
1291 }
1292
1296 public function pastePage(): void
1297 {
1299 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_page_in_clipboard"), true);
1300 $this->ctrl->redirect($this, "pages");
1301 }
1302
1303 // paste selected object
1305
1306 // copy page, if action is copy
1307 if (ilEditClipboard::getAction() == "copy") {
1308 // check wether page belongs to lm
1310 == $this->lm->getId()) {
1311 $lm_page = new ilLMPageObject($this->lm, $id);
1312 $new_page = $lm_page->copy($this->lm);
1313 $id = $new_page->getId();
1314 } else {
1315 // get page from other content object into current content object
1318 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1319 $lm_page = new ilLMPageObject($lm_obj, $id);
1320 $copied_nodes = array();
1321 $new_page = $lm_page->copyToOtherContObject($this->lm, $copied_nodes);
1322 $id = $new_page->getId();
1323 ilLMObject::updateInternalLinks($copied_nodes);
1324 }
1325 }
1326
1327 // cut is not be possible in "all pages" form yet
1328 if (ilEditClipboard::getAction() == "cut") {
1329 // check wether page belongs not to lm
1331 != $this->lm->getId()) {
1334 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1335 $lm_page = new ilLMPageObject($lm_obj, $id);
1336 $lm_page->setLMId($this->lm->getId());
1337 $lm_page->update();
1338 $page = $lm_page->getPageObject();
1339 $page->buildDom();
1340 $page->setParentId($this->lm->getId());
1341 $page->update();
1342 }
1343 }
1344
1345
1347 $this->ctrl->redirect($this, "pages");
1348 }
1349
1350 public function copyPage(): void
1351 {
1352 $ids = $this->edit_request->getIds();
1353 if (count($ids) == 0) {
1354 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1355 $this->ctrl->redirect($this, "pages");
1356 }
1357
1358 ilLMObject::clipboardCopy($this->lm->getId(), $ids);
1360
1361 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_copied"), true);
1362
1363 $this->ctrl->redirect($this, "pages");
1364 }
1365
1366 public function getContextPath(
1367 int $a_endnode_id,
1368 int $a_startnode_id = 1
1369 ): string {
1370 $path = "";
1371
1372 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1373
1374 // count -1, to exclude the learning module itself
1375 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1376 if ($path != "") {
1377 $path .= " > ";
1378 }
1379
1380 $path .= $tmpPath[$i]["title"];
1381 }
1382
1383 return $path;
1384 }
1385
1386 public function showActions(array $a_actions): void
1387 {
1388 $d = null;
1389 foreach ($a_actions as $name => $lng) {
1390 $d[$name] = array("name" => $name, "lng" => $lng);
1391 }
1392
1393 $notoperations = array();
1394
1395 $operations = array();
1396
1397 if (is_array($d)) {
1398 foreach ($d as $row) {
1399 if (!in_array($row["name"], $notoperations)) {
1400 $operations[] = $row;
1401 }
1402 }
1403 }
1404
1405 if (count($operations) > 0) {
1406 foreach ($operations as $val) {
1407 $this->tpl->setCurrentBlock("operation_btn");
1408 $this->tpl->setVariable("BTN_NAME", $val["name"]);
1409 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1410 $this->tpl->parseCurrentBlock();
1411 }
1412
1413 $this->tpl->setCurrentBlock("operation");
1414 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("nav/arrow_downright.svg"));
1415 $this->tpl->parseCurrentBlock();
1416 }
1417 }
1418
1419 public function view(): void
1420 {
1421 if (strtolower($this->requested_baseClass) == "iladministrationgui") {
1422 $this->prepareOutput();
1423 parent::viewObject();
1424 } else {
1425 $this->viewObject();
1426 }
1427 }
1428
1429
1433 public function moveChapter(int $a_parent_subobj_id = 0): void
1434 {
1435 $ids = $this->edit_request->getIds();
1436 if (count($ids) == 0) {
1437 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1438 if ($a_parent_subobj_id == 0) {
1439 $this->ctrl->redirect($this, "chapters");
1440 }
1441 return;
1442 }
1443 if (count($ids) > 1) {
1444 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"));
1445 if ($a_parent_subobj_id == 0) {
1446 $this->ctrl->redirect($this, "chapters");
1447 }
1448 return;
1449 }
1450
1451 if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1452 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"));
1453 if ($a_parent_subobj_id == 0) {
1454 $this->ctrl->redirect($this, "chapters");
1455 }
1456 }
1457
1458 // SAVE POST VALUES
1459 ilEditClipboard::storeContentObject("st", $ids[0], "move");
1460
1461 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_chap_select_target_now"), true);
1462
1463 if ($a_parent_subobj_id == 0) {
1464 $this->ctrl->redirect($this, "chapters");
1465 }
1466 }
1467
1468 public function copyChapter(): void
1469 {
1470 $this->copyItems();
1471 }
1472
1473 public function pasteChapter(): void
1474 {
1475 $this->insertChapterClip();
1476 }
1477
1478 public function movePage(): void
1479 {
1480 $ids = $this->edit_request->getIds();
1481 if (count($ids) == 0) {
1482 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1483 $this->ctrl->redirect($this, "pages");
1484 }
1485
1486 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_cut"), true);
1487
1488 ilLMObject::clipboardCut($this->lm->getId(), $ids);
1490
1491 $this->ctrl->redirect($this, "pages");
1492 }
1493
1494 public function cancel(): void
1495 {
1496 if ($this->requested_new_type == "pg") {
1497 $this->ctrl->redirect($this, "pages");
1498 } else {
1499 $this->ctrl->redirect($this, "chapters");
1500 }
1501 }
1502
1503 public function export(): void
1504 {
1505 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
1506 $opt = "";
1507 if ($ot->getContentTranslationActivated()) {
1508 $format = explode("_", $this->edit_request->getFormat());
1509 $opt = ilUtil::stripSlashes($format[1]);
1510 }
1511
1512
1513 $cont_exp = new ilContObjectExport($this->lm);
1514 $cont_exp->buildExportFile($opt);
1515 }
1516
1517 public function fixTreeConfirm(): void
1518 {
1519 $this->setTabs();
1520 $this->setContentSubTabs("maintenance");
1521
1522 // display confirmation message
1523 $cgui = new ilConfirmationGUI();
1524 $cgui->setFormAction($this->ctrl->getFormAction($this));
1525 $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1526 $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1527 $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1528 $issues = $this->lm->checkStructure();
1529 $mess = "";
1530 if (count($issues) > 0) {
1531 $mess = "Found Issues: <br>" . implode("<br>", $issues);
1532 }
1533 $this->tpl->setContent($cgui->getHTML() . $mess);
1534 }
1535
1536 public function fixTree(): void
1537 {
1538 $this->lm->fixTree();
1539 $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_tree_fixed"), true);
1540 $this->ctrl->redirect($this, "showMaintenance");
1541 }
1542
1543 public function exportHTML(): void
1544 {
1545 $ot = $this->lm->getObjectProperties()->getPropertyTranslations();
1546 $lang = "";
1547 if ($ot->getContentTranslationActivated()) {
1548 $format = explode("_", $this->edit_request->getFormat());
1549 $lang = ilUtil::stripSlashes($format[1]);
1550 }
1551 $cont_exp = new ilContObjectExport($this->lm, "html", $lang);
1552 $cont_exp->buildExportFile();
1553 }
1554
1559 public function addLocations(
1560 bool $a_omit_obj_id = false
1561 ): void {
1562 $locator = $this->locator;
1563
1564 $obj_id = 0;
1565 if (!$a_omit_obj_id) {
1566 $obj_id = $this->requested_obj_id;
1567 }
1568 $lmtree = $this->lm->getTree();
1569 if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
1570 $path = $lmtree->getPathFull($obj_id);
1571 } else {
1572 $path = $lmtree->getPathFull($lmtree->getRootId());
1573 if ($obj_id != 0) {
1574 $path[] = array("type" => "pg", "child" => $this->obj_id,
1575 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
1576 }
1577 }
1578
1579 foreach ($path as $key => $row) {
1580 if ($row["child"] == 1) {
1581 $this->ctrl->setParameter($this, "obj_id", null);
1582 $locator->addItem($this->lm->getTitle(), $this->ctrl->getLinkTarget($this, "chapters"));
1583 } else {
1584 $title = $row["title"];
1585 switch ($row["type"]) {
1586 case "st":
1587 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
1588 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
1589 break;
1590
1591 case "pg":
1592 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
1593 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
1594 break;
1595 }
1596 }
1597 }
1598 if (!$a_omit_obj_id) {
1599 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1600 }
1601 }
1602
1606
1607
1608 public function listQuestions(): void
1609 {
1610 $tpl = $this->tpl;
1611
1612 $this->setTabs("questions");
1613 $this->setQuestionsSubTabs("question_stats");
1614
1615 $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->lm);
1616 $tpl->setContent($table->getHTML());
1617 }
1618
1619 public function listQuestionUsages(): void
1620 {
1621 $tpl = $this->tpl;
1622
1623 $this->setTabs("questions");
1624 $this->setQuestionsSubTabs("question_usage");
1625
1626 $table_builder = new QuestionUsageTableBuilder(
1627 $this,
1628 'listQuestionUsages',
1629 $this->lm->getId()
1630 );
1631 $table = $table_builder->getTable();
1632 $tpl->setContent($table->render());
1633 }
1634
1635
1636 public function listBlockedUsers(): void
1637 {
1638 $tpl = $this->tpl;
1639
1640 $this->setTabs("questions");
1641 $this->setQuestionsSubTabs("blocked_users");
1642
1643 $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->lm);
1644 $tpl->setContent($table->getHTML());
1645 }
1646
1647 public function resetNumberOfTries(): void
1648 {
1649 $lng = $this->lng;
1650 $ilCtrl = $this->ctrl;
1651
1652 $user_q_ids = $this->edit_request->getUserQuestionIds();
1653 if (count($user_q_ids) > 0) {
1654 foreach ($user_q_ids as $uqid) {
1655 $uqid = explode(":", $uqid);
1656 ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
1657 }
1658 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1659 }
1660 $ilCtrl->redirect($this, "listBlockedUsers");
1661 }
1662
1663 public function unlockQuestion(): void
1664 {
1665 $lng = $this->lng;
1666 $ilCtrl = $this->ctrl;
1667
1668 $user_q_ids = $this->edit_request->getUserQuestionIds();
1669 if (count($user_q_ids) > 0) {
1670 foreach ($user_q_ids as $uqid) {
1671 $uqid = explode(":", $uqid);
1672 ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
1673 }
1674 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1675 }
1676 $ilCtrl->redirect($this, "listBlockedUsers");
1677 }
1678
1679 public function sendMailToBlockedUsers(): void
1680 {
1681 $ilCtrl = $this->ctrl;
1682
1683 $user_q_ids = $this->edit_request->getUserQuestionIds();
1684 if (count($user_q_ids) == 0) {
1685 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), 1);
1686 $ilCtrl->redirect($this, "listBlockedUsers");
1687 }
1688
1689 $rcps = array();
1690 foreach ($user_q_ids as $uqid) {
1691 $uqid = explode(":", $uqid);
1692 $login = ilObjUser::_lookupLogin($uqid[1]);
1693 if (!in_array($login, $rcps)) {
1694 $rcps[] = $login;
1695 }
1696 }
1698 $this,
1699 'listBlockedUsers',
1700 array(),
1701 array(
1702 'type' => 'new',
1703 'rcp_to' => implode(',', $rcps),
1704 'sig' => $this->getBlockedUsersMailSignature()
1705 )
1706 ));
1707 }
1708
1709 protected function getBlockedUsersMailSignature(): string
1710 {
1711 $link = chr(13) . chr(10) . chr(13) . chr(10);
1712 $link .= $this->lng->txt('cont_blocked_users_mail_link');
1713 $link .= chr(13) . chr(10) . chr(13) . chr(10);
1714 $link .= ilLink::_getLink($this->lm->getRefId());
1715 return rawurlencode(base64_encode($link));
1716 }
1717
1718
1722
1723 protected function setTabs(string $a_act = ""): void
1724 {
1725 parent::setTitleAndDescription();
1726 $ilHelp = $this->help;
1727 $ilHelp->setScreenIdComponent("lm");
1728 $this->addTabs($a_act);
1729 }
1730
1731 public function setContentSubTabs(string $a_active): void
1732 {
1733 $ilTabs = $this->tabs;
1734 $lng = $this->lng;
1735 $ilCtrl = $this->ctrl;
1736
1737 $lm_set = new ilSetting("lm");
1738
1739 // chapters
1740 $this->ctrl->setParameterByClass(static::class, "sub_type", "st");
1741 $ilTabs->addSubTab(
1742 "sub_chapters",
1743 $lng->txt("objs_st"),
1744 $this->ctrl->getLinkTargetByClass(EditSubObjectsGUI::class)
1745 );
1746
1747
1748 // all pages
1749 $ilTabs->addSubTab(
1750 "pages",
1751 $lng->txt("cont_all_pages"),
1752 $ilCtrl->getLinkTarget($this, "pages")
1753 );
1754
1755 // all pages
1756 $ilTabs->addSubTab(
1757 "short_titles",
1758 $lng->txt("cont_short_titles"),
1759 $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
1760 );
1761
1762 // export ids
1763 if ($lm_set->get("html_export_ids")) {
1764 if (!ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1765 $ilTabs->addSubTab(
1766 "export_ids",
1767 $lng->txt("cont_html_export_ids"),
1768 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1769 );
1770 }
1771 }
1772 if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1773 $lng->loadLanguageModule("help");
1774 $ilTabs->addSubTab(
1775 "export_ids",
1776 $lng->txt("cont_online_help_ids"),
1777 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1778 );
1779
1780 $ilTabs->addSubTab(
1781 "help_tooltips",
1782 $lng->txt("help_tooltips"),
1783 $ilCtrl->getLinkTarget($this, "showTooltipList")
1784 );
1785 }
1786
1787 // list links
1788 $ilTabs->addSubTab(
1789 "internal_links",
1790 $lng->txt("cont_internal_links"),
1791 $ilCtrl->getLinkTarget($this, "listLinks")
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 "import",
1804 $lng->txt("cont_import"),
1805 $ilCtrl->getLinkTargetByClass("illmimportgui", "")
1806 );
1807
1808 $ilTabs->activateSubTab($a_active);
1809 $ilTabs->activateTab("content");
1810 }
1811
1812 public function setMediaSubTabs(string $a_active): void
1813 {
1814 $ilTabs = $this->tabs;
1815 $lng = $this->lng;
1816 $ilCtrl = $this->ctrl;
1817
1818 // media
1819 $ilTabs->addSubTab(
1820 "usages",
1821 $lng->txt("cont_mob_usages"),
1822 $this->ctrl->getLinkTargetByClass(ilMediaObjectOverviewGUI::class, "show")
1823 );
1824
1825 // srt files
1826 $ilTabs->addSubTab(
1827 "srt_files",
1828 $lng->txt("cont_subtitle_files"),
1829 $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1830 );
1831
1832 $ilTabs->activateSubTab($a_active);
1833 }
1834
1835 public function setQuestionsSubTabs(string $a_active): void
1836 {
1837 $ilTabs = $this->tabs;
1838 $lng = $this->lng;
1839 $ilCtrl = $this->ctrl;
1840
1841 // usage
1842 $ilTabs->addSubTab(
1843 "question_usage",
1844 $lng->txt("cont_question_usage"),
1845 $ilCtrl->getLinkTarget($this, "listQuestionUsages")
1846 );
1847
1848 // chapters
1849 $ilTabs->addSubTab(
1850 "question_stats",
1851 $lng->txt("cont_question_stats"),
1852 $ilCtrl->getLinkTarget($this, "listQuestions")
1853 );
1854
1855 // blocked users
1856 $ilTabs->addSubTab(
1857 "blocked_users",
1858 $lng->txt("cont_blocked_users"),
1859 $ilCtrl->getLinkTarget($this, "listBlockedUsers")
1860 );
1861
1862 $ilTabs->activateSubTab($a_active);
1863 }
1864
1865 public function addTabs(string $a_act = ""): void
1866 {
1867 $rbacsystem = $this->rbacsystem;
1868 $ilTabs = $this->tabs;
1869 $lng = $this->lng;
1870
1871 // content -> pages
1872 $this->ctrl->setParameterByClass(static::class, "sub_type", "st");
1873 $ilTabs->addTab(
1874 "content",
1875 $lng->txt("content"),
1876 $this->ctrl->getLinkTargetByClass(EditSubObjectsGUI::class)
1877 );
1878
1879 // media
1880 $this->lng->loadLanguageModule('mob');
1881 $ilTabs->addTab(
1882 "media",
1883 $lng->txt("mob_media"),
1884 $this->ctrl->getLinkTargetByClass(ilMediaObjectOverviewGUI::class, "show")
1885 );
1886
1887 // questions
1888 $ilTabs->addTab(
1889 "questions",
1890 $lng->txt("objs_qst"),
1891 $this->ctrl->getLinkTarget($this, "listQuestionUsages")
1892 );
1893
1894 // info
1895 if ($this->object->isInfoEnabled()) {
1896 $ilTabs->addTab(
1897 "info",
1898 $lng->txt("info_short"),
1899 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
1900 );
1901 }
1902
1903 // settings
1904 $ilTabs->addTab(
1905 "settings",
1906 $lng->txt("settings"),
1907 $this->ctrl->getLinkTarget($this, 'properties')
1908 );
1909
1910 // learning progress
1911 if (ilLearningProgressAccess::checkAccess($this->lm->getRefId()) and ($this->lm->getType() == 'lm')) {
1912 $ilTabs->addTab(
1913 'learning_progress',
1914 $lng->txt("learning_progress"),
1915 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
1916 );
1917 }
1918
1919 // meta data
1920 $mdgui = new ilObjectMetaDataGUI($this->lm);
1921 $mdtab = $mdgui->getTab();
1922 if ($mdtab) {
1923 $ilTabs->addTab(
1924 "meta",
1925 $lng->txt("meta_data"),
1926 $mdtab
1927 );
1928 }
1929
1930 // export
1931 $ilTabs->addTab(
1932 "export",
1933 $lng->txt("export"),
1934 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1935 );
1936
1937 // permissions
1938 if ($rbacsystem->checkAccess('edit_permission', $this->lm->getRefId())) {
1939 $ilTabs->addTab(
1940 "perm",
1941 $lng->txt("perm_settings"),
1942 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
1943 );
1944 }
1945
1946 if ($a_act != "") {
1947 $ilTabs->activateTab($a_act);
1948 }
1949
1950 // presentation view
1951 $ilTabs->addNonTabbedLink(
1952 "pres_mode",
1953 $lng->txt("cont_presentation_view"),
1954 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->lm->getRefId()
1955 );
1956 }
1957
1958 public function setSubTabs(string $a_active): void
1959 {
1960 $ilTabs = $this->tabs;
1961 $ilSetting = $this->settings;
1962
1963 if (in_array(
1964 $a_active,
1965 array("settings", "cont_style", "cont_lm_menu", "public_section",
1966 "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
1967 "lti_provider")
1968 )) {
1969 // general properties
1970 $ilTabs->addSubTabTarget(
1971 "settings",
1972 $this->ctrl->getLinkTarget($this, 'properties'),
1973 "",
1974 ""
1975 );
1976
1977 // style properties
1978 $ilTabs->addSubTabTarget(
1979 "cont_style",
1980 $this->ctrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", ""),
1981 "",
1982 "ilObjectContentStyleSettingsGUI"
1983 );
1984
1985 // menu properties
1986 $ilTabs->addSubTabTarget(
1987 "cont_lm_menu",
1988 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
1989 "",
1990 ""
1991 );
1992
1993 // glossaries
1994 $ilTabs->addSubTabTarget(
1995 "cont_glossaries",
1996 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
1997 "",
1998 ""
1999 );
2000
2001 $ilTabs->addSubTabTarget(
2002 "obj_multilinguality",
2003 $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "")
2004 );
2005
2006 $lti_settings = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
2007 if ($lti_settings->hasSettingsAccess()) {
2008 $ilTabs->addSubTabTarget(
2009 'lti_provider',
2010 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
2011 );
2012 }
2013
2014 $ilTabs->setSubTabActive($a_active);
2015 }
2016 }
2017
2018 public function __initLMMenuEditor(): void
2019 {
2020 $this->lmme_obj = new ilLMMenuEditor();
2021 $this->lmme_obj->setObjId($this->lm->getId());
2022 }
2023
2027 public function addMenuEntry(?ilPropertyFormGUI $form = null): void
2028 {
2029 $ilTabs = $this->tabs;
2030 $ilToolbar = $this->toolbar;
2031 $ilCtrl = $this->ctrl;
2032
2033 $this->setTabs();
2034
2035 $ilTabs->setTabActive("settings");
2036 $this->setSubTabs("cont_lm_menu");
2037
2038 $ilToolbar->addButton(
2039 $this->lng->txt("lm_menu_select_internal_object"),
2040 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2041 );
2042
2043 if (is_null($form)) {
2044 $form = $this->initMenuEntryForm("create");
2045 }
2046 $this->tpl->setContent($form->getHTML());
2047 }
2048
2049 public function initMenuEntryForm(string $a_mode = "edit"): ilPropertyFormGUI
2050 {
2051 $lng = $this->lng;
2052 $ilCtrl = $this->ctrl;
2053
2054 $form = new ilPropertyFormGUI();
2055
2056 // title
2057 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2058 $ti->setMaxLength(255);
2059 $ti->setSize(40);
2060 $ti->setRequired(true);
2061 $form->addItem($ti);
2062
2063 // target
2064 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2065 $ta->setMaxLength(255);
2066 $ta->setSize(40);
2067 $ta->setRequired(true);
2068 $form->addItem($ta);
2069
2070 if ($a_mode == "edit") {
2071 $this->__initLMMenuEditor();
2072 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2073 $ti->setValue($this->lmme_obj->getTitle());
2074 $ta->setValue($this->lmme_obj->getTarget());
2075 }
2076
2077 if ($this->requested_link_ref_id > 0) {
2078 $link_ref_id = $this->requested_link_ref_id;
2079 $obj_type = ilObject::_lookupType($link_ref_id, true);
2080 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2081 $title = ilObject::_lookupTitle($obj_id);
2082
2083 $target_link = $obj_type . "_" . $link_ref_id;
2084 $ti->setValue($title);
2085 $ta->setValue($target_link);
2086
2087 // link ref id
2088 $hi = new ilHiddenInputGUI("link_ref_id");
2089 $hi->setValue($link_ref_id);
2090 $form->addItem($hi);
2091 }
2092
2093
2094 // save and cancel commands
2095 if ($a_mode == "create") {
2096 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2097 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2098 $form->setTitle($lng->txt("lm_menu_new_entry"));
2099 } else {
2100 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
2101 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2102 $form->setTitle($lng->txt("lm_menu_edit_entry"));
2103 }
2104
2105 $form->setFormAction($ilCtrl->getFormAction($this));
2106
2107 return $form;
2108 }
2109
2110 public function saveMenuEntry(): void
2111 {
2112 $form = $this->initMenuEntryForm("create");
2113 if ($form->checkInput()) {
2114 $this->__initLMMenuEditor();
2115 $this->lmme_obj->setTitle($form->getInput("title"));
2116 $this->lmme_obj->setTarget($form->getInput("target"));
2117 $this->lmme_obj->setLinkRefId((int) $form->getInput("link_ref_id"));
2118
2119 if ($form->getInput("link_ref_id")) {
2120 $this->lmme_obj->setLinkType("intern");
2121 }
2122
2123 $this->lmme_obj->create();
2124
2125 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_added"), true);
2126 $this->ctrl->redirect($this, "editMenuProperties");
2127 } else {
2128 $form->setValuesByPost();
2129 $this->addMenuEntry($form);
2130 }
2131 }
2132
2133 public function deleteMenuEntry(): void
2134 {
2135 if (empty($this->requested_menu_entry)) {
2136 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2137 $this->ctrl->redirect($this, "editMenuProperties");
2138 }
2139
2140 $this->__initLMMenuEditor();
2141 $this->lmme_obj->delete($this->requested_menu_entry);
2142
2143 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_removed"), true);
2144 $this->ctrl->redirect($this, "editMenuProperties");
2145 }
2146
2147 public function editMenuEntry(?ilPropertyFormGUI $form = null): void
2148 {
2149 $ilToolbar = $this->toolbar;
2150 $ilCtrl = $this->ctrl;
2151 $ilTabs = $this->tabs;
2152
2153 $this->setTabs();
2154
2155 $ilTabs->setTabActive("settings");
2156 $this->setSubTabs("cont_lm_menu");
2157
2158
2159 if (empty($this->requested_menu_entry)) {
2160 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2161 $this->ctrl->redirect($this, "editMenuProperties");
2162 }
2163
2164 $ilCtrl->saveParameter($this, array("menu_entry"));
2165 $ilToolbar->addButton(
2166 $this->lng->txt("lm_menu_select_internal_object"),
2167 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2168 );
2169
2170 if (is_null($form)) {
2171 $form = $this->initMenuEntryForm("edit");
2172 }
2173 $this->tpl->setContent($form->getHTML());
2174 }
2175
2176 public function updateMenuEntry(): void
2177 {
2178 $form = $this->initMenuEntryForm("edit");
2179 if ($form->checkInput()) {
2180 if ($this->edit_request->getMenuEntry() == "") {
2181 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2182 $this->ctrl->redirect($this, "editMenuProperties");
2183 }
2184
2185 $this->__initLMMenuEditor();
2186 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2187 $this->lmme_obj->setTitle($form->getInput("title"));
2188 $this->lmme_obj->setTarget($form->getInput("target"));
2189 if ($form->getInput("link_ref_id")) {
2190 $this->lmme_obj->setLinkType("intern");
2191 }
2192 if (is_int(strpos($form->getInput("target"), "."))) {
2193 $this->lmme_obj->setLinkType("extern");
2194 }
2195 $this->lmme_obj->update();
2196 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_updated"), true);
2197 $this->ctrl->redirect($this, "editMenuProperties");
2198 } else {
2199 $form->setValuesByPost();
2200 $this->editMenuEntry($form);
2201 }
2202 }
2203
2204 public function showEntrySelector(): void
2205 {
2206 $ilTabs = $this->tabs;
2207 $ilCtrl = $this->ctrl;
2208
2209 $this->setTabs();
2210
2211 $ilTabs->setTabActive("settings");
2212 $this->setSubTabs("cont_lm_menu");
2213
2214 $ilCtrl->saveParameter($this, array("menu_entry"));
2215
2216 $this->tpl->setOnScreenMessage('info', $this->lng->txt("lm_menu_select_object_to_add"));
2217
2219 $this,
2220 "showEntrySelector",
2221 $this,
2222 "addMenuEntry",
2223 "link_ref_id"
2224 );
2225 //$exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "glo", "fold"));
2226 $exp->setClickableTypes(array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs', "crs", "grp", "book", "tst", "file"));
2227 if (!$exp->handleCommand()) {
2228 $this->tpl->setContent($exp->getHTML());
2229 }
2230 }
2231
2235 public function selectHeader(): void
2236 {
2237 $ids = $this->edit_request->getIds();
2238 if (count($ids) == 0) {
2239 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2240 $this->ctrl->redirect($this, "pages");
2241 }
2242 if (count($ids) > 1) {
2243 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2244 $this->ctrl->redirect($this, "pages");
2245 }
2246 if ($ids[0] != $this->lm->getHeaderPage()) {
2247 $this->lm->setHeaderPage($ids[0]);
2248 } else {
2249 $this->lm->setHeaderPage(0);
2250 }
2251 $this->lm->updateProperties();
2252 $this->ctrl->redirect($this, "pages");
2253 }
2254
2258 public function selectFooter(): void
2259 {
2260 $ids = $this->edit_request->getIds();
2261 if (count($ids) == 0) {
2262 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2263 $this->ctrl->redirect($this, "pages");
2264 }
2265 if (count($ids) > 1) {
2266 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2267 $this->ctrl->redirect($this, "pages");
2268 }
2269 if ($ids[0] != $this->lm->getFooterPage()) {
2270 $this->lm->setFooterPage($ids[0]);
2271 } else {
2272 $this->lm->setFooterPage(0);
2273 }
2274 $this->lm->updateProperties();
2275 $this->ctrl->redirect($this, "pages");
2276 }
2277
2281 public function saveAllTitles(): void
2282 {
2283 $ilCtrl = $this->ctrl;
2284
2286 $this->lm,
2287 $this->edit_request->getTitles(),
2288 $this->requested_transl
2289 );
2290
2291 $this->tpl->setOnScreenMessage('success', $this->lng->txt("lm_save_titles"), true);
2292 $ilCtrl->redirect($this, "chapters");
2293 }
2294
2295 public static function _goto(string $a_target): void
2296 {
2297 global $DIC;
2298 $main_tpl = $DIC->ui()->mainTemplate();
2299
2300 $ilAccess = $DIC->access();
2301 $ilErr = $DIC["ilErr"];
2302 $lng = $DIC->language();
2303 $ctrl = $DIC->ctrl();
2304
2305 if ($ilAccess->checkAccess("read", "", $a_target)) {
2306 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2307 if (ilObjLearningModuleAccess::_lookupSetting("lm_starting_point") == "first") {
2308 $ctrl->redirectByClass("ilLMPresentationGUI", "");
2309 } else {
2310 $ctrl->redirectByClass("ilLMPresentationGUI", "resume");
2311 }
2312 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
2313 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2314 $ctrl->redirectByClass("ilLMPresentationGUI", "infoScreen");
2315 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2316 $main_tpl->setOnScreenMessage('failure', sprintf(
2317 $lng->txt("msg_no_perm_read_item"),
2319 ), true);
2321 }
2322
2323
2324 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
2325 }
2326
2327 public function cutItems(array $ids): void
2328 {
2329 $ilCtrl = $this->ctrl;
2330 $lng = $this->lng;
2331
2332 if (count($ids) == 0) {
2333 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2334 $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2335 }
2336
2337 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2338 foreach ($ids as $k => $item) {
2339 if ($item < 0) {
2340 $todel[] = $k;
2341 }
2342 }
2343 foreach ($todel as $k) {
2344 unset($ids[$k]);
2345 }
2346 ilLMObject::clipboardCut($this->lm->getId(), $ids);
2348 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
2349
2350 $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2351 }
2352
2356 public function copyItems(array $ids): void
2357 {
2358 $ilCtrl = $this->ctrl;
2359 $lng = $this->lng;
2360
2361 if (count($ids) == 0) {
2362 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2363 $ilCtrl->redirect($this, "chapters");
2364 }
2365
2366 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2367 foreach ($ids as $k => $item) {
2368 if ($item < 0) {
2369 $todel[] = $k;
2370 }
2371 }
2372 foreach ($todel as $k) {
2373 unset($ids[$k]);
2374 }
2375 ilLMObject::clipboardCopy($this->lm->getId(), $ids);
2377 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
2378 $ilCtrl->redirect($this, "chapters");
2379 }
2380
2384 public function cutChapter(): void
2385 {
2386 $this->cutItems("chapters");
2387 }
2388
2392
2393 public function showExportIDsOverview(bool $a_validation = false): void
2394 {
2395 $tpl = $this->tpl;
2396 $ilToolbar = $this->toolbar;
2397 $lng = $this->lng;
2398 $ilCtrl = $this->ctrl;
2399
2400 $this->setTabs();
2401 $this->setContentSubTabs("export_ids");
2402
2403 if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
2404 // toolbar
2405 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2406 $lm_tree = $this->lm->getTree();
2407 $childs = $lm_tree->getChilds($lm_tree->readRootId());
2408 $options = array("" => $lng->txt("all"));
2409 foreach ($childs as $c) {
2410 $options[$c["child"]] = $c["title"];
2411 }
2412 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
2413 $si->setOptions($options);
2414 $si->setValue(ilSession::get("help_chap"));
2415 $ilToolbar->addInputItem($si, true);
2416 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
2417
2418 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation);
2419 } else {
2420 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
2421 }
2422
2423 $tpl->setContent($tbl->getHTML());
2424 }
2425
2426 public function filterHelpChapters(): void
2427 {
2428 $ilCtrl = $this->ctrl;
2429 ilSession::set("help_chap", $this->edit_request->getHelpChap());
2430 $ilCtrl->redirect($this, "showExportIDsOverview");
2431 }
2432
2433 public function saveExportIds(): void
2434 {
2435 $ilCtrl = $this->ctrl;
2436 $lng = $this->lng;
2437
2438 // check all export ids
2439 $ok = true;
2440 foreach ($this->edit_request->getExportIds() as $exp_id) {
2441 if ($exp_id != "" && !preg_match(
2442 "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
2443 trim($exp_id)
2444 )) {
2445 $ok = false;
2446 }
2447 }
2448 if (!$ok) {
2449 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
2450 $lng->txt("cont_exp_ids_not_resp_format3") . " " .
2451 $lng->txt("cont_exp_ids_not_resp_format2"));
2452 $this->showExportIDsOverview(true);
2453 return;
2454 }
2455
2456
2457 foreach ($this->edit_request->getExportIds() as $pg_id => $exp_id) {
2459 $this->lm->getId(),
2460 $pg_id,
2461 ilUtil::stripSlashes($exp_id),
2463 );
2464 }
2465
2466 $this->tpl->setOnScreenMessage('success', $lng->txt("cont_saved_export_ids"), true);
2467 $ilCtrl->redirect($this, "showExportIdsOverview");
2468 }
2469
2470 public function saveHelpMapping(): void
2471 {
2472 $lng = $this->lng;
2473 $ilCtrl = $this->ctrl;
2474 $help_map = $this->help->internal()->domain()->map();
2475
2476 foreach ($this->edit_request->getScreenIds() as $chap => $ids) {
2477 $ids = explode("\n", $ids);
2478 $help_map->saveScreenIdsForChapter($chap, $ids);
2479 }
2480 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2481 $ilCtrl->redirect($this, "showExportIdsOverview");
2482 }
2483
2487
2488 public function showTooltipList(): void
2489 {
2490 $tpl = $this->tpl;
2491 $ilToolbar = $this->toolbar;
2492 $ilCtrl = $this->ctrl;
2493 $lng = $this->lng;
2494
2495 $this->setTabs();
2496 $this->setContentSubTabs("help_tooltips");
2497
2498 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2499 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
2500 $ti->setMaxLength(200);
2501 $ti->setSize(20);
2502 $ilToolbar->addInputItem($ti, true);
2503 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
2504 $ilToolbar->addSeparator();
2505
2506 $options = $this->help->internal()->domain()->tooltips()->getTooltipComponents();
2507 if (ilSession::get("help_tt_comp") != "") {
2508 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
2509 }
2510 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
2511 $si->setOptions($options);
2512 $si->setValue(ilSession::get("help_tt_comp"));
2513 $ilToolbar->addInputItem($si, true);
2514 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
2515
2516 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", (string) ilSession::get("help_tt_comp"));
2517
2518 $tpl->setContent($tbl->getHTML());
2519 }
2520
2521 public function addTooltip(): void
2522 {
2523 $lng = $this->lng;
2524 $ilCtrl = $this->ctrl;
2525
2526 $tt_id = $this->edit_request->getTooltipId();
2527 if (trim($tt_id) != "") {
2528 if (is_int(strpos($tt_id, "_"))) {
2529 $this->help->internal()->domain()->tooltips()->addTooltip(trim($tt_id), "");
2530 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2531
2532 $fu = strpos($tt_id, "_");
2533 $comp = substr($tt_id, 0, $fu);
2534 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
2535 } else {
2536 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_help_no_valid_tooltip_id"), true);
2537 }
2538 }
2539 $ilCtrl->redirect($this, "showTooltipList");
2540 }
2541
2542 public function filterTooltips(): void
2543 {
2544 $ilCtrl = $this->ctrl;
2545
2547 "help_tt_comp",
2548 $this->edit_request->getTooltipComponent()
2549 );
2550 $ilCtrl->redirect($this, "showTooltipList");
2551 }
2552
2553 public function saveTooltips(): void
2554 {
2555 $ilCtrl = $this->ctrl;
2556 $lng = $this->lng;
2557
2558 $tooltip_ids = $this->edit_request->getTooltipIds();
2559 foreach ($this->edit_request->getTooltipTexts() as $id => $text) {
2560 $this->help->internal()->domain()->tooltips()->updateTooltip(
2561 (int) $id,
2562 $text,
2563 $tooltip_ids[(int) $id]
2564 );
2565 }
2566 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2567 $ilCtrl->redirect($this, "showTooltipList");
2568 }
2569
2570 public function deleteTooltips(): void
2571 {
2572 $lng = $this->lng;
2573 $ilCtrl = $this->ctrl;
2574
2575 $ids = $this->edit_request->getIds();
2576 if (count($ids) > 0) {
2577 foreach ($ids as $id) {
2578 $this->help->internal()->domain()->tooltips()->deleteTooltip($id);
2579 }
2580 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2581 }
2582 $ilCtrl->redirect($this, "showTooltipList");
2583 }
2584
2588
2589 public static function getLayoutOption(
2590 string $a_txt,
2591 string $a_var,
2592 string $a_def_option = ""
2594 global $DIC;
2595
2596 $im_tag = "";
2597
2598 $lng = $DIC->language();
2599
2600 // default layout
2601 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
2602 if ($a_def_option != "") {
2603 if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
2604 $im_tag = ilUtil::img($im, $a_def_option);
2605 }
2606 $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><strong>" .
2607 $lng->txt("cont_lm_default_layout") .
2608 "</strong>: " . $lng->txt("cont_layout_" . $a_def_option) .
2609 "</td></tr></table>", ""));
2610 }
2611 foreach (ilObjContentObject::getAvailableLayouts() as $l) {
2612 $im_tag = "";
2613 if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
2614 $im_tag = ilUtil::img($im, $l);
2615 }
2616 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
2617 $im_tag . "</td><td style='padding:5px;'><strong>" . $lng->txt("cont_layout_" . $l) . "</strong>: " .
2618 $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
2619 }
2620
2621 return $layout;
2622 }
2623
2627 public function setPageLayoutInHierarchy(): void
2628 {
2629 $ilCtrl = $this->ctrl;
2630 $ilCtrl->setParameter($this, "hierarchy", "1");
2631 $this->setPageLayout(true);
2632 }
2633
2634
2638 public function setPageLayout(
2639 bool $a_in_hierarchy = false
2640 ): void {
2641 $tpl = $this->tpl;
2642 $ilCtrl = $this->ctrl;
2643 $lng = $this->lng;
2644
2645 $ids = $this->edit_request->getIds();
2646 if (count($ids) == 0) {
2647 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2648
2649 if ($a_in_hierarchy) {
2650 $ilCtrl->redirect($this, "chapters");
2651 } else {
2652 $ilCtrl->redirect($this, "pages");
2653 }
2654 }
2655
2656 $this->initSetPageLayoutForm();
2657
2658 $tpl->setContent($this->form->getHTML());
2659 }
2660
2661 public function initSetPageLayoutForm(): void
2662 {
2663 $lng = $this->lng;
2664 $ilCtrl = $this->ctrl;
2665
2666 $this->form = new ilPropertyFormGUI();
2667
2668 $ids = $this->edit_request->getIds();
2669 foreach ($ids as $id) {
2670 $hi = new ilHiddenInputGUI("id[]");
2671 $hi->setValue($id);
2672 $this->form->addItem($hi);
2673 }
2674 $layout = self::getLayoutOption(
2675 $lng->txt("cont_layout"),
2676 "layout",
2677 $this->lm->getLayout()
2678 );
2679 $this->form->addItem($layout);
2680
2681 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
2682 $this->form->addCommandButton("pages", $lng->txt("cancel"));
2683
2684 $this->form->setTitle($lng->txt("cont_set_layout"));
2685 $this->form->setFormAction($ilCtrl->getFormAction($this));
2686 }
2687
2688 public function savePageLayout(): void
2689 {
2690 $lng = $this->lng;
2691 $ilCtrl = $this->ctrl;
2692
2693 $ilCtrl->setParameter($this, "hierarchy", $this->requested_hierarchy);
2694
2695 $ids = $this->edit_request->getIds();
2696 foreach ($ids as $id) {
2698 $id,
2699 $this->edit_request->getLayout(),
2700 $this->lm
2701 );
2702 }
2703 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2704
2705 if ($this->requested_hierarchy) {
2706 $ilCtrl->redirect($this, "chapters");
2707 } else {
2708 $ilCtrl->redirect($this, "pages");
2709 }
2710 }
2711
2712 //
2713 // Auto glossaries
2714 //
2715
2719 public function editGlossaries(): void
2720 {
2721 $tpl = $this->tpl;
2722 $ilToolbar = $this->toolbar;
2723 $lng = $this->lng;
2724 $ilCtrl = $this->ctrl;
2725 $ilTabs = $this->tabs;
2726
2727 $this->setTabs();
2728 $ilTabs->setTabActive("settings");
2729 $this->setSubTabs("cont_glossaries");
2730
2731 $ilToolbar->addButton(
2732 $lng->txt("add"),
2733 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
2734 );
2735
2736 $tab = new ilLMGlossaryTableGUI($this->lm, $this, "editGlossaries");
2737
2738 $tpl->setContent($tab->getHTML());
2739 }
2740
2741 public function showLMGlossarySelector(): void
2742 {
2743 $tpl = $this->tpl;
2744 $ilCtrl = $this->ctrl;
2745 $tree = $this->tree;
2746 $ilTabs = $this->tabs;
2747
2748 $this->setTabs();
2749 $ilTabs->setTabActive("settings");
2750 $this->setSubTabs("cont_glossaries");
2751
2752 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2753 $exp->setExpand($this->requested_search_root_expand ?: $tree->readRootId());
2754 $exp->setPathOpen($this->object->getRefId());
2755 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2756 $exp->setTargetClass(get_class($this));
2757 $exp->setCmd('confirmGlossarySelection');
2758 $exp->setClickableTypes(array("glo"));
2759 $exp->addFilter("glo");
2760
2761 // build html-output
2762 $exp->setOutput(0);
2763 $tpl->setContent($exp->getOutput());
2764 }
2765
2766 public function confirmGlossarySelection(): void
2767 {
2768 $ilCtrl = $this->ctrl;
2769 $tpl = $this->tpl;
2770 $lng = $this->lng;
2771
2772 $cgui = new ilConfirmationGUI();
2773 $ilCtrl->setParameter($this, "glo_ref_id", $this->requested_root_id);
2774 $cgui->setFormAction($ilCtrl->getFormAction($this));
2775 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
2776 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
2777 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
2778 $tpl->setContent($cgui->getHTML());
2779 }
2780
2781 public function selectLMGlossaryLink(): void
2782 {
2783 $glo_ref_id = $this->requested_glo_ref_id;
2784 $this->lm->autoLinkGlossaryTerms($glo_ref_id);
2785 $this->selectLMGlossary();
2786 }
2787
2788 public function selectLMGlossary(): void
2789 {
2790 $ilCtrl = $this->ctrl;
2791 $lng = $this->lng;
2792
2793 $glos = $this->lm->getAutoGlossaries();
2794 $glo_ref_id = $this->requested_glo_ref_id;
2795 $glo_id = ilObject::_lookupObjId($glo_ref_id);
2796 if (!in_array($glo_id, $glos)) {
2797 $glos[] = $glo_id;
2798 }
2799 $this->lm->setAutoGlossaries($glos);
2800 $this->lm->update();
2801
2802 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2803 $ilCtrl->redirect($this, "editGlossaries");
2804 }
2805
2806 public function removeLMGlossary(): void
2807 {
2808 $ilCtrl = $this->ctrl;
2809 $lng = $this->lng;
2810
2811 $this->lm->removeAutoGlossary($this->requested_glo_id);
2812 $this->lm->update();
2813
2814 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2815 $ilCtrl->redirect($this, "editGlossaries");
2816 }
2817
2818 public function editMasterLanguage(): void
2819 {
2820 $ilCtrl = $this->ctrl;
2821
2822 $ilCtrl->setParameter($this, "transl", "-");
2823 if ($this->lang_switch_mode == "short_titles") {
2824 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2825 }
2826 $ilCtrl->redirect($this, "chapters");
2827 }
2828
2829 public function switchToLanguage(): void
2830 {
2831 $ilCtrl = $this->ctrl;
2832
2833 $ilCtrl->setParameter($this, "transl", $this->requested_totransl);
2834 if ($this->lang_switch_mode == "short_titles") {
2835 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2836 }
2837 $ilCtrl->redirect($this, "chapters");
2838 }
2839
2840 public function redrawHeaderAction(): void
2841 {
2842 // #12281
2843 parent::redrawHeaderActionObject();
2844 }
2845
2849 protected function learningProgress(): void
2850 {
2851 $this->ctrl->redirectByClass(array('illearningprogressgui'), '');
2852 }
2853}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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)
Export User Interface Class.
const CMD_LIST_EXPORT_FILES
setFormAction(string $a_formaction)
setCloseTag(bool $a_val)
setOpenTag(bool $a_open)
This class represents a section header in a property form.
Help GUI class.
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 hidden form property in a property form.
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)
Class ilLMObject.
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 clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static _lookupType(int $a_obj_id, int $a_lm_id=0)
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...
GUI class for LTI provider object settings.
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
Class ilObjUserTrackingGUI.
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...
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.
copyItems(array $ids)
Copy items to clipboard.
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
ilComponentRepository $component_repository
initMenuEntryForm(string $a_mode="edit")
editMenuEntry(?ilPropertyFormGUI $form=null)
ILIAS LearningModule InternalDomainService $domain
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)
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.
selectFooter()
select page as footer
ILIAS LearningModule ReadingTime SettingsGUI $reading_time_gui
showExportIDsOverview(bool $a_validation=false)
setPageLayoutInHierarchy()
Set layout for multiple pages.
addLocations(bool $a_omit_obj_id=false)
display locator
activatePages()
activates or deactivates pages
ILIAS LearningModule InternalGUIService $gui
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.
UIFactory $ui_factory
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
UIRenderer $ui_renderer
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
Class ilObjectMetaDataGUI.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
Class ilObject Basic functions for all objects.
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
Page multilinguality GUI class.
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 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 class represents a property in a property form.
This class represents an option in a radio group.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
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.
ILIAS Setting Class.
@ilCtrl_Calls ilStructureObjectGUI: ilConditionHandlerGUI, ilObjectMetaDataGUI @ilCtrl_Calls ilStruct...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
isInTree(?int $a_node_id)
get all information of a node.
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
deleteTree(array $a_node)
delete node and the whole subtree under this node
const POS_FIRST_NODE
static getImagePath(string $image_name, 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.
const ROOT_FOLDER_ID
Definition: constants.php:32
$c
Definition: deliver.php:25
$valid
$info
Definition: entry_point.php:21
setContent(string $a_html)
Sets content for standard template.
Readable part of repository interface to ilComponentDataDB.
Interface ilDBInterface.
$path
Definition: ltiservices.php:30
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form(?array $class_path, string $cmd, string $submit_caption="")
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
catch(\Exception $e) $req
Definition: xapiproxy.php:78
global $lng
Definition: privfeed.php:31
global $ilSetting
Definition: privfeed.php:31
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$lm_set
$GLOBALS["DIC"]
Definition: wac.php:54
$text
Definition: xapiexit.php:21