ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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 if ($this->access->checkAccess("write", "", $this->ref_id)) {
1874 $ilTabs->addTab(
1875 "content",
1876 $lng->txt("content"),
1877 $this->ctrl->getLinkTargetByClass(EditSubObjectsGUI::class)
1878 );
1879
1880 // media
1881 $this->lng->loadLanguageModule('mob');
1882 $ilTabs->addTab(
1883 "media",
1884 $lng->txt("mob_media"),
1885 $this->ctrl->getLinkTargetByClass(ilMediaObjectOverviewGUI::class, "show")
1886 );
1887
1888 // questions
1889 $ilTabs->addTab(
1890 "questions",
1891 $lng->txt("objs_qst"),
1892 $this->ctrl->getLinkTarget($this, "listQuestionUsages")
1893 );
1894
1895 // info
1896 if ($this->object->isInfoEnabled()) {
1897 $ilTabs->addTab(
1898 "info",
1899 $lng->txt("info_short"),
1900 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
1901 );
1902 }
1903
1904 $ilTabs->addTab(
1905 "settings",
1906 $lng->txt("settings"),
1907 $this->ctrl->getLinkTarget($this, 'properties')
1908 );
1909 }
1910
1911 // learning progress
1912 if (ilLearningProgressAccess::checkAccess($this->lm->getRefId()) and ($this->lm->getType() == 'lm')) {
1913 $ilTabs->addTab(
1914 'learning_progress',
1915 $lng->txt("learning_progress"),
1916 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
1917 );
1918 }
1919
1920 // meta data
1921 if ($this->access->checkAccess("write", "", $this->ref_id)) {
1922 $mdgui = new ilObjectMetaDataGUI($this->lm);
1923 $mdtab = $mdgui->getTab();
1924 if ($mdtab) {
1925 $ilTabs->addTab(
1926 "meta",
1927 $lng->txt("meta_data"),
1928 $mdtab
1929 );
1930 }
1931
1932 // export
1933 $ilTabs->addTab(
1934 "export",
1935 $lng->txt("export"),
1936 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1937 );
1938 }
1939
1940 // permissions
1941 if ($rbacsystem->checkAccess('edit_permission', $this->lm->getRefId())) {
1942 $ilTabs->addTab(
1943 "perm",
1944 $lng->txt("perm_settings"),
1945 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
1946 );
1947 }
1948
1949 if ($a_act != "") {
1950 $ilTabs->activateTab($a_act);
1951 }
1952
1953 if ($this->access->checkAccess("write", "", $this->ref_id)) {
1954 // presentation view
1955 $ilTabs->addNonTabbedLink(
1956 "pres_mode",
1957 $lng->txt("cont_presentation_view"),
1958 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->lm->getRefId()
1959 );
1960 }
1961 }
1962
1963 public function setSubTabs(string $a_active): void
1964 {
1965 $ilTabs = $this->tabs;
1966 $ilSetting = $this->settings;
1967
1968 if (in_array(
1969 $a_active,
1970 array("settings", "cont_style", "cont_lm_menu", "public_section",
1971 "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
1972 "lti_provider")
1973 )) {
1974 // general properties
1975 $ilTabs->addSubTabTarget(
1976 "settings",
1977 $this->ctrl->getLinkTarget($this, 'properties'),
1978 "",
1979 ""
1980 );
1981
1982 // style properties
1983 $ilTabs->addSubTabTarget(
1984 "cont_style",
1985 $this->ctrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", ""),
1986 "",
1987 "ilObjectContentStyleSettingsGUI"
1988 );
1989
1990 // menu properties
1991 $ilTabs->addSubTabTarget(
1992 "cont_lm_menu",
1993 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
1994 "",
1995 ""
1996 );
1997
1998 // glossaries
1999 $ilTabs->addSubTabTarget(
2000 "cont_glossaries",
2001 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
2002 "",
2003 ""
2004 );
2005
2006 $ilTabs->addSubTabTarget(
2007 "obj_multilinguality",
2008 $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "")
2009 );
2010
2011 $lti_settings = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
2012 if ($lti_settings->hasSettingsAccess()) {
2013 $ilTabs->addSubTabTarget(
2014 'lti_provider',
2015 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
2016 );
2017 }
2018
2019 $ilTabs->setSubTabActive($a_active);
2020 }
2021 }
2022
2023 public function __initLMMenuEditor(): void
2024 {
2025 $this->lmme_obj = new ilLMMenuEditor();
2026 $this->lmme_obj->setObjId($this->lm->getId());
2027 }
2028
2032 public function addMenuEntry(?ilPropertyFormGUI $form = null): void
2033 {
2034 $ilTabs = $this->tabs;
2035 $ilToolbar = $this->toolbar;
2036 $ilCtrl = $this->ctrl;
2037
2038 $this->setTabs();
2039
2040 $ilTabs->setTabActive("settings");
2041 $this->setSubTabs("cont_lm_menu");
2042
2043 $ilToolbar->addButton(
2044 $this->lng->txt("lm_menu_select_internal_object"),
2045 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2046 );
2047
2048 if (is_null($form)) {
2049 $form = $this->initMenuEntryForm("create");
2050 }
2051 $this->tpl->setContent($form->getHTML());
2052 }
2053
2054 public function initMenuEntryForm(string $a_mode = "edit"): ilPropertyFormGUI
2055 {
2056 $lng = $this->lng;
2057 $ilCtrl = $this->ctrl;
2058
2059 $form = new ilPropertyFormGUI();
2060
2061 // title
2062 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2063 $ti->setMaxLength(255);
2064 $ti->setSize(40);
2065 $ti->setRequired(true);
2066 $form->addItem($ti);
2067
2068 // target
2069 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2070 $ta->setMaxLength(255);
2071 $ta->setSize(40);
2072 $ta->setRequired(true);
2073 $form->addItem($ta);
2074
2075 if ($a_mode == "edit") {
2076 $this->__initLMMenuEditor();
2077 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2078 $ti->setValue($this->lmme_obj->getTitle());
2079 $ta->setValue($this->lmme_obj->getTarget());
2080 }
2081
2082 if ($this->requested_link_ref_id > 0) {
2083 $link_ref_id = $this->requested_link_ref_id;
2084 $obj_type = ilObject::_lookupType($link_ref_id, true);
2085 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2086 $title = ilObject::_lookupTitle($obj_id);
2087
2088 $target_link = $obj_type . "_" . $link_ref_id;
2089 $ti->setValue($title);
2090 $ta->setValue($target_link);
2091
2092 // link ref id
2093 $hi = new ilHiddenInputGUI("link_ref_id");
2094 $hi->setValue($link_ref_id);
2095 $form->addItem($hi);
2096 }
2097
2098
2099 // save and cancel commands
2100 if ($a_mode == "create") {
2101 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2102 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2103 $form->setTitle($lng->txt("lm_menu_new_entry"));
2104 } else {
2105 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
2106 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2107 $form->setTitle($lng->txt("lm_menu_edit_entry"));
2108 }
2109
2110 $form->setFormAction($ilCtrl->getFormAction($this));
2111
2112 return $form;
2113 }
2114
2115 public function saveMenuEntry(): void
2116 {
2117 $form = $this->initMenuEntryForm("create");
2118 if ($form->checkInput()) {
2119 $this->__initLMMenuEditor();
2120 $this->lmme_obj->setTitle($form->getInput("title"));
2121 $this->lmme_obj->setTarget($form->getInput("target"));
2122 $this->lmme_obj->setLinkRefId((int) $form->getInput("link_ref_id"));
2123
2124 if ($form->getInput("link_ref_id")) {
2125 $this->lmme_obj->setLinkType("intern");
2126 }
2127
2128 $this->lmme_obj->create();
2129
2130 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_added"), true);
2131 $this->ctrl->redirect($this, "editMenuProperties");
2132 } else {
2133 $form->setValuesByPost();
2134 $this->addMenuEntry($form);
2135 }
2136 }
2137
2138 public function deleteMenuEntry(): void
2139 {
2140 if (empty($this->requested_menu_entry)) {
2141 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2142 $this->ctrl->redirect($this, "editMenuProperties");
2143 }
2144
2145 $this->__initLMMenuEditor();
2146 $this->lmme_obj->delete($this->requested_menu_entry);
2147
2148 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_removed"), true);
2149 $this->ctrl->redirect($this, "editMenuProperties");
2150 }
2151
2152 public function editMenuEntry(?ilPropertyFormGUI $form = null): void
2153 {
2154 $ilToolbar = $this->toolbar;
2155 $ilCtrl = $this->ctrl;
2156 $ilTabs = $this->tabs;
2157
2158 $this->setTabs();
2159
2160 $ilTabs->setTabActive("settings");
2161 $this->setSubTabs("cont_lm_menu");
2162
2163
2164 if (empty($this->requested_menu_entry)) {
2165 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2166 $this->ctrl->redirect($this, "editMenuProperties");
2167 }
2168
2169 $ilCtrl->saveParameter($this, array("menu_entry"));
2170 $ilToolbar->addButton(
2171 $this->lng->txt("lm_menu_select_internal_object"),
2172 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2173 );
2174
2175 if (is_null($form)) {
2176 $form = $this->initMenuEntryForm("edit");
2177 }
2178 $this->tpl->setContent($form->getHTML());
2179 }
2180
2181 public function updateMenuEntry(): void
2182 {
2183 $form = $this->initMenuEntryForm("edit");
2184 if ($form->checkInput()) {
2185 if ($this->edit_request->getMenuEntry() == "") {
2186 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2187 $this->ctrl->redirect($this, "editMenuProperties");
2188 }
2189
2190 $this->__initLMMenuEditor();
2191 $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2192 $this->lmme_obj->setTitle($form->getInput("title"));
2193 $this->lmme_obj->setTarget($form->getInput("target"));
2194 if ($form->getInput("link_ref_id")) {
2195 $this->lmme_obj->setLinkType("intern");
2196 }
2197 if (is_int(strpos($form->getInput("target"), "."))) {
2198 $this->lmme_obj->setLinkType("extern");
2199 }
2200 $this->lmme_obj->update();
2201 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_updated"), true);
2202 $this->ctrl->redirect($this, "editMenuProperties");
2203 } else {
2204 $form->setValuesByPost();
2205 $this->editMenuEntry($form);
2206 }
2207 }
2208
2209 public function showEntrySelector(): void
2210 {
2211 $ilTabs = $this->tabs;
2212 $ilCtrl = $this->ctrl;
2213
2214 $this->setTabs();
2215
2216 $ilTabs->setTabActive("settings");
2217 $this->setSubTabs("cont_lm_menu");
2218
2219 $ilCtrl->saveParameter($this, array("menu_entry"));
2220
2221 $this->tpl->setOnScreenMessage('info', $this->lng->txt("lm_menu_select_object_to_add"));
2222
2224 $this,
2225 "showEntrySelector",
2226 $this,
2227 "addMenuEntry",
2228 "link_ref_id"
2229 );
2230 //$exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "glo", "fold"));
2231 $exp->setClickableTypes(array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs', "crs", "grp", "book", "tst", "file"));
2232 if (!$exp->handleCommand()) {
2233 $this->tpl->setContent($exp->getHTML());
2234 }
2235 }
2236
2240 public function selectHeader(): void
2241 {
2242 $ids = $this->edit_request->getIds();
2243 if (count($ids) == 0) {
2244 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2245 $this->ctrl->redirect($this, "pages");
2246 }
2247 if (count($ids) > 1) {
2248 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2249 $this->ctrl->redirect($this, "pages");
2250 }
2251 if ($ids[0] != $this->lm->getHeaderPage()) {
2252 $this->lm->setHeaderPage($ids[0]);
2253 } else {
2254 $this->lm->setHeaderPage(0);
2255 }
2256 $this->lm->updateProperties();
2257 $this->ctrl->redirect($this, "pages");
2258 }
2259
2263 public function selectFooter(): void
2264 {
2265 $ids = $this->edit_request->getIds();
2266 if (count($ids) == 0) {
2267 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2268 $this->ctrl->redirect($this, "pages");
2269 }
2270 if (count($ids) > 1) {
2271 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2272 $this->ctrl->redirect($this, "pages");
2273 }
2274 if ($ids[0] != $this->lm->getFooterPage()) {
2275 $this->lm->setFooterPage($ids[0]);
2276 } else {
2277 $this->lm->setFooterPage(0);
2278 }
2279 $this->lm->updateProperties();
2280 $this->ctrl->redirect($this, "pages");
2281 }
2282
2286 public function saveAllTitles(): void
2287 {
2288 $ilCtrl = $this->ctrl;
2289
2291 $this->lm,
2292 $this->edit_request->getTitles(),
2293 $this->requested_transl
2294 );
2295
2296 $this->tpl->setOnScreenMessage('success', $this->lng->txt("lm_save_titles"), true);
2297 $ilCtrl->redirect($this, "chapters");
2298 }
2299
2300 public static function _goto(string $a_target): void
2301 {
2302 global $DIC;
2303 $main_tpl = $DIC->ui()->mainTemplate();
2304
2305 $ilAccess = $DIC->access();
2306 $ilErr = $DIC["ilErr"];
2307 $lng = $DIC->language();
2308 $ctrl = $DIC->ctrl();
2309
2310 if ($ilAccess->checkAccess("read", "", $a_target)) {
2311 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2312 if (ilObjLearningModuleAccess::_lookupSetting("lm_starting_point") == "first") {
2313 $ctrl->redirectByClass("ilLMPresentationGUI", "");
2314 } else {
2315 $ctrl->redirectByClass("ilLMPresentationGUI", "resume");
2316 }
2317 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
2318 $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2319 $ctrl->redirectByClass("ilLMPresentationGUI", "infoScreen");
2320 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2321 $main_tpl->setOnScreenMessage('failure', sprintf(
2322 $lng->txt("msg_no_perm_read_item"),
2324 ), true);
2326 }
2327
2328
2329 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
2330 }
2331
2332 public function cutItems(array $ids): void
2333 {
2334 $ilCtrl = $this->ctrl;
2335 $lng = $this->lng;
2336
2337 if (count($ids) == 0) {
2338 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2339 $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2340 }
2341
2342 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2343 foreach ($ids as $k => $item) {
2344 if ($item < 0) {
2345 $todel[] = $k;
2346 }
2347 }
2348 foreach ($todel as $k) {
2349 unset($ids[$k]);
2350 }
2351 ilLMObject::clipboardCut($this->lm->getId(), $ids);
2353 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
2354
2355 $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2356 }
2357
2361 public function copyItems(array $ids): void
2362 {
2363 $ilCtrl = $this->ctrl;
2364 $lng = $this->lng;
2365
2366 if (count($ids) == 0) {
2367 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2368 $ilCtrl->redirect($this, "chapters");
2369 }
2370
2371 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2372 foreach ($ids as $k => $item) {
2373 if ($item < 0) {
2374 $todel[] = $k;
2375 }
2376 }
2377 foreach ($todel as $k) {
2378 unset($ids[$k]);
2379 }
2380 ilLMObject::clipboardCopy($this->lm->getId(), $ids);
2382 $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
2383 $ilCtrl->redirect($this, "chapters");
2384 }
2385
2389 public function cutChapter(): void
2390 {
2391 $this->cutItems("chapters");
2392 }
2393
2397
2398 public function showExportIDsOverview(bool $a_validation = false): void
2399 {
2400 $tpl = $this->tpl;
2401 $ilToolbar = $this->toolbar;
2402 $lng = $this->lng;
2403 $ilCtrl = $this->ctrl;
2404
2405 $this->setTabs();
2406 $this->setContentSubTabs("export_ids");
2407
2408 if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
2409 // toolbar
2410 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2411 $lm_tree = $this->lm->getTree();
2412 $childs = $lm_tree->getChilds($lm_tree->readRootId());
2413 $options = array("" => $lng->txt("all"));
2414 foreach ($childs as $c) {
2415 $options[$c["child"]] = $c["title"];
2416 }
2417 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
2418 $si->setOptions($options);
2419 $si->setValue(ilSession::get("help_chap"));
2420 $ilToolbar->addInputItem($si, true);
2421 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
2422
2423 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation);
2424 } else {
2425 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
2426 }
2427
2428 $tpl->setContent($tbl->getHTML());
2429 }
2430
2431 public function filterHelpChapters(): void
2432 {
2433 $ilCtrl = $this->ctrl;
2434 ilSession::set("help_chap", $this->edit_request->getHelpChap());
2435 $ilCtrl->redirect($this, "showExportIDsOverview");
2436 }
2437
2438 public function saveExportIds(): void
2439 {
2440 $ilCtrl = $this->ctrl;
2441 $lng = $this->lng;
2442
2443 // check all export ids
2444 $ok = true;
2445 foreach ($this->edit_request->getExportIds() as $exp_id) {
2446 if ($exp_id != "" && !preg_match(
2447 "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
2448 trim($exp_id)
2449 )) {
2450 $ok = false;
2451 }
2452 }
2453 if (!$ok) {
2454 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
2455 $lng->txt("cont_exp_ids_not_resp_format3") . " " .
2456 $lng->txt("cont_exp_ids_not_resp_format2"));
2457 $this->showExportIDsOverview(true);
2458 return;
2459 }
2460
2461
2462 foreach ($this->edit_request->getExportIds() as $pg_id => $exp_id) {
2464 $this->lm->getId(),
2465 $pg_id,
2466 ilUtil::stripSlashes($exp_id),
2468 );
2469 }
2470
2471 $this->tpl->setOnScreenMessage('success', $lng->txt("cont_saved_export_ids"), true);
2472 $ilCtrl->redirect($this, "showExportIdsOverview");
2473 }
2474
2475 public function saveHelpMapping(): void
2476 {
2477 $lng = $this->lng;
2478 $ilCtrl = $this->ctrl;
2479 $help_map = $this->help->internal()->domain()->map();
2480
2481 foreach ($this->edit_request->getScreenIds() as $chap => $ids) {
2482 $ids = explode("\n", $ids);
2483 $help_map->saveScreenIdsForChapter($chap, $ids);
2484 }
2485 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2486 $ilCtrl->redirect($this, "showExportIdsOverview");
2487 }
2488
2492
2493 public function showTooltipList(): void
2494 {
2495 $tpl = $this->tpl;
2496 $ilToolbar = $this->toolbar;
2497 $ilCtrl = $this->ctrl;
2498 $lng = $this->lng;
2499
2500 $this->setTabs();
2501 $this->setContentSubTabs("help_tooltips");
2502
2503 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2504 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
2505 $ti->setMaxLength(200);
2506 $ti->setSize(20);
2507 $ilToolbar->addInputItem($ti, true);
2508 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
2509 $ilToolbar->addSeparator();
2510
2511 $options = $this->help->internal()->domain()->tooltips()->getTooltipComponents();
2512 if (ilSession::get("help_tt_comp") != "") {
2513 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
2514 }
2515 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
2516 $si->setOptions($options);
2517 $si->setValue(ilSession::get("help_tt_comp"));
2518 $ilToolbar->addInputItem($si, true);
2519 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
2520
2521 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", (string) ilSession::get("help_tt_comp"));
2522
2523 $tpl->setContent($tbl->getHTML());
2524 }
2525
2526 public function addTooltip(): void
2527 {
2528 $lng = $this->lng;
2529 $ilCtrl = $this->ctrl;
2530
2531 $tt_id = $this->edit_request->getTooltipId();
2532 if (trim($tt_id) != "") {
2533 if (is_int(strpos($tt_id, "_"))) {
2534 $this->help->internal()->domain()->tooltips()->addTooltip(trim($tt_id), "");
2535 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2536
2537 $fu = strpos($tt_id, "_");
2538 $comp = substr($tt_id, 0, $fu);
2539 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
2540 } else {
2541 $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_help_no_valid_tooltip_id"), true);
2542 }
2543 }
2544 $ilCtrl->redirect($this, "showTooltipList");
2545 }
2546
2547 public function filterTooltips(): void
2548 {
2549 $ilCtrl = $this->ctrl;
2550
2552 "help_tt_comp",
2553 $this->edit_request->getTooltipComponent()
2554 );
2555 $ilCtrl->redirect($this, "showTooltipList");
2556 }
2557
2558 public function saveTooltips(): void
2559 {
2560 $ilCtrl = $this->ctrl;
2561 $lng = $this->lng;
2562
2563 $tooltip_ids = $this->edit_request->getTooltipIds();
2564 foreach ($this->edit_request->getTooltipTexts() as $id => $text) {
2565 $this->help->internal()->domain()->tooltips()->updateTooltip(
2566 (int) $id,
2567 $text,
2568 $tooltip_ids[(int) $id]
2569 );
2570 }
2571 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2572 $ilCtrl->redirect($this, "showTooltipList");
2573 }
2574
2575 public function deleteTooltips(): void
2576 {
2577 $lng = $this->lng;
2578 $ilCtrl = $this->ctrl;
2579
2580 $ids = $this->edit_request->getIds();
2581 if (count($ids) > 0) {
2582 foreach ($ids as $id) {
2583 $this->help->internal()->domain()->tooltips()->deleteTooltip($id);
2584 }
2585 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2586 }
2587 $ilCtrl->redirect($this, "showTooltipList");
2588 }
2589
2593
2594 public static function getLayoutOption(
2595 string $a_txt,
2596 string $a_var,
2597 string $a_def_option = ""
2599 global $DIC;
2600
2601 $im_tag = "";
2602
2603 $lng = $DIC->language();
2604
2605 // default layout
2606 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
2607 if ($a_def_option != "") {
2608 if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
2609 $im_tag = ilUtil::img($im, $a_def_option);
2610 }
2611 $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><strong>" .
2612 $lng->txt("cont_lm_default_layout") .
2613 "</strong>: " . $lng->txt("cont_layout_" . $a_def_option) .
2614 "</td></tr></table>", ""));
2615 }
2616 foreach (ilObjContentObject::getAvailableLayouts() as $l) {
2617 $im_tag = "";
2618 if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
2619 $im_tag = ilUtil::img($im, $l);
2620 }
2621 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
2622 $im_tag . "</td><td style='padding:5px;'><strong>" . $lng->txt("cont_layout_" . $l) . "</strong>: " .
2623 $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
2624 }
2625
2626 return $layout;
2627 }
2628
2632 public function setPageLayoutInHierarchy(): void
2633 {
2634 $ilCtrl = $this->ctrl;
2635 $ilCtrl->setParameter($this, "hierarchy", "1");
2636 $this->setPageLayout(true);
2637 }
2638
2639
2643 public function setPageLayout(
2644 bool $a_in_hierarchy = false
2645 ): void {
2646 $tpl = $this->tpl;
2647 $ilCtrl = $this->ctrl;
2648 $lng = $this->lng;
2649
2650 $ids = $this->edit_request->getIds();
2651 if (count($ids) == 0) {
2652 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2653
2654 if ($a_in_hierarchy) {
2655 $ilCtrl->redirect($this, "chapters");
2656 } else {
2657 $ilCtrl->redirect($this, "pages");
2658 }
2659 }
2660
2661 $this->initSetPageLayoutForm();
2662
2663 $tpl->setContent($this->form->getHTML());
2664 }
2665
2666 public function initSetPageLayoutForm(): void
2667 {
2668 $lng = $this->lng;
2669 $ilCtrl = $this->ctrl;
2670
2671 $this->form = new ilPropertyFormGUI();
2672
2673 $ids = $this->edit_request->getIds();
2674 foreach ($ids as $id) {
2675 $hi = new ilHiddenInputGUI("id[]");
2676 $hi->setValue($id);
2677 $this->form->addItem($hi);
2678 }
2679 $layout = self::getLayoutOption(
2680 $lng->txt("cont_layout"),
2681 "layout",
2682 $this->lm->getLayout()
2683 );
2684 $this->form->addItem($layout);
2685
2686 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
2687 $this->form->addCommandButton("pages", $lng->txt("cancel"));
2688
2689 $this->form->setTitle($lng->txt("cont_set_layout"));
2690 $this->form->setFormAction($ilCtrl->getFormAction($this));
2691 }
2692
2693 public function savePageLayout(): void
2694 {
2695 $lng = $this->lng;
2696 $ilCtrl = $this->ctrl;
2697
2698 $ilCtrl->setParameter($this, "hierarchy", $this->requested_hierarchy);
2699
2700 $ids = $this->edit_request->getIds();
2701 foreach ($ids as $id) {
2703 $id,
2704 $this->edit_request->getLayout(),
2705 $this->lm
2706 );
2707 }
2708 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2709
2710 if ($this->requested_hierarchy) {
2711 $ilCtrl->redirect($this, "chapters");
2712 } else {
2713 $ilCtrl->redirect($this, "pages");
2714 }
2715 }
2716
2717 //
2718 // Auto glossaries
2719 //
2720
2724 public function editGlossaries(): void
2725 {
2726 $tpl = $this->tpl;
2727 $ilToolbar = $this->toolbar;
2728 $lng = $this->lng;
2729 $ilCtrl = $this->ctrl;
2730 $ilTabs = $this->tabs;
2731
2732 $this->setTabs();
2733 $ilTabs->setTabActive("settings");
2734 $this->setSubTabs("cont_glossaries");
2735
2736 $ilToolbar->addButton(
2737 $lng->txt("add"),
2738 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
2739 );
2740
2741 $tab = new ilLMGlossaryTableGUI($this->lm, $this, "editGlossaries");
2742
2743 $tpl->setContent($tab->getHTML());
2744 }
2745
2746 public function showLMGlossarySelector(): void
2747 {
2748 $tpl = $this->tpl;
2749 $ilCtrl = $this->ctrl;
2750 $tree = $this->tree;
2751 $ilTabs = $this->tabs;
2752
2753 $this->setTabs();
2754 $ilTabs->setTabActive("settings");
2755 $this->setSubTabs("cont_glossaries");
2756
2757 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2758 $exp->setExpand($this->requested_search_root_expand ?: $tree->readRootId());
2759 $exp->setPathOpen($this->object->getRefId());
2760 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2761 $exp->setTargetClass(get_class($this));
2762 $exp->setCmd('confirmGlossarySelection');
2763 $exp->setClickableTypes(array("glo"));
2764 $exp->addFilter("glo");
2765
2766 // build html-output
2767 $exp->setOutput(0);
2768 $tpl->setContent($exp->getOutput());
2769 }
2770
2771 public function confirmGlossarySelection(): void
2772 {
2773 $ilCtrl = $this->ctrl;
2774 $tpl = $this->tpl;
2775 $lng = $this->lng;
2776
2777 $cgui = new ilConfirmationGUI();
2778 $ilCtrl->setParameter($this, "glo_ref_id", $this->requested_root_id);
2779 $cgui->setFormAction($ilCtrl->getFormAction($this));
2780 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
2781 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
2782 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
2783 $tpl->setContent($cgui->getHTML());
2784 }
2785
2786 public function selectLMGlossaryLink(): void
2787 {
2788 $glo_ref_id = $this->requested_glo_ref_id;
2789 $this->lm->autoLinkGlossaryTerms($glo_ref_id);
2790 $this->selectLMGlossary();
2791 }
2792
2793 public function selectLMGlossary(): void
2794 {
2795 $ilCtrl = $this->ctrl;
2796 $lng = $this->lng;
2797
2798 $glos = $this->lm->getAutoGlossaries();
2799 $glo_ref_id = $this->requested_glo_ref_id;
2800 $glo_id = ilObject::_lookupObjId($glo_ref_id);
2801 if (!in_array($glo_id, $glos)) {
2802 $glos[] = $glo_id;
2803 }
2804 $this->lm->setAutoGlossaries($glos);
2805 $this->lm->update();
2806
2807 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2808 $ilCtrl->redirect($this, "editGlossaries");
2809 }
2810
2811 public function removeLMGlossary(): void
2812 {
2813 $ilCtrl = $this->ctrl;
2814 $lng = $this->lng;
2815
2816 $this->lm->removeAutoGlossary($this->requested_glo_id);
2817 $this->lm->update();
2818
2819 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2820 $ilCtrl->redirect($this, "editGlossaries");
2821 }
2822
2823 public function editMasterLanguage(): void
2824 {
2825 $ilCtrl = $this->ctrl;
2826
2827 $ilCtrl->setParameter($this, "transl", "-");
2828 if ($this->lang_switch_mode == "short_titles") {
2829 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2830 }
2831 $ilCtrl->redirect($this, "chapters");
2832 }
2833
2834 public function switchToLanguage(): void
2835 {
2836 $ilCtrl = $this->ctrl;
2837
2838 $ilCtrl->setParameter($this, "transl", $this->requested_totransl);
2839 if ($this->lang_switch_mode == "short_titles") {
2840 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2841 }
2842 $ilCtrl->redirect($this, "chapters");
2843 }
2844
2845 public function redrawHeaderAction(): void
2846 {
2847 // #12281
2848 parent::redrawHeaderActionObject();
2849 }
2850
2854 protected function learningProgress(): void
2855 {
2856 $this->ctrl->redirectByClass(array('illearningprogressgui'), '');
2857 }
2858}
$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:26
global $ilSetting
Definition: privfeed.php:26
$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