ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
16{
20 protected $tabs;
21
25 protected $error;
26
30 protected $rbacsystem;
31
35 protected $plugin_admin;
36
40 protected $help;
41
45 protected $db;
46
50 protected $log;
51
55 protected $ctrl;
56
60 protected $locator;
61
65 protected $ui;
66
67
73 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
74 {
75 global $DIC;
76
77 $this->lng = $DIC->language();
78 $this->access = $DIC->access();
79 $this->tabs = $DIC->tabs();
80 $this->error = $DIC["ilErr"];
81 $this->settings = $DIC->settings();
82 $this->user = $DIC->user();
83 $this->tpl = $DIC["tpl"];
84 $this->toolbar = $DIC->toolbar();
85 $this->rbacsystem = $DIC->rbac()->system();
86 $this->tree = $DIC->repositoryTree();
87 $this->plugin_admin = $DIC["ilPluginAdmin"];
88 $this->help = $DIC["ilHelp"];
89 $this->locator = $DIC["ilLocator"];
90 $this->db = $DIC->database();
91 $this->log = $DIC["ilLog"];
92 $this->ui = $DIC->ui();
93 $lng = $DIC->language();
94 $ilCtrl = $DIC->ctrl();
95 $this->ctrl = $ilCtrl;
96 $lng->loadLanguageModule("content");
97 $lng->loadLanguageModule("obj");
98 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
99 }
100
101 protected function checkCtrlPath() : void
102 {
103 if (!$this->getCreationMode()) {
104 $baseclass = strtolower($_GET["baseClass"]);
105 $next_class = strtolower($this->ctrl->getNextClass());
106 // all calls must be routed through illmpresentationgui or
107 // illmeditorgui...
108 if (!in_array($baseclass, ["illmpresentationgui", "illmeditorgui"])) {
109 // ...except the comman action handler routes to
110 // activation/condition GUI, see https://mantis.ilias.de/view.php?id=32858
111 if (in_array($next_class, ["ilcommonactiondispatchergui"])) {
112 return;
113 }
114 throw new ilLMException("Wrong ctrl path");
115 }
116 }
117 }
118
124 public function executeCommand()
125 {
126 $ilAccess = $this->access;
128 $ilTabs = $this->tabs;
129 $ilCtrl = $this->ctrl;
131
132 $this->checkCtrlPath();
133
134 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
135 $this->explorer();
136 return;
137 }
138
139 if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
140 $this->ctrl->setReturn($this, "explorer");
141 }
142
143 // get next class that processes or forwards current command
144 $next_class = $this->ctrl->getNextClass($this);
145
146 // get current command
147 if ($_GET["to_props"] == 1) {
148 $cmd = $this->ctrl->getCmd("properties");
149 } else {
150 $cmd = $this->ctrl->getCmd("chapters");
151 }
152
153
154 switch ($next_class) {
155 case 'illtiproviderobjectsettinggui':
156
157 $this->setTabs();
158 $ilTabs->setTabActive("settings");
159 $this->setSubTabs("lti_provider");
160
161 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
162 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
163 $lti_gui->offerLTIRolesForSelection(true);
164 $this->ctrl->forwardCommand($lti_gui);
165 break;
166
167
168
169 case "illearningprogressgui":
170 $this->addHeaderAction();
171 $this->addLocations();
172 $this->setTabs("learning_progress");
173
174 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
175 $this->ctrl->forwardCommand($new_gui);
176
177 break;
178
179 case 'ilobjectmetadatagui':
180 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
181 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
182 }
183
184 $this->addHeaderAction();
185 $this->addLocations();
186 $this->setTabs("meta");
187
188 $md_gui = new ilObjectMetaDataGUI($this->object);
189 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'Educational'); // #9510
190 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
191 $this->ctrl->forwardCommand($md_gui);
192 break;
193
194 case "ilobjstylesheetgui":
195 $this->addLocations();
196 $this->ctrl->setReturn($this, "editStyleProperties");
197 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
198 $style_gui->omitLocator();
199 if ($cmd == "create" || $_GET["new_type"] == "sty") {
200 $style_gui->setCreationMode(true);
201 }
202 $ret = $this->ctrl->forwardCommand($style_gui);
203
204 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
205 $style_id = $ret;
206 $this->object->setStyleSheetId($style_id);
207 $this->object->update();
208 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
209 }
210 break;
211
212 case "illmpageobjectgui":
213 $this->setTitleAndDescription();
214 $ilTabs->setBackTarget(
215 $lng->txt("learning module"),
216 $ilCtrl->getLinkTarget($this, "chapters")
217 );
218 $this->ctrl->saveParameter($this, array("obj_id"));
219 $this->addLocations();
220 $this->ctrl->setReturn($this, "chapters");
221
222 $pg_gui = new ilLMPageObjectGUI($this->object);
223 if ($_GET["obj_id"] != "") {
224 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
225 $pg_gui->setLMPageObject($obj);
226 }
227 $ret = $this->ctrl->forwardCommand($pg_gui);
228 break;
229
230 case "ilstructureobjectgui":
231 $ilTabs->setBackTarget(
232 $lng->txt("learning module"),
233 $ilCtrl->getLinkTarget($this, "chapters")
234 );
235
236 $this->ctrl->saveParameter($this, array("obj_id"));
237 $this->addLocations();
238 $this->ctrl->setReturn($this, "chapters");
239 $st_gui = new ilStructureObjectGUI($this->object, $this->object->lm_tree);
240 if ($_GET["obj_id"] != "") {
241 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
242 $st_gui->setStructureObject($obj);
243 }
244 $ret = $this->ctrl->forwardCommand($st_gui);
245 if ($cmd == "save" || $cmd == "cancel") {
246 if ($_GET["obj_id"] == "") {
247 $this->ctrl->redirect($this, "chapters");
248 } else {
249 $this->ctrl->setCmd("subchap");
250 $this->executeCommand();
251 }
252 }
253 break;
254
255 case 'ilpermissiongui':
256 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
257 $this->prepareOutput();
258 } else {
259 $this->addHeaderAction();
260 $this->addLocations(true);
261 $this->setTabs("perm");
262 }
263 $perm_gui = new ilPermissionGUI($this);
264 $ret = $this->ctrl->forwardCommand($perm_gui);
265 break;
266
267 // infoscreen
268 case 'ilinfoscreengui':
269 $this->addHeaderAction();
270 $this->addLocations(true);
271 $this->setTabs("info");
272 $info = new ilInfoScreenGUI($this);
273 $info->enablePrivateNotes();
274 $info->enableLearningProgress();
275
276 $info->enableNews();
277 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
278 $info->enableNewsEditing();
279 $info->setBlockProperty("news", "settings", true);
280 }
281
282 // show standard meta data section
283 $info->addMetaDataSections(
284 $this->object->getId(),
285 0,
286 $this->object->getType()
287 );
288
289 $ret = $this->ctrl->forwardCommand($info);
290 break;
291
292 case "ilexportgui":
293 $exp_gui = new ilExportGUI($this);
294 $exp_gui->addFormat("xml");
295 $ot = ilObjectTranslation::getInstance($this->object->getId());
296 if ($ot->getContentActivated()) {
297 $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("cont_master_language_only") . ")", $this, "export");
298 $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("cont_master_language_only_no_media") . ")", $this, "export");
299
300 $lng->loadLanguageModule("meta");
301 $langs = $ot->getLanguages();
302 foreach ($langs as $l => $ldata) {
303 $exp_gui->addFormat("html_" . $l, "HTML (" . $lng->txt("meta_l_" . $l) . ")", $this, "exportHTML");
304 }
305 $exp_gui->addFormat("html_all", "HTML (" . $lng->txt("cont_all_languages") . ")", $this, "exportHTML");
306 } else {
307 $exp_gui->addFormat("html", "", $this, "exportHTML");
308 }
309
310 $exp_gui->addFormat("scorm", "", $this, "exportSCORM");
311 $exp_gui->addCustomColumn(
312 $lng->txt("cont_public_access"),
313 $this,
314 "getPublicAccessColValue"
315 );
316 $exp_gui->addCustomMultiCommand(
317 $lng->txt("cont_public_access"),
318 $this,
319 "publishExportFile"
320 );
321 $ret = $this->ctrl->forwardCommand($exp_gui);
322 ilUtil::sendInfo($this->lng->txt("lm_only_one_download_per_type"));
323 $this->addHeaderAction();
324 $this->addLocations(true);
325 $this->setTabs("export");
326 break;
327
328 case 'ilobjecttranslationgui':
329 $this->addHeaderAction();
330 $this->addLocations(true);
331 $this->setTabs("settings");
332 $this->setSubTabs("obj_multilinguality");
333 $transgui = new ilObjectTranslationGUI($this);
334 $transgui->setTitleDescrOnlyMode(false);
335 $this->ctrl->forwardCommand($transgui);
336 break;
337
338
339 case "ilcommonactiondispatchergui":
341 $this->prepareOutput();
342 $this->ctrl->forwardCommand($gui);
343 break;
344
345 case 'ilobjectcopygui':
346 $this->prepareOutput();
347 $cp = new ilObjectCopyGUI($this);
348 $cp->setType('lm');
349 $this->ctrl->forwardCommand($cp);
350 break;
351
352 case "ilmobmultisrtuploadgui":
353 $this->addHeaderAction();
354 $this->addLocations(true);
355 $this->setTabs("content");
356 $this->setContentSubTabs("srt_files");
357 $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->object));
358 $this->ctrl->forwardCommand($gui);
359 break;
360
361 case "illmimportgui":
362 $this->addHeaderAction();
363 $this->addLocations(true);
364 $this->setTabs("content");
365 $this->setContentSubTabs("import");
366 $gui = new ilLMImportGUI($this->object);
367 $this->ctrl->forwardCommand($gui);
368 break;
369
370 case "illmeditshorttitlesgui":
371 $this->addHeaderAction();
372 $this->addLocations(true);
373 $this->setTabs("content");
374 $this->setContentSubTabs("short_titles");
375 $gui = new ilLMEditShortTitlesGUI($this);
376 $this->ctrl->forwardCommand($gui);
377 break;
378
379 default:
380 $new_type = $_POST["new_type"]
381 ? $_POST["new_type"]
382 : $_GET["new_type"];
383
384
385 if ($cmd == "create" &&
386 !in_array($new_type, array("lm"))) {
387 switch ($new_type) {
388 case "pg":
389 $this->setTabs();
390 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
391 $ret = $this->executeCommand();
392 break;
393
394 case "st":
395 $this->setTabs();
396 $this->ctrl->setCmdClass("ilStructureObjectGUI");
397 $ret = $this->executeCommand();
398 break;
399 }
400 } else {
401 // creation of new dbk/lm in repository
402 if ($this->getCreationMode() == true &&
403 in_array($new_type, array("lm"))) {
404 $this->prepareOutput();
405 if ($cmd == "") { // this may be due to too big upload files
406 $cmd = "create";
407 }
408 $cmd .= "Object";
409 $ret = $this->$cmd();
410 } else {
411 $this->addHeaderAction();
412 $this->addLocations();
413 $ret = $this->$cmd();
414 }
415 }
416 break;
417 }
418 return $ret;
419 }
420
421 public static function _forwards()
422 {
423 return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
424 }
425
429 public function properties()
430 {
432
433 $lng->loadLanguageModule("style");
434 $this->setTabs("settings");
435 $this->setSubTabs("settings");
436
437 // lm properties
438 $this->initPropertiesForm();
440
441 if ($this->object->getType() == "lm") {
442 // Edit ecs export settings
443 $ecs = new ilECSLearningModuleSettings($this->object);
444 $ecs->addSettingsToForm($this->form, 'lm');
445 }
446
447 $this->tpl->setContent($this->form->getHTML());
448 }
449
453 public function initPropertiesForm()
454 {
455 $obj_service = $this->object_service;
456
457 $ilCtrl = $this->ctrl;
460
461 $this->form = new ilPropertyFormGUI();
462
463 // title
464 $ti = new ilTextInputGUI($lng->txt("title"), "title");
465 $ti->setRequired(true);
466 $this->form->addItem($ti);
467
468 // description
469 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
470 $this->form->addItem($ta);
471
472 $lng->loadLanguageModule("rep");
474 $section->setTitle($this->lng->txt('rep_activation_availability'));
475 $this->form->addItem($section);
476
477 // online
478 $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
479 $this->form->addItem($online);
480
481 // presentation
483 $section->setTitle($this->lng->txt('cont_presentation'));
484 $this->form->addItem($section);
485
486 // tile image
487 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
488
489 // default layout
490 /*
491 $layout = self::getLayoutOption($lng->txt("cont_def_layout"), "lm_layout");
492 $this->form->addItem($layout);*/
493
494 // layout per page
495 /*
496 $lpp = new ilCheckboxInputGUI($lng->txt("cont_layout_per_page"), "layout_per_page");
497 $lpp->setInfo($this->lng->txt("cont_layout_per_page_info"));
498 $this->form->addItem($lpp);*/
499
500 // page header
501 $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
502 $option = array("st_title" => $this->lng->txt("cont_st_title"),
503 "pg_title" => $this->lng->txt("cont_pg_title"),
504 "none" => $this->lng->txt("cont_none"));
505 $page_header->setOptions($option);
506 $this->form->addItem($page_header);
507
508 // chapter numeration
509 $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
510 $this->form->addItem($chap_num);
511
512 // toc mode
513 $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
514 $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
515 "pages" => $this->lng->txt("cont_chapters_and_pages"));
516 $toc_mode->setOptions($option);
517 $this->form->addItem($toc_mode);
518
519 // show progress icons
520 $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
521 $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
522 $this->form->addItem($progr_icons);
523
524 // self assessment
526 $section->setTitle($this->lng->txt('cont_self_assessment'));
527 $this->form->addItem($section);
528
529 // tries
530 $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
531 $radg->setValue(0);
532 $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), 0, $lng->txt("cont_tries_reset_on_visit_info"));
533 $radg->addOption($op1);
534 $op2 = new ilRadioOption($lng->txt("cont_tries_store"), 1, $lng->txt("cont_tries_store_info"));
535 $radg->addOption($op2);
536 $this->form->addItem($radg);
537
538 // restrict forward navigation
539 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
540 $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
541 $this->form->addItem($qfeed);
542
543 // notification
544 $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
545 $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
546 $qfeed->addSubItem($not);
547
548 // disable default feedback for questions
549 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
550 $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
551 $this->form->addItem($qfeed);
552
553 // additional features
555 $section->setTitle($this->lng->txt('obj_features'));
556 $this->form->addItem($section);
557
558 // public notes
559 if (!$ilSetting->get('disable_comments')) {
560 $this->lng->loadLanguageModule("notes");
561 $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
562 $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
563 $this->form->addItem($pub_nodes);
564 }
565
566 // history user comments
567 $com = new ilCheckboxInputGUI($lng->txt("enable_hist_user_comments"), "cobj_user_comments");
568 $com->setInfo($this->lng->txt("enable_hist_user_comments_desc"));
569 $this->form->addItem($com);
570
571 // rating
572 $this->lng->loadLanguageModule('rating');
573 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
574 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
575 $this->form->addItem($rate);
576 $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
577 $this->form->addItem($ratep);
578
579 $this->form->setTitle($lng->txt("cont_lm_properties"));
580 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
581 $this->form->setFormAction($ilCtrl->getFormAction($this));
582 }
583
587 public function getPropertiesFormValues()
588 {
590
591 $values = array();
592
593 $title = $this->object->getTitle();
594 $description = $this->object->getLongDescription();
595 $ot = ilObjectTranslation::getInstance($this->object->getId());
596 if ($ot->getContentActivated()) {
597 $title = $ot->getDefaultTitle();
598 $description = $ot->getDefaultDescription();
599 }
600
601 $values["title"] = $title;
602 $values["description"] = $description;
603 if (!$this->object->getOfflineStatus()) {
604 $values["cobj_online"] = true;
605 }
606 //$values["lm_layout"] = $this->object->getLayout();
607 $values["lm_pg_header"] = $this->object->getPageHeader();
608 if ($this->object->isActiveNumbering()) {
609 $values["cobj_act_number"] = true;
610 }
611 $values["toc_mode"] = $this->object->getTOCMode();
612 if ($this->object->publicNotes()) {
613 $values["cobj_pub_notes"] = true;
614 }
615 if ($this->object->cleanFrames()) {
616 $values["cobj_clean_frames"] = true;
617 }
618 if ($this->object->isActiveHistoryUserComments()) {
619 $values["cobj_user_comments"] = true;
620 }
621 //$values["layout_per_page"] = $this->object->getLayoutPerPage();
622 $values["rating"] = $this->object->hasRating();
623 $values["rating_pages"] = $this->object->hasRatingPages();
624 $values["disable_def_feedback"] = $this->object->getDisableDefaultFeedback();
625 $values["progr_icons"] = $this->object->getProgressIcons();
626 $values["store_tries"] = $this->object->getStoreTries();
627 $values["restrict_forw_nav"] = $this->object->getRestrictForwardNavigation();
628
629 $values["notification_blocked_users"] = ilNotification::hasNotification(
631 $ilUser->getId(),
632 $this->object->getId()
633 );
634
635 $this->form->setValuesByArray($values);
636 }
637
641 public function saveProperties()
642 {
646 $obj_service = $this->object_service;
647
648 $valid = false;
649 $this->initPropertiesForm();
650 if ($this->form->checkInput()) {
651 $ot = ilObjectTranslation::getInstance($this->object->getId());
652 if ($ot->getContentActivated()) {
653 $ot->setDefaultTitle($_POST['title']);
654 $ot->setDefaultDescription($_POST['description']);
655 $ot->save();
656 }
657
658 $this->object->setTitle($_POST['title']);
659 $this->object->setDescription($_POST['description']);
660 //$this->object->setLayout($_POST["lm_layout"]);
661 $this->object->setPageHeader($_POST["lm_pg_header"]);
662 $this->object->setTOCMode($_POST["toc_mode"]);
663 $this->object->setOfflineStatus(!($_POST['cobj_online']));
664 $this->object->setActiveNumbering($_POST["cobj_act_number"]);
665 $this->object->setCleanFrames($_POST["cobj_clean_frames"]);
666 if (!$ilSetting->get('disable_comments')) {
667 $this->object->setPublicNotes($_POST["cobj_pub_notes"]);
668 }
669 $this->object->setHistoryUserComments($_POST["cobj_user_comments"]);
670 //$this->object->setLayoutPerPage($_POST["layout_per_page"]);
671 $this->object->setRating($_POST["rating"]);
672 $this->object->setRatingPages($_POST["rating_pages"]);
673 $this->object->setDisableDefaultFeedback((int) $_POST["disable_def_feedback"]);
674 $this->object->setProgressIcons((int) $_POST["progr_icons"]);
675
676 $add_info = "";
677 if ($_POST["restrict_forw_nav"] && !$_POST["store_tries"]) {
678 $_POST["store_tries"] = 1;
679 $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
680 $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
681 $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
682 }
683
684 $this->object->setStoreTries((int) $_POST["store_tries"]);
685 $this->object->setRestrictForwardNavigation((int) $_POST["restrict_forw_nav"]);
686 $this->object->updateProperties();
687 $this->object->update();
688
689 // tile image
690 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
691
694 $ilUser->getId(),
695 $this->object->getId(),
696 (bool) $this->form->getInput("notification_blocked_users")
697 );
698
699
700 if ($this->object->getType() == 'lm') {
701 // Update ecs export settings
702 $ecs = new ilECSLearningModuleSettings($this->object);
703 if ($ecs->handleSettingsUpdate()) {
704 $valid = true;
705 }
706 } else {
707 $valid = true;
708 }
709 }
710
711 if ($valid) {
712 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified") . $add_info, true);
713 $this->ctrl->redirect($this, "properties");
714 } else {
715 $lng->loadLanguageModule("style");
716 $this->setTabs("settings");
717 $this->setSubTabs("cont_general_properties");
718
719 $this->form->setValuesByPost();
720 $this->tpl->setContent($this->form->getHTML());
721 }
722 }
723
727 public function editStyleProperties()
728 {
730
732 $tpl->setContent($this->form->getHTML());
733 }
734
738 public function initStylePropertiesForm()
739 {
740 $ilCtrl = $this->ctrl;
742 $ilTabs = $this->tabs;
744
745 $lng->loadLanguageModule("style");
746 $this->setTabs();
747 $ilTabs->setTabActive("settings");
748 $this->setSubTabs("cont_style");
749
750 $this->form = new ilPropertyFormGUI();
751
752 $fixed_style = $ilSetting->get("fixed_content_style_id");
753 $def_style = $ilSetting->get("default_content_style_id");
754 $style_id = $this->object->getStyleSheetId();
755
756 if ($fixed_style > 0) {
757 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
758 $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
759 $this->lng->txt("global_fixed") . ")");
760 $this->form->addItem($st);
761 } else {
763 true,
764 false,
765 $_GET["ref_id"]
766 );
767
768 if ($def_style > 0) {
769 $st_styles[0] = ilObject::_lookupTitle($def_style) . " (" . $this->lng->txt("default") . ")";
770 } else {
771 $st_styles[0] = $this->lng->txt("default");
772 }
773 ksort($st_styles);
774
775 if ($style_id > 0) {
776 // individual style
777 if (!ilObjStyleSheet::_lookupStandard($style_id)) {
778 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
779 $st->setValue(ilObject::_lookupTitle($style_id));
780 $this->form->addItem($st);
781
782 // delete command
783 $this->form->addCommandButton(
784 "editStyle",
785 $lng->txt("cont_edit_style")
786 );
787 $this->form->addCommandButton(
788 "deleteStyle",
789 $lng->txt("cont_delete_style")
790 );
791 }
792 }
793
794 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
795 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
796 $style_sel->setOptions($st_styles);
797 $style_sel->setValue($style_id);
798 $this->form->addItem($style_sel);
799 $this->form->addCommandButton(
800 "saveStyleSettings",
801 $lng->txt("save")
802 );
803 $this->form->addCommandButton(
804 "createStyle",
805 $lng->txt("sty_create_ind_style")
806 );
807 }
808 }
809 $this->form->setTitle($lng->txt("cont_style"));
810 $this->form->setFormAction($ilCtrl->getFormAction($this));
811 }
812
816 public function createStyle()
817 {
818 $ilCtrl = $this->ctrl;
819
820 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
821 }
822
826 public function editStyle()
827 {
828 $ilCtrl = $this->ctrl;
829
830 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
831 }
832
836 public function deleteStyle()
837 {
838 $ilCtrl = $this->ctrl;
839
840 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
841 }
842
846 public function saveStyleSettings()
847 {
849
850 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
851 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
852 || $this->object->getStyleSheetId() == 0)) {
853 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
854 $this->object->update();
855 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
856 }
857 $this->ctrl->redirect($this, "editStyleProperties");
858 }
859
863 public function initMenuForm()
864 {
866 $ilCtrl = $this->ctrl;
867
868 $form = new ilPropertyFormGUI();
869
870 // enable menu
871 $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
872 $menu->setChecked($this->object->isActiveLMMenu());
873 $form->addItem($menu);
874
875 // toc
876 /*
877 $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
878 $toc->setChecked($this->object->isActiveTOC());
879 $form->addItem($toc);*/
880
881 // print view
882 $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
883 $print->setChecked($this->object->isActivePrintView());
884 $form->addItem($print);
885
886 // prevent glossary appendix
887 $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
888 $glo->setChecked($this->object->isActivePreventGlossaryAppendix());
889 $print->addSubItem($glo);
890
891 // hide header and footer in print view
892 $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
893 $hhfp->setChecked($this->object->getHideHeaderFooterPrint());
894 $print->addSubItem($hhfp);
895
896 // downloads
897 $no_download_file_available =
898 " " . $lng->txt("cont_no_download_file_available") .
899 " <a href='" . $ilCtrl->getLinkTargetByClass("ilexportgui", "") . "'>" . $lng->txt("change") . "</a>";
900 $types = array("xml", "html", "scorm");
901 foreach ($types as $type) {
902 if ($this->object->getPublicExportFile($type) != "") {
903 if (is_file($this->object->getExportDirectory($type) . "/" .
904 $this->object->getPublicExportFile($type))) {
905 $no_download_file_available = "";
906 }
907 }
908 }
909 $dl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "cobj_act_downloads");
910 $dl->setInfo($this->lng->txt("cont_downloads_desc") . $no_download_file_available);
911 $dl->setChecked($this->object->isActiveDownloads());
912 $form->addItem($dl);
913
914 // downloads in public area
915 $pdl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads_public_desc"), "cobj_act_downloads_public");
916 $pdl->setChecked($this->object->isActiveDownloadsPublic());
917 $dl->addSubItem($pdl);
918
919 $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
920
921 $form->setTitle($lng->txt("cont_lm_menu"));
922 $form->setFormAction($ilCtrl->getFormAction($this));
923
924 return $form;
925 }
926
930 public function editMenuProperties()
931 {
933 $ilTabs = $this->tabs;
934 $ilCtrl = $this->ctrl;
936 $ilToolbar = $this->toolbar;
937
938 $lng->loadLanguageModule("style");
939 $this->setTabs();
940 $ilTabs->setTabActive("settings");
941 $this->setSubTabs("cont_lm_menu");
942
943 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
944 $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
945 $ilToolbar->setCloseFormTag(false);
946
947 $form = $this->initMenuForm();
948 $form->setOpenTag(false);
949 $form->setCloseTag(false);
950
951 $this->__initLMMenuEditor();
952 $entries = $this->lmme_obj->getMenuEntries();
953 $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
954 $table->setOpenFormTag(false);
955
956 $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
957 }
958
962 public function saveMenuProperties()
963 {
964 $this->object->setActiveLMMenu((int) $_POST["cobj_act_lm_menu"]);
965 //$this->object->setActiveTOC((int) $_POST["cobj_act_toc"]);
966 $this->object->setActivePrintView((int) $_POST["cobj_act_print"]);
967 $this->object->setActivePreventGlossaryAppendix((int) $_POST["cobj_act_print_prev_glo"]);
968 $this->object->setHideHeaderFooterPrint((int) $_POST["hide_head_foot_print"]);
969 $this->object->setActiveDownloads((int) $_POST["cobj_act_downloads"]);
970 $this->object->setActiveDownloadsPublic((int) $_POST["cobj_act_downloads_public"]);
971 $this->object->updateProperties();
972
973 $this->__initLMMenuEditor();
974 //var_dump($_POST["menu_entries"]); exit;
975 $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
976
977 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
978 $this->ctrl->redirect($this, "editMenuProperties");
979 }
980
984 public function explorer()
985 {
986 $ilCtrl = $this->ctrl;
987
988 $gui_class = "ilobjlearningmodulegui";
989
990 $ilCtrl->setParameterByClass($gui_class, "active_node", $_GET["active_node"]);
991
992 $this->tpl = new ilTemplate("tpl.main.html", true, true);
993
994 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
995
996 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
997 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
998
999 $exp = new ilLMEditorExplorer(
1000 $this->ctrl->getLinkTarget($this, "view"),
1001 $this->object,
1002 $gui_class
1003 );
1004
1005 $exp->setTargetGet("obj_id");
1006 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
1007
1008 if ($_GET["lmmovecopy"] == "1") {
1009 $this->proceedDragDrop();
1010 }
1011
1012
1013 if ($_GET["lmexpand"] == "") {
1014 $mtree = new ilTree($this->object->getId());
1015 $mtree->setTableNames('lm_tree', 'lm_data');
1016 $mtree->setTreeTablePK("lm_id");
1017 $expanded = $mtree->readRootId();
1018 } else {
1019 $expanded = $_GET["lmexpand"];
1020 }
1021 if ($_GET["active_node"] != "") {
1022 $path = $this->lm_tree->getPathId($_GET["active_node"]);
1023 $exp->setForceOpenPath($path);
1024
1025 $exp->highlightNode($_GET["active_node"]);
1026 }
1027 $exp->setExpand($expanded);
1028
1029 // build html-output
1030 $exp->setOutput(0);
1031 $output = $exp->getOutput();
1032
1033 // asynchronous output
1034 if ($ilCtrl->isAsynch()) {
1035 echo $output;
1036 exit;
1037 }
1038
1039 $this->tpl->setCurrentBlock("content");
1040 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
1041 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1042 $this->tpl->setVariable("EXPLORER", $output);
1043 $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
1044 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
1045 $this->tpl->parseCurrentBlock();
1046 $this->tpl->printToStdout(false);
1047 exit;
1048 }
1049
1053 public function popup()
1054 {
1055 $popup = new ilWysiwygUtil();
1056 $popup->show($_GET["ptype"]);
1057 exit;
1058 }
1059
1063 public function proceedDragDrop()
1064 {
1065 $ilCtrl = $this->ctrl;
1066
1067 $this->object->executeDragDrop(
1068 $_POST["il_hform_source_id"],
1069 $_POST["il_hform_target_id"],
1070 $_POST["il_hform_fc"],
1071 $_POST["il_hform_as_subitem"]
1072 );
1073 $ilCtrl->redirect($this, "chapters");
1074 }
1075
1076 /* protected function initCreationForms($a_new_type)
1077 {
1078 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
1079 self::CFORM_IMPORT => $this->initImportForm());
1080
1081 return $forms;
1082 }*/
1083
1084 protected function afterSave(ilObject $a_new_object)
1085 {
1086 $a_new_object->setCleanFrames(true);
1087 $a_new_object->update();
1088
1089 // create content object tree
1090 $a_new_object->createLMTree();
1091
1092 // create a first chapter
1093 $a_new_object->addFirstChapterAndPage();
1094
1095 // always send a message
1096 ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1097 ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
1098 "&baseClass=ilLMEditorGUI");
1099 }
1100
1104 public function initImportForm($a_new_type)
1105 {
1106 $form = parent::initImportForm($a_new_type);
1107
1108 // validation
1109 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
1110 $cb->setInfo($this->lng->txt(""));
1111 $form->addItem($cb);
1112 return $form;
1113 }
1114
1120 public function exportObject()
1121 {
1122 return;
1123 }
1124
1130 public function importObject()
1131 {
1132 $this->createObject();
1133 return;
1134 }
1135
1136
1143 public function importFileObject($parent_id = null, $a_catch_errors = true)
1144 {
1147 $tpl = $this->tpl;
1148
1149 $form = $this->initImportForm("lm");
1150
1151 try {
1152 // the new import
1153 parent::importFileObject(null, false);
1154 return;
1156 // we just run through in this case.
1157 $no_manifest = true;
1158 } catch (ilException $e) {
1159 // display message and form again
1160 ilUtil::sendFailure($this->lng->txt("obj_import_file_error") . " <br />" . $e->getMessage());
1161 $form->setValuesByPost();
1162 $tpl->setContent($form->getHtml());
1163 return;
1164 }
1165
1166 if (!$no_manifest) {
1167 return; // something different has gone wrong, but we have a manifest, this is definitely not "the old" import
1168 }
1169
1170 // the "old" (pre 5.1) import
1171
1172 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"])) {
1173 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
1174 return;
1175 }
1176
1177 if ($form->checkInput()) {
1178 // create and insert object in objecttree
1179 $newObj = new ilObjContentObject();
1180 $newObj->setType($_GET["new_type"]);
1181 $newObj->setTitle($_FILES["importfile"]["name"]);
1182 $newObj->setDescription("");
1183 $newObj->create(true);
1184 $newObj->createReference();
1185 $newObj->putInTree($_GET["ref_id"]);
1186 $newObj->setPermissions($_GET["ref_id"]);
1187
1188 // create learning module tree
1189 $newObj->createLMTree();
1190
1191 // since the "new" import already did the extracting
1192 $mess = $newObj->importFromDirectory($this->tmp_import_dir, $_POST["validate"]);
1193
1194 if ($mess == "") {
1195 ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1196 ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
1197 "&baseClass=ilLMEditorGUI");
1198 } else {
1199 $link = '<a href="' . "ilias.php?ref_id=" . $newObj->getRefId() .
1200 "&baseClass=ilLMEditorGUI" . '" target="_top">' . $this->lng->txt("btn_next") . '</a>';
1201 $tpl->setContent("<br />" . $link . "<br /><br />" . $mess . $link);
1202 }
1203 } else {
1204 $form->setValuesByPost();
1205 $tpl->setContent($form->getHtml());
1206 }
1207 }
1208
1212 public function chapters()
1213 {
1214 $lng = $this->lng;
1215 $ilCtrl = $this->ctrl;
1216
1217 $this->setTabs();
1218 $this->setContentSubTabs("chapters");
1219
1220 $ilCtrl->setParameter($this, "backcmd", "chapters");
1221
1222 $form_gui = new ilChapterHierarchyFormGUI($this->object->getType(), $_GET["transl"]);
1223 $form_gui->setFormAction($ilCtrl->getFormAction($this));
1224 $form_gui->setTitle($this->object->getTitle());
1225 $form_gui->setIcon(ilUtil::getImagePath("icon_lm.svg"));
1226 $form_gui->setTree($this->lm_tree);
1227 $form_gui->setMaxDepth(0);
1228 $form_gui->setCurrentTopNodeId($this->tree->getRootId());
1229 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
1230 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1231 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1232 if ($this->object->getLayoutPerPage()) {
1233 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
1234 }
1235 $form_gui->setDragIcon(ilUtil::getImagePath("icon_st.svg"));
1236 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1237 $up_gui = "ilobjlearningmodulegui";
1238
1239 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
1240 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
1241 $ilCtrl->setParameter($this, "obj_id", "");
1242
1243 $ml_head = self::getMultiLangHeader($this->object->getId(), $this);
1244
1245 $this->tpl->setContent($ml_head . $ctpl->get());
1246 }
1247
1254 public static function getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode = "")
1255 {
1256 global $DIC;
1257
1258 $lng = $DIC->language();
1259 $ilCtrl = $DIC->ctrl();
1260
1261 // multi language
1262 $ot = ilObjectTranslation::getInstance($a_lm_id);
1263 if ($ot->getContentActivated()) {
1264 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1265 $lng->loadLanguageModule("meta");
1266
1267 // info
1268 $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1269 $ml_head = $ml_gui->getMultiLangInfo($_GET["transl"]);
1270
1271 // language switch
1272 $list = new ilAdvancedSelectionListGUI();
1273 $list->setListTitle($lng->txt("actions"));
1274 $list->setId("copage_act");
1275 $entries = false;
1276 if (!in_array($_GET["transl"], array("", "-"))) {
1277 $l = $ot->getMasterLanguage();
1278 $list->addItem(
1279 $lng->txt("cont_edit_language_version") . ": " .
1280 $lng->txt("meta_l_" . $l),
1281 "",
1282 $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1283 );
1284 $entries = true;
1285 }
1286
1287 foreach ($ot->getLanguages() as $al => $lang) {
1288 if ($_GET["transl"] != $al &&
1289 $al != $ot->getMasterLanguage()) {
1290 $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1291 $list->addItem(
1292 $lng->txt("cont_edit_language_version") . ": " .
1293 $lng->txt("meta_l_" . $al),
1294 "",
1295 $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1296 );
1297 $ilCtrl->setParameter($a_gui_class, "totransl", $_GET["totransl"]);
1298 }
1299 $entries = true;
1300 }
1301
1302 if ($entries) {
1303 $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $list->getHTML() . "</div>";
1304 }
1305 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1306 }
1307
1308 return $ml_head;
1309 }
1310
1311
1312 /*
1313 * List all pages of learning module
1314 */
1315 public function pages()
1316 {
1317 $tpl = $this->tpl;
1318 $ilToolbar = $this->toolbar;
1319 $ilCtrl = $this->ctrl;
1320 $lng = $this->lng;
1321
1322 $this->setTabs();
1323 $this->setContentSubTabs("pages");
1324
1325 $ilCtrl->setParameter($this, "backcmd", "pages");
1326 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1327 $ilToolbar->addButton(
1328 $lng->txt("pg_add"),
1329 $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1330 );
1331 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1332
1333 $t = new ilLMPagesTableGUI($this, "pages", $this->object);
1334 $tpl->setContent($t->getHTML());
1335 }
1336
1340 public function listLinks()
1341 {
1342 $tpl = $this->tpl;
1343
1344 $this->setTabs();
1345 $this->setContentSubTabs("internal_links");
1346
1347 $table_gui = new ilLinksTableGUI(
1348 $this,
1349 "listLinks",
1350 $this->object->getId(),
1351 $this->object->getType()
1352 );
1353
1354 $tpl->setContent($table_gui->getHTML());
1355 }
1356
1360 public function showMaintenance()
1361 {
1362 $ilToolbar = $this->toolbar;
1363
1364 $this->setTabs();
1365 $this->setContentSubTabs("maintenance");
1366
1367 $ilToolbar->addButton(
1368 $this->lng->txt("cont_fix_tree"),
1369 $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1370 );
1371 }
1372
1376 public function activatePages()
1377 {
1378 if (is_array($_POST["id"])) {
1379 foreach ($_POST["id"] as $id) {
1380 $act = ilLMPage::_lookupActive($id, $this->object->getType());
1381 ilLMPage::_writeActive($id, $this->object->getType(), !$act);
1382 }
1383 }
1384
1385 $this->ctrl->redirect($this, "pages");
1386 }
1387
1391 public function pastePage()
1392 {
1394
1396 $ilErr->raiseError($this->lng->txt("no_page_in_clipboard"), $ilErr->MESSAGE);
1397 }
1398
1399 // paste selected object
1401
1402 // copy page, if action is copy
1403 if (ilEditClipboard::getAction() == "copy") {
1404 // check wether page belongs to lm
1406 == $this->object->getID()) {
1407 $lm_page = new ilLMPageObject($this->object, $id);
1408 $new_page = $lm_page->copy();
1409 $id = $new_page->getId();
1410 } else {
1411 // get page from other content object into current content object
1413 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1414 $lm_page = new ilLMPageObject($lm_obj, $id);
1415 $copied_nodes = array();
1416 $new_page = $lm_page->copyToOtherContObject($this->object, $copied_nodes);
1417 $id = $new_page->getId();
1418 ilLMObject::updateInternalLinks($copied_nodes);
1419 }
1420 }
1421
1422 // cut is not be possible in "all pages" form yet
1423 if (ilEditClipboard::getAction() == "cut") {
1424 // check wether page belongs not to lm
1426 != $this->object->getID()) {
1428 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1429 $lm_page = new ilLMPageObject($lm_obj, $id);
1430 $lm_page->setLMId($this->object->getID());
1431 $lm_page->update();
1432 $page = $lm_page->getPageObject();
1433 $page->buildDom();
1434 $page->setParentId($this->object->getID());
1435 $page->update();
1436 }
1437 }
1438
1439
1441 $this->ctrl->redirect($this, "pages");
1442 }
1443
1447 public function copyPage()
1448 {
1450
1451 if (!isset($_POST["id"])) {
1452 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1453 }
1454
1455 $items = ilUtil::stripSlashesArray($_POST["id"]);
1456 ilLMObject::clipboardCopy($this->object->getId(), $items);
1458
1459 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_copied"), true);
1460
1461 $this->ctrl->redirect($this, "pages");
1462 }
1463
1471 public function delete($a_parent_subobj_id = 0)
1472 {
1474
1475 if (!isset($_POST["id"])) {
1476 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1477 }
1478
1479 if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1480 $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1481 }
1482
1483 if ($a_parent_subobj_id == 0) {
1484 $this->setTabs("content");
1485 }
1486
1487 if ($a_parent_subobj_id != 0) {
1488 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
1489 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1490 $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1491 } else {
1492 $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
1493 $form_action = $this->ctrl->getFormAction($this);
1494 }
1495
1496 // display confirmation message
1497 $cgui = new ilConfirmationGUI();
1498 $cgui->setFormAction($form_action);
1499 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1500 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1501 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1502
1503 foreach ($_POST["id"] as $id) {
1504 if ($id != IL_FIRST_NODE) {
1505 $obj = new ilLMObject($this->object, $id);
1506 $caption = ilUtil::getImageTagByType($obj->getType(), $this->tpl->tplPath) .
1507 " " . $obj->getTitle();
1508
1509 $cgui->addItem("id[]", $id, $caption);
1510 }
1511 }
1512
1513 $this->tpl->setContent($cgui->getHTML());
1514 }
1515
1519 public function cancelDelete()
1520 {
1521 $this->ctrl->redirect($this, $_GET["backcmd"]);
1522 }
1523
1531 public function confirmedDelete($a_parent_subobj_id = 0)
1532 {
1534
1535 $tree = new ilTree($this->object->getId());
1536 $tree->setTableNames('lm_tree', 'lm_data');
1537 $tree->setTreeTablePK("lm_id");
1538
1539 // check number of objects
1540 if (!$_POST["id"]) {
1541 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1542 }
1543
1544 // delete all selected objects
1545 foreach ($_POST["id"] as $id) {
1546 if ($id != IL_FIRST_NODE) {
1547 $obj = ilLMObjectFactory::getInstance($this->object, $id, false);
1548 $node_data = $tree->getNodeData($id);
1549 if (is_object($obj)) {
1550 $obj->setLMId($this->object->getId());
1551
1553 $this->object->getId(),
1554 "delete_" . $obj->getType(),
1555 array(ilLMObject::_lookupTitle($id), $id),
1556 $this->object->getType()
1557 );
1558
1559 $obj->delete();
1560 }
1561 if ($tree->isInTree($id)) {
1562 $tree->deleteTree($node_data);
1563 }
1564 }
1565 }
1566
1567 // check the tree
1568 $this->object->checkTree();
1569
1570 // feedback
1571 ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
1572
1573 if ($a_parent_subobj_id == 0) {
1574 $this->ctrl->redirect($this, $_GET["backcmd"]);
1575 }
1576 }
1577
1578
1579
1586 public function getContextPath($a_endnode_id, $a_startnode_id = 1)
1587 {
1588 $path = "";
1589
1590 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1591
1592 // count -1, to exclude the learning module itself
1593 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1594 if ($path != "") {
1595 $path .= " > ";
1596 }
1597
1598 $path .= $tmpPath[$i]["title"];
1599 }
1600
1601 return $path;
1602 }
1603
1604
1605
1611 public function showActions($a_actions)
1612 {
1613 foreach ($a_actions as $name => $lng) {
1614 $d[$name] = array("name" => $name, "lng" => $lng);
1615 }
1616
1617 $notoperations = array();
1618
1619 $operations = array();
1620
1621 if (is_array($d)) {
1622 foreach ($d as $row) {
1623 if (!in_array($row["name"], $notoperations)) {
1624 $operations[] = $row;
1625 }
1626 }
1627 }
1628
1629 if (count($operations) > 0) {
1630 foreach ($operations as $val) {
1631 $this->tpl->setCurrentBlock("operation_btn");
1632 $this->tpl->setVariable("BTN_NAME", $val["name"]);
1633 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1634 $this->tpl->parseCurrentBlock();
1635 }
1636
1637 $this->tpl->setCurrentBlock("operation");
1638 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1639 $this->tpl->parseCurrentBlock();
1640 }
1641 }
1642
1646 public function view()
1647 {
1648 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1649 $this->prepareOutput();
1650 parent::viewObject();
1651 } else {
1652 $this->viewObject();
1653 }
1654 }
1655
1656
1660 public function moveChapter($a_parent_subobj_id = 0)
1661 {
1663
1664 if (!isset($_POST["id"])) {
1665 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1666 }
1667 if (count($_POST["id"]) > 1) {
1668 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1669 }
1670
1671 if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1672 $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1673 }
1674
1675 // SAVE POST VALUES
1676 ilEditClipboard::storeContentObject("st", $_POST["id"][0], "move");
1677
1678 ilUtil::sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
1679
1680 if ($a_parent_subobj_id == 0) {
1681 $this->ctrl->redirect($this, "chapters");
1682 }
1683 }
1684
1685
1689 public function copyChapter($a_parent_subobj_id = 0)
1690 {
1691 $this->copyItems();
1692 }
1693
1697 public function pasteChapter($a_parent_subobj_id = 0)
1698 {
1699 return $this->insertChapterClip(false);
1700 }
1701
1705 public function movePage()
1706 {
1708
1709 if (!isset($_POST["id"])) {
1710 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1711 }
1712
1713 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_cut"), true);
1714
1715 $items = ilUtil::stripSlashesArray($_POST["id"]);
1716 ilLMObject::clipboardCut($this->object->getId(), $items);
1718
1719 $this->ctrl->redirect($this, "pages");
1720 }
1721
1725 public function cancel()
1726 {
1727 if ($_GET["new_type"] == "pg") {
1728 $this->ctrl->redirect($this, "pages");
1729 } else {
1730 $this->ctrl->redirect($this, "chapters");
1731 }
1732 }
1733
1734
1738 public function export()
1739 {
1740 $ot = ilObjectTranslation::getInstance($this->object->getId());
1741 $opt = "";
1742 if ($ot->getContentActivated()) {
1743 $format = explode("_", $_POST["format"]);
1744 $opt = ilUtil::stripSlashes($format[1]);
1745 }
1746
1747
1748 $cont_exp = new ilContObjectExport($this->object);
1749 $cont_exp->buildExportFile($opt);
1750 }
1751
1755 public function getPublicAccessColValue($a_type, $a_file)
1756 {
1757 $lng = $this->lng;
1758 $ilCtrl = $this->ctrl;
1759
1760 $changelink = "<a href='" . $ilCtrl->getLinkTarget($this, "editMenuProperties") . "'>" . $lng->txt("change") . "</a>";
1761 if (!$this->object->isActiveLMMenu()) {
1762 $add = "<br />" . $lng->txt("cont_download_no_menu") . " " . $changelink;
1763 } elseif (!$this->object->isActiveDownloads()) {
1764 $add = "<br />" . $lng->txt("cont_download_no_download") . " " . $changelink;
1765 }
1766
1767 $basetype = explode("_", $a_type);
1768 $basetype = $basetype[0];
1769
1770 if ($this->object->getPublicExportFile($basetype) == $a_file) {
1771 return $lng->txt("yes") . $add;
1772 }
1773
1774 return " ";
1775 }
1776
1777
1778
1782 public function publishExportFile($a_files)
1783 {
1784 $ilCtrl = $this->ctrl;
1785
1786 if (!isset($a_files)) {
1787 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1788 } else {
1789 foreach ($a_files as $f) {
1790 $file = explode(":", $f);
1791 if (is_int(strpos($file[0], "_"))) {
1792 $file[0] = explode("_", $file[0])[0];
1793 }
1794 $export_dir = $this->object->getExportDirectory($file[0]);
1795
1796 if ($this->object->getPublicExportFile($file[0]) ==
1797 $file[1]) {
1798 $this->object->setPublicExportFile($file[0], "");
1799 } else {
1800 $this->object->setPublicExportFile($file[0], $file[1]);
1801 }
1802 }
1803 $this->object->update();
1804 }
1805 $ilCtrl->redirectByClass("ilexportgui");
1806 }
1807
1811 public function downloadPDFFile()
1812 {
1814
1815 if (!isset($_POST["file"])) {
1816 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1817 }
1818
1819 if (count($_POST["file"]) > 1) {
1820 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1821 }
1822
1823
1824 $export_dir = $this->object->getOfflineDirectory();
1825
1826 $file = basename($_POST["file"][0]);
1827
1828 ilUtil::deliverFile($export_dir . "/" . $file, $file);
1829 }
1830
1831
1836 public function fixTreeConfirm()
1837 {
1838 $this->setTabs();
1839 $this->setContentSubTabs("maintenance");
1840
1841 // display confirmation message
1842 $cgui = new ilConfirmationGUI();
1843 $cgui->setFormAction($this->ctrl->getFormAction($this));
1844 $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1845 $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1846 $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1847 $issues = $this->object->checkStructure();
1848 $mess = "";
1849 if (count($issues) > 0) {
1850 $mess = "Found Issues: <br>" . implode("<br>", $issues);
1851 }
1852 $this->tpl->setContent($cgui->getHTML() . $mess);
1853 }
1854
1858 public function fixTree()
1859 {
1860 $this->object->fixTree();
1861 ilUtil::sendSuccess($this->lng->txt("cont_tree_fixed"), true);
1862 $this->ctrl->redirect($this, "showMaintenance");
1863 }
1864
1868 public function setilLMMenu(
1869 $a_offline = false,
1870 $a_export_format = "",
1871 $a_active = "content",
1872 $a_use_global_tabs = false,
1873 $a_as_subtabs = false,
1874 $a_cur_page = 0,
1875 $a_lang = "",
1876 $a_export_all = false
1877 ) {
1878 $ilCtrl = $this->ctrl;
1880 $ilAccess = $this->access;
1881 $ilTabs = $this->tabs;
1883 $ilPluginAdmin = $this->plugin_admin;
1884 $ilHelp = $this->help;
1885
1886 $ilHelp->setScreenIdComponent("lm");
1887
1888 if ($a_as_subtabs) {
1889 $addcmd = "addSubTabTarget";
1890 $getcmd = "getSubTabHTML";
1891 } else {
1892 $addcmd = "addTarget";
1893 $getcmd = "getHTML";
1894 }
1895
1896 $active[$a_active] = true;
1897
1898 if (!$this->object->isActiveLMMenu()) {
1899 return "";
1900 }
1901
1902 if ($a_use_global_tabs) {
1903 $tabs_gui = $ilTabs;
1904 } else {
1905 $tabs_gui = new ilTabsGUI();
1906 }
1907
1908 // workaround for preventing tooltips in export
1909 if ($a_offline) {
1910 $tabs_gui->setSetupMode(true);
1911 }
1912
1913 // Determine whether the view of a learning resource should
1914 // be shown in the frameset of ilias, or in a separate window.
1915 $showViewInFrameset = true;
1916
1917 if ($showViewInFrameset && !$a_offline) {
1918 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
1919 } else {
1920 $buttonTarget = "_top";
1921 }
1922
1923 if ($a_export_format == "scorm") {
1924 $buttonTarget = "";
1925 }
1926
1927 // content
1928 if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1929 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1930 $tabs_gui->$addcmd(
1931 "content",
1932 $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"),
1933 "",
1934 "",
1935 $buttonTarget,
1936 $active["content"]
1937 );
1938 if ($active["content"]) {
1939 $ilHelp->setScreenId("content");
1940 $ilHelp->setSubScreenId("content");
1941 }
1942 } elseif ($a_offline) {
1943 $tabs_gui->setForcePresentationOfSingleTab(true);
1944 }
1945 // table of contents
1946 if ($this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1947 if (!$a_offline) {
1948 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1949 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
1950 } else {
1951 if ($a_export_all) {
1952 $link = "./table_of_contents_" . $a_lang . ".html";
1953 } else {
1954 $link = "./table_of_contents.html";
1955 }
1956 }
1957 $tabs_gui->$addcmd(
1958 "cont_toc",
1959 $link,
1960 "",
1961 "",
1962 $buttonTarget,
1963 $active["toc"]
1964 );
1965 }
1966
1967 // print view
1968 if ($this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1969 if (!$a_offline) { // has to be implemented for offline mode
1970 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1971 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
1972 $tabs_gui->$addcmd(
1973 "cont_print_view",
1974 $link,
1975 "",
1976 "",
1977 $buttonTarget,
1978 $active["print"]
1979 );
1980 }
1981 }
1982
1983 // download
1984 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
1985 $is_public = $this->object->isActiveDownloadsPublic();
1986 } else {
1987 $is_public = true;
1988 }
1989
1990 if ($this->object->isActiveDownloads() && !$a_offline && $is_public &&
1991 $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1992 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1993 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
1994 $tabs_gui->$addcmd(
1995 "download",
1996 $link,
1997 "",
1998 "",
1999 $buttonTarget,
2000 $active["download"]
2001 );
2002 }
2003
2004 // info button
2005 if ($a_export_format != "scorm" && !$a_offline) {
2006 if (!$a_offline) {
2007 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2008 $link = $this->ctrl->getLinkTargetByClass(
2009 array("illmpresentationgui", "ilinfoscreengui"),
2010 "showSummary"
2011 );
2012 } else {
2013 $link = "./info.html";
2014 }
2015
2016 $tabs_gui->$addcmd(
2017 'info_short',
2018 $link,
2019 "",
2020 "",
2021 $buttonTarget,
2022 $active["info"]
2023 );
2024 }
2025
2026 if (!$a_offline &&
2027 $ilAccess->checkAccess("read", "", $_GET["ref_id"]) && // #14075
2029 $olp = ilObjectLP::getInstance($this->object->getId());
2030 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
2031 $tabs_gui->$addcmd(
2032 "learning_progress",
2033 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editManual"),
2034 "",
2035 "",
2036 $buttonTarget,
2037 $active["learning_progress"]
2038 );
2039 } elseif ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
2040 $tabs_gui->$addcmd(
2041 "learning_progress",
2042 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"),
2043 "",
2044 "",
2045 $buttonTarget,
2046 $active["learning_progress"]
2047 );
2048 }
2049 }
2050
2051 // get user defined menu entries
2052 $this->__initLMMenuEditor();
2053 $entries = $this->lmme_obj->getMenuEntries(true);
2054 if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2055 foreach ($entries as $entry) {
2056 // build goto-link for internal resources
2057 if ($entry["type"] == "intern") {
2058 $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
2059 }
2060
2061 // add http:// prefix if not exist
2062 if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
2063 $entry["link"] = "http://" . $entry["link"];
2064 }
2065
2066 if (!strstr($entry["link"], 'mailto:')) {
2067 $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->ref_id . "&structure_id=" . $this->obj_id);
2068 }
2069 $tabs_gui->$addcmd(
2070 $entry["title"],
2071 $entry["link"],
2072 "",
2073 "",
2074 "_blank",
2075 "",
2076 true
2077 );
2078 }
2079 }
2080
2081 // edit learning module
2082 if (!$a_offline && $a_cur_page > 0) {
2083 if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
2084 //$page_id = $this->getCurrentPageId();
2085 $page_id = $a_cur_page;
2086 $tabs_gui->$addcmd(
2087 "edit_page",
2088 ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] .
2089 "&obj_id=" . $page_id . "&to_page=1",
2090 "",
2091 "",
2092 $buttonTarget,
2093 $active["edit_page"]
2094 );
2095 }
2096 }
2097
2098 // user interface hook [uihk]
2099 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
2100 $plugin_html = false;
2101 foreach ($pl_names as $pl) {
2102 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
2103 $gui_class = $ui_plugin->getUIClassInstance();
2104 $resp = $gui_class->modifyGUI(
2105 "Modules/LearningModule",
2106 "lm_menu_tabs",
2107 array("lm_menu_tabs" => $tabs_gui)
2108 );
2109 }
2110
2111 return $tabs_gui->$getcmd();
2112 }
2113
2117 public function createPDF()
2118 {
2119 $cont_exp = new ilContObjectExport($this->object, "pdf");
2120 $cont_exp->buildExportFile();
2121 $this->offlineList();
2122 }
2123
2127 public function exportHTML()
2128 {
2129 $ot = ilObjectTranslation::getInstance($this->object->getId());
2130 $lang = "";
2131 if ($ot->getContentActivated()) {
2132 $format = explode("_", $_POST["format"]);
2134 }
2135 $cont_exp = new ilContObjectExport($this->object, "html", $lang);
2136 $cont_exp->buildExportFile();
2137 }
2138
2142 public function exportSCORM()
2143 {
2144 $cont_exp = new ilContObjectExport($this->object, "scorm");
2145 $cont_exp->buildExportFile();
2146 }
2147
2153 public function addLocations($a_omit_obj_id = false)
2154 {
2156
2157 if (!$a_omit_obj_id) {
2158 $obj_id = $_GET["obj_id"];
2159 }
2160 $lmtree = $this->object->getTree();
2161
2162 if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
2163 $path = $lmtree->getPathFull($obj_id);
2164 } else {
2165 $path = $lmtree->getPathFull($lmtree->getRootId());
2166 if ($obj_id != 0) {
2167 $path[] = array("type" => "pg", "child" => $this->obj_id,
2168 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
2169 }
2170 }
2171
2172 foreach ($path as $key => $row) {
2173 if ($row["child"] == 1) {
2174 $this->ctrl->setParameter($this, "obj_id", "");
2175 $locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "chapters"));
2176 } else {
2177 $title = $row["title"];
2178 switch ($row["type"]) {
2179 case "st":
2180 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
2181 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
2182 break;
2183
2184 case "pg":
2185 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
2186 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
2187 break;
2188 }
2189 }
2190 }
2191 if (!$a_omit_obj_id) {
2192 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
2193 }
2194 }
2195
2199
2200
2204 public function listQuestions()
2205 {
2206 $tpl = $this->tpl;
2207
2208 $this->setTabs("questions");
2209 $this->setQuestionsSubTabs("question_stats");
2210
2211 $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->object);
2212 $tpl->setContent($table->getHTML());
2213 }
2214
2218 public function listBlockedUsers()
2219 {
2220 $tpl = $this->tpl;
2221
2222 $this->setTabs("questions");
2223 $this->setQuestionsSubTabs("blocked_users");
2224
2225 $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->object);
2226 $tpl->setContent($table->getHTML());
2227 }
2228
2232 public function resetNumberOfTries()
2233 {
2234 $lng = $this->lng;
2235 $ilCtrl = $this->ctrl;
2236
2237 if (is_array($_POST["userquest_id"])) {
2238 foreach ($_POST["userquest_id"] as $uqid) {
2239 $uqid = explode(":", $uqid);
2240 ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
2241 }
2242 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2243 }
2244 $ilCtrl->redirect($this, "listBlockedUsers");
2245 }
2246
2250 public function unlockQuestion()
2251 {
2252 $lng = $this->lng;
2253 $ilCtrl = $this->ctrl;
2254
2255 if (is_array($_POST["userquest_id"])) {
2256 foreach ($_POST["userquest_id"] as $uqid) {
2257 $uqid = explode(":", $uqid);
2258 ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
2259 }
2260 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2261 }
2262 $ilCtrl->redirect($this, "listBlockedUsers");
2263 }
2264
2268 public function sendMailToBlockedUsers()
2269 {
2270 $ilCtrl = $this->ctrl;
2271
2272 if (!is_array($_POST["userquest_id"])) {
2273 ilUtil::sendFailure($this->lng->txt("no_checkbox"), 1);
2274 $ilCtrl->redirect($this, "listBlockedUsers");
2275 }
2276
2277 $rcps = array();
2278 foreach ($_POST["userquest_id"] as $uqid) {
2279 $uqid = explode(":", $uqid);
2280 $login = ilObjUser::_lookupLogin($uqid[1]);
2281 if (!in_array($login, $rcps)) {
2282 $rcps[] = $login;
2283 }
2284 }
2286 $this,
2287 'listBlockedUsers',
2288 array(),
2289 array(
2290 'type' => 'new',
2291 'rcp_to' => implode(',', $rcps),
2292 'sig' => $this->getBlockedUsersMailSignature()
2293 )
2294 ));
2295 }
2296
2300 protected function getBlockedUsersMailSignature()
2301 {
2302 $link = chr(13) . chr(10) . chr(13) . chr(10);
2303 $link .= $this->lng->txt('cont_blocked_users_mail_link');
2304 $link .= chr(13) . chr(10) . chr(13) . chr(10);
2305 $link .= ilLink::_getLink($this->object->getRefId());
2306 return rawurlencode(base64_encode($link));
2307 }
2308
2309
2313
2314
2318 public function setTabs($a_act = "")
2319 {
2320 parent::setTitleAndDescription();
2321 $ilHelp = $this->help;
2322 $ilHelp->setScreenIdComponent("lm");
2323 $this->addTabs($a_act);
2324 }
2325
2331 public function setContentSubTabs($a_active)
2332 {
2333 $ilTabs = $this->tabs;
2334 $lng = $this->lng;
2335 $ilCtrl = $this->ctrl;
2336
2337 $lm_set = new ilSetting("lm");
2338
2339 // chapters
2340 $ilTabs->addSubtab(
2341 "chapters",
2342 $lng->txt("cont_chapters"),
2343 $ilCtrl->getLinkTarget($this, "chapters")
2344 );
2345
2346 // all pages
2347 $ilTabs->addSubtab(
2348 "pages",
2349 $lng->txt("cont_all_pages"),
2350 $ilCtrl->getLinkTarget($this, "pages")
2351 );
2352
2353 // all pages
2354 $ilTabs->addSubtab(
2355 "short_titles",
2356 $lng->txt("cont_short_titles"),
2357 $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
2358 );
2359
2360 // export ids
2361 if ($lm_set->get("html_export_ids")) {
2362 if (!ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2363 $ilTabs->addSubtab(
2364 "export_ids",
2365 $lng->txt("cont_html_export_ids"),
2366 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2367 );
2368 }
2369 }
2370 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2371 $lng->loadLanguageModule("help");
2372 $ilTabs->addSubtab(
2373 "export_ids",
2374 $lng->txt("cont_online_help_ids"),
2375 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2376 );
2377
2378 $ilTabs->addSubtab(
2379 "help_tooltips",
2380 $lng->txt("help_tooltips"),
2381 $ilCtrl->getLinkTarget($this, "showTooltipList")
2382 );
2383 }
2384
2385 // list links
2386 $ilTabs->addSubtab(
2387 "internal_links",
2388 $lng->txt("cont_internal_links"),
2389 $ilCtrl->getLinkTarget($this, "listLinks")
2390 );
2391
2392 // web link checker
2393 $ilTabs->addSubtab(
2394 "link_check",
2395 $lng->txt("link_check"),
2396 $ilCtrl->getLinkTarget($this, "linkChecker")
2397 );
2398
2399 $ilTabs->addSubtab(
2400 "history",
2401 $lng->txt("history"),
2402 $this->ctrl->getLinkTarget($this, "history")
2403 );
2404
2405 // maintenance
2406 $ilTabs->addSubtab(
2407 "maintenance",
2408 $lng->txt("cont_maintenance"),
2409 $ilCtrl->getLinkTarget($this, "showMaintenance")
2410 );
2411
2412 // srt files
2413 $ilTabs->addSubtab(
2414 "srt_files",
2415 $lng->txt("cont_subtitle_files"),
2416 $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
2417 );
2418
2419 // srt files
2420 $ilTabs->addSubtab(
2421 "import",
2422 $lng->txt("cont_import"),
2423 $ilCtrl->getLinkTargetByClass("illmimportgui", "")
2424 );
2425
2426 $ilTabs->activateSubTab($a_active);
2427 $ilTabs->activateTab("content");
2428 }
2429
2435 public function setQuestionsSubTabs($a_active)
2436 {
2437 $ilTabs = $this->tabs;
2438 $lng = $this->lng;
2439 $ilCtrl = $this->ctrl;
2440
2441 // chapters
2442 $ilTabs->addSubtab(
2443 "question_stats",
2444 $lng->txt("cont_question_stats"),
2445 $ilCtrl->getLinkTarget($this, "listQuestions")
2446 );
2447
2448 // blocked users
2449 $ilTabs->addSubtab(
2450 "blocked_users",
2451 $lng->txt("cont_blocked_users"),
2452 $ilCtrl->getLinkTarget($this, "listBlockedUsers")
2453 );
2454
2455 $ilTabs->activateSubTab($a_active);
2456 }
2457
2461 public function addTabs($a_act = "")
2462 {
2464 $ilTabs = $this->tabs;
2465 $lng = $this->lng;
2466
2467 // content
2468 $ilTabs->addTab(
2469 "content",
2470 $lng->txt("content"),
2471 $this->ctrl->getLinkTarget($this, "chapters")
2472 );
2473
2474 // info
2475 $ilTabs->addTab(
2476 "info",
2477 $lng->txt("info_short"),
2478 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
2479 );
2480
2481 // settings
2482 $ilTabs->addTab(
2483 "settings",
2484 $lng->txt("settings"),
2485 $this->ctrl->getLinkTarget($this, 'properties')
2486 );
2487
2488 // questions
2489 $ilTabs->addTab(
2490 "questions",
2491 $lng->txt("objs_qst"),
2492 $this->ctrl->getLinkTarget($this, "listQuestions")
2493 );
2494
2495 // learning progress
2496 if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) and ($this->object->getType() == 'lm')) {
2497 $ilTabs->addTab(
2498 'learning_progress',
2499 $lng->txt("learning_progress"),
2500 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
2501 );
2502 }
2503
2504 if ($this->object->getType() != "lm") {
2505 // bibliographical data
2506 $ilTabs->addTab(
2507 "bib_data",
2508 $lng->txt("bib_data"),
2509 $this->ctrl->getLinkTarget($this, "editBibItem")
2510 );
2511 }
2512
2513 // meta data
2514 $mdgui = new ilObjectMetaDataGUI($this->object);
2515 $mdtab = $mdgui->getTab();
2516 if ($mdtab) {
2517 $ilTabs->addTab(
2518 "meta",
2519 $lng->txt("meta_data"),
2520 $mdtab
2521 );
2522 }
2523
2524 if ($this->object->getType() == "lm") {
2525 // export
2526 $ilTabs->addTab(
2527 "export",
2528 $lng->txt("export"),
2529 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
2530 );
2531 }
2532
2533 // permissions
2534 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
2535 $ilTabs->addTab(
2536 "perm",
2537 $lng->txt("perm_settings"),
2538 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
2539 );
2540 }
2541
2542 if ($a_act != "") {
2543 $ilTabs->activateTab($a_act);
2544 }
2545
2546 // presentation view
2547 $ilTabs->addNonTabbedLink(
2548 "pres_mode",
2549 $lng->txt("cont_presentation_view"),
2550 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->object->getRefID(),
2551 "_top"
2552 );
2553 }
2554
2558 public function setSubTabs($a_active)
2559 {
2560 $ilTabs = $this->tabs;
2562
2563 if (in_array(
2564 $a_active,
2565 array("settings", "cont_style", "cont_lm_menu", "public_section",
2566 "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
2567 "lti_provider")
2568 )) {
2569 // general properties
2570 $ilTabs->addSubTabTarget(
2571 "settings",
2572 $this->ctrl->getLinkTarget($this, 'properties'),
2573 "",
2574 ""
2575 );
2576
2577 // style properties
2578 $ilTabs->addSubTabTarget(
2579 "cont_style",
2580 $this->ctrl->getLinkTarget($this, 'editStyleProperties'),
2581 "",
2582 ""
2583 );
2584
2585 // menu properties
2586 $ilTabs->addSubTabTarget(
2587 "cont_lm_menu",
2588 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
2589 "",
2590 ""
2591 );
2592
2593 // glossaries
2594 $ilTabs->addSubTabTarget(
2595 "cont_glossaries",
2596 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
2597 "",
2598 ""
2599 );
2600
2601 if ($ilSetting->get("pub_section")) {
2602 // public section
2603 $ilTabs->addSubTabTarget(
2604 "public_section",
2605 $this->ctrl->getLinkTarget($this, 'editPublicSection'),
2606 "",
2607 ""
2608 );
2609 }
2610
2611 $ilTabs->addSubTabTarget(
2612 "obj_multilinguality",
2613 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
2614 );
2615
2616 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2617 if ($lti_settings->hasSettingsAccess()) {
2618 $ilTabs->addSubTabTarget(
2619 'lti_provider',
2620 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
2621 );
2622 }
2623
2624 $ilTabs->setSubTabActive($a_active);
2625 }
2626 }
2627
2628 public function editPublicSection()
2629 {
2630 $ilTabs = $this->tabs;
2631 $ilToolbar = $this->toolbar;
2632 $ilAccess = $this->access;
2633
2634
2635 if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->object->getRefId())) {
2636 ilUtil::sendInfo($this->lng->txt("cont_anonymous_user_missing_perm"));
2637 }
2638
2639 $this->setTabs();
2640 $this->setSubTabs("public_section");
2641 $ilTabs->setTabActive("settings");
2642
2643 $this->tpl->addBlockFile(
2644 "ADM_CONTENT",
2645 "adm_content",
2646 "tpl.lm_public_selector.html",
2647 "Modules/LearningModule"
2648 );
2649
2650 // get learning module object
2651 $this->lm_obj = new ilObjLearningModule($this->ref_id, true);
2652
2653
2654 // public mode
2655 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
2656 $si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
2657 $si->setOptions($modes);
2658 $si->setValue($this->object->getPublicAccessMode());
2659 $ilToolbar->addInputItem($si, true);
2660 $ilToolbar->addFormButton($this->lng->txt("save"), "savePublicSectionAccess");
2661 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "savePublicSectionAccess"));
2662
2663 if ($this->object->getPublicAccessMode() == "selected") {
2664 $this->tpl->setCurrentBlock("select_pages");
2665 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSectionPages"));
2666
2667 $tree = new ilPublicSectionExplorerGUI($this, "editPublicSection", $this->lm_obj);
2668 $tree->setSelectMode("pages", true);
2669 $tree->setSkipRootNode(true);
2670
2671 $this->tpl->setVariable("EXPLORER", $tree->getHTML());
2672 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2673
2674 $this->tpl->parseCurrentBlock();
2675 }
2676 }
2677
2678 public function savePublicSection()
2679 {
2680 //var_dump($_POST["lm_public_mode"]);exit;
2681 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2682 $this->object->updateProperties();
2683 ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2684 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2685 $this->ctrl->redirect($this, "editPublicSection");
2686 }
2687
2691 public function savePublicSectionAccess()
2692 {
2693 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2694 $this->object->updateProperties();
2695 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2696 $this->ctrl->redirect($this, "editPublicSection");
2697 }
2698
2702 public function savePublicSectionPages()
2703 {
2704 ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2705 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2706 $this->ctrl->redirect($this, "editPublicSection");
2707 }
2708
2714 public function history()
2715 {
2716 $this->setTabs("content");
2717 $this->setContentSubTabs("history");
2718
2719 $hist_gui = new ilHistoryTableGUI(
2720 $this,
2721 "history",
2722 $this->object->getId(),
2723 $this->object->getType()
2724 );
2725 $hist_gui->initTable();
2726 $hist_gui->setCommentVisibility($this->object->isActiveHistoryUserComments());
2727
2728 $this->tpl->setContent($hist_gui->getHTML());
2729 }
2730
2739 public function formatInvalidLinkArray(array $row)
2740 {
2741 $row['title'] = ilLMPageObject::_getPresentationTitle($row['page_id'], $this->object->getPageHeader());
2742
2744 $actions->setSelectionHeaderClass('small');
2745 $actions->setItemLinkClass('xsmall');
2746 $actions->setListTitle($this->lng->txt('actions'));
2747 $actions->setId($row['page_id']);
2748 $this->ctrl->setParameterByClass('ilLMPageObjectGUI', 'obj_id', $row['page_id']);
2749 $actions->addItem(
2750 $this->lng->txt('edit'),
2751 '',
2752 $this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI', 'edit')
2753 );
2754 $this->ctrl->clearParametersByClass('ilLMPageObjectGUI');
2755 $row['action_html'] = $actions->getHTML();
2756
2757 return $row;
2758 }
2759
2760 public function linkChecker()
2761 {
2763 $tpl = $this->tpl;
2764
2765 $this->__initLinkChecker();
2766
2767 $this->setTabs();
2768 $this->setContentSubTabs("link_check");
2769
2770 $toolbar = new ilToolbarGUI();
2771
2772 // #13684
2773 if (ilCronManager::isJobActive("lm_link_check")) {
2774 $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
2775 $chb->setValue(1);
2776 $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
2777 $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
2778
2779 $toolbar->addInputItem($chb);
2780 $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
2781 $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
2782 }
2783
2784 $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
2785 $tgui->setLinkChecker($this->link_checker_obj)
2786 ->setRowHandler($this)
2787 ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
2788
2789 return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
2790 }
2791
2792 public function saveLinkCheck()
2793 {
2794 $ilDB = $this->db;
2796
2797 $link_check_notify = new ilLinkCheckNotify($ilDB);
2798 $link_check_notify->setUserId($ilUser->getId());
2799 $link_check_notify->setObjId($this->object->getId());
2800
2801 if ($_POST['link_check_message']) {
2802 ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
2803 $link_check_notify->addNotifier();
2804 } else {
2805 ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
2806 $link_check_notify->deleteNotifier();
2807 }
2808 $this->linkChecker();
2809
2810 return true;
2811 }
2812
2813
2814
2815 public function refreshLinkCheck()
2816 {
2817 $this->__initLinkChecker();
2818 $this->link_checker_obj->checkLinks();
2819 ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
2820
2821 $this->linkChecker();
2822
2823 return true;
2824 }
2825
2826 public function __initLinkChecker()
2827 {
2828 $ilDB = $this->db;
2829
2830 $this->link_checker_obj = new ilLinkChecker($ilDB, false);
2831 $this->link_checker_obj->setObjId($this->object->getId());
2832
2833 return true;
2834 }
2835
2836 public function __initLMMenuEditor()
2837 {
2838 $this->lmme_obj = new ilLMMenuEditor();
2839 $this->lmme_obj->setObjId($this->object->getId());
2840
2841 return true;
2842 }
2843
2847 public function addMenuEntry()
2848 {
2849 $ilTabs = $this->tabs;
2850 $ilToolbar = $this->toolbar;
2851 $tpl = $this->tpl;
2852 $ilCtrl = $this->ctrl;
2853
2854 $this->setTabs();
2855
2856 $ilTabs->setTabActive("settings");
2857 $this->setSubTabs("cont_lm_menu");
2858
2859 $ilToolbar->addButton(
2860 $this->lng->txt("lm_menu_select_internal_object"),
2861 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2862 );
2863
2864 $form = $this->initMenuEntryForm("create");
2865 $this->tpl->setContent($form->getHTML());
2866 }
2867
2873 public function initMenuEntryForm($a_mode = "edit")
2874 {
2875 $lng = $this->lng;
2876 $ilCtrl = $this->ctrl;
2877
2878 $form = new ilPropertyFormGUI();
2879
2880 // title
2881 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2882 $ti->setMaxLength(255);
2883 $ti->setSize(40);
2884 $form->addItem($ti);
2885
2886 // target
2887 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2888 $ta->setMaxLength(255);
2889 $ta->setSize(40);
2890 $form->addItem($ta);
2891
2892 if ($a_mode == "edit") {
2893 $this->__initLMMenuEditor();
2894 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
2895 $ti->setValue($this->lmme_obj->getTitle());
2896 $ta->setValue($this->lmme_obj->getTarget());
2897 }
2898
2899 if (isset($_GET["link_ref_id"])) {
2900 $link_ref_id = (int) $_GET["link_ref_id"];
2901 $obj_type = ilObject::_lookupType($link_ref_id, true);
2902 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2904
2905 $target_link = $obj_type . "_" . $link_ref_id;
2906 $ti->setValue($title);
2907 $ta->setValue($target_link);
2908
2909 // link ref id
2910 $hi = new ilHiddenInputGUI("link_ref_id");
2911 $hi->setValue($link_ref_id);
2912 $form->addItem($hi);
2913 }
2914
2915
2916 // save and cancel commands
2917 if ($a_mode == "create") {
2918 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2919 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2920 $form->setTitle($lng->txt("lm_menu_new_entry"));
2921 } else {
2922 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
2923 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2924 $form->setTitle($lng->txt("lm_menu_edit_entry"));
2925 }
2926
2927 $form->setFormAction($ilCtrl->getFormAction($this));
2928
2929 return $form;
2930 }
2931
2935 public function saveMenuEntry()
2936 {
2937 $ilCtrl = $this->ctrl;
2938
2939 // check title and target
2940 if (empty($_POST["title"])) {
2941 ilUtil::sendFailure($this->lng->txt("please_enter_title"), true);
2942 $ilCtrl->redirect($this, "addMenuEntry");
2943 }
2944 if (empty($_POST["target"])) {
2945 ilUtil::sendFailure($this->lng->txt("please_enter_target"), true);
2946 $ilCtrl->redirect($this, "addMenuEntry");
2947 }
2948
2949 $this->__initLMMenuEditor();
2950 $this->lmme_obj->setTitle($_POST["title"]);
2951 $this->lmme_obj->setTarget($_POST["target"]);
2952 $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
2953
2954 if ($_POST["link_ref_id"]) {
2955 $this->lmme_obj->setLinkType("intern");
2956 }
2957
2958 $this->lmme_obj->create();
2959
2960 ilUtil::sendSuccess($this->lng->txt("msg_entry_added"), true);
2961 $this->ctrl->redirect($this, "editMenuProperties");
2962 }
2963
2967 public function deleteMenuEntry()
2968 {
2970
2971 if (empty($_GET["menu_entry"])) {
2972 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
2973 }
2974
2975 $this->__initLMMenuEditor();
2976 $this->lmme_obj->delete($_GET["menu_entry"]);
2977
2978 ilUtil::sendSuccess($this->lng->txt("msg_entry_removed"), true);
2979 $this->ctrl->redirect($this, "editMenuProperties");
2980 }
2981
2985 public function editMenuEntry()
2986 {
2987 $ilToolbar = $this->toolbar;
2988 $ilCtrl = $this->ctrl;
2989 $ilTabs = $this->tabs;
2991
2992 $this->setTabs();
2993
2994 $ilTabs->setTabActive("settings");
2995 $this->setSubTabs("cont_lm_menu");
2996
2997
2998 if (empty($_GET["menu_entry"])) {
2999 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3000 }
3001
3002 $ilCtrl->saveParameter($this, array("menu_entry"));
3003 $ilToolbar->addButton(
3004 $this->lng->txt("lm_menu_select_internal_object"),
3005 $ilCtrl->getLinkTarget($this, "showEntrySelector")
3006 );
3007
3008 $form = $this->initMenuEntryForm("edit");
3009 $this->tpl->setContent($form->getHTML());
3010 }
3011
3015 public function updateMenuEntry()
3016 {
3018
3019 if (empty($_REQUEST["menu_entry"])) {
3020 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3021 }
3022
3023 // check title and target
3024 if (empty($_POST["title"])) {
3025 $ilErr->raiseError($this->lng->txt("please_enter_title"), $ilErr->MESSAGE);
3026 }
3027 if (empty($_POST["target"])) {
3028 $ilErr->raiseError($this->lng->txt("please_enter_target"), $ilErr->MESSAGE);
3029 }
3030
3031 $this->__initLMMenuEditor();
3032 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
3033 $this->lmme_obj->setTitle($_POST["title"]);
3034 $this->lmme_obj->setTarget($_POST["target"]);
3035 if ($_POST["link_ref_id"]) {
3036 $this->lmme_obj->setLinkType("intern");
3037 }
3038 if (is_int(strpos($_POST["target"], "."))) {
3039 $this->lmme_obj->setLinkType("extern");
3040 }
3041 $this->lmme_obj->update();
3042
3043 ilUtil::sendSuccess($this->lng->txt("msg_entry_updated"), true);
3044 $this->ctrl->redirect($this, "editMenuProperties");
3045 }
3046
3047 public function showEntrySelector()
3048 {
3049 $ilTabs = $this->tabs;
3050 $ilCtrl = $this->ctrl;
3051
3052 $this->setTabs();
3053
3054 $ilTabs->setTabActive("settings");
3055 $this->setSubTabs("cont_lm_menu");
3056
3057 $ilCtrl->saveParameter($this, array("menu_entry"));
3058
3059 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html", "Modules/LearningModule");
3060
3061 ilUtil::sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
3062
3063 $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this, 'test'), $this);
3064
3065 $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
3066 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showEntrySelector'));
3067 $exp->setTargetGet("ref_id");
3068 $exp->setRefId($this->cur_ref_id);
3069
3070 $sel_types = array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs',
3071 "crs", "grp", "book", "tst", "file");
3072 $exp->setSelectableTypes($sel_types);
3073
3074 // build html-output
3075 $exp->setOutput(0);
3076 $output = $exp->getOutput();
3077
3078 // get page ids
3079 foreach ($exp->format_options as $node) {
3080 if (!$node["container"]) {
3081 $pages[] = $node["child"];
3082 }
3083 }
3084
3085 // access mode selector
3086 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
3087 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
3088 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
3089 $select_public_mode = ilUtil::formSelect($this->object->getPublicAccessMode(), "lm_public_mode", $modes, false, true);
3090 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
3091
3092 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
3093 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
3094 $this->tpl->setVariable("EXPLORER", $output);
3095 $this->tpl->setVariable("ONCLICK", $js_pages);
3096 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
3097 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
3098 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3099 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
3100 }
3101
3105 public function selectHeader()
3106 {
3108
3109 if (!isset($_POST["id"])) {
3110 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3111 }
3112 if (count($_POST["id"]) > 1) {
3113 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3114 }
3115 if ($_POST["id"][0] != $this->object->getHeaderPage()) {
3116 $this->object->setHeaderPage($_POST["id"][0]);
3117 } else {
3118 $this->object->setHeaderPage(0);
3119 }
3120 $this->object->updateProperties();
3121 $this->ctrl->redirect($this, "pages");
3122 }
3123
3127 public function selectFooter()
3128 {
3130
3131 if (!isset($_POST["id"])) {
3132 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3133 }
3134 if (count($_POST["id"]) > 1) {
3135 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3136 }
3137 if ($_POST["id"][0] != $this->object->getFooterPage()) {
3138 $this->object->setFooterPage($_POST["id"][0]);
3139 } else {
3140 $this->object->setFooterPage(0);
3141 }
3142 $this->object->updateProperties();
3143 $this->ctrl->redirect($this, "pages");
3144 }
3145
3149 public function saveAllTitles()
3150 {
3151 $ilCtrl = $this->ctrl;
3152
3153 ilLMObject::saveTitles($this->object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
3154
3155 ilUtil::sendSuccess($this->lng->txt("lm_save_titles"), true);
3156 $ilCtrl->redirect($this, "chapters");
3157 }
3158
3162 public function insertChapter()
3163 {
3164 $ilCtrl = $this->ctrl;
3165 $lng = $this->lng;
3166
3169
3170 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
3171 $parent_id = $this->lm_tree->getParentId($node_id);
3172 $target = $node_id;
3173 } else { // insert as first child
3174 $parent_id = $node_id;
3175 $target = IL_FIRST_NODE;
3176 }
3177
3178 for ($i = 1; $i <= $num; $i++) {
3179 $chap = new ilStructureObject($this->object);
3180 $chap->setType("st");
3181 $chap->setTitle($lng->txt("cont_new_chap"));
3182 $chap->setLMId($this->object->getId());
3183 $chap->create();
3184 ilLMObject::putInTree($chap, $parent_id, $target);
3185 }
3186
3187 $ilCtrl->redirect($this, "chapters");
3188 }
3189
3193 public function insertChapterClip()
3194 {
3196 $ilCtrl = $this->ctrl;
3197 $ilLog = $this->log;
3198
3201
3202 $ilLog->write("InsertChapterClip, num: $num, node_id: $node_id, " .
3203 " getPostFirstChild " . ilChapterHierarchyFormGUI::getPostFirstChild());
3204
3205 if (!$first_child) { // insert after node id
3206 $parent_id = $this->lm_tree->getParentId($node_id);
3207 $target = $node_id;
3208 } else { // insert as first child
3209 $parent_id = $node_id;
3210 $target = IL_FIRST_NODE;
3211 }
3212
3213 // copy and paste
3214 $chapters = $ilUser->getClipboardObjects("st", true);
3215 $copied_nodes = array();
3216 foreach ($chapters as $chap) {
3217 $ilLog->write("Call pasteTree, Target LM: " . $this->object->getId() . ", Chapter ID: " . $chap["id"]
3218 . ", Parent ID: " . $parent_id . ", Target: " . $target);
3219 $cid = ilLMObject::pasteTree(
3220 $this->object,
3221 $chap["id"],
3222 $parent_id,
3223 $target,
3224 $chap["insert_time"],
3225 $copied_nodes,
3226 (ilEditClipboard::getAction() == "copy")
3227 );
3228 $target = $cid;
3229 }
3230 ilLMObject::updateInternalLinks($copied_nodes);
3231
3232 if (ilEditClipboard::getAction() == "cut") {
3233 $ilUser->clipboardDeleteObjectsOfType("pg");
3234 $ilUser->clipboardDeleteObjectsOfType("st");
3236 }
3237
3238 $this->object->checkTree();
3239 $ilCtrl->redirect($this, "chapters");
3240 }
3241
3247 public static function _goto($a_target)
3248 {
3249 global $DIC;
3250
3251 $ilAccess = $DIC->access();
3252 $ilErr = $DIC["ilErr"];
3253 $lng = $DIC->language();
3254
3255 if ($ilAccess->checkAccess("read", "", $a_target)) {
3256 $_GET["baseClass"] = "ilLMPresentationGUI";
3257 $_GET["ref_id"] = $a_target;
3258 $_GET["cmd"] = "resume";
3259 include("ilias.php");
3260 exit;
3261 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
3262 $_GET["baseClass"] = "ilLMPresentationGUI";
3263 $_GET["ref_id"] = $a_target;
3264 $_GET["cmd"] = "infoScreen";
3265 include("ilias.php");
3266 exit;
3267 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
3268 ilUtil::sendFailure(sprintf(
3269 $lng->txt("msg_no_perm_read_item"),
3271 ), true);
3273 }
3274
3275
3276 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3277 }
3278
3282 public function cutItems($a_return = "chapters")
3283 {
3284 $ilCtrl = $this->ctrl;
3285 $lng = $this->lng;
3286
3287 $items = ilUtil::stripSlashesArray($_POST["id"]);
3288 if (!is_array($items)) {
3289 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3290 $ilCtrl->redirect($this, $a_return);
3291 }
3292
3293 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3294 foreach ($items as $k => $item) {
3295 if ($item < 0) {
3296 $todel[] = $k;
3297 }
3298 }
3299 foreach ($todel as $k) {
3300 unset($items[$k]);
3301 }
3302 ilLMObject::clipboardCut($this->object->getId(), $items);
3304 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
3305
3306 $ilCtrl->redirect($this, $a_return);
3307 }
3308
3312 public function copyItems()
3313 {
3314 $ilCtrl = $this->ctrl;
3315 $lng = $this->lng;
3316
3317 $items = ilUtil::stripSlashesArray($_POST["id"]);
3318 if (!is_array($items)) {
3319 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3320 $ilCtrl->redirect($this, "chapters");
3321 }
3322
3323 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3324 foreach ($items as $k => $item) {
3325 if ($item < 0) {
3326 $todel[] = $k;
3327 }
3328 }
3329 foreach ($todel as $k) {
3330 unset($items[$k]);
3331 }
3332 ilLMObject::clipboardCopy($this->object->getId(), $items);
3334 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
3335 $ilCtrl->redirect($this, "chapters");
3336 }
3337
3341 public function cutChapter()
3342 {
3343 $this->cutItems("chapters");
3344 }
3345
3349
3356 public function showExportIDsOverview($a_validation = false)
3357 {
3358 $tpl = $this->tpl;
3359 $ilToolbar = $this->toolbar;
3360 $lng = $this->lng;
3361 $ilCtrl = $this->ctrl;
3362
3363 $this->setTabs();
3364 $this->setContentSubTabs("export_ids");
3365
3366 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
3367 // toolbar
3368 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3369 $lm_tree = $this->object->getTree();
3370 $childs = $lm_tree->getChilds($lm_tree->readRootId());
3371 $options = array("" => $lng->txt("all"));
3372 foreach ($childs as $c) {
3373 $options[$c["child"]] = $c["title"];
3374 }
3375 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
3376 $si->setOptions($options);
3377 $si->setValue(ilSession::get("help_chap"));
3378 $ilToolbar->addInputItem($si, true);
3379 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
3380
3381 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation, false);
3382 } else {
3383 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
3384 }
3385
3386 $tpl->setContent($tbl->getHTML());
3387 }
3388
3395 public function filterHelpChapters()
3396 {
3397 $ilCtrl = $this->ctrl;
3398
3399 ilSession::set("help_chap", ilUtil::stripSlashes($_POST["help_chap"]));
3400 $ilCtrl->redirect($this, "showExportIDsOverview");
3401 }
3402
3403
3407 public function saveExportIds()
3408 {
3409 $ilCtrl = $this->ctrl;
3410 $lng = $this->lng;
3411
3412 // check all export ids
3413 $ok = true;
3414 if (is_array($_POST["exportid"])) {
3415 foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3416 if ($exp_id != "" && !preg_match(
3417 "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
3418 trim($exp_id)
3419 )) {
3420 $ok = false;
3421 }
3422 }
3423 }
3424 if (!$ok) {
3425 ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
3426 $lng->txt("cont_exp_ids_not_resp_format3") . " " .
3427 $lng->txt("cont_exp_ids_not_resp_format2"));
3428 $this->showExportIDsOverview(true);
3429 return;
3430 }
3431
3432
3433 if (is_array($_POST["exportid"])) {
3434 foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3436 $this->object->getId(),
3437 $pg_id,
3438 ilUtil::stripSlashes($exp_id),
3440 );
3441 }
3442 }
3443
3444 ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true);
3445 $ilCtrl->redirect($this, "showExportIdsOverview");
3446 }
3447
3454 public function saveHelpMapping()
3455 {
3456 $lng = $this->lng;
3457 $ilCtrl = $this->ctrl;
3458
3459 if (is_array($_POST["screen_ids"])) {
3460 foreach ($_POST["screen_ids"] as $chap => $ids) {
3461 $ids = explode("\n", $ids);
3463 }
3464 }
3465 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3466 $ilCtrl->redirect($this, "showExportIdsOverview");
3467 }
3468
3472
3479 public function showTooltipList()
3480 {
3481 $tpl = $this->tpl;
3482 $ilToolbar = $this->toolbar;
3483 $ilCtrl = $this->ctrl;
3484 $lng = $this->lng;
3485
3486 $this->setTabs();
3487 $this->setContentSubTabs("help_tooltips");
3488
3489 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3490 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
3491 $ti->setMaxLength(200);
3492 $ti->setSize(20);
3493 $ilToolbar->addInputItem($ti, true);
3494 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
3495 $ilToolbar->addSeparator();
3496
3497 $options = ilHelp::getTooltipComponents();
3498 if (ilSession::get("help_tt_comp") != "") {
3499 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
3500 }
3501 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
3502 $si->setOptions($options);
3503 $si->setValue(ilSession::get("help_tt_comp"));
3504 $ilToolbar->addInputItem($si, true);
3505 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
3506
3507 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp"));
3508
3509 $tpl->setContent($tbl->getHTML());
3510 }
3511
3518 public function addTooltip()
3519 {
3520 $lng = $this->lng;
3521 $ilCtrl = $this->ctrl;
3522
3523 $tt_id = ilUtil::stripSlashes($_POST["tooltip_id"]);
3524 if (trim($tt_id) != "") {
3525 if (is_int(strpos($tt_id, "_"))) {
3526 ilHelp::addTooltip(trim($tt_id), "");
3527 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3528
3529 $fu = strpos($tt_id, "_");
3530 $comp = substr($tt_id, 0, $fu);
3531 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
3532 } else {
3533 ilUtil::sendFailure($lng->txt("cont_help_no_valid_tooltip_id"), true);
3534 }
3535 }
3536 $ilCtrl->redirect($this, "showTooltipList");
3537 }
3538
3545 public function filterTooltips()
3546 {
3547 $lng = $this->lng;
3548 $ilCtrl = $this->ctrl;
3549
3550 ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"]));
3551 $ilCtrl->redirect($this, "showTooltipList");
3552 }
3553
3554
3561 public function saveTooltips()
3562 {
3563 $ilCtrl = $this->ctrl;
3564 $lng = $this->lng;
3565
3566 if (is_array($_POST["text"])) {
3567 foreach ($_POST["text"] as $id => $text) {
3569 (int) $id,
3570 ilUtil::stripSlashes($text),
3571 ilUtil::stripSlashes($_POST["tt_id"][(int) $id])
3572 );
3573 }
3574 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3575 }
3576 $ilCtrl->redirect($this, "showTooltipList");
3577 }
3578
3582 public function deleteTooltips()
3583 {
3584 $lng = $this->lng;
3585 $ilCtrl = $this->ctrl;
3586
3587 if (is_array($_POST["id"])) {
3588 foreach ($_POST["id"] as $id) {
3589 ilHelp::deleteTooltip((int) $id);
3590 }
3591 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3592 }
3593 $ilCtrl->redirect($this, "showTooltipList");
3594 }
3595
3599
3605 public static function getLayoutOption($a_txt, $a_var, $a_def_option = "")
3606 {
3607 global $DIC;
3608
3609 $lng = $DIC->language();
3610
3611 // default layout
3612 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
3613 if ($a_def_option != "") {
3614 if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
3615 $im_tag = ilUtil::img($im, $a_def_option);
3616 }
3617 $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><b>" .
3618 $lng->txt("cont_lm_default_layout") .
3619 "</b>: " . $lng->txt("cont_layout_" . $a_def_option) .
3620 "</td></tr></table>", ""));
3621 }
3622 foreach (ilObjContentObject::getAvailableLayouts() as $l) {
3623 $im_tag = "";
3624 if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
3625 $im_tag = ilUtil::img($im, $l);
3626 }
3627 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
3628 $im_tag . "</td><td style='padding:5px;'><b>" . $lng->txt("cont_layout_" . $l) . "</b>: " .
3629 $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
3630 }
3631
3632 return $layout;
3633 }
3634
3639 {
3640 $ilCtrl = $this->ctrl;
3641 $ilCtrl->setParameter($this, "hierarchy", "1");
3642 $this->setPageLayout(true);
3643 }
3644
3645
3649 public function setPageLayout($a_in_hierarchy = false)
3650 {
3651 $tpl = $this->tpl;
3652 $ilCtrl = $this->ctrl;
3653 $lng = $this->lng;
3654
3655 if (!is_array($_POST["id"])) {
3656 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3657
3658 if ($a_in_hierarchy) {
3659 $ilCtrl->redirect($this, "chapters");
3660 } else {
3661 $ilCtrl->redirect($this, "pages");
3662 }
3663 }
3664
3665 $this->initSetPageLayoutForm();
3666
3667 $tpl->setContent($this->form->getHTML());
3668 }
3669
3673 public function initSetPageLayoutForm()
3674 {
3675 $lng = $this->lng;
3676 $ilCtrl = $this->ctrl;
3677
3678 $this->form = new ilPropertyFormGUI();
3679
3680 if (is_array($_POST["id"])) {
3681 foreach ($_POST["id"] as $id) {
3682 $hi = new ilHiddenInputGUI("id[]");
3683 $hi->setValue($id);
3684 $this->form->addItem($hi);
3685 }
3686 }
3687 $layout = self::getLayoutOption(
3688 $lng->txt("cont_layout"),
3689 "layout",
3690 $this->object->getLayout()
3691 );
3692 $this->form->addItem($layout);
3693
3694 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
3695 $this->form->addCommandButton("pages", $lng->txt("cancel"));
3696
3697 $this->form->setTitle($lng->txt("cont_set_layout"));
3698 $this->form->setFormAction($ilCtrl->getFormAction($this));
3699 }
3700
3704 public function savePageLayout()
3705 {
3706 $lng = $this->lng;
3707 $ilCtrl = $this->ctrl;
3708
3709 $ilCtrl->setParameter($this, "hierarchy", $_GET["hierarchy"]);
3710
3711 foreach ($_POST["id"] as $id) {
3714 ilUtil::stripSlashes($_POST["layout"]),
3715 $this->object
3716 );
3717 }
3718 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3719
3720 if ($_GET["hierarchy"] == 1) {
3721 $ilCtrl->redirect($this, "chapters");
3722 } else {
3723 $ilCtrl->redirect($this, "pages");
3724 }
3725 }
3726
3727 //
3728 // Auto glossaries
3729 //
3730
3737 public function editGlossaries()
3738 {
3739 $tpl = $this->tpl;
3740 $ilToolbar = $this->toolbar;
3741 $lng = $this->lng;
3742 $ilCtrl = $this->ctrl;
3743 $ilTabs = $this->tabs;
3744
3745 $this->setTabs();
3746 $ilTabs->setTabActive("settings");
3747 $this->setSubTabs("cont_glossaries");
3748
3749 $ilToolbar->addButton(
3750 $lng->txt("add"),
3751 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
3752 );
3753
3754 $tab = new ilLMGlossaryTableGUI($this->object, $this, "editGlossaries");
3755
3756 $tpl->setContent($tab->getHTML());
3757 }
3758
3765 public function showLMGlossarySelector()
3766 {
3767 $tpl = $this->tpl;
3768 $lng = $this->lng;
3769 $ilCtrl = $this->ctrl;
3772 $ilTabs = $this->tabs;
3773
3774 $this->setTabs();
3775 $ilTabs->setTabActive("settings");
3776 $this->setSubTabs("cont_glossaries");
3777
3778 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
3779 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
3780 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
3781 $exp->setTargetClass(get_class($this));
3782 $exp->setCmd('confirmGlossarySelection');
3783 $exp->setClickableTypes(array("glo"));
3784 $exp->addFilter("glo");
3785
3786 // build html-output
3787 $exp->setOutput(0);
3788 $tpl->setContent($exp->getOutput());
3789 }
3790
3795 {
3796 $ilCtrl = $this->ctrl;
3797 $tpl = $this->tpl;
3798 $lng = $this->lng;
3799
3800 $cgui = new ilConfirmationGUI();
3801 $ilCtrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
3802 $cgui->setFormAction($ilCtrl->getFormAction($this));
3803 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
3804 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
3805 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
3806 $tpl->setContent($cgui->getHTML());
3807 }
3808
3815 public function selectLMGlossaryLink()
3816 {
3817 $glo_ref_id = (int) $_GET["glo_ref_id"];
3818 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3819 $this->object->autoLinkGlossaryTerms($glo_ref_id);
3820 $this->selectLMGlossary();
3821 }
3822
3823
3830 public function selectLMGlossary()
3831 {
3832 $ilCtrl = $this->ctrl;
3833 $lng = $this->lng;
3834
3835 $glos = $this->object->getAutoGlossaries();
3836 $glo_ref_id = (int) $_GET["glo_ref_id"];
3837 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3838 if (!in_array($glo_id, $glos)) {
3839 $glos[] = $glo_id;
3840 }
3841 $this->object->setAutoGlossaries($glos);
3842 $this->object->update();
3843
3844 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3845 $ilCtrl->redirect($this, "editGlossaries");
3846 }
3847
3854 public function removeLMGlossary()
3855 {
3856 $ilCtrl = $this->ctrl;
3857 $lng = $this->lng;
3858
3859 $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
3860 $this->object->update();
3861
3862 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3863 $ilCtrl->redirect($this, "editGlossaries");
3864 }
3865
3872 public function editMasterLanguage()
3873 {
3874 $ilCtrl = $this->ctrl;
3875
3876 $ilCtrl->setParameter($this, "transl", "");
3877 if ($_GET["lang_switch_mode"] == "short_titles") {
3878 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
3879 }
3880 $ilCtrl->redirect($this, "chapters");
3881 }
3882
3889 public function switchToLanguage()
3890 {
3891 $ilCtrl = $this->ctrl;
3892
3893 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
3894 if ($_GET["lang_switch_mode"] == "short_titles") {
3895 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
3896 }
3897 $ilCtrl->redirect($this, "chapters");
3898 }
3899
3900 public function redrawHeaderAction()
3901 {
3902 // #12281
3903 return parent::redrawHeaderActionObject();
3904 }
3905}
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
error($a_errmsg)
set error message @access public
const IL_FIRST_NODE
Definition: class.ilTree.php:5
User interface class for advanced drop-down selection lists.
This class represents a hierarchical form.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
Export class for content objects.
static isJobActive($a_job_id)
Check if given job is currently active.
Class ilECSLearningModuleSettings.
static setAction($a_action)
static storeContentObject($a_type, $a_id, $a_action="cut")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Export User Interface Class.
This class represents a section header in a property form.
static _getFrame($a_class, $a_type='')
Get content frame name.
static saveScreenIdsForChapter($a_chap, $a_ids)
Save screen ids for chapter.
static addTooltip($a_tt_id, $a_text, $a_module_id=0)
Add tooltip.
static updateTooltip($a_id, $a_text, $a_tt_id)
Update tooltip.
static getTooltipComponents($a_module_id=0)
Get all tooltip components.
static deleteTooltip($a_id)
Delete tooltip.
This class represents a hidden form property in a property form.
static getPostNodeId()
Get node ID of _POST input.
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false)
static getPostMulti()
Get multi number of _POST input.
Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE Date: 24....
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
Class ilInfoScreenGUI.
Base exception class for learning modules.
TableGUI class for glossary tables.
Import related features for learning modules.
class for editing lm menu
TableGUI class for lm menu items.
Handler class for multi srt upload in learning modules.
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
Class ilLMObject.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.
static saveExportId($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
Save export id.
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static _lookupTitle($a_obj_id)
Lookup title.
static _writePublicAccessStatus($a_pages, $a_cont_obj_id)
update public access flags in lm_data for all pages of a content object@access public
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
static pasteTree( $a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
Class ilLMPageObjectGUI.
Class ilLMPageObject.
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
TableGUI class for all pages of a learning module.
GUI class for LTI provider object settings.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
class for checking external links in page objects.
static _getNotifyStatus($a_usr_id, $a_obj_id)
class ilLinkCheckerTableGUI
class for checking external links in page objects Normally used in Cron jobs, but should be extensibl...
TableGUI class for (broken) links in learning module.
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
manifest.xml file not found-exception for import
Upload SRT files to a set of media objects.
This class represents a non editable value in a property form.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
Class ilObjContentObjectGUI.
fixTreeConfirm()
confirm screen for tree fixing
addMenuEntry()
display add menu entry form
setPageLayout($a_in_hierarchy=false)
Set layout for multipl pages.
sendMailToBlockedUsers()
Send Mail to blocked users.
showExportIDsOverview($a_validation=false)
Show export IDs overview.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
filterHelpChapters()
Filter help chapters.
unlockQuestion()
Unlock blocked question.
getContextPath($a_endnode_id, $a_startnode_id=1)
get context path in content object tree
addLocations($a_omit_obj_id=false)
display locator
confirmGlossarySelection()
Confirm glossary selection.
importObject()
display dialogue for importing XML-LeaningObjects
cutItems($a_return="chapters")
Copy items to clipboard, then cut them from the current tree.
showActions($a_actions)
show possible action (form buttons)
selectHeader()
select page as header
savePublicSectionPages()
Saves public lm pages.
importFileObject($parent_id=null, $a_catch_errors=true)
display status information or report errors messages in case of error
initSetPageLayoutForm()
Init set page layout form.
savePublicSectionAccess()
Saves lm access mode.
insertChapter()
Insert (multiple) chapters at node.
setilLMMenu( $a_offline=false, $a_export_format="", $a_active="content", $a_use_global_tabs=false, $a_as_subtabs=false, $a_cur_page=0, $a_lang="", $a_export_all=false)
get lm menu html
saveAllTitles()
Save all titles of chapters/pages.
editStyleProperties()
Edit style properties.
copyItems()
Copy items to clipboard.
initPropertiesForm()
Init properties form.
proceedDragDrop()
proceed drag and drop operations on pages/chapters
publishExportFile($a_files)
download export file
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=false)
Constructor.
confirmedDelete($a_parent_subobj_id=0)
delete page object or structure objects
pasteChapter($a_parent_subobj_id=0)
paste chapter
getPropertiesFormValues()
Get values for properties form.
editMasterLanguage()
Edit master language.
static _goto($a_target)
redirect script
popup()
popup window for wysiwyg editor
getPublicAccessColValue($a_type, $a_file)
Get public access value for export table.
showTooltipList()
Show export IDs overview.
listLinks()
List all broken links.
selectFooter()
select page as footer
setContentSubTabs($a_active)
Set pages tabs.
initMenuEntryForm($a_mode="edit")
Init menu entry form.
initStylePropertiesForm()
Init style properties form.
setSubTabs($a_active)
Set sub tabs.
setPageLayoutInHierarchy()
Set layout for multipl pages.
insertChapterClip()
Insert Chapter from clipboard.
activatePages()
activates or deactivates pages
moveChapter($a_parent_subobj_id=0)
move a single chapter (selection)
downloadPDFFile()
download export file
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Get layout option.
selectLMGlossaryLink()
Select a glossary and link all its terms.
showLMGlossarySelector()
Select LM Glossary.
copyChapter($a_parent_subobj_id=0)
copy a single chapter (selection)
initImportForm($a_new_type)
Init import form.
getBlockedUsersMailSignature()
Get mail signature for blocked users.
editGlossaries()
Edit automatically linked glossaries.
saveStyleSettings()
Save style settings.
setQuestionsSubTabs($a_active)
Set pages tabs.
resetNumberOfTries()
Reset number of tries.
editMenuProperties()
Edit menu properies.
Class ilObjContentObject.
static getAvailableLayouts()
get all available lm layouts
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
Class ilObjLearningModule.
Class ilObjStyleSheetGUI.
static _lookupStandard($a_id)
Lookup standard flag.
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static _lookupLogin($a_user_id)
lookup login
GUI class for the workflow of copying objects.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
addHeaderAction()
Add header action menu.
createObject()
create new object form
setTabs()
set admin tabs @access public
setTitleAndDescription()
called by prepare output
static getInstance($a_obj_id)
Class ilObjectMetaDataGUI.
GUI class for object translation handling.
static getInstance($a_obj_id)
Get instance.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
getRefId()
get reference id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
Page multilinguality GUI class.
static _writeActive( $a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static resetTries($a_q_id, $a_user_id)
Reset tries.
static unlock($a_q_id, $a_user_id)
Reset tries.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
ILIAS Setting Class.
Class ilStructureObjectGUI.
Class ilStructreObject.
Tabs GUI.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$c
Definition: cli.php:37
const ANONYMOUS_USER_ID
Definition: constants.php:25
const ROOT_FOLDER_ID
Definition: constants.php:30
$login
Definition: cron.php:13
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$valid
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
interface ilLinkCheckerGUIRowHandling
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
$format
Definition: metadata.php:218
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
settings()
Definition: settings.php:2
global $ilDB
$lm_set
ui()
Definition: ui.php:5
$lang
Definition: xapiexit.php:8