ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
67 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
68 {
69 global $DIC;
70
71 $this->lng = $DIC->language();
72 $this->access = $DIC->access();
73 $this->tabs = $DIC->tabs();
74 $this->error = $DIC["ilErr"];
75 $this->settings = $DIC->settings();
76 $this->user = $DIC->user();
77 $this->tpl = $DIC["tpl"];
78 $this->toolbar = $DIC->toolbar();
79 $this->rbacsystem = $DIC->rbac()->system();
80 $this->tree = $DIC->repositoryTree();
81 $this->plugin_admin = $DIC["ilPluginAdmin"];
82 $this->help = $DIC["ilHelp"];
83 $this->locator = $DIC["ilLocator"];
84 $this->db = $DIC->database();
85 $this->log = $DIC["ilLog"];
86 $lng = $DIC->language();
87 $ilCtrl = $DIC->ctrl();
88 $this->ctrl = $ilCtrl;
89 $lng->loadLanguageModule("content");
90 $lng->loadLanguageModule("obj");
91 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
92 }
93
99 public function executeCommand()
100 {
101 $ilAccess = $this->access;
103 $ilTabs = $this->tabs;
106
107 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
108 $this->explorer();
109 return;
110 }
111
112 if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
113 $this->ctrl->setReturn($this, "explorer");
114 }
115
116 // get next class that processes or forwards current command
117 $next_class = $this->ctrl->getNextClass($this);
118
119 // get current command
120 if ($_GET["to_props"] == 1) {
121 $cmd = $this->ctrl->getCmd("properties");
122 } else {
123 $cmd = $this->ctrl->getCmd("chapters");
124 }
125
126
127 switch ($next_class) {
128 case 'illtiproviderobjectsettinggui':
129
130 $this->setTabs();
131 $ilTabs->setTabActive("settings");
132 $this->setSubTabs("lti_provider");
133
134 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
135 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
136 $lti_gui->offerLTIRolesForSelection(true);
137 $this->ctrl->forwardCommand($lti_gui);
138 break;
139
140
141
142 case "illearningprogressgui":
143 $this->addHeaderAction();
144 $this->addLocations();
145 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
146 $this->setTabs("learning_progress");
147
148 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
149 $this->ctrl->forwardCommand($new_gui);
150
151 break;
152
153 case 'ilobjectmetadatagui':
154 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
155 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
156 }
157
158 $this->addHeaderAction();
159 $this->addLocations();
160 $this->setTabs("meta");
161
162 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
163 $md_gui = new ilObjectMetaDataGUI($this->object);
164 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'Educational'); // #9510
165 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
166 $this->ctrl->forwardCommand($md_gui);
167 break;
168
169 case "ilobjstylesheetgui":
170 $this->addLocations();
171 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
172 $this->ctrl->setReturn($this, "editStyleProperties");
173 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
174 $style_gui->omitLocator();
175 if ($cmd == "create" || $_GET["new_type"] == "sty") {
176 $style_gui->setCreationMode(true);
177 }
178 $ret = $this->ctrl->forwardCommand($style_gui);
179
180 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
181 $style_id = $ret;
182 $this->object->setStyleSheetId($style_id);
183 $this->object->update();
184 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
185 }
186 break;
187
188 case "illmpageobjectgui":
189
190 $ilTabs->setBackTarget(
191 $lng->txt("learning module"),
192 $ilCtrl->getLinkTarget($this, "chapters")
193 );
194 $this->ctrl->saveParameter($this, array("obj_id"));
195 $this->addLocations();
196 $this->ctrl->setReturn($this, "chapters");
197
198 $pg_gui = new ilLMPageObjectGUI($this->object);
199 if ($_GET["obj_id"] != "") {
200 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
201 $pg_gui->setLMPageObject($obj);
202 }
203 $ret = $this->ctrl->forwardCommand($pg_gui);
204 break;
205
206 case "ilstructureobjectgui":
207 $ilTabs->setBackTarget(
208 $lng->txt("learning module"),
209 $ilCtrl->getLinkTarget($this, "chapters")
210 );
211
212 $this->ctrl->saveParameter($this, array("obj_id"));
213 $this->addLocations();
214 $this->ctrl->setReturn($this, "chapters");
215 $st_gui = new ilStructureObjectGUI($this->object, $this->object->lm_tree);
216 if ($_GET["obj_id"] != "") {
217 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
218 $st_gui->setStructureObject($obj);
219 }
220 $ret = $this->ctrl->forwardCommand($st_gui);
221 if ($cmd == "save" || $cmd == "cancel") {
222 if ($_GET["obj_id"] == "") {
223 $this->ctrl->redirect($this, "chapters");
224 } else {
225 $this->ctrl->setCmd("subchap");
226 $this->executeCommand();
227 }
228 }
229 break;
230
231 case 'ilpermissiongui':
232 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
233 $this->prepareOutput();
234 } else {
235 $this->addHeaderAction();
236 $this->addLocations(true);
237 $this->setTabs("perm");
238 }
239 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
240 $perm_gui = new ilPermissionGUI($this);
241 $ret = $this->ctrl->forwardCommand($perm_gui);
242 break;
243
244 // infoscreen
245 case 'ilinfoscreengui':
246 $this->addHeaderAction();
247 $this->addLocations(true);
248 $this->setTabs("info");
249 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
250 $info = new ilInfoScreenGUI($this);
251 $info->enablePrivateNotes();
252 $info->enableLearningProgress();
253
254 $info->enableNews();
255 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
256 $info->enableNewsEditing();
257 $info->setBlockProperty("news", "settings", true);
258 }
259
260 // show standard meta data section
261 $info->addMetaDataSections(
262 $this->object->getId(),
263 0,
264 $this->object->getType()
265 );
266
267 $ret = $this->ctrl->forwardCommand($info);
268 break;
269
270 case "ilexportgui":
271 ilUtil::sendInfo($this->lng->txt("lm_only_one_download_per_type"));
272 $this->addHeaderAction();
273 $this->addLocations(true);
274 $this->setTabs("export");
275 include_once("./Services/Export/classes/class.ilExportGUI.php");
276 $exp_gui = new ilExportGUI($this);
277 $exp_gui->addFormat("xml");
278 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
279 $ot = ilObjectTranslation::getInstance($this->object->getId());
280 if ($ot->getContentActivated()) {
281 $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("cont_master_language_only") . ")", $this, "export");
282 $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("cont_master_language_only_no_media") . ")", $this, "export");
283
284 $lng->loadLanguageModule("meta");
285 $langs = $ot->getLanguages();
286 foreach ($langs as $l => $ldata) {
287 $exp_gui->addFormat("html_" . $l, "HTML (" . $lng->txt("meta_l_" . $l) . ")", $this, "exportHTML");
288 }
289 $exp_gui->addFormat("html_all", "HTML (" . $lng->txt("cont_all_languages") . ")", $this, "exportHTML");
290 } else {
291 $exp_gui->addFormat("html", "", $this, "exportHTML");
292 }
293
294 $exp_gui->addFormat("scorm", "", $this, "exportSCORM");
295 $exp_gui->addCustomColumn(
296 $lng->txt("cont_public_access"),
297 $this,
298 "getPublicAccessColValue"
299 );
300 $exp_gui->addCustomMultiCommand(
301 $lng->txt("cont_public_access"),
302 $this,
303 "publishExportFile"
304 );
305 $ret = $this->ctrl->forwardCommand($exp_gui);
306 break;
307
308 case 'ilobjecttranslationgui':
309 $this->addHeaderAction();
310 $this->addLocations(true);
311 $this->setTabs("settings");
312 $this->setSubTabs("obj_multilinguality");
313 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
314 $transgui = new ilObjectTranslationGUI($this);
315 $transgui->setTitleDescrOnlyMode(false);
316 $this->ctrl->forwardCommand($transgui);
317 break;
318
319
320 case "ilcommonactiondispatchergui":
321 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
323 $this->ctrl->forwardCommand($gui);
324 break;
325
326 case 'ilobjectcopygui':
327 $this->prepareOutput();
328 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
329 $cp = new ilObjectCopyGUI($this);
330 $cp->setType('lm');
331 $this->ctrl->forwardCommand($cp);
332 break;
333
334 case "ilmobmultisrtuploadgui":
335 $this->addHeaderAction();
336 $this->addLocations(true);
337 $this->setTabs("content");
338 $this->setContentSubTabs("srt_files");
339 include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUploadGUI.php");
340 include_once("./Modules/LearningModule/classes/class.ilLMMultiSrt.php");
341 $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->object));
342 $this->ctrl->forwardCommand($gui);
343 break;
344
345 case "illmimportgui":
346 $this->addHeaderAction();
347 $this->addLocations(true);
348 $this->setTabs("content");
349 $this->setContentSubTabs("import");
350 include_once("./Modules/LearningModule/classes/class.ilLMImportGUI.php");
351 $gui = new ilLMImportGUI($this->object);
352 $this->ctrl->forwardCommand($gui);
353 break;
354
355 case "illmeditshorttitlesgui":
356 $this->addHeaderAction();
357 $this->addLocations(true);
358 $this->setTabs("content");
359 $this->setContentSubTabs("short_titles");
360 include_once("./Modules/LearningModule/classes/class.ilLMEditShortTitlesGUI.php");
361 $gui = new ilLMEditShortTitlesGUI($this);
362 $this->ctrl->forwardCommand($gui);
363 break;
364
365 default:
366 $new_type = $_POST["new_type"]
367 ? $_POST["new_type"]
368 : $_GET["new_type"];
369
370
371 if ($cmd == "create" &&
372 !in_array($new_type, array("lm"))) {
373 switch ($new_type) {
374 case "pg":
375 $this->setTabs();
376 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
377 $ret = $this->executeCommand();
378 break;
379
380 case "st":
381 $this->setTabs();
382 $this->ctrl->setCmdClass("ilStructureObjectGUI");
383 $ret = $this->executeCommand();
384 break;
385 }
386 } else {
387 // creation of new dbk/lm in repository
388 if ($this->getCreationMode() == true &&
389 in_array($new_type, array("lm"))) {
390 $this->prepareOutput();
391 if ($cmd == "") { // this may be due to too big upload files
392 $cmd = "create";
393 }
394 $cmd .= "Object";
395 $ret = $this->$cmd();
396 } else {
397 $this->addHeaderAction();
398 $this->addLocations();
399 $ret = $this->$cmd();
400 }
401 }
402 break;
403 }
404 return $ret;
405 }
406
407 public static function _forwards()
408 {
409 return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
410 }
411
415 public function properties()
416 {
418
419 $lng->loadLanguageModule("style");
420 $this->setTabs("settings");
421 $this->setSubTabs("settings");
422
423 // lm properties
424 $this->initPropertiesForm();
426
427 if ($this->object->getType() == "lm") {
428 // Edit ecs export settings
429 include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
430 $ecs = new ilECSLearningModuleSettings($this->object);
431 $ecs->addSettingsToForm($this->form, 'lm');
432 }
433
434 $this->tpl->setContent($this->form->getHTML());
435 }
436
440 public function initPropertiesForm()
441 {
442 $obj_service = $this->object_service;
443
447
448 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
449 $this->form = new ilPropertyFormGUI();
450
451 // title
452 $ti = new ilTextInputGUI($lng->txt("title"), "title");
453 $ti->setRequired(true);
454 $this->form->addItem($ti);
455
456 // description
457 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
458 $this->form->addItem($ta);
459
460 $lng->loadLanguageModule("rep");
462 $section->setTitle($this->lng->txt('rep_activation_availability'));
463 $this->form->addItem($section);
464
465 // online
466 $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
467 $this->form->addItem($online);
468
469 // presentation
471 $section->setTitle($this->lng->txt('cont_presentation'));
472 $this->form->addItem($section);
473
474 // tile image
475 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
476
477 // default layout
478 $layout = self::getLayoutOption($lng->txt("cont_def_layout"), "lm_layout");
479 $this->form->addItem($layout);
480
481 // layout per page
482 $lpp = new ilCheckboxInputGUI($lng->txt("cont_layout_per_page"), "layout_per_page");
483 $lpp->setInfo($this->lng->txt("cont_layout_per_page_info"));
484 $this->form->addItem($lpp);
485
486 // page header
487 $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
488 $option = array("st_title" => $this->lng->txt("cont_st_title"),
489 "pg_title" => $this->lng->txt("cont_pg_title"),
490 "none" => $this->lng->txt("cont_none"));
491 $page_header->setOptions($option);
492 $this->form->addItem($page_header);
493
494 // chapter numeration
495 $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
496 $this->form->addItem($chap_num);
497
498 // toc mode
499 $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
500 $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
501 "pages" => $this->lng->txt("cont_chapters_and_pages"));
502 $toc_mode->setOptions($option);
503 $this->form->addItem($toc_mode);
504
505 // show progress icons
506 $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
507 $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
508 $this->form->addItem($progr_icons);
509
510 // self assessment
512 $section->setTitle($this->lng->txt('cont_self_assessment'));
513 $this->form->addItem($section);
514
515 // tries
516 $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
517 $radg->setValue(0);
518 $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), 0, $lng->txt("cont_tries_reset_on_visit_info"));
519 $radg->addOption($op1);
520 $op2 = new ilRadioOption($lng->txt("cont_tries_store"), 1, $lng->txt("cont_tries_store_info"));
521 $radg->addOption($op2);
522 $this->form->addItem($radg);
523
524 // restrict forward navigation
525 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
526 $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
527 $this->form->addItem($qfeed);
528
529 // notification
530 $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
531 $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
532 $qfeed->addSubItem($not);
533
534 // disable default feedback for questions
535 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
536 $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
537 $this->form->addItem($qfeed);
538
539 // additional features
541 $section->setTitle($this->lng->txt('obj_features'));
542 $this->form->addItem($section);
543
544 // public notes
545 if (!$ilSetting->get('disable_comments')) {
546 $this->lng->loadLanguageModule("notes");
547 $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
548 $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
549 $this->form->addItem($pub_nodes);
550 }
551
552 // history user comments
553 $com = new ilCheckboxInputGUI($lng->txt("enable_hist_user_comments"), "cobj_user_comments");
554 $com->setInfo($this->lng->txt("enable_hist_user_comments_desc"));
555 $this->form->addItem($com);
556
557 // rating
558 $this->lng->loadLanguageModule('rating');
559 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
560 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
561 $this->form->addItem($rate);
562 $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
563 $this->form->addItem($ratep);
564
565 $this->form->setTitle($lng->txt("cont_lm_properties"));
566 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
567 $this->form->setFormAction($ilCtrl->getFormAction($this));
568 }
569
573 public function getPropertiesFormValues()
574 {
576
577 $values = array();
578
579 $title = $this->object->getTitle();
580 $description = $this->object->getLongDescription();
581 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
582 $ot = ilObjectTranslation::getInstance($this->object->getId());
583 if ($ot->getContentActivated()) {
584 $title = $ot->getDefaultTitle();
585 $description = $ot->getDefaultDescription();
586 }
587
588 $values["title"] = $title;
589 $values["description"] = $description;
590 if (!$this->object->getOfflineStatus()) {
591 $values["cobj_online"] = true;
592 }
593 $values["lm_layout"] = $this->object->getLayout();
594 $values["lm_pg_header"] = $this->object->getPageHeader();
595 if ($this->object->isActiveNumbering()) {
596 $values["cobj_act_number"] = true;
597 }
598 $values["toc_mode"] = $this->object->getTOCMode();
599 if ($this->object->publicNotes()) {
600 $values["cobj_pub_notes"] = true;
601 }
602 if ($this->object->cleanFrames()) {
603 $values["cobj_clean_frames"] = true;
604 }
605 if ($this->object->isActiveHistoryUserComments()) {
606 $values["cobj_user_comments"] = true;
607 }
608 $values["layout_per_page"] = $this->object->getLayoutPerPage();
609 $values["rating"] = $this->object->hasRating();
610 $values["rating_pages"] = $this->object->hasRatingPages();
611 $values["disable_def_feedback"] = $this->object->getDisableDefaultFeedback();
612 $values["progr_icons"] = $this->object->getProgressIcons();
613 $values["store_tries"] = $this->object->getStoreTries();
614 $values["restrict_forw_nav"] = $this->object->getRestrictForwardNavigation();
615
616 include_once "./Services/Notification/classes/class.ilNotification.php";
617 $values["notification_blocked_users"] = ilNotification::hasNotification(
619 $ilUser->getId(),
620 $this->object->getId()
621 );
622
623 $this->form->setValuesByArray($values);
624 }
625
629 public function saveProperties()
630 {
634 $obj_service = $this->object_service;
635
636 $valid = false;
637 $this->initPropertiesForm();
638 if ($this->form->checkInput()) {
639 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
640 $ot = ilObjectTranslation::getInstance($this->object->getId());
641 if ($ot->getContentActivated()) {
642 $ot->setDefaultTitle($_POST['title']);
643 $ot->setDefaultDescription($_POST['description']);
644 $ot->save();
645 }
646
647 $this->object->setTitle($_POST['title']);
648 $this->object->setDescription($_POST['description']);
649 $this->object->setLayout($_POST["lm_layout"]);
650 $this->object->setPageHeader($_POST["lm_pg_header"]);
651 $this->object->setTOCMode($_POST["toc_mode"]);
652 $this->object->setOfflineStatus(!($_POST['cobj_online']));
653 $this->object->setActiveNumbering($_POST["cobj_act_number"]);
654 $this->object->setCleanFrames($_POST["cobj_clean_frames"]);
655 if (!$ilSetting->get('disable_comments')) {
656 $this->object->setPublicNotes($_POST["cobj_pub_notes"]);
657 }
658 $this->object->setHistoryUserComments($_POST["cobj_user_comments"]);
659 $this->object->setLayoutPerPage($_POST["layout_per_page"]);
660 $this->object->setRating($_POST["rating"]);
661 $this->object->setRatingPages($_POST["rating_pages"]);
662 $this->object->setDisableDefaultFeedback((int) $_POST["disable_def_feedback"]);
663 $this->object->setProgressIcons((int) $_POST["progr_icons"]);
664
665 $add_info = "";
666 if ($_POST["restrict_forw_nav"] && !$_POST["store_tries"]) {
667 $_POST["store_tries"] = 1;
668 $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
669 $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
670 $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
671 }
672
673 $this->object->setStoreTries((int) $_POST["store_tries"]);
674 $this->object->setRestrictForwardNavigation((int) $_POST["restrict_forw_nav"]);
675 $this->object->updateProperties();
676 $this->object->update();
677
678 // tile image
679 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
680
681 include_once "./Services/Notification/classes/class.ilNotification.php";
684 $ilUser->getId(),
685 $this->object->getId(),
686 (bool) $this->form->getInput("notification_blocked_users")
687 );
688
689
690 if ($this->object->getType() == 'lm') {
691 // Update ecs export settings
692 include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
693 $ecs = new ilECSLearningModuleSettings($this->object);
694 if ($ecs->handleSettingsUpdate()) {
695 $valid = true;
696 }
697 } else {
698 $valid = true;
699 }
700 }
701
702 if ($valid) {
703 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified") . $add_info, true);
704 $this->ctrl->redirect($this, "properties");
705 } else {
706 $lng->loadLanguageModule("style");
707 $this->setTabs("settings");
708 $this->setSubTabs("cont_general_properties");
709
710 $this->form->setValuesByPost();
711 $this->tpl->setContent($this->form->getHTML());
712 }
713 }
714
718 public function editStyleProperties()
719 {
721
723 $tpl->setContent($this->form->getHTML());
724 }
725
729 public function initStylePropertiesForm()
730 {
733 $ilTabs = $this->tabs;
735
736 $lng->loadLanguageModule("style");
737 $this->setTabs();
738 $ilTabs->setTabActive("settings");
739 $this->setSubTabs("cont_style");
740
741 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
742 $this->form = new ilPropertyFormGUI();
743
744 $fixed_style = $ilSetting->get("fixed_content_style_id");
745 $def_style = $ilSetting->get("default_content_style_id");
746 $style_id = $this->object->getStyleSheetId();
747
748 if ($fixed_style > 0) {
749 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
750 $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
751 $this->lng->txt("global_fixed") . ")");
752 $this->form->addItem($st);
753 } else {
755 true,
756 false,
757 $_GET["ref_id"]
758 );
759
760 if ($def_style > 0) {
761 $st_styles[0] = ilObject::_lookupTitle($def_style) . " (" . $this->lng->txt("default") . ")";
762 } else {
763 $st_styles[0] = $this->lng->txt("default");
764 }
765 ksort($st_styles);
766
767 if ($style_id > 0) {
768 // individual style
769 if (!ilObjStyleSheet::_lookupStandard($style_id)) {
770 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
771 $st->setValue(ilObject::_lookupTitle($style_id));
772 $this->form->addItem($st);
773
774 // delete command
775 $this->form->addCommandButton(
776 "editStyle",
777 $lng->txt("cont_edit_style")
778 );
779 $this->form->addCommandButton(
780 "deleteStyle",
781 $lng->txt("cont_delete_style")
782 );
783 }
784 }
785
786 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
787 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
788 $style_sel->setOptions($st_styles);
789 $style_sel->setValue($style_id);
790 $this->form->addItem($style_sel);
791 $this->form->addCommandButton(
792 "saveStyleSettings",
793 $lng->txt("save")
794 );
795 $this->form->addCommandButton(
796 "createStyle",
797 $lng->txt("sty_create_ind_style")
798 );
799 }
800 }
801 $this->form->setTitle($lng->txt("cont_style"));
802 $this->form->setFormAction($ilCtrl->getFormAction($this));
803 }
804
808 public function createStyle()
809 {
811
812 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
813 }
814
818 public function editStyle()
819 {
821
822 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
823 }
824
828 public function deleteStyle()
829 {
831
832 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
833 }
834
838 public function saveStyleSettings()
839 {
841
842 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
843 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
844 || $this->object->getStyleSheetId() == 0)) {
845 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
846 $this->object->update();
847 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
848 }
849 $this->ctrl->redirect($this, "editStyleProperties");
850 }
851
855 public function initMenuForm()
856 {
859
860 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
861 $form = new ilPropertyFormGUI();
862
863 // enable menu
864 $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
865 $menu->setChecked($this->object->isActiveLMMenu());
866 $form->addItem($menu);
867
868 // toc
869 $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
870 $toc->setChecked($this->object->isActiveTOC());
871 $form->addItem($toc);
872
873 // print view
874 $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
875 $print->setChecked($this->object->isActivePrintView());
876 $form->addItem($print);
877
878 // prevent glossary appendix
879 $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
880 $glo->setChecked($this->object->isActivePreventGlossaryAppendix());
881 $print->addSubItem($glo);
882
883 // hide header and footer in print view
884 $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
885 $hhfp->setChecked($this->object->getHideHeaderFooterPrint());
886 $print->addSubItem($hhfp);
887
888 // downloads
889 $no_download_file_available =
890 " " . $lng->txt("cont_no_download_file_available") .
891 " <a href='" . $ilCtrl->getLinkTargetByClass("ilexportgui", "") . "'>" . $lng->txt("change") . "</a>";
892 $types = array("xml", "html", "scorm");
893 foreach ($types as $type) {
894 if ($this->object->getPublicExportFile($type) != "") {
895 if (is_file($this->object->getExportDirectory($type) . "/" .
896 $this->object->getPublicExportFile($type))) {
897 $no_download_file_available = "";
898 }
899 }
900 }
901 $dl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "cobj_act_downloads");
902 $dl->setInfo($this->lng->txt("cont_downloads_desc") . $no_download_file_available);
903 $dl->setChecked($this->object->isActiveDownloads());
904 $form->addItem($dl);
905
906 // downloads in public area
907 $pdl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads_public_desc"), "cobj_act_downloads_public");
908 $pdl->setChecked($this->object->isActiveDownloadsPublic());
909 $dl->addSubItem($pdl);
910
911 $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
912
913 $form->setTitle($lng->txt("cont_lm_menu"));
914 $form->setFormAction($ilCtrl->getFormAction($this));
915
916 return $form;
917 }
918
922 public function editMenuProperties()
923 {
925 $ilTabs = $this->tabs;
928 $ilToolbar = $this->toolbar;
929
930 $lng->loadLanguageModule("style");
931 $this->setTabs();
932 $ilTabs->setTabActive("settings");
933 $this->setSubTabs("cont_lm_menu");
934
935 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
936 $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
937 $ilToolbar->setCloseFormTag(false);
938
939 $form = $this->initMenuForm();
940 $form->setOpenTag(false);
941 $form->setCloseTag(false);
942
943 $this->__initLMMenuEditor();
944 $entries = $this->lmme_obj->getMenuEntries();
945 include_once("./Modules/LearningModule/classes/class.ilLMMenuItemsTableGUI.php");
946 $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
947 $table->setOpenFormTag(false);
948
949 $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
950 }
951
955 public function saveMenuProperties()
956 {
957 $this->object->setActiveLMMenu((int) $_POST["cobj_act_lm_menu"]);
958 $this->object->setActiveTOC((int) $_POST["cobj_act_toc"]);
959 $this->object->setActivePrintView((int) $_POST["cobj_act_print"]);
960 $this->object->setActivePreventGlossaryAppendix((int) $_POST["cobj_act_print_prev_glo"]);
961 $this->object->setHideHeaderFooterPrint((int) $_POST["hide_head_foot_print"]);
962 $this->object->setActiveDownloads((int) $_POST["cobj_act_downloads"]);
963 $this->object->setActiveDownloadsPublic((int) $_POST["cobj_act_downloads_public"]);
964 $this->object->updateProperties();
965
966 $this->__initLMMenuEditor();
967 //var_dump($_POST["menu_entries"]); exit;
968 $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
969
970 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
971 $this->ctrl->redirect($this, "editMenuProperties");
972 }
973
977 public function explorer()
978 {
980
981 $gui_class = "ilobjlearningmodulegui";
982
983 $ilCtrl->setParameterByClass($gui_class, "active_node", $_GET["active_node"]);
984
985 $this->tpl = new ilTemplate("tpl.main.html", true, true);
986
987 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
988
989 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
990 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
991
992 require_once("./Modules/LearningModule/classes/class.ilLMEditorExplorer.php");
993 $exp = new ilLMEditorExplorer(
994 $this->ctrl->getLinkTarget($this, "view"),
995 $this->object,
996 $gui_class
997 );
998
999 $exp->setTargetGet("obj_id");
1000 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
1001
1002 if ($_GET["lmmovecopy"] == "1") {
1003 $this->proceedDragDrop();
1004 }
1005
1006
1007 if ($_GET["lmexpand"] == "") {
1008 $mtree = new ilTree($this->object->getId());
1009 $mtree->setTableNames('lm_tree', 'lm_data');
1010 $mtree->setTreeTablePK("lm_id");
1011 $expanded = $mtree->readRootId();
1012 } else {
1013 $expanded = $_GET["lmexpand"];
1014 }
1015 if ($_GET["active_node"] != "") {
1016 $path = $this->lm_tree->getPathId($_GET["active_node"]);
1017 $exp->setForceOpenPath($path);
1018
1019 $exp->highlightNode($_GET["active_node"]);
1020 }
1021 $exp->setExpand($expanded);
1022
1023 // build html-output
1024 $exp->setOutput(0);
1025 $output = $exp->getOutput();
1026
1027 // asynchronous output
1028 if ($ilCtrl->isAsynch()) {
1029 echo $output;
1030 exit;
1031 }
1032
1033 include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
1034
1035 $this->tpl->setCurrentBlock("content");
1036 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
1037 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1038 $this->tpl->setVariable("EXPLORER", $output);
1039 $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
1040 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
1041 $this->tpl->parseCurrentBlock();
1042 $this->tpl->show(false);
1043 exit;
1044 }
1045
1049 public function popup()
1050 {
1051 include_once "./Services/COPage/classes/class.ilWysiwygUtil.php";
1052 $popup = new ilWysiwygUtil();
1053 $popup->show($_GET["ptype"]);
1054 exit;
1055 }
1056
1060 public function proceedDragDrop()
1061 {
1063
1064 $this->object->executeDragDrop(
1065 $_POST["il_hform_source_id"],
1066 $_POST["il_hform_target_id"],
1067 $_POST["il_hform_fc"],
1068 $_POST["il_hform_as_subitem"]
1069 );
1070 $ilCtrl->redirect($this, "chapters");
1071 }
1072
1073 /* protected function initCreationForms($a_new_type)
1074 {
1075 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
1076 self::CFORM_IMPORT => $this->initImportForm());
1077
1078 return $forms;
1079 }*/
1080
1081 protected function afterSave(ilObject $a_new_object)
1082 {
1083 $a_new_object->setCleanFrames(true);
1084 $a_new_object->update();
1085
1086 // create content object tree
1087 $a_new_object->createLMTree();
1088
1089 // create a first chapter
1090 $a_new_object->addFirstChapterAndPage();
1091
1092 // always send a message
1093 ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1094 ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
1095 "&baseClass=ilLMEditorGUI");
1096 }
1097
1101 public function initImportForm($a_new_type)
1102 {
1103 $lng = $this->lng;
1105
1106 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1107 $form = new ilPropertyFormGUI();
1108
1109 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
1110 $this->ctrl->setParameter($this, "new_type", $new_type);
1111
1112 $form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
1113 $form->setTableWidth("600px");
1114
1115 // import file
1116 //$fi = new ilFileInputGUI($this->lng->txt("file"), "xmldoc");
1117 $fi = new ilFileInputGUI($this->lng->txt("file"), "importfile");
1118 $fi->setSuffixes(array("zip"));
1119 $fi->setRequired(true);
1120 $fi->setSize(30);
1121 $form->addItem($fi);
1122
1123 // validation
1124 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
1125 $cb->setInfo($this->lng->txt(""));
1126 $form->addItem($cb);
1127
1128 $form->addCommandButton("importFile", $lng->txt("import"));
1129 $form->addCommandButton("cancel", $lng->txt("cancel"));
1130
1131 $form->setTitle($this->lng->txt("import_" . $new_type));
1132 $form->setFormAction($ilCtrl->getFormAction($this));
1133
1134 return $form;
1135 }
1136
1142 public function exportObject()
1143 {
1144 return;
1145 }
1146
1152 public function importObject()
1153 {
1154 $this->createObject();
1155 return;
1156 }
1157
1158
1165 public function importFileObject($parent_id = null, $a_catch_errors = true)
1166 {
1169 $tpl = $this->tpl;
1170
1171 $form = $this->initImportForm("lm");
1172
1173 try {
1174 // the new import
1175 parent::importFileObject(null, false);
1176 return;
1178 // we just run through in this case.
1179 $no_manifest = true;
1180 } catch (ilException $e) {
1181 // display message and form again
1182 ilUtil::sendFailure($this->lng->txt("obj_import_file_error") . " <br />" . $e->getMessage());
1183 $form->setValuesByPost();
1184 $tpl->setContent($form->getHtml());
1185 return;
1186 }
1187
1188 if (!$no_manifest) {
1189 return; // something different has gone wrong, but we have a manifest, this is definitely not "the old" import
1190 }
1191
1192 // the "old" (pre 5.1) import
1193
1194 include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
1195
1196 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"])) {
1197 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
1198 return;
1199 }
1200
1201 if ($form->checkInput()) {
1202 // create and insert object in objecttree
1203 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1204 $newObj = new ilObjContentObject();
1205 $newObj->setType($_GET["new_type"]);
1206 $newObj->setTitle($_FILES["importfile"]["name"]);
1207 $newObj->setDescription("");
1208 $newObj->create(true);
1209 $newObj->createReference();
1210 $newObj->putInTree($_GET["ref_id"]);
1211 $newObj->setPermissions($_GET["ref_id"]);
1212
1213 // create learning module tree
1214 $newObj->createLMTree();
1215
1216 // since the "new" import already did the extracting
1217 $mess = $newObj->importFromDirectory($this->tmp_import_dir, $_POST["validate"]);
1218
1219 if ($mess == "") {
1220 ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1221 ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
1222 "&baseClass=ilLMEditorGUI");
1223 } else {
1224 $link = '<a href="' . "ilias.php?ref_id=" . $newObj->getRefId() .
1225 "&baseClass=ilLMEditorGUI" . '" target="_top">' . $this->lng->txt("btn_next") . '</a>';
1226 $tpl->setContent("<br />" . $link . "<br /><br />" . $mess . $link);
1227 }
1228 } else {
1229 $form->setValuesByPost();
1230 $tpl->setContent($form->getHtml());
1231 }
1232 }
1233
1237 public function chapters()
1238 {
1239 $lng = $this->lng;
1241
1242 $this->setTabs();
1243 $this->setContentSubTabs("chapters");
1244
1245 $ilCtrl->setParameter($this, "backcmd", "chapters");
1246
1247 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
1248 $form_gui = new ilChapterHierarchyFormGUI($this->object->getType(), $_GET["transl"]);
1249 $form_gui->setFormAction($ilCtrl->getFormAction($this));
1250 $form_gui->setTitle($this->object->getTitle());
1251 $form_gui->setIcon(ilUtil::getImagePath("icon_lm.svg"));
1252 $form_gui->setTree($this->lm_tree);
1253 $form_gui->setMaxDepth(0);
1254 $form_gui->setCurrentTopNodeId($this->tree->getRootId());
1255 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
1256 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1257 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1258 if ($this->object->getLayoutPerPage()) {
1259 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
1260 }
1261 $form_gui->setDragIcon(ilUtil::getImagePath("icon_st.svg"));
1262 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1263 $up_gui = "ilobjlearningmodulegui";
1264
1265 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
1266 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
1267 $ilCtrl->setParameter($this, "obj_id", "");
1268
1269 $ml_head = self::getMultiLangHeader($this->object->getId(), $this);
1270
1271 $this->tpl->setContent($ml_head . $ctpl->get());
1272 }
1273
1280 public static function getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode = "")
1281 {
1282 global $DIC;
1283
1284 $lng = $DIC->language();
1285 $ilCtrl = $DIC->ctrl();
1286
1287 // multi language
1288 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
1289 $ot = ilObjectTranslation::getInstance($a_lm_id);
1290 if ($ot->getContentActivated()) {
1291 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1292 $lng->loadLanguageModule("meta");
1293
1294 // info
1295 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1296 $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1297 $ml_head = $ml_gui->getMultiLangInfo($_GET["transl"]);
1298
1299 // language switch
1300 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1302 $list->setListTitle($lng->txt("actions"));
1303 $list->setId("copage_act");
1304 $entries = false;
1305 if (!in_array($_GET["transl"], array("", "-"))) {
1306 $l = $ot->getMasterLanguage();
1307 $list->addItem(
1308 $lng->txt("cont_edit_language_version") . ": " .
1309 $lng->txt("meta_l_" . $l),
1310 "",
1311 $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1312 );
1313 $entries = true;
1314 }
1315
1316 foreach ($ot->getLanguages() as $al => $lang) {
1317 if ($_GET["transl"] != $al &&
1318 $al != $ot->getMasterLanguage()) {
1319 $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1320 $list->addItem(
1321 $lng->txt("cont_edit_language_version") . ": " .
1322 $lng->txt("meta_l_" . $al),
1323 "",
1324 $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1325 );
1326 $ilCtrl->setParameter($a_gui_class, "totransl", $_GET["totransl"]);
1327 }
1328 $entries = true;
1329 }
1330
1331 if ($entries) {
1332 $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $list->getHTML() . "</div>";
1333 }
1334 $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1335 }
1336
1337 return $ml_head;
1338 }
1339
1340
1341 /*
1342 * List all pages of learning module
1343 */
1344 public function pages()
1345 {
1346 $tpl = $this->tpl;
1347 $ilToolbar = $this->toolbar;
1349 $lng = $this->lng;
1350
1351 $this->setTabs();
1352 $this->setContentSubTabs("pages");
1353
1354 $ilCtrl->setParameter($this, "backcmd", "pages");
1355 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1356 $ilToolbar->addButton(
1357 $lng->txt("pg_add"),
1358 $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1359 );
1360 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1361
1362 include_once("./Modules/LearningModule/classes/class.ilLMPagesTableGUI.php");
1363 $t = new ilLMPagesTableGUI($this, "pages", $this->object);
1364 $tpl->setContent($t->getHTML());
1365 }
1366
1370 public function listLinks()
1371 {
1372 $tpl = $this->tpl;
1373
1374 $this->setTabs();
1375 $this->setContentSubTabs("internal_links");
1376
1377 include_once("./Modules/LearningModule/classes/class.ilLinksTableGUI.php");
1378 $table_gui = new ilLinksTableGUI(
1379 $this,
1380 "listLinks",
1381 $this->object->getId(),
1382 $this->object->getType()
1383 );
1384
1385 $tpl->setContent($table_gui->getHTML());
1386 }
1387
1391 public function showMaintenance()
1392 {
1393 $ilToolbar = $this->toolbar;
1394
1395 $this->setTabs();
1396 $this->setContentSubTabs("maintenance");
1397
1398 $ilToolbar->addButton(
1399 $this->lng->txt("cont_fix_tree"),
1400 $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1401 );
1402 }
1403
1407 public function activatePages()
1408 {
1409 if (is_array($_POST["id"])) {
1410 foreach ($_POST["id"] as $id) {
1411 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1412 $act = ilLMPage::_lookupActive($id, $this->object->getType());
1413 ilLMPage::_writeActive($id, $this->object->getType(), !$act);
1414 }
1415 }
1416
1417 $this->ctrl->redirect($this, "pages");
1418 }
1419
1423 public function pastePage()
1424 {
1426
1428 $ilErr->raiseError($this->lng->txt("no_page_in_clipboard"), $ilErr->MESSAGE);
1429 }
1430
1431 // paste selected object
1433
1434 // copy page, if action is copy
1435 if (ilEditClipboard::getAction() == "copy") {
1436 // check wether page belongs to lm
1438 == $this->object->getID()) {
1439 $lm_page = new ilLMPageObject($this->object, $id);
1440 $new_page = $lm_page->copy();
1441 $id = $new_page->getId();
1442 } else {
1443 // get page from other content object into current content object
1445 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1446 $lm_page = new ilLMPageObject($lm_obj, $id);
1447 $copied_nodes = array();
1448 $new_page = $lm_page->copyToOtherContObject($this->object, $copied_nodes);
1449 $id = $new_page->getId();
1450 ilLMObject::updateInternalLinks($copied_nodes);
1451 }
1452 }
1453
1454 // cut is not be possible in "all pages" form yet
1455 if (ilEditClipboard::getAction() == "cut") {
1456 // check wether page belongs not to lm
1458 != $this->object->getID()) {
1460 $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1461 $lm_page = new ilLMPageObject($lm_obj, $id);
1462 $lm_page->setLMId($this->object->getID());
1463 $lm_page->update();
1464 $page = $lm_page->getPageObject();
1465 $page->buildDom();
1466 $page->setParentId($this->object->getID());
1467 $page->update();
1468 }
1469 }
1470
1471
1473 $this->ctrl->redirect($this, "pages");
1474 }
1475
1479 public function copyPage()
1480 {
1482
1483 if (!isset($_POST["id"])) {
1484 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1485 }
1486
1487 $items = ilUtil::stripSlashesArray($_POST["id"]);
1488 ilLMObject::clipboardCopy($this->object->getId(), $items);
1490
1491 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_copied"), true);
1492
1493 $this->ctrl->redirect($this, "pages");
1494 }
1495
1503 public function delete($a_parent_subobj_id = 0)
1504 {
1506
1507 if (!isset($_POST["id"])) {
1508 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1509 }
1510
1511 if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1512 $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1513 }
1514
1515 if ($a_parent_subobj_id == 0) {
1516 $this->setTabs();
1517 }
1518
1519 if ($a_parent_subobj_id != 0) {
1520 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
1521 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1522 $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1523 } else {
1524 $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
1525 $form_action = $this->ctrl->getFormAction($this);
1526 }
1527
1528 // display confirmation message
1529 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1530 $cgui = new ilConfirmationGUI();
1531 $cgui->setFormAction($form_action);
1532 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1533 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1534 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1535
1536 foreach ($_POST["id"] as $id) {
1537 if ($id != IL_FIRST_NODE) {
1538 $obj = new ilLMObject($this->object, $id);
1539 $caption = ilUtil::getImageTagByType($obj->getType(), $this->tpl->tplPath) .
1540 " " . $obj->getTitle();
1541
1542 $cgui->addItem("id[]", $id, $caption);
1543 }
1544 }
1545
1546 $this->tpl->setContent($cgui->getHTML());
1547 }
1548
1552 public function cancelDelete()
1553 {
1554 $this->ctrl->redirect($this, $_GET["backcmd"]);
1555 }
1556
1564 public function confirmedDelete($a_parent_subobj_id = 0)
1565 {
1567
1568 $tree = new ilTree($this->object->getId());
1569 $tree->setTableNames('lm_tree', 'lm_data');
1570 $tree->setTreeTablePK("lm_id");
1571
1572 // check number of objects
1573 if (!$_POST["id"]) {
1574 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1575 }
1576
1577 // delete all selected objects
1578 foreach ($_POST["id"] as $id) {
1579 if ($id != IL_FIRST_NODE) {
1580 $obj = ilLMObjectFactory::getInstance($this->object, $id, false);
1581 $node_data = $tree->getNodeData($id);
1582 if (is_object($obj)) {
1583 $obj->setLMId($this->object->getId());
1584
1585 include_once("./Services/History/classes/class.ilHistory.php");
1587 $this->object->getId(),
1588 "delete_" . $obj->getType(),
1590 $this->object->getType()
1591 );
1592
1593 $obj->delete();
1594 }
1595 if ($tree->isInTree($id)) {
1596 $tree->deleteTree($node_data);
1597 }
1598 }
1599 }
1600
1601 // check the tree
1602 $this->object->checkTree();
1603
1604 // feedback
1605 ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
1606
1607 if ($a_parent_subobj_id == 0) {
1608 $this->ctrl->redirect($this, $_GET["backcmd"]);
1609 }
1610 }
1611
1612
1613
1620 public function getContextPath($a_endnode_id, $a_startnode_id = 1)
1621 {
1622 $path = "";
1623
1624 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1625
1626 // count -1, to exclude the learning module itself
1627 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1628 if ($path != "") {
1629 $path .= " > ";
1630 }
1631
1632 $path .= $tmpPath[$i]["title"];
1633 }
1634
1635 return $path;
1636 }
1637
1638
1639
1645 public function showActions($a_actions)
1646 {
1647 foreach ($a_actions as $name => $lng) {
1648 $d[$name] = array("name" => $name, "lng" => $lng);
1649 }
1650
1651 $notoperations = array();
1652
1653 $operations = array();
1654
1655 if (is_array($d)) {
1656 foreach ($d as $row) {
1657 if (!in_array($row["name"], $notoperations)) {
1658 $operations[] = $row;
1659 }
1660 }
1661 }
1662
1663 if (count($operations) > 0) {
1664 foreach ($operations as $val) {
1665 $this->tpl->setCurrentBlock("operation_btn");
1666 $this->tpl->setVariable("BTN_NAME", $val["name"]);
1667 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1668 $this->tpl->parseCurrentBlock();
1669 }
1670
1671 $this->tpl->setCurrentBlock("operation");
1672 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1673 $this->tpl->parseCurrentBlock();
1674 }
1675 }
1676
1680 public function view()
1681 {
1682 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1683 $this->prepareOutput();
1684 parent::viewObject();
1685 } else {
1686 $this->viewObject();
1687 }
1688 }
1689
1690
1694 public function moveChapter($a_parent_subobj_id = 0)
1695 {
1697
1698 if (!isset($_POST["id"])) {
1699 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1700 }
1701 if (count($_POST["id"]) > 1) {
1702 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1703 }
1704
1705 if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1706 $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1707 }
1708
1709 // SAVE POST VALUES
1710 ilEditClipboard::storeContentObject("st", $_POST["id"][0], "move");
1711
1712 ilUtil::sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
1713
1714 if ($a_parent_subobj_id == 0) {
1715 $this->ctrl->redirect($this, "chapters");
1716 }
1717 }
1718
1719
1723 public function copyChapter($a_parent_subobj_id = 0)
1724 {
1725 $this->copyItems();
1726 }
1727
1731 public function pasteChapter($a_parent_subobj_id = 0)
1732 {
1733 return $this->insertChapterClip(false);
1734 }
1735
1739 public function movePage()
1740 {
1742
1743 if (!isset($_POST["id"])) {
1744 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1745 }
1746
1747 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_cut"), true);
1748
1749 $items = ilUtil::stripSlashesArray($_POST["id"]);
1750 ilLMObject::clipboardCut($this->object->getId(), $items);
1752
1753 $this->ctrl->redirect($this, "pages");
1754 }
1755
1759 public function cancel()
1760 {
1761 if ($_GET["new_type"] == "pg") {
1762 $this->ctrl->redirect($this, "pages");
1763 } else {
1764 $this->ctrl->redirect($this, "chapters");
1765 }
1766 }
1767
1768
1772 public function export()
1773 {
1774 $ot = ilObjectTranslation::getInstance($this->object->getId());
1775 $opt = "";
1776 if ($ot->getContentActivated()) {
1777 $format = explode("_", $_POST["format"]);
1778 $opt = ilUtil::stripSlashes($format[1]);
1779 }
1780
1781
1782 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
1783 $cont_exp = new ilContObjectExport($this->object);
1784 $cont_exp->buildExportFile($opt);
1785 // $this->ctrl->redirect($this, "exportList");
1786 }
1787
1791 public function getPublicAccessColValue($a_type, $a_file)
1792 {
1793 $lng = $this->lng;
1795
1796 $changelink = "<a href='" . $ilCtrl->getLinkTarget($this, "editMenuProperties") . "'>" . $lng->txt("change") . "</a>";
1797 if (!$this->object->isActiveLMMenu()) {
1798 $add = "<br />" . $lng->txt("cont_download_no_menu") . " " . $changelink;
1799 } elseif (!$this->object->isActiveDownloads()) {
1800 $add = "<br />" . $lng->txt("cont_download_no_download") . " " . $changelink;
1801 }
1802
1803 $basetype = explode("_", $a_type);
1804 $basetype = $basetype[0];
1805
1806 if ($this->object->getPublicExportFile($basetype) == $a_file) {
1807 return $lng->txt("yes") . $add;
1808 }
1809
1810 return " ";
1811 }
1812
1813
1814
1818 public function publishExportFile($a_files)
1819 {
1821
1822 if (!isset($a_files)) {
1823 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1824 } else {
1825 foreach ($a_files as $f) {
1826 $file = explode(":", $f);
1827 if (is_int(strpos($file[0], "_"))) {
1828 $file[0] = explode("_", $file[0])[0];
1829 }
1830 $export_dir = $this->object->getExportDirectory($file[0]);
1831
1832 if ($this->object->getPublicExportFile($file[0]) ==
1833 $file[1]) {
1834 $this->object->setPublicExportFile($file[0], "");
1835 } else {
1836 $this->object->setPublicExportFile($file[0], $file[1]);
1837 }
1838 }
1839 $this->object->update();
1840 }
1841 $ilCtrl->redirectByClass("ilexportgui");
1842 }
1843
1847 public function downloadPDFFile()
1848 {
1850
1851 if (!isset($_POST["file"])) {
1852 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1853 }
1854
1855 if (count($_POST["file"]) > 1) {
1856 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1857 }
1858
1859
1860 $export_dir = $this->object->getOfflineDirectory();
1861
1862 $file = basename($_POST["file"][0]);
1863
1864 ilUtil::deliverFile($export_dir . "/" . $file, $file);
1865 }
1866
1867
1872 public function fixTreeConfirm()
1873 {
1874 $this->setTabs();
1875 $this->setContentSubTabs("maintenance");
1876
1877 // display confirmation message
1878 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1879 $cgui = new ilConfirmationGUI();
1880 $cgui->setFormAction($this->ctrl->getFormAction($this));
1881 $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1882 $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1883 $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1884 $issues = $this->object->checkStructure();
1885 $mess = "";
1886 if (count($issues) > 0) {
1887 $mess = "Found Issues: <br>" . implode("<br>", $issues);
1888 }
1889 $this->tpl->setContent($cgui->getHTML() . $mess);
1890 }
1891
1895 public function fixTree()
1896 {
1897 $this->object->fixTree();
1898 ilUtil::sendSuccess($this->lng->txt("cont_tree_fixed"), true);
1899 $this->ctrl->redirect($this, "showMaintenance");
1900 }
1901
1905 public function setilLMMenu(
1906 $a_offline = false,
1907 $a_export_format = "",
1908 $a_active = "content",
1909 $a_use_global_tabs = false,
1910 $a_as_subtabs = false,
1911 $a_cur_page = 0,
1912 $a_lang = "",
1913 $a_export_all = false
1914 ) {
1917 $ilAccess = $this->access;
1918 $ilTabs = $this->tabs;
1920 $ilPluginAdmin = $this->plugin_admin;
1921 $ilHelp = $this->help;
1922
1923 $ilHelp->setScreenIdComponent("lm");
1924
1925 if ($a_as_subtabs) {
1926 $addcmd = "addSubTabTarget";
1927 $getcmd = "getSubTabHTML";
1928 } else {
1929 $addcmd = "addTarget";
1930 $getcmd = "getHTML";
1931 }
1932
1933 $active[$a_active] = true;
1934
1935 if (!$this->object->isActiveLMMenu()) {
1936 return "";
1937 }
1938
1939 if ($a_use_global_tabs) {
1940 $tabs_gui = $ilTabs;
1941 } else {
1942 $tabs_gui = new ilTabsGUI();
1943 }
1944
1945 // workaround for preventing tooltips in export
1946 if ($a_offline) {
1947 $tabs_gui->setSetupMode(true);
1948 }
1949
1950 // Determine whether the view of a learning resource should
1951 // be shown in the frameset of ilias, or in a separate window.
1952 $showViewInFrameset = true;
1953
1954 if ($showViewInFrameset && !$a_offline) {
1955 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
1956 } else {
1957 $buttonTarget = "_top";
1958 }
1959
1960 if ($a_export_format == "scorm") {
1961 $buttonTarget = "";
1962 }
1963
1964 // content
1965 if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1966 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1967 $tabs_gui->$addcmd(
1968 "content",
1969 $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"),
1970 "",
1971 "",
1972 $buttonTarget,
1973 $active["content"]
1974 );
1975 if ($active["content"]) {
1976 $ilHelp->setScreenId("content");
1977 $ilHelp->setSubScreenId("content");
1978 }
1979 } elseif ($a_offline) {
1980 $tabs_gui->setForcePresentationOfSingleTab(true);
1981 }
1982
1983 // table of contents
1984 if ($this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
1985 if (!$a_offline) {
1986 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
1987 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
1988 } else {
1989 if ($a_export_all) {
1990 $link = "./table_of_contents_" . $a_lang . ".html";
1991 } else {
1992 $link = "./table_of_contents.html";
1993 }
1994 }
1995 $tabs_gui->$addcmd(
1996 "cont_toc",
1997 $link,
1998 "",
1999 "",
2000 $buttonTarget,
2001 $active["toc"]
2002 );
2003 }
2004
2005 // print view
2006 if ($this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2007 if (!$a_offline) { // has to be implemented for offline mode
2008 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2009 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
2010 $tabs_gui->$addcmd(
2011 "cont_print_view",
2012 $link,
2013 "",
2014 "",
2015 $buttonTarget,
2016 $active["print"]
2017 );
2018 }
2019 }
2020
2021 // download
2022 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
2023 $is_public = $this->object->isActiveDownloadsPublic();
2024 } else {
2025 $is_public = true;
2026 }
2027
2028 if ($this->object->isActiveDownloads() && !$a_offline && $is_public &&
2029 $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2030 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2031 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
2032 $tabs_gui->$addcmd(
2033 "download",
2034 $link,
2035 "",
2036 "",
2037 $buttonTarget,
2038 $active["download"]
2039 );
2040 }
2041
2042 // info button
2043 if ($a_export_format != "scorm" && !$a_offline) {
2044 if (!$a_offline) {
2045 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2046 $link = $this->ctrl->getLinkTargetByClass(
2047 array("illmpresentationgui", "ilinfoscreengui"),
2048 "showSummary"
2049 );
2050 } else {
2051 $link = "./info.html";
2052 }
2053
2054 $tabs_gui->$addcmd(
2055 'info_short',
2056 $link,
2057 "",
2058 "",
2059 $buttonTarget,
2060 $active["info"]
2061 );
2062 }
2063
2064 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2065 if (!$a_offline &&
2066 $ilAccess->checkAccess("read", "", $_GET["ref_id"]) && // #14075
2068 include_once './Services/Object/classes/class.ilObjectLP.php';
2069 $olp = ilObjectLP::getInstance($this->object->getId());
2070 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
2071 $tabs_gui->$addcmd(
2072 "learning_progress",
2073 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editManual"),
2074 "",
2075 "",
2076 $buttonTarget,
2077 $active["learning_progress"]
2078 );
2079 } elseif ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
2080 $tabs_gui->$addcmd(
2081 "learning_progress",
2082 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"),
2083 "",
2084 "",
2085 $buttonTarget,
2086 $active["learning_progress"]
2087 );
2088 }
2089 }
2090
2091 // get user defined menu entries
2092 $this->__initLMMenuEditor();
2093 $entries = $this->lmme_obj->getMenuEntries(true);
2094 if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2095 foreach ($entries as $entry) {
2096 // build goto-link for internal resources
2097 if ($entry["type"] == "intern") {
2098 $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
2099 }
2100
2101 // add http:// prefix if not exist
2102 if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
2103 $entry["link"] = "http://" . $entry["link"];
2104 }
2105
2106 if (!strstr($entry["link"], 'mailto:')) {
2107 $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->ref_id . "&structure_id=" . $this->obj_id);
2108 }
2109 $tabs_gui->$addcmd(
2110 $entry["title"],
2111 $entry["link"],
2112 "",
2113 "",
2114 "_blank",
2115 "",
2116 true
2117 );
2118 }
2119 }
2120
2121 // edit learning module
2122 if (!$a_offline && $a_cur_page > 0) {
2123 if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
2124 //$page_id = $this->getCurrentPageId();
2125 $page_id = $a_cur_page;
2126 $tabs_gui->$addcmd(
2127 "edit_page",
2128 ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] .
2129 "&obj_id=" . $page_id . "&to_page=1",
2130 "",
2131 "",
2132 $buttonTarget,
2133 $active["edit_page"]
2134 );
2135 }
2136 }
2137
2138 // user interface hook [uihk]
2139 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
2140 $plugin_html = false;
2141 foreach ($pl_names as $pl) {
2142 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
2143 $gui_class = $ui_plugin->getUIClassInstance();
2144 $resp = $gui_class->modifyGUI(
2145 "Modules/LearningModule",
2146 "lm_menu_tabs",
2147 array("lm_menu_tabs" => $tabs_gui)
2148 );
2149 }
2150
2151 return $tabs_gui->$getcmd();
2152 }
2153
2157 public function createPDF()
2158 {
2159 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2160 $cont_exp = new ilContObjectExport($this->object, "pdf");
2161 $cont_exp->buildExportFile();
2162 $this->offlineList();
2163 }
2164
2168 public function exportHTML()
2169 {
2170 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2171 $ot = ilObjectTranslation::getInstance($this->object->getId());
2172 $lang = "";
2173 if ($ot->getContentActivated()) {
2174 $format = explode("_", $_POST["format"]);
2176 }
2177 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2178 $cont_exp = new ilContObjectExport($this->object, "html", $lang);
2179 $cont_exp->buildExportFile();
2180 }
2181
2185 public function exportSCORM()
2186 {
2187 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2188 $cont_exp = new ilContObjectExport($this->object, "scorm");
2189 $cont_exp->buildExportFile();
2190 }
2191
2197 public function addLocations($a_omit_obj_id = false)
2198 {
2200
2201 if (!$a_omit_obj_id) {
2202 $obj_id = $_GET["obj_id"];
2203 }
2204 $lmtree = $this->object->getTree();
2205
2206 if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
2207 $path = $lmtree->getPathFull($obj_id);
2208 } else {
2209 $path = $lmtree->getPathFull($lmtree->getRootId());
2210 if ($obj_id != 0) {
2211 $path[] = array("type" => "pg", "child" => $this->obj_id,
2212 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
2213 }
2214 }
2215
2216 foreach ($path as $key => $row) {
2217 if ($row["child"] == 1) {
2218 $this->ctrl->setParameter($this, "obj_id", "");
2219 $locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "chapters"));
2220 } else {
2221 $title = $row["title"];
2222 switch ($row["type"]) {
2223 case "st":
2224 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
2225 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
2226 break;
2227
2228 case "pg":
2229 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
2230 $locator->addItem($title, $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
2231 break;
2232 }
2233 }
2234 }
2235 if (!$a_omit_obj_id) {
2236 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
2237 }
2238 }
2239
2243
2244
2248 public function listQuestions()
2249 {
2250 $tpl = $this->tpl;
2251
2252 $this->setTabs("questions");
2253 $this->setQuestionsSubTabs("question_stats");
2254
2255 include_once("./Modules/LearningModule/classes/class.ilLMQuestionListTableGUI.php");
2256 $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->object);
2257 $tpl->setContent($table->getHTML());
2258 }
2259
2263 public function listBlockedUsers()
2264 {
2265 $tpl = $this->tpl;
2266
2267 $this->setTabs("questions");
2268 $this->setQuestionsSubTabs("blocked_users");
2269
2270 include_once("./Modules/LearningModule/classes/class.ilLMBlockedUsersTableGUI.php");
2271 $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->object);
2272 $tpl->setContent($table->getHTML());
2273 }
2274
2278 public function resetNumberOfTries()
2279 {
2280 $lng = $this->lng;
2282
2283 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2284 if (is_array($_POST["userquest_id"])) {
2285 foreach ($_POST["userquest_id"] as $uqid) {
2286 $uqid = explode(":", $uqid);
2287 ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
2288 }
2289 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2290 }
2291 $ilCtrl->redirect($this, "listBlockedUsers");
2292 }
2293
2297 public function unlockQuestion()
2298 {
2299 $lng = $this->lng;
2301
2302 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2303 if (is_array($_POST["userquest_id"])) {
2304 foreach ($_POST["userquest_id"] as $uqid) {
2305 $uqid = explode(":", $uqid);
2306 ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
2307 }
2308 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2309 }
2310 $ilCtrl->redirect($this, "listBlockedUsers");
2311 }
2312
2316 public function sendMailToBlockedUsers()
2317 {
2319
2320 if (!is_array($_POST["userquest_id"])) {
2321 ilUtil::sendFailure($this->lng->txt("no_checkbox"), 1);
2322 $ilCtrl->redirect($this, "listBlockedUsers");
2323 }
2324
2325 $rcps = array();
2326 foreach ($_POST["userquest_id"] as $uqid) {
2327 $uqid = explode(":", $uqid);
2328 $login = ilObjUser::_lookupLogin($uqid[1]);
2329 if (!in_array($login, $rcps)) {
2330 $rcps[] = $login;
2331 }
2332 }
2333 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
2335 $this,
2336 'listBlockedUsers',
2337 array(),
2338 array(
2339 'type' => 'new',
2340 'rcp_to' => implode(',', $rcps),
2341 'sig' => $this->getBlockedUsersMailSignature()
2342 )
2343 ));
2344 }
2345
2349 protected function getBlockedUsersMailSignature()
2350 {
2351 $link = chr(13) . chr(10) . chr(13) . chr(10);
2352 $link .= $this->lng->txt('cont_blocked_users_mail_link');
2353 $link .= chr(13) . chr(10) . chr(13) . chr(10);
2354 include_once './Services/Link/classes/class.ilLink.php';
2355 $link .= ilLink::_getLink($this->object->getRefId());
2356 return rawurlencode(base64_encode($link));
2357 }
2358
2359
2363
2364
2368 public function setTabs($a_act = "")
2369 {
2370 $lng = $this->lng;
2371 $ilHelp = $this->help;
2372
2373 $ilHelp->setScreenIdComponent("lm");
2374
2375 $this->addTabs($a_act);
2376 parent::setTitleAndDescription();
2377 $this->tpl->setTitle($this->object->getTitle());
2378 $this->tpl->setTitleIcon(
2379 ilUtil::getImagePath("icon_lm.svg"),
2380 $lng->txt("obj_lm")
2381 );
2382 }
2383
2389 public function setContentSubTabs($a_active)
2390 {
2391 $ilTabs = $this->tabs;
2392 $lng = $this->lng;
2394
2395 $lm_set = new ilSetting("lm");
2396
2397 // chapters
2398 $ilTabs->addSubtab(
2399 "chapters",
2400 $lng->txt("cont_chapters"),
2401 $ilCtrl->getLinkTarget($this, "chapters")
2402 );
2403
2404 // all pages
2405 $ilTabs->addSubtab(
2406 "pages",
2407 $lng->txt("cont_all_pages"),
2408 $ilCtrl->getLinkTarget($this, "pages")
2409 );
2410
2411 // all pages
2412 $ilTabs->addSubtab(
2413 "short_titles",
2414 $lng->txt("cont_short_titles"),
2415 $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
2416 );
2417
2418 // export ids
2419 if ($lm_set->get("html_export_ids")) {
2420 if (!ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2421 $ilTabs->addSubtab(
2422 "export_ids",
2423 $lng->txt("cont_html_export_ids"),
2424 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2425 );
2426 }
2427 }
2428 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2429 $lng->loadLanguageModule("help");
2430 $ilTabs->addSubtab(
2431 "export_ids",
2432 $lng->txt("cont_online_help_ids"),
2433 $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2434 );
2435
2436 $ilTabs->addSubtab(
2437 "help_tooltips",
2438 $lng->txt("help_tooltips"),
2439 $ilCtrl->getLinkTarget($this, "showTooltipList")
2440 );
2441 }
2442
2443 // list links
2444 $ilTabs->addSubtab(
2445 "internal_links",
2446 $lng->txt("cont_internal_links"),
2447 $ilCtrl->getLinkTarget($this, "listLinks")
2448 );
2449
2450 // web link checker
2451 $ilTabs->addSubtab(
2452 "link_check",
2453 $lng->txt("link_check"),
2454 $ilCtrl->getLinkTarget($this, "linkChecker")
2455 );
2456
2457 $ilTabs->addSubtab(
2458 "history",
2459 $lng->txt("history"),
2460 $this->ctrl->getLinkTarget($this, "history")
2461 );
2462
2463 // maintenance
2464 $ilTabs->addSubtab(
2465 "maintenance",
2466 $lng->txt("cont_maintenance"),
2467 $ilCtrl->getLinkTarget($this, "showMaintenance")
2468 );
2469
2470 // srt files
2471 $ilTabs->addSubtab(
2472 "srt_files",
2473 $lng->txt("cont_subtitle_files"),
2474 $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
2475 );
2476
2477 // srt files
2478 $ilTabs->addSubtab(
2479 "import",
2480 $lng->txt("cont_import"),
2481 $ilCtrl->getLinkTargetByClass("illmimportgui", "")
2482 );
2483
2484 $ilTabs->activateSubTab($a_active);
2485 $ilTabs->activateTab("content");
2486 }
2487
2493 public function setQuestionsSubTabs($a_active)
2494 {
2495 $ilTabs = $this->tabs;
2496 $lng = $this->lng;
2498
2499 // chapters
2500 $ilTabs->addSubtab(
2501 "question_stats",
2502 $lng->txt("cont_question_stats"),
2503 $ilCtrl->getLinkTarget($this, "listQuestions")
2504 );
2505
2506 // blocked users
2507 $ilTabs->addSubtab(
2508 "blocked_users",
2509 $lng->txt("cont_blocked_users"),
2510 $ilCtrl->getLinkTarget($this, "listBlockedUsers")
2511 );
2512
2513 $ilTabs->activateSubTab($a_active);
2514 }
2515
2519 public function addTabs($a_act = "")
2520 {
2522 $ilTabs = $this->tabs;
2523 $lng = $this->lng;
2524
2525 // content
2526 $ilTabs->addTab(
2527 "content",
2528 $lng->txt("content"),
2529 $this->ctrl->getLinkTarget($this, "chapters")
2530 );
2531
2532 // info
2533 $ilTabs->addTab(
2534 "info",
2535 $lng->txt("info_short"),
2536 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
2537 );
2538
2539 // settings
2540 $ilTabs->addTab(
2541 "settings",
2542 $lng->txt("settings"),
2543 $this->ctrl->getLinkTarget($this, 'properties')
2544 );
2545
2546 // questions
2547 $ilTabs->addTab(
2548 "questions",
2549 $lng->txt("objs_qst"),
2550 $this->ctrl->getLinkTarget($this, "listQuestions")
2551 );
2552
2553 // learning progress
2554 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2555 if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) and ($this->object->getType() == 'lm')) {
2556 $ilTabs->addTab(
2557 'learning_progress',
2558 $lng->txt("learning_progress"),
2559 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
2560 );
2561 }
2562
2563 if ($this->object->getType() != "lm") {
2564 // bibliographical data
2565 $ilTabs->addTab(
2566 "bib_data",
2567 $lng->txt("bib_data"),
2568 $this->ctrl->getLinkTarget($this, "editBibItem")
2569 );
2570 }
2571
2572 // meta data
2573 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
2574 $mdgui = new ilObjectMetaDataGUI($this->object);
2575 $mdtab = $mdgui->getTab();
2576 if ($mdtab) {
2577 $ilTabs->addTab(
2578 "meta",
2579 $lng->txt("meta_data"),
2580 $mdtab
2581 );
2582 }
2583
2584 if ($this->object->getType() == "lm") {
2585 // export
2586 $ilTabs->addTab(
2587 "export",
2588 $lng->txt("export"),
2589 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
2590 );
2591 }
2592
2593 // permissions
2594 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
2595 $ilTabs->addTab(
2596 "perm",
2597 $lng->txt("perm_settings"),
2598 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
2599 );
2600 }
2601
2602 if ($a_act != "") {
2603 $ilTabs->activateTab($a_act);
2604 }
2605
2606 // presentation view
2607 $ilTabs->addNonTabbedLink(
2608 "pres_mode",
2609 $lng->txt("cont_presentation_view"),
2610 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->object->getRefID(),
2611 "_top"
2612 );
2613 }
2614
2618 public function setSubTabs($a_active)
2619 {
2620 $ilTabs = $this->tabs;
2622
2623 if (in_array(
2624 $a_active,
2625 array("settings", "cont_style", "cont_lm_menu", "public_section",
2626 "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
2627 "lti_provider")
2628 )) {
2629 // general properties
2630 $ilTabs->addSubTabTarget(
2631 "settings",
2632 $this->ctrl->getLinkTarget($this, 'properties'),
2633 "",
2634 ""
2635 );
2636
2637 // style properties
2638 $ilTabs->addSubTabTarget(
2639 "cont_style",
2640 $this->ctrl->getLinkTarget($this, 'editStyleProperties'),
2641 "",
2642 ""
2643 );
2644
2645 // menu properties
2646 $ilTabs->addSubTabTarget(
2647 "cont_lm_menu",
2648 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
2649 "",
2650 ""
2651 );
2652
2653 // glossaries
2654 $ilTabs->addSubTabTarget(
2655 "cont_glossaries",
2656 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
2657 "",
2658 ""
2659 );
2660
2661 if ($ilSetting->get("pub_section")) {
2662 // public section
2663 $ilTabs->addSubTabTarget(
2664 "public_section",
2665 $this->ctrl->getLinkTarget($this, 'editPublicSection'),
2666 "",
2667 ""
2668 );
2669 }
2670
2671 $ilTabs->addSubTabTarget(
2672 "obj_multilinguality",
2673 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
2674 );
2675
2676 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2677 if ($lti_settings->hasSettingsAccess()) {
2678 $ilTabs->addSubTabTarget(
2679 'lti_provider',
2680 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
2681 );
2682 }
2683
2684 $ilTabs->setSubTabActive($a_active);
2685 }
2686 }
2687
2688 public function editPublicSection()
2689 {
2690 $ilTabs = $this->tabs;
2691 $ilToolbar = $this->toolbar;
2692 $ilAccess = $this->access;
2693
2694
2695 if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->object->getRefId())) {
2696 ilUtil::sendInfo($this->lng->txt("cont_anonymous_user_missing_perm"));
2697 }
2698
2699 $this->setTabs();
2700 $this->setSubTabs("public_section");
2701 $ilTabs->setTabActive("settings");
2702
2703 $this->tpl->addBlockFile(
2704 "ADM_CONTENT",
2705 "adm_content",
2706 "tpl.lm_public_selector.html",
2707 "Modules/LearningModule"
2708 );
2709
2710 // get learning module object
2711 $this->lm_obj = new ilObjLearningModule($this->ref_id, true);
2712
2713
2714 // public mode
2715 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
2716 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2717 $si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
2718 $si->setOptions($modes);
2719 $si->setValue($this->object->getPublicAccessMode());
2720 $ilToolbar->addInputItem($si, true);
2721 $ilToolbar->addFormButton($this->lng->txt("save"), "savePublicSectionAccess");
2722 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "savePublicSectionAccess"));
2723
2724 if ($this->object->getPublicAccessMode() == "selected") {
2725 $this->tpl->setCurrentBlock("select_pages");
2726 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSectionPages"));
2727
2728 include_once("./Modules/LearningModule/classes/class.ilPublicSectionExplorerGUI.php");
2729 $tree = new ilPublicSectionExplorerGUI($this, "editPublicSection", $this->lm_obj);
2730 $tree->setSelectMode("pages", true);
2731 $tree->setSkipRootNode(true);
2732
2733 $this->tpl->setVariable("EXPLORER", $tree->getHTML());
2734 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2735
2736 $this->tpl->parseCurrentBlock();
2737 }
2738 }
2739
2740 public function savePublicSection()
2741 {
2742 //var_dump($_POST["lm_public_mode"]);exit;
2743 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2744 $this->object->updateProperties();
2745 ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2746 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2747 $this->ctrl->redirect($this, "editPublicSection");
2748 }
2749
2753 public function savePublicSectionAccess()
2754 {
2755 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2756 $this->object->updateProperties();
2757 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2758 $this->ctrl->redirect($this, "editPublicSection");
2759 }
2760
2764 public function savePublicSectionPages()
2765 {
2766 ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2767 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2768 $this->ctrl->redirect($this, "editPublicSection");
2769 }
2770
2776 public function history()
2777 {
2778 $this->setTabs("content");
2779 $this->setContentSubTabs("history");
2780
2781 require_once("./Services/History/classes/class.ilHistoryTableGUI.php");
2782 $hist_gui = new ilHistoryTableGUI(
2783 $this,
2784 "history",
2785 $this->object->getId(),
2786 $this->object->getType()
2787 );
2788 $hist_gui->initTable();
2789 $hist_gui->setCommentVisibility($this->object->isActiveHistoryUserComments());
2790
2791 $this->tpl->setContent($hist_gui->getHTML());
2792 }
2793
2802 public function formatInvalidLinkArray(array $row)
2803 {
2804 $row['title'] = ilLMPageObject::_getPresentationTitle($row['page_id'], $this->object->getPageHeader());
2805
2806 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
2808 $actions->setSelectionHeaderClass('small');
2809 $actions->setItemLinkClass('xsmall');
2810 $actions->setListTitle($this->lng->txt('actions'));
2811 $actions->setId($row['page_id']);
2812 $this->ctrl->setParameterByClass('ilLMPageObjectGUI', 'obj_id', $row['page_id']);
2813 $actions->addItem(
2814 $this->lng->txt('edit'),
2815 '',
2816 $this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI', 'edit')
2817 );
2818 $this->ctrl->clearParametersByClass('ilLMPageObjectGUI');
2819 $row['action_html'] = $actions->getHTML();
2820
2821 return $row;
2822 }
2823
2824 public function linkChecker()
2825 {
2827 $tpl = $this->tpl;
2828
2829 $this->__initLinkChecker();
2830
2831 $this->setTabs();
2832 $this->setContentSubTabs("link_check");
2833
2834 require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
2835
2836 $toolbar = new ilToolbarGUI();
2837
2838 // #13684
2839 include_once "Services/Cron/classes/class.ilCronManager.php";
2840 if (ilCronManager::isJobActive("lm_link_check")) {
2841 include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
2842 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2843
2844 $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
2845 $chb->setValue(1);
2846 $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
2847 $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
2848
2849 $toolbar->addInputItem($chb);
2850 $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
2851 $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
2852 }
2853
2854 $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
2855 $tgui->setLinkChecker($this->link_checker_obj)
2856 ->setRowHandler($this)
2857 ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
2858
2859 return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
2860 }
2861
2862 public function saveLinkCheck()
2863 {
2864 $ilDB = $this->db;
2866
2867 include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
2868
2869 $link_check_notify = new ilLinkCheckNotify($ilDB);
2870 $link_check_notify->setUserId($ilUser->getId());
2871 $link_check_notify->setObjId($this->object->getId());
2872
2873 if ($_POST['link_check_message']) {
2874 ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
2875 $link_check_notify->addNotifier();
2876 } else {
2877 ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
2878 $link_check_notify->deleteNotifier();
2879 }
2880 $this->linkChecker();
2881
2882 return true;
2883 }
2884
2885
2886
2887 public function refreshLinkCheck()
2888 {
2889 $this->__initLinkChecker();
2890 $this->link_checker_obj->checkLinks();
2891 ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
2892
2893 $this->linkChecker();
2894
2895 return true;
2896 }
2897
2898 public function __initLinkChecker()
2899 {
2900 $ilDB = $this->db;
2901
2902 include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
2903
2904 $this->link_checker_obj = new ilLinkChecker($ilDB, false);
2905 $this->link_checker_obj->setObjId($this->object->getId());
2906
2907 return true;
2908 }
2909
2910 public function __initLMMenuEditor()
2911 {
2912 include_once './Modules/LearningModule/classes/class.ilLMMenuEditor.php';
2913
2914 $this->lmme_obj = new ilLMMenuEditor();
2915 $this->lmme_obj->setObjId($this->object->getId());
2916
2917 return true;
2918 }
2919
2923 public function addMenuEntry()
2924 {
2925 $ilTabs = $this->tabs;
2926 $ilToolbar = $this->toolbar;
2927 $tpl = $this->tpl;
2929
2930 $this->setTabs();
2931
2932 $ilTabs->setTabActive("settings");
2933 $this->setSubTabs("cont_lm_menu");
2934
2935 $ilToolbar->addButton(
2936 $this->lng->txt("lm_menu_select_internal_object"),
2937 $ilCtrl->getLinkTarget($this, "showEntrySelector")
2938 );
2939
2940 $form = $this->initMenuEntryForm("create");
2941 $this->tpl->setContent($form->getHTML());
2942 }
2943
2949 public function initMenuEntryForm($a_mode = "edit")
2950 {
2951 $lng = $this->lng;
2953
2954 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2955 $form = new ilPropertyFormGUI();
2956
2957 // title
2958 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2959 $ti->setMaxLength(255);
2960 $ti->setSize(40);
2961 $form->addItem($ti);
2962
2963 // target
2964 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2965 $ta->setMaxLength(255);
2966 $ta->setSize(40);
2967 $form->addItem($ta);
2968
2969 if ($a_mode == "edit") {
2970 $this->__initLMMenuEditor();
2971 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
2972 $ti->setValue($this->lmme_obj->getTitle());
2973 $ta->setValue($this->lmme_obj->getTarget());
2974 }
2975
2976 if (isset($_GET["link_ref_id"])) {
2977 $link_ref_id = (int) $_GET["link_ref_id"];
2978 $obj_type = ilObject::_lookupType($link_ref_id, true);
2979 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2981
2982 $target_link = $obj_type . "_" . $link_ref_id;
2983 $ti->setValue($title);
2984 $ta->setValue($target_link);
2985
2986 // link ref id
2987 $hi = new ilHiddenInputGUI("link_ref_id");
2988 $hi->setValue($link_ref_id);
2989 $form->addItem($hi);
2990 }
2991
2992
2993 // save and cancel commands
2994 if ($a_mode == "create") {
2995 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2996 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2997 $form->setTitle($lng->txt("lm_menu_new_entry"));
2998 } else {
2999 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
3000 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
3001 $form->setTitle($lng->txt("lm_menu_edit_entry"));
3002 }
3003
3004 $form->setFormAction($ilCtrl->getFormAction($this));
3005
3006 return $form;
3007 }
3008
3012 public function saveMenuEntry()
3013 {
3015
3016 // check title and target
3017 if (empty($_POST["title"])) {
3018 ilUtil::sendFailure($this->lng->txt("please_enter_title"), true);
3019 $ilCtrl->redirect($this, "addMenuEntry");
3020 }
3021 if (empty($_POST["target"])) {
3022 ilUtil::sendFailure($this->lng->txt("please_enter_target"), true);
3023 $ilCtrl->redirect($this, "addMenuEntry");
3024 }
3025
3026 $this->__initLMMenuEditor();
3027 $this->lmme_obj->setTitle($_POST["title"]);
3028 $this->lmme_obj->setTarget($_POST["target"]);
3029 $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
3030
3031 if ($_POST["link_ref_id"]) {
3032 $this->lmme_obj->setLinkType("intern");
3033 }
3034
3035 $this->lmme_obj->create();
3036
3037 ilUtil::sendSuccess($this->lng->txt("msg_entry_added"), true);
3038 $this->ctrl->redirect($this, "editMenuProperties");
3039 }
3040
3044 public function deleteMenuEntry()
3045 {
3047
3048 if (empty($_GET["menu_entry"])) {
3049 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3050 }
3051
3052 $this->__initLMMenuEditor();
3053 $this->lmme_obj->delete($_GET["menu_entry"]);
3054
3055 ilUtil::sendSuccess($this->lng->txt("msg_entry_removed"), true);
3056 $this->ctrl->redirect($this, "editMenuProperties");
3057 }
3058
3062 public function editMenuEntry()
3063 {
3064 $ilToolbar = $this->toolbar;
3066 $ilTabs = $this->tabs;
3068
3069 $this->setTabs();
3070
3071 $ilTabs->setTabActive("settings");
3072 $this->setSubTabs("cont_lm_menu");
3073
3074
3075 if (empty($_GET["menu_entry"])) {
3076 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3077 }
3078
3079 $ilCtrl->saveParameter($this, array("menu_entry"));
3080 $ilToolbar->addButton(
3081 $this->lng->txt("lm_menu_select_internal_object"),
3082 $ilCtrl->getLinkTarget($this, "showEntrySelector")
3083 );
3084
3085 $form = $this->initMenuEntryForm("edit");
3086 $this->tpl->setContent($form->getHTML());
3087 }
3088
3092 public function updateMenuEntry()
3093 {
3095
3096 if (empty($_REQUEST["menu_entry"])) {
3097 $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3098 }
3099
3100 // check title and target
3101 if (empty($_POST["title"])) {
3102 $ilErr->raiseError($this->lng->txt("please_enter_title"), $ilErr->MESSAGE);
3103 }
3104 if (empty($_POST["target"])) {
3105 $ilErr->raiseError($this->lng->txt("please_enter_target"), $ilErr->MESSAGE);
3106 }
3107
3108 $this->__initLMMenuEditor();
3109 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
3110 $this->lmme_obj->setTitle($_POST["title"]);
3111 $this->lmme_obj->setTarget($_POST["target"]);
3112 if ($_POST["link_ref_id"]) {
3113 $this->lmme_obj->setLinkType("intern");
3114 }
3115 if (is_int(strpos($_POST["target"], "."))) {
3116 $this->lmme_obj->setLinkType("extern");
3117 }
3118 $this->lmme_obj->update();
3119
3120 ilUtil::sendSuccess($this->lng->txt("msg_entry_updated"), true);
3121 $this->ctrl->redirect($this, "editMenuProperties");
3122 }
3123
3124 public function showEntrySelector()
3125 {
3126 $ilTabs = $this->tabs;
3128
3129 $this->setTabs();
3130
3131 $ilTabs->setTabActive("settings");
3132 $this->setSubTabs("cont_lm_menu");
3133
3134 $ilCtrl->saveParameter($this, array("menu_entry"));
3135
3136 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html", "Modules/LearningModule");
3137
3138 ilUtil::sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
3139
3140 require_once("./Modules/LearningModule/classes/class.ilLMMenuObjectSelector.php");
3141 $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this, 'test'), $this);
3142
3143 $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
3144 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showEntrySelector'));
3145 $exp->setTargetGet("ref_id");
3146 $exp->setRefId($this->cur_ref_id);
3147
3148 $sel_types = array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs',
3149 "crs", "grp", "book", "tst", "file");
3150 $exp->setSelectableTypes($sel_types);
3151
3152 // build html-output
3153 $exp->setOutput(0);
3154 $output = $exp->getOutput();
3155
3156 // get page ids
3157 foreach ($exp->format_options as $node) {
3158 if (!$node["container"]) {
3159 $pages[] = $node["child"];
3160 }
3161 }
3162
3163 // access mode selector
3164 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
3165 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
3166 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
3167 $select_public_mode = ilUtil::formSelect($this->object->getPublicAccessMode(), "lm_public_mode", $modes, false, true);
3168 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
3169
3170 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
3171 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
3172 $this->tpl->setVariable("EXPLORER", $output);
3173 $this->tpl->setVariable("ONCLICK", $js_pages);
3174 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
3175 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
3176 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3177 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
3178 }
3179
3183 public function selectHeader()
3184 {
3186
3187 if (!isset($_POST["id"])) {
3188 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3189 }
3190 if (count($_POST["id"]) > 1) {
3191 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3192 }
3193 if ($_POST["id"][0] != $this->object->getHeaderPage()) {
3194 $this->object->setHeaderPage($_POST["id"][0]);
3195 } else {
3196 $this->object->setHeaderPage(0);
3197 }
3198 $this->object->updateProperties();
3199 $this->ctrl->redirect($this, "pages");
3200 }
3201
3205 public function selectFooter()
3206 {
3208
3209 if (!isset($_POST["id"])) {
3210 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3211 }
3212 if (count($_POST["id"]) > 1) {
3213 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3214 }
3215 if ($_POST["id"][0] != $this->object->getFooterPage()) {
3216 $this->object->setFooterPage($_POST["id"][0]);
3217 } else {
3218 $this->object->setFooterPage(0);
3219 }
3220 $this->object->updateProperties();
3221 $this->ctrl->redirect($this, "pages");
3222 }
3223
3227 public function saveAllTitles()
3228 {
3230
3231 ilLMObject::saveTitles($this->object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
3232
3233 ilUtil::sendSuccess($this->lng->txt("lm_save_titles"), true);
3234 $ilCtrl->redirect($this, "chapters");
3235 }
3236
3240 public function insertChapter()
3241 {
3243 $lng = $this->lng;
3244
3245 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3246
3249
3250 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
3251 $parent_id = $this->lm_tree->getParentId($node_id);
3252 $target = $node_id;
3253 } else { // insert as first child
3254 $parent_id = $node_id;
3256 }
3257
3258 for ($i = 1; $i <= $num; $i++) {
3259 $chap = new ilStructureObject($this->object);
3260 $chap->setType("st");
3261 $chap->setTitle($lng->txt("cont_new_chap"));
3262 $chap->setLMId($this->object->getId());
3263 $chap->create();
3264 ilLMObject::putInTree($chap, $parent_id, $target);
3265 }
3266
3267 $ilCtrl->redirect($this, "chapters");
3268 }
3269
3273 public function insertChapterClip()
3274 {
3278
3279 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3280
3283
3284 $ilLog->write("InsertChapterClip, num: $num, node_id: $node_id, " .
3285 " getPostFirstChild " . ilChapterHierarchyFormGUI::getPostFirstChild());
3286
3287 if (!$first_child) { // insert after node id
3288 $parent_id = $this->lm_tree->getParentId($node_id);
3289 $target = $node_id;
3290 } else { // insert as first child
3291 $parent_id = $node_id;
3293 }
3294
3295 // copy and paste
3296 $chapters = $ilUser->getClipboardObjects("st", true);
3297 $copied_nodes = array();
3298 foreach ($chapters as $chap) {
3299 $ilLog->write("Call pasteTree, Target LM: " . $this->object->getId() . ", Chapter ID: " . $chap["id"]
3300 . ", Parent ID: " . $parent_id . ", Target: " . $target);
3301 $cid = ilLMObject::pasteTree(
3302 $this->object,
3303 $chap["id"],
3304 $parent_id,
3305 $target,
3306 $chap["insert_time"],
3307 $copied_nodes,
3308 (ilEditClipboard::getAction() == "copy")
3309 );
3310 $target = $cid;
3311 }
3312 ilLMObject::updateInternalLinks($copied_nodes);
3313
3314 if (ilEditClipboard::getAction() == "cut") {
3315 $ilUser->clipboardDeleteObjectsOfType("pg");
3316 $ilUser->clipboardDeleteObjectsOfType("st");
3318 }
3319
3320 $this->object->checkTree();
3321 $ilCtrl->redirect($this, "chapters");
3322 }
3323
3329 public static function _goto($a_target)
3330 {
3331 global $DIC;
3332
3333 $ilAccess = $DIC->access();
3334 $ilErr = $DIC["ilErr"];
3335 $lng = $DIC->language();
3336
3337 if ($ilAccess->checkAccess("read", "", $a_target)) {
3338 $_GET["baseClass"] = "ilLMPresentationGUI";
3339 $_GET["ref_id"] = $a_target;
3340 $_GET["cmd"] = "resume";
3341 include("ilias.php");
3342 exit;
3343 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
3344 $_GET["baseClass"] = "ilLMPresentationGUI";
3345 $_GET["ref_id"] = $a_target;
3346 $_GET["cmd"] = "infoScreen";
3347 include("ilias.php");
3348 exit;
3349 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
3350 ilUtil::sendFailure(sprintf(
3351 $lng->txt("msg_no_perm_read_item"),
3353 ), true);
3355 }
3356
3357
3358 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3359 }
3360
3364 public function cutItems($a_return = "chapters")
3365 {
3367 $lng = $this->lng;
3368
3369 $items = ilUtil::stripSlashesArray($_POST["id"]);
3370 if (!is_array($items)) {
3371 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3372 $ilCtrl->redirect($this, $a_return);
3373 }
3374
3375 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3376 foreach ($items as $k => $item) {
3377 if ($item < 0) {
3378 $todel[] = $k;
3379 }
3380 }
3381 foreach ($todel as $k) {
3382 unset($items[$k]);
3383 }
3384 ilLMObject::clipboardCut($this->object->getId(), $items);
3386 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
3387
3388 $ilCtrl->redirect($this, $a_return);
3389 }
3390
3394 public function copyItems()
3395 {
3397 $lng = $this->lng;
3398
3399 $items = ilUtil::stripSlashesArray($_POST["id"]);
3400 if (!is_array($items)) {
3401 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3402 $ilCtrl->redirect($this, "chapters");
3403 }
3404
3405 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3406 foreach ($items as $k => $item) {
3407 if ($item < 0) {
3408 $todel[] = $k;
3409 }
3410 }
3411 foreach ($todel as $k) {
3412 unset($items[$k]);
3413 }
3414 ilLMObject::clipboardCopy($this->object->getId(), $items);
3416 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
3417 $ilCtrl->redirect($this, "chapters");
3418 }
3419
3423 public function cutChapter()
3424 {
3425 $this->cutItems("chapters");
3426 }
3427
3431
3438 public function showExportIDsOverview($a_validation = false)
3439 {
3440 $tpl = $this->tpl;
3441 $ilToolbar = $this->toolbar;
3442 $lng = $this->lng;
3444
3445 $this->setTabs();
3446 $this->setContentSubTabs("export_ids");
3447
3448 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
3449 // toolbar
3450 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3451 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3452 $lm_tree = $this->object->getTree();
3453 $childs = $lm_tree->getChilds($lm_tree->readRootId());
3454 $options = array("" => $lng->txt("all"));
3455 foreach ($childs as $c) {
3456 $options[$c["child"]] = $c["title"];
3457 }
3458 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
3459 $si->setOptions($options);
3460 $si->setValue(ilSession::get("help_chap"));
3461 $ilToolbar->addInputItem($si, true);
3462 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
3463
3464 include_once("./Modules/LearningModule/classes/class.ilHelpMappingTableGUI.php");
3465 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation, false);
3466 } else {
3467 include_once("./Modules/LearningModule/classes/class.ilExportIDTableGUI.php");
3468 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
3469 }
3470
3471 $tpl->setContent($tbl->getHTML());
3472 }
3473
3480 public function filterHelpChapters()
3481 {
3483
3484 ilSession::set("help_chap", ilUtil::stripSlashes($_POST["help_chap"]));
3485 $ilCtrl->redirect($this, "showExportIDsOverview");
3486 }
3487
3488
3492 public function saveExportIds()
3493 {
3495 $lng = $this->lng;
3496
3497 // check all export ids
3498 $ok = true;
3499 if (is_array($_POST["exportid"])) {
3500 foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3501 if ($exp_id != "" && !preg_match(
3502 "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
3503 trim($exp_id)
3504 )) {
3505 $ok = false;
3506 }
3507 }
3508 }
3509 if (!$ok) {
3510 ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
3511 $lng->txt("cont_exp_ids_not_resp_format3") . " " .
3512 $lng->txt("cont_exp_ids_not_resp_format2"));
3513 $this->showExportIDsOverview(true);
3514 return;
3515 }
3516
3517
3518 if (is_array($_POST["exportid"])) {
3519 foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3521 $this->object->getId(),
3522 $pg_id,
3523 ilUtil::stripSlashes($exp_id),
3525 );
3526 }
3527 }
3528
3529 ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true);
3530 $ilCtrl->redirect($this, "showExportIdsOverview");
3531 }
3532
3539 public function saveHelpMapping()
3540 {
3541 $lng = $this->lng;
3543
3544 include_once("./Services/Help/classes/class.ilHelpMapping.php");
3545 if (is_array($_POST["screen_ids"])) {
3546 foreach ($_POST["screen_ids"] as $chap => $ids) {
3547 $ids = explode("\n", $ids);
3549 }
3550 }
3551 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3552 $ilCtrl->redirect($this, "showExportIdsOverview");
3553 }
3554
3558
3565 public function showTooltipList()
3566 {
3567 $tpl = $this->tpl;
3568 $ilToolbar = $this->toolbar;
3570 $lng = $this->lng;
3571
3572 $this->setTabs();
3573 $this->setContentSubTabs("help_tooltips");
3574
3575 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3576 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
3577 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
3578 $ti->setMaxLength(200);
3579 $ti->setSize(20);
3580 $ilToolbar->addInputItem($ti, true);
3581 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
3582 $ilToolbar->addSeparator();
3583
3584 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3586 if (ilSession::get("help_tt_comp") != "") {
3587 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
3588 }
3589 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
3590 $si->setOptions($options);
3591 $si->setValue(ilSession::get("help_tt_comp"));
3592 $ilToolbar->addInputItem($si, true);
3593 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
3594
3595 include_once("./Modules/LearningModule/classes/class.ilHelpTooltipTableGUI.php");
3596 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp"));
3597
3598 $tpl->setContent($tbl->getHTML());
3599 }
3600
3607 public function addTooltip()
3608 {
3609 $lng = $this->lng;
3611
3612 $tt_id = ilUtil::stripSlashes($_POST["tooltip_id"]);
3613 if (trim($tt_id) != "") {
3614 if (is_int(strpos($tt_id, "_"))) {
3615 include_once("./Services/Help/classes/class.ilHelp.php");
3616 ilHelp::addTooltip(trim($tt_id), "");
3617 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3618
3619 $fu = strpos($tt_id, "_");
3620 $comp = substr($tt_id, 0, $fu);
3621 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
3622 } else {
3623 ilUtil::sendFailure($lng->txt("cont_help_no_valid_tooltip_id"), true);
3624 }
3625 }
3626 $ilCtrl->redirect($this, "showTooltipList");
3627 }
3628
3635 public function filterTooltips()
3636 {
3637 $lng = $this->lng;
3639
3640 ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"]));
3641 $ilCtrl->redirect($this, "showTooltipList");
3642 }
3643
3644
3651 public function saveTooltips()
3652 {
3654 $lng = $this->lng;
3655
3656 include_once("./Services/Help/classes/class.ilHelp.php");
3657
3658 if (is_array($_POST["text"])) {
3659 foreach ($_POST["text"] as $id => $text) {
3661 (int) $id,
3663 ilUtil::stripSlashes($_POST["tt_id"][(int) $id])
3664 );
3665 }
3666 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3667 }
3668 $ilCtrl->redirect($this, "showTooltipList");
3669 }
3670
3674 public function deleteTooltips()
3675 {
3676 $lng = $this->lng;
3678
3679 if (is_array($_POST["id"])) {
3680 include_once("./Services/Help/classes/class.ilHelp.php");
3681 foreach ($_POST["id"] as $id) {
3683 }
3684 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3685 }
3686 $ilCtrl->redirect($this, "showTooltipList");
3687 }
3688
3692
3698 public static function getLayoutOption($a_txt, $a_var, $a_def_option = "")
3699 {
3700 global $DIC;
3701
3702 $lng = $DIC->language();
3703
3704 // default layout
3705 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
3706 if ($a_def_option != "") {
3707 if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
3708 $im_tag = ilUtil::img($im, $a_def_option);
3709 }
3710 $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><b>" .
3711 $lng->txt("cont_lm_default_layout") .
3712 "</b>: " . $lng->txt("cont_layout_" . $a_def_option) .
3713 "</td></tr></table>", ""));
3714 }
3716 $im_tag = "";
3717 if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
3718 $im_tag = ilUtil::img($im, $l);
3719 }
3720 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
3721 $im_tag . "</td><td style='padding:5px;'><b>" . $lng->txt("cont_layout_" . $l) . "</b>: " .
3722 $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
3723 }
3724
3725 return $layout;
3726 }
3727
3732 {
3734 $ilCtrl->setParameter($this, "hierarchy", "1");
3735 $this->setPageLayout(true);
3736 }
3737
3738
3742 public function setPageLayout($a_in_hierarchy = false)
3743 {
3744 $tpl = $this->tpl;
3746 $lng = $this->lng;
3747
3748 if (!is_array($_POST["id"])) {
3749 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3750
3751 if ($a_in_hierarchy) {
3752 $ilCtrl->redirect($this, "chapters");
3753 } else {
3754 $ilCtrl->redirect($this, "pages");
3755 }
3756 }
3757
3758 $this->initSetPageLayoutForm();
3759
3760 $tpl->setContent($this->form->getHTML());
3761 }
3762
3766 public function initSetPageLayoutForm()
3767 {
3768 $lng = $this->lng;
3770
3771 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3772 $this->form = new ilPropertyFormGUI();
3773
3774 if (is_array($_POST["id"])) {
3775 foreach ($_POST["id"] as $id) {
3776 $hi = new ilHiddenInputGUI("id[]");
3777 $hi->setValue($id);
3778 $this->form->addItem($hi);
3779 }
3780 }
3781 $layout = self::getLayoutOption(
3782 $lng->txt("cont_layout"),
3783 "layout",
3784 $this->object->getLayout()
3785 );
3786 $this->form->addItem($layout);
3787
3788 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
3789 $this->form->addCommandButton("pages", $lng->txt("cancel"));
3790
3791 $this->form->setTitle($lng->txt("cont_set_layout"));
3792 $this->form->setFormAction($ilCtrl->getFormAction($this));
3793 }
3794
3798 public function savePageLayout()
3799 {
3800 $lng = $this->lng;
3802
3803 $ilCtrl->setParameter($this, "hierarchy", $_GET["hierarchy"]);
3804
3805 foreach ($_POST["id"] as $id) {
3808 ilUtil::stripSlashes($_POST["layout"]),
3809 $this->object
3810 );
3811 }
3812 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3813
3814 if ($_GET["hierarchy"] == 1) {
3815 $ilCtrl->redirect($this, "chapters");
3816 } else {
3817 $ilCtrl->redirect($this, "pages");
3818 }
3819 }
3820
3821 //
3822 // Auto glossaries
3823 //
3824
3831 public function editGlossaries()
3832 {
3833 $tpl = $this->tpl;
3834 $ilToolbar = $this->toolbar;
3835 $lng = $this->lng;
3837 $ilTabs = $this->tabs;
3838
3839 $this->setTabs();
3840 $ilTabs->setTabActive("settings");
3841 $this->setSubTabs("cont_glossaries");
3842
3843 $ilToolbar->addButton(
3844 $lng->txt("add"),
3845 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
3846 );
3847
3848 include_once("./Modules/LearningModule/classes/class.ilLMGlossaryTableGUI.php");
3849 $tab = new ilLMGlossaryTableGUI($this->object, $this, "editGlossaries");
3850
3851 $tpl->setContent($tab->getHTML());
3852 }
3853
3860 public function showLMGlossarySelector()
3861 {
3862 $tpl = $this->tpl;
3863 $lng = $this->lng;
3867 $ilTabs = $this->tabs;
3868
3869 $this->setTabs();
3870 $ilTabs->setTabActive("settings");
3871 $this->setSubTabs("cont_glossaries");
3872
3873 include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
3874
3875 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
3876 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
3877 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
3878 $exp->setTargetClass(get_class($this));
3879 $exp->setCmd('confirmGlossarySelection');
3880 $exp->setClickableTypes(array("glo"));
3881 $exp->addFilter("glo");
3882
3883 // build html-output
3884 $exp->setOutput(0);
3885 $tpl->setContent($exp->getOutput());
3886 }
3887
3892 {
3894 $tpl = $this->tpl;
3895 $lng = $this->lng;
3896
3897 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3898 $cgui = new ilConfirmationGUI();
3899 $ilCtrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
3900 $cgui->setFormAction($ilCtrl->getFormAction($this));
3901 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
3902 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
3903 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
3904 $tpl->setContent($cgui->getHTML());
3905 }
3906
3913 public function selectLMGlossaryLink()
3914 {
3915 $glo_ref_id = (int) $_GET["glo_ref_id"];
3916 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3917 $this->object->autoLinkGlossaryTerms($glo_ref_id);
3918 $this->selectLMGlossary();
3919 }
3920
3921
3928 public function selectLMGlossary()
3929 {
3931 $lng = $this->lng;
3932
3933 $glos = $this->object->getAutoGlossaries();
3934 $glo_ref_id = (int) $_GET["glo_ref_id"];
3935 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3936 if (!in_array($glo_id, $glos)) {
3937 $glos[] = $glo_id;
3938 }
3939 $this->object->setAutoGlossaries($glos);
3940 $this->object->update();
3941
3942 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3943 $ilCtrl->redirect($this, "editGlossaries");
3944 }
3945
3952 public function removeLMGlossary()
3953 {
3955 $lng = $this->lng;
3956
3957 $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
3958 $this->object->update();
3959
3960 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3961 $ilCtrl->redirect($this, "editGlossaries");
3962 }
3963
3970 public function editMasterLanguage()
3971 {
3973
3974 $ilCtrl->setParameter($this, "transl", "");
3975 if ($_GET["lang_switch_mode"] == "short_titles") {
3976 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
3977 }
3978 $ilCtrl->redirect($this, "chapters");
3979 }
3980
3987 public function switchToLanguage()
3988 {
3990
3991 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
3992 if ($_GET["lang_switch_mode"] == "short_titles") {
3993 $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
3994 }
3995 $ilCtrl->redirect($this, "chapters");
3996 }
3997
3998 public function redrawHeaderAction()
3999 {
4000 // #12281
4001 return parent::redrawHeaderActionObject();
4002 }
4003}
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
global $l
Definition: afr.php:30
$path
Definition: aliased.php:25
exit
Definition: backend.php:16
$_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")
Base class for ILIAS Exception handling.
Export User Interface Class.
This class represents a file property in a property form.
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.
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=IL_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, $cmd, array $gui_params=array(), array $mail_params=array(), array $context_params=array())
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()
list childs of current object
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
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 _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write 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.
$login
Definition: cron.php:13
$key
Definition: croninfo.php:18
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$i
Definition: disco.tpl.php:19
$valid
$tbl
Definition: example_048.php:81
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
interface ilLinkCheckerGUIRowHandling
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$format
Definition: metadata.php:141
$info
Definition: index.php:5
$target
Definition: test.php:19
$row
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
global $ilDB
$lm_set
$values
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$text
Definition: errorreport.php:18