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