ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "./Services/Object/classes/class.ilObjectGUI.php";
5include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
6include_once ("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
7include_once ("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
8require_once 'Services/LinkChecker/interfaces/interface.ilLinkCheckerGUIRowHandling.php';
9
22{
23 var $ctrl;
24
30 function __construct($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = false)
31 {
32 global $lng, $ilCtrl;
33//echo "<br>ilobjcontobjgui-constructor-id-$a_id";
34 $this->ctrl = $ilCtrl;
35 $lng->loadLanguageModule("content");
36 $lng->loadLanguageModule("obj");
37 parent::__construct($a_data,$a_id,$a_call_by_reference,false);
38 }
39
43 function executeCommand()
44 {
45 global $ilAccess, $lng, $ilTabs, $ilCtrl, $ilErr;
46
47 if ($this->ctrl->getRedirectSource() == "ilinternallinkgui")
48 {
49 $this->explorer();
50 return;
51 }
52
53 if ($this->ctrl->getCmdClass() == "ilinternallinkgui")
54 {
55 $this->ctrl->setReturn($this, "explorer");
56 }
57
58 // get next class that processes or forwards current command
59 $next_class = $this->ctrl->getNextClass($this);
60
61 // get current command
62// $cmd = $this->ctrl->getCmd("", array("downloadExportFile"));
63 if ($_GET["to_props"] == 1)
64 {
65 $cmd = $this->ctrl->getCmd("properties");
66 }
67 else
68 {
69 $cmd = $this->ctrl->getCmd("chapters");
70 }
71
72
73//echo "-$cmd-".$next_class."-";
74 switch($next_class)
75 {
76 case "illearningprogressgui":
77 $this->addHeaderAction();
78 $this->addLocations();
79 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
80 $this->setTabs("learning_progress");
81
82 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY,$this->object->getRefId());
83 $this->ctrl->forwardCommand($new_gui);
84
85 break;
86
87 case 'ilobjectmetadatagui':
88 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
89 {
90 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
91 }
92
93 $this->addHeaderAction();
94 $this->addLocations();
95 $this->setTabs("meta");
96
97 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
98 $md_gui = new ilObjectMetaDataGUI($this->object);
99 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'Educational'); // #9510
100 $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
101 $this->ctrl->forwardCommand($md_gui);
102 break;
103
104 case "ilobjstylesheetgui":
105 $this->addLocations();
106 include_once ("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
107 $this->ctrl->setReturn($this, "editStyleProperties");
108 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
109 $style_gui->omitLocator();
110 if ($cmd == "create" || $_GET["new_type"]=="sty")
111 {
112 $style_gui->setCreationMode(true);
113 }
114 $ret = $this->ctrl->forwardCommand($style_gui);
115 //$ret =& $style_gui->executeCommand();
116
117 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
118 {
119 $style_id = $ret;
120 $this->object->setStyleSheetId($style_id);
121 $this->object->update();
122 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
123 }
124 break;
125
126 case "illmpageobjectgui":
127
128 $ilTabs->setBackTarget($lng->txt("learning module"),
129 $ilCtrl->getLinkTarget($this, "chapters"));
130 $this->ctrl->saveParameter($this, array("obj_id"));
131 $this->addLocations();
132 $this->ctrl->setReturn($this, "chapters");
133//echo "!";
134 //$this->lm_obj =& $this->ilias->obj_factory->getInstanceByRefId($this->ref_id);
135
136 $pg_gui = new ilLMPageObjectGUI($this->object);
137 if ($_GET["obj_id"] != "")
138 {
139 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
140 $pg_gui->setLMPageObject($obj);
141 }
142 //$ret =& $pg_gui->executeCommand();
143 $ret = $this->ctrl->forwardCommand($pg_gui);
144 if ($cmd == "save" || $cmd == "cancel")
145 {
146// $this->ctrl->redirect($this, "pages");
147 }
148 break;
149
150 case "ilstructureobjectgui":
151 $ilTabs->setBackTarget($lng->txt("learning module"),
152 $ilCtrl->getLinkTarget($this, "chapters"));
153
154 $this->ctrl->saveParameter($this, array("obj_id"));
155 $this->addLocations();
156 $this->ctrl->setReturn($this, "chapters");
157 $st_gui = new ilStructureObjectGUI($this->object, $this->object->lm_tree);
158 if ($_GET["obj_id"] != "")
159 {
160 $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
161 $st_gui->setStructureObject($obj);
162 }
163 //$ret =& $st_gui->executeCommand();
164 $ret = $this->ctrl->forwardCommand($st_gui);
165 if ($cmd == "save" || $cmd == "cancel")
166 {
167 if ($_GET["obj_id"] == "")
168 {
169 $this->ctrl->redirect($this, "chapters");
170 }
171 else
172 {
173 $this->ctrl->setCmd("subchap");
174 $this->executeCommand();
175 }
176 }
177 break;
178
179 case 'ilpermissiongui':
180 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
181 {
182 $this->prepareOutput();
183 }
184 else
185 {
186 $this->addHeaderAction();
187 $this->addLocations(true);
188 $this->setTabs("perm");
189 }
190 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
191 $perm_gui = new ilPermissionGUI($this);
192 $ret = $this->ctrl->forwardCommand($perm_gui);
193 break;
194
195 // infoscreen
196 case 'ilinfoscreengui':
197 $this->addHeaderAction();
198 $this->addLocations(true);
199 $this->setTabs("info");
200 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
201 $info = new ilInfoScreenGUI($this);
202 $info->enablePrivateNotes();
203 $info->enableLearningProgress();
204
205 $info->enableNews();
206 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
207 {
208 $info->enableNewsEditing();
209 $info->setBlockProperty("news", "settings", true);
210 }
211
212 // show standard meta data section
213 $info->addMetaDataSections($this->object->getId(), 0,
214 $this->object->getType());
215
216 $ret = $this->ctrl->forwardCommand($info);
217 break;
218
219 case "ilexportgui":
220 ilUtil::sendInfo($this->lng->txt("lm_only_one_download_per_type"));
221 $this->addHeaderAction();
222 $this->addLocations(true);
223 $this->setTabs("export");
224 include_once("./Services/Export/classes/class.ilExportGUI.php");
225 $exp_gui = new ilExportGUI($this);
226 // old school -> new school
227 //$exp_gui->addFormat("xml", "", $this, "export");
228 $exp_gui->addFormat("xml");
229 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
230 $ot = ilObjectTranslation::getInstance($this->object->getId());
231 if ($ot->getContentActivated())
232 {
233 $exp_gui->addFormat("xml_master", "XML (".$lng->txt("cont_master_language_only").")", $this, "export");
234
235 $lng->loadLanguageModule("meta");
236 $langs = $ot->getLanguages();
237 foreach ($langs as $l => $ldata)
238 {
239 $exp_gui->addFormat("html_".$l, "HTML (".$lng->txt("meta_l_".$l).")", $this, "exportHTML");
240 }
241 $exp_gui->addFormat("html_all", "HTML (".$lng->txt("cont_all_languages").")", $this, "exportHTML");
242 }
243 else
244 {
245 $exp_gui->addFormat("html", "", $this, "exportHTML");
246 }
247
248 $exp_gui->addFormat("scorm", "", $this, "exportSCORM");
249 $exp_gui->addCustomColumn($lng->txt("cont_public_access"),
250 $this, "getPublicAccessColValue");
251 $exp_gui->addCustomMultiCommand($lng->txt("cont_public_access"),
252 $this, "publishExportFile");
253 $ret = $this->ctrl->forwardCommand($exp_gui);
254 break;
255
256 case 'ilobjecttranslationgui':
257 $this->addHeaderAction();
258 $this->addLocations(true);
259 //$this->checkPermissionBool("write");
260 //$this->prepareOutput();
261 //$this->tabs_gui->setTabActive('export');
262 $this->setTabs("settings");
263 $this->setSubTabs("obj_multilinguality");
264 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
265 $transgui = new ilObjectTranslationGUI($this);
266 $transgui->setTitleDescrOnlyMode(false);
267 $this->ctrl->forwardCommand($transgui);
268 break;
269
270
271 case "ilcommonactiondispatchergui":
272 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
274 $this->ctrl->forwardCommand($gui);
275 break;
276
277 case 'ilobjectcopygui':
278 $this->prepareOutput();
279 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
280 $cp = new ilObjectCopyGUI($this);
281 $cp->setType('lm');
282 $this->ctrl->forwardCommand($cp);
283 break;
284
285/* case "ilpagemultilanggui":
286 $this->addHeaderAction();
287 $this->addLocations(true);
288 $ilCtrl->setReturn($this, "properties");
289 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
290 $ml_gui = new ilPageMultiLangGUI("lm", $this->object->getId());
291 $this->setTabs("settings");
292 $this->setSubTabs("cont_multilinguality");
293 $ret = $this->ctrl->forwardCommand($ml_gui);
294 break;*/
295
296 case "illmmultisrtuploadgui":
297 $this->addHeaderAction();
298 $this->addLocations(true);
299 $this->setTabs("content");
300 $this->setContentSubTabs("srt_files");
301 include_once("./Modules/LearningModule/classes/class.ilLMMultiSrtUploadGUI.php");
302 $gui = new ilLMMultiSrtUploadGUI($this->object);
303 $this->ctrl->forwardCommand($gui);
304 break;
305
306 case "illmimportgui":
307 $this->addHeaderAction();
308 $this->addLocations(true);
309 $this->setTabs("content");
310 $this->setContentSubTabs("import");
311 include_once("./Modules/LearningModule/classes/class.ilLMImportGUI.php");
312 $gui = new ilLMImportGUI($this->object);
313 $this->ctrl->forwardCommand($gui);
314 break;
315
316 default:
317 $new_type = $_POST["new_type"]
318 ? $_POST["new_type"]
319 : $_GET["new_type"];
320
321
322 if ($cmd == "create" &&
323 !in_array($new_type, array("lm")))
324 {
325 //$this->addLocations();
326 switch ($new_type)
327 {
328 case "pg":
329 $this->setTabs();
330 $this->ctrl->setCmdClass("ilLMPageObjectGUI");
331 $ret = $this->executeCommand();
332 break;
333
334 case "st":
335 $this->setTabs();
336 $this->ctrl->setCmdClass("ilStructureObjectGUI");
337 $ret = $this->executeCommand();
338 break;
339 }
340 }
341 else
342 {
343 // creation of new dbk/lm in repository
344 if ($this->getCreationMode() == true &&
345 in_array($new_type, array("lm")))
346 {
347 $this->prepareOutput();
348 if ($cmd == "") // this may be due to too big upload files
349 {
350 $cmd = "create";
351 }
352 $cmd .= "Object";
353 $ret = $this->$cmd();
354 }
355 else
356 {
357 $this->addHeaderAction();
358 $this->addLocations();
359 $ret = $this->$cmd();
360 }
361 }
362 break;
363 }
364 return $ret;
365 }
366
367 static function _forwards()
368 {
369 return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
370 }
371
375 function properties()
376 {
377 global $lng;
378
379 $lng->loadLanguageModule("style");
380 $this->setTabs("settings");
381 $this->setSubTabs("settings");
382
383 // lm properties
384 $this->initPropertiesForm();
386
387 if($this->object->getType() == "lm")
388 {
389 // Edit ecs export settings
390 include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
391 $ecs = new ilECSLearningModuleSettings($this->object);
392 $ecs->addSettingsToForm($this->form, 'lm');
393 }
394
395 $this->tpl->setContent($this->form->getHTML());
396 }
397
402 {
403 global $ilCtrl, $lng;
404
405 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
406 $this->form = new ilPropertyFormGUI();
407
408 // title
409 $ti = new ilTextInputGUI($lng->txt("title"), "title");
410 //$ti->setMaxLength();
411 //$ti->setSize();
412 //$ti->setInfo($lng->txt(""));
413 $ti->setRequired(true);
414 $this->form->addItem($ti);
415
416 // description
417 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
418 //$ta->setCols();
419 //$ta->setRows();
420 //$ta->setInfo($lng->txt(""));
421 $this->form->addItem($ta);
422
423 $lng->loadLanguageModule("rep");
425 $section->setTitle($this->lng->txt('rep_activation_availability'));
426 $this->form->addItem($section);
427
428 // online
429 $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
430 $this->form->addItem($online);
431
432 // presentation
434 $section->setTitle($this->lng->txt('cont_presentation'));
435 $this->form->addItem($section);
436
437 // default layout
438 $layout = self::getLayoutOption($lng->txt("cont_def_layout"), "lm_layout");
439 $this->form->addItem($layout);
440
441 // layout per page
442 $lpp = new ilCheckboxInputGUI($lng->txt("cont_layout_per_page"), "layout_per_page");
443 $lpp->setInfo($this->lng->txt("cont_layout_per_page_info"));
444 $this->form->addItem($lpp);
445
446 // page header
447 $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
448 $option = array ("st_title" => $this->lng->txt("cont_st_title"),
449 "pg_title" => $this->lng->txt("cont_pg_title"),
450 "none" => $this->lng->txt("cont_none"));
451 $page_header->setOptions($option);
452 $this->form->addItem($page_header);
453
454 // chapter numeration
455 $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
456 $this->form->addItem($chap_num);
457
458 // toc mode
459 $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
460 $option = array ("chapters" => $this->lng->txt("cont_chapters_only"),
461 "pages" => $this->lng->txt("cont_chapters_and_pages"));
462 $toc_mode->setOptions($option);
463 $this->form->addItem($toc_mode);
464
465 // synchronize frames
466 /*
467 $synch = new ilCheckboxInputGUI($lng->txt("cont_synchronize_frames"), "cobj_clean_frames");
468 $synch->setInfo($this->lng->txt("cont_synchronize_frames_desc"));
469 $this->form->addItem($synch);*/
470
471 // show progress icons
472 $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
473 $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
474 $this->form->addItem($progr_icons);
475
476 // self assessment
478 $section->setTitle($this->lng->txt('cont_self_assessment'));
479 $this->form->addItem($section);
480
481 // tries
482 $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
483 $radg->setValue(0);
484 $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), 0,$lng->txt("cont_tries_reset_on_visit_info"));
485 $radg->addOption($op1);
486 $op2 = new ilRadioOption($lng->txt("cont_tries_store"), 1,$lng->txt("cont_tries_store_info"));
487 $radg->addOption($op2);
488 $this->form->addItem($radg);
489
490 // restrict forward navigation
491 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
492 $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
493 $this->form->addItem($qfeed);
494
495 // notification
496 $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
497 $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
498 $qfeed->addSubItem($not);
499
500 // disable default feedback for questions
501 $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
502 $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
503 $this->form->addItem($qfeed);
504
505 // additional features
507 $section->setTitle($this->lng->txt('obj_features'));
508 $this->form->addItem($section);
509
510 // public notes
511 if (!$this->ilias->getSetting('disable_comments'))
512 {
513 $this->lng->loadLanguageModule("notes");
514 $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
515 $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
516 $this->form->addItem($pub_nodes);
517 }
518
519 // history user comments
520 $com = new ilCheckboxInputGUI($lng->txt("enable_hist_user_comments"), "cobj_user_comments");
521 $com->setInfo($this->lng->txt("enable_hist_user_comments_desc"));
522 $this->form->addItem($com);
523
524 // rating
525 $this->lng->loadLanguageModule('rating');
526 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
527 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
528 $this->form->addItem($rate);
529 $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
530 $this->form->addItem($ratep);
531
532 $this->form->setTitle($lng->txt("cont_lm_properties"));
533 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
534 $this->form->setFormAction($ilCtrl->getFormAction($this));
535 }
536
541 {
542 global $ilUser;
543
544 $values = array();
545
546 $title = $this->object->getTitle();
547 $description = $this->object->getDescription();
548 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
549 $ot = ilObjectTranslation::getInstance($this->object->getId());
550 if ($ot->getContentActivated())
551 {
552 $title = $ot->getDefaultTitle();
553 $description = $ot->getDefaultDescription();
554 }
555
556 $values["title"] = $title;
557 $values["description"] = $description;
558 if ($this->object->getOnline())
559 {
560 $values["cobj_online"] = true;
561 }
562 $values["lm_layout"] = $this->object->getLayout();
563 $values["lm_pg_header"] = $this->object->getPageHeader();
564 if ($this->object->isActiveNumbering())
565 {
566 $values["cobj_act_number"] = true;
567 }
568 $values["toc_mode"] = $this->object->getTOCMode();
569 if ($this->object->publicNotes())
570 {
571 $values["cobj_pub_notes"] = true;
572 }
573 if ($this->object->cleanFrames())
574 {
575 $values["cobj_clean_frames"] = true;
576 }
577 if ($this->object->isActiveHistoryUserComments())
578 {
579 $values["cobj_user_comments"] = true;
580 }
581 $values["layout_per_page"] = $this->object->getLayoutPerPage();
582 $values["rating"] = $this->object->hasRating();
583 $values["rating_pages"] = $this->object->hasRatingPages();
584 $values["disable_def_feedback"] = $this->object->getDisableDefaultFeedback();
585 $values["progr_icons"] = $this->object->getProgressIcons();
586 $values["store_tries"] = $this->object->getStoreTries();
587 $values["restrict_forw_nav"] = $this->object->getRestrictForwardNavigation();
588
589 include_once "./Services/Notification/classes/class.ilNotification.php";
590 $values["notification_blocked_users"] = ilNotification::hasNotification(
592 $this->object->getId());
593
594 $this->form->setValuesByArray($values);
595 }
596
600 function saveProperties()
601 {
602 global $lng, $ilUser;
603
604 $valid = false;
605 $this->initPropertiesForm();
606 if ($this->form->checkInput())
607 {
608 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
609 $ot = ilObjectTranslation::getInstance($this->object->getId());
610 if ($ot->getContentActivated())
611 {
612 $ot->setDefaultTitle($_POST['title']);
613 $ot->setDefaultDescription($_POST['description']);
614 $ot->save();
615 }
616
617 $this->object->setTitle($_POST['title']);
618 $this->object->setDescription($_POST['description']);
619 $this->object->setLayout($_POST["lm_layout"]);
620 $this->object->setPageHeader($_POST["lm_pg_header"]);
621 $this->object->setTOCMode($_POST["toc_mode"]);
622 $this->object->setOnline($_POST["cobj_online"]);
623 $this->object->setActiveNumbering($_POST["cobj_act_number"]);
624 $this->object->setCleanFrames($_POST["cobj_clean_frames"]);
625 if (!$this->ilias->getSetting('disable_comments'))
626 {
627 $this->object->setPublicNotes($_POST["cobj_pub_notes"]);
628 }
629 $this->object->setHistoryUserComments($_POST["cobj_user_comments"]);
630 $this->object->setLayoutPerPage($_POST["layout_per_page"]);
631 $this->object->setRating($_POST["rating"]);
632 $this->object->setRatingPages($_POST["rating_pages"]);
633 $this->object->setDisableDefaultFeedback((int) $_POST["disable_def_feedback"]);
634 $this->object->setProgressIcons((int) $_POST["progr_icons"]);
635
636 $add_info = "";
637 if ($_POST["restrict_forw_nav"] && !$_POST["store_tries"])
638 {
639 $_POST["store_tries"] = 1;
640 $add_info = "</br>".$lng->txt("cont_automatically_set_store_tries");
641 $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
642 $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
643 }
644
645 $this->object->setStoreTries((int) $_POST["store_tries"]);
646 $this->object->setRestrictForwardNavigation((int) $_POST["restrict_forw_nav"]);
647 $this->object->updateProperties();
648 $this->object->update();
649
650 include_once "./Services/Notification/classes/class.ilNotification.php";
652 $ilUser->getId(), $this->object->getId(),
653 (bool)$this->form->getInput("notification_blocked_users"));
654
655
656 if($this->object->getType() == 'lm')
657 {
658 // Update ecs export settings
659 include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
660 $ecs = new ilECSLearningModuleSettings($this->object);
661 if($ecs->handleSettingsUpdate())
662 {
663 $valid = true;
664 }
665 }
666 else
667 {
668 $valid = true;
669 }
670 }
671
672 if($valid)
673 {
674 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified").$add_info, true);
675 $this->ctrl->redirect($this, "properties");
676 }
677 else
678 {
679 $lng->loadLanguageModule("style");
680 $this->setTabs("settings");
681 $this->setSubTabs("cont_general_properties");
682
683 $this->form->setValuesByPost();
684 $this->tpl->setContent($this->form->getHTML());
685 }
686 }
687
692 {
693 global $tpl;
694
696 $tpl->setContent($this->form->getHTML());
697 }
698
703 {
704 global $ilCtrl, $lng, $ilTabs, $ilSetting;
705
706 $lng->loadLanguageModule("style");
707 $this->setTabs();
708 $ilTabs->setTabActive("settings");
709 $this->setSubTabs("cont_style");
710
711 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
712 $this->form = new ilPropertyFormGUI();
713
714 $fixed_style = $ilSetting->get("fixed_content_style_id");
715 $style_id = $this->object->getStyleSheetId();
716
717 if ($fixed_style > 0)
718 {
719 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
720 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
721 $this->lng->txt("global_fixed").")");
722 $this->form->addItem($st);
723 }
724 else
725 {
726 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
727 $_GET["ref_id"]);
728
729 $st_styles[0] = $this->lng->txt("default");
730 ksort($st_styles);
731
732 if ($style_id > 0)
733 {
734 // individual style
735 if (!ilObjStyleSheet::_lookupStandard($style_id))
736 {
737 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
738 $st->setValue(ilObject::_lookupTitle($style_id));
739 $this->form->addItem($st);
740
741//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
742
743 // delete command
744 $this->form->addCommandButton("editStyle",
745 $lng->txt("cont_edit_style"));
746 $this->form->addCommandButton("deleteStyle",
747 $lng->txt("cont_delete_style"));
748//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
749 }
750 }
751
752 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
753 {
754 $style_sel = ilUtil::formSelect ($style_id, "style_id",
755 $st_styles, false, true);
756 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
757 $style_sel->setOptions($st_styles);
758 $style_sel->setValue($style_id);
759 $this->form->addItem($style_sel);
760//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
761 $this->form->addCommandButton("saveStyleSettings",
762 $lng->txt("save"));
763 $this->form->addCommandButton("createStyle",
764 $lng->txt("sty_create_ind_style"));
765 }
766 }
767 $this->form->setTitle($lng->txt("cont_style"));
768 $this->form->setFormAction($ilCtrl->getFormAction($this));
769 }
770
774 function createStyle()
775 {
776 global $ilCtrl;
777
778 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
779 }
780
784 function editStyle()
785 {
786 global $ilCtrl;
787
788 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
789 }
790
794 function deleteStyle()
795 {
796 global $ilCtrl;
797
798 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
799 }
800
805 {
806 global $ilSetting;
807
808 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
809 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
810 || $this->object->getStyleSheetId() == 0))
811 {
812 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
813 $this->object->update();
814 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
815 }
816 $this->ctrl->redirect($this, "editStyleProperties");
817 }
818
822 public function initMenuForm()
823 {
824 global $lng, $ilCtrl;
825
826 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
827 $form = new ilPropertyFormGUI();
828
829 // enable menu
830 $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
831 $menu->setChecked($this->object->isActiveLMMenu());
832 $form->addItem($menu);
833
834 // toc
835 $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
836 $toc->setChecked($this->object->isActiveTOC());
837 $form->addItem($toc);
838
839 // print view
840 $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
841 $print->setChecked($this->object->isActivePrintView());
842 $form->addItem($print);
843
844 // prevent glossary appendix
845 $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
846 $glo->setChecked($this->object->isActivePreventGlossaryAppendix());
847 $print->addSubItem($glo);
848
849 // hide header and footer in print view
850 $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
851 $hhfp->setChecked($this->object->getHideHeaderFooterPrint());
852 $print->addSubItem($hhfp);
853
854 // downloads
855 $no_download_file_available =
856 " ".$lng->txt("cont_no_download_file_available").
857 " <a href='".$ilCtrl->getLinkTargetByClass("ilexportgui", "")."'>".$lng->txt("change")."</a>";
858 $types = array("xml", "html", "scorm");
859 foreach($types as $type)
860 {
861 if ($this->object->getPublicExportFile($type) != "")
862 {
863 if (is_file($this->object->getExportDirectory($type)."/".
864 $this->object->getPublicExportFile($type)))
865 {
866 $no_download_file_available = "";
867 }
868 }
869 }
870 $dl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "cobj_act_downloads");
871 $dl->setInfo($this->lng->txt("cont_downloads_desc").$no_download_file_available);
872 $dl->setChecked($this->object->isActiveDownloads());
873 $form->addItem($dl);
874
875 // downloads in public area
876 $pdl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads_public_desc"), "cobj_act_downloads_public");
877 $pdl->setChecked($this->object->isActiveDownloadsPublic());
878 $dl->addSubItem($pdl);
879
880 $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
881
882 $form->setTitle($lng->txt("cont_lm_menu"));
883 $form->setFormAction($ilCtrl->getFormAction($this));
884
885 return $form;
886 }
887
892 {
893 global $lng, $ilTabs, $ilCtrl, $tpl, $ilToolbar;
894
895 $lng->loadLanguageModule("style");
896 $this->setTabs();
897 $ilTabs->setTabActive("settings");
898 $this->setSubTabs("cont_lm_menu");
899
900 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
901 $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
902 $ilToolbar->setCloseFormTag(false);
903
904 $form = $this->initMenuForm();
905 $form->setOpenTag(false);
906 $form->setCloseTag(false);
907
908 $this->__initLMMenuEditor();
909 $entries = $this->lmme_obj->getMenuEntries();
910 include_once("./Modules/LearningModule/classes/class.ilLMMenuItemsTableGUI.php");
911 $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
912 $table->setOpenFormTag(false);
913
914 $tpl->setContent($form->getHTML()."<br />".$table->getHTML());
915 }
916
921 {
922 global $ilias;
923
924 $this->object->setActiveLMMenu((int) $_POST["cobj_act_lm_menu"]);
925 $this->object->setActiveTOC((int) $_POST["cobj_act_toc"]);
926 $this->object->setActivePrintView((int) $_POST["cobj_act_print"]);
927 $this->object->setActivePreventGlossaryAppendix((int) $_POST["cobj_act_print_prev_glo"]);
928 $this->object->setHideHeaderFooterPrint((int) $_POST["hide_head_foot_print"]);
929 $this->object->setActiveDownloads((int) $_POST["cobj_act_downloads"]);
930 $this->object->setActiveDownloadsPublic((int) $_POST["cobj_act_downloads_public"]);
931 $this->object->updateProperties();
932
933 $this->__initLMMenuEditor();
934//var_dump($_POST["menu_entries"]); exit;
935 $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
936
937 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
938 $this->ctrl->redirect($this, "editMenuProperties");
939 }
940
944 function explorer()
945 {
946 global $ilUser, $ilias, $ilCtrl;
947
948 $gui_class = "ilobjlearningmodulegui";
949
950 $ilCtrl->setParameterByClass($gui_class, "active_node", $_GET["active_node"]);
951
952 $this->tpl = new ilTemplate("tpl.main.html", true, true);
953 // get learning module object
954 //$this->lm_obj = new ilObjLearningModule($this->ref_id, true);
955
956 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
957
958 //$this->tpl = new ilTemplate("tpl.explorer.html", false, false);
959 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
960 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
961
962 require_once ("./Modules/LearningModule/classes/class.ilLMEditorExplorer.php");
963 $exp = new ilLMEditorExplorer($this->ctrl->getLinkTarget($this, "view"),
964 $this->object, $gui_class);
965
966 $exp->setTargetGet("obj_id");
967 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
968
969 if ($_GET["lmmovecopy"] == "1")
970 {
971 $this->proceedDragDrop();
972 }
973
974
975 if ($_GET["lmexpand"] == "")
976 {
977 $mtree = new ilTree($this->object->getId());
978 $mtree->setTableNames('lm_tree','lm_data');
979 $mtree->setTreeTablePK("lm_id");
980 $expanded = $mtree->readRootId();
981 }
982 else
983 {
984 $expanded = $_GET["lmexpand"];
985 }
986 if ($_GET["active_node"] != "")
987 {
988 $path = $this->lm_tree->getPathId($_GET["active_node"]);
989 $exp->setForceOpenPath($path);
990
991 $exp->highlightNode($_GET["active_node"]);
992 }
993 $exp->setExpand($expanded);
994
995 // build html-output
996 $exp->setOutput(0);
997 $output = $exp->getOutput();
998
999 // asynchronous output
1000 if ($ilCtrl->isAsynch())
1001 {
1002 echo $output; exit;
1003 }
1004
1005 include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
1006
1007 /*if (ilPageEditorGUI::_doJSEditing())
1008 {
1009 //$this->tpl->touchBlock("includejavascript");
1010
1011 $IDS = "";
1012 for ($i=0;$i<count($exp->iconList);$i++)
1013 {
1014 if ($i>0) $IDS .= ",";
1015 $IDS .= "'".$exp->iconList[$i]."'";
1016 }
1017 $this->tpl->setVariable("ICONIDS",$IDS);
1018 //$this->ctrl->setParameter($this, "lmovecopy", 1);
1019 $this->tpl->setVariable("TESTPFAD",$this->ctrl->getLinkTarget($this, "explorer")."&lmmovecopy=1");
1020 //$this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
1021 $this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
1022 }*/
1023
1024 $this->tpl->setCurrentBlock("content");
1025 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
1026 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1027 $this->tpl->setVariable("EXPLORER",$output);
1028 $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
1029 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
1030 $this->tpl->parseCurrentBlock();
1031 $this->tpl->show(false);
1032 exit;
1033 }
1034
1038 function popup()
1039 {
1040 include_once "./Services/COPage/classes/class.ilWysiwygUtil.php";
1041 $popup = new ilWysiwygUtil();
1042 $popup->show($_GET["ptype"]);
1043 exit;
1044 }
1045
1050 {
1051 global $ilCtrl;
1052
1053 $this->object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
1054 $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
1055 $ilCtrl->redirect($this, "chapters");
1056 }
1057
1058 /* protected function initCreationForms($a_new_type)
1059 {
1060 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
1061 self::CFORM_IMPORT => $this->initImportForm());
1062
1063 return $forms;
1064 }*/
1065
1066 protected function afterSave(ilObject $a_new_object)
1067 {
1068 $a_new_object->setCleanFrames(true);
1069 $a_new_object->update();
1070
1071 // create content object tree
1072 $a_new_object->createLMTree();
1073
1074 // create a first chapter
1075 $a_new_object->addFirstChapterAndPage();
1076
1077 // always send a message
1078 ilUtil::sendSuccess($this->lng->txt($this->type."_added"), true);
1079 ilUtil::redirect("ilias.php?ref_id=".$a_new_object->getRefId().
1080 "&baseClass=ilLMEditorGUI");
1081 }
1082
1086 public function initImportForm($a_new_type)
1087 {
1088 global $lng, $ilCtrl;
1089
1090 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1091 $form = new ilPropertyFormGUI();
1092
1093 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
1094 $this->ctrl->setParameter($this, "new_type", $new_type);
1095
1096 $form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
1097 $form->setTableWidth("600px");
1098
1099 // import file
1100 //$fi = new ilFileInputGUI($this->lng->txt("file"), "xmldoc");
1101 $fi = new ilFileInputGUI($this->lng->txt("file"), "importfile");
1102 $fi->setSuffixes(array("zip"));
1103 $fi->setRequired(true);
1104 $fi->setSize(30);
1105 $form->addItem($fi);
1106
1107 // validation
1108 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
1109 $cb->setInfo($this->lng->txt(""));
1110 $form->addItem($cb);
1111
1112 $form->addCommandButton("importFile", $lng->txt("import"));
1113 $form->addCommandButton("cancel", $lng->txt("cancel"));
1114
1115 $form->setTitle($this->lng->txt("import_".$new_type));
1116 $form->setFormAction($ilCtrl->getFormAction($this));
1117
1118 return $form;
1119 }
1120
1126 function exportObject()
1127 {
1128 return;
1129 }
1130
1136 function importObject()
1137 {
1138 $this->createObject();
1139 return;
1140 }
1141
1142
1149 function importFileObject($parent_id = NULL, $a_catch_errors = true)
1150 {
1151 global $_FILES, $rbacsystem, $ilDB, $tpl;
1152
1153 $no_manifest = false;
1154 try
1155 {
1156 // the new import
1157 parent::importFileObject(null, false);
1158 return;
1159 }
1161 {
1162 // we just run through in this case.
1163 $no_manifest = true;
1164 }
1165
1166 if (!$no_manifest)
1167 {
1168 return; // something different has gone wrong, but we have a manifest, this is definitely not "the old" import
1169 }
1170
1171 // the "old" (pre 5.1) import
1172
1173 include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
1174
1175 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"]))
1176 {
1177 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
1178 return;
1179 }
1180 $form = $this->initImportForm("lm");
1181 if ($form->checkInput())
1182 {
1183 // create and insert object in objecttree
1184 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1185 $newObj = new ilObjContentObject();
1186 $newObj->setType($_GET["new_type"]);
1187 $newObj->setTitle($_FILES["importfile"]["name"]);
1188 $newObj->setDescription("");
1189 $newObj->create(true);
1190 $newObj->createReference();
1191 $newObj->putInTree($_GET["ref_id"]);
1192 $newObj->setPermissions($_GET["ref_id"]);
1193
1194 // create learning module tree
1195 $newObj->createLMTree();
1196
1197 // since the "new" import already did the extracting
1198 $mess = $newObj->importFromDirectory($this->tmp_import_dir, $_POST["validate"]);
1199
1200
1201 // import lm from file
1202// $mess = $newObj->importFromZipFile($_FILES["importfile"]["tmp_name"], $_FILES["importfile"]["name"],
1203// $_POST["validate"]);
1204
1205 if ($mess == "")
1206 {
1207 ilUtil::sendSuccess($this->lng->txt($this->type."_added"),true);
1208 ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
1209 "&baseClass=ilLMEditorGUI");
1210 }
1211 else
1212 {
1213 $link = '<a href="'."ilias.php?ref_id=".$newObj->getRefId().
1214 "&baseClass=ilLMEditorGUI".'" target="_top">'.$this->lng->txt("btn_next").'</a>';
1215 $tpl->setContent("<br />".$link."<br /><br />".$mess.$link);
1216 }
1217 }
1218 else
1219 {
1220 $form->setValuesByPost();
1221 $tpl->setContent($form->getHtml());
1222 }
1223 }
1224
1228 function chapters()
1229 {
1230 global $tree, $lng, $ilCtrl, $ilUser;
1231
1232 $this->setTabs();
1233 $this->setContentSubTabs("chapters");
1234
1235 $ilCtrl->setParameter($this, "backcmd", "chapters");
1236
1237 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
1238 $form_gui = new ilChapterHierarchyFormGUI($this->object->getType(), $_GET["transl"]);
1239 $form_gui->setFormAction($ilCtrl->getFormAction($this));
1240 $form_gui->setTitle($this->object->getTitle());
1241 $form_gui->setIcon(ilUtil::getImagePath("icon_lm.svg"));
1242 $form_gui->setTree($this->lm_tree);
1243 $form_gui->setMaxDepth(0);
1244 $form_gui->setCurrentTopNodeId($this->tree->getRootId());
1245 $form_gui->addMultiCommand($lng->txt("delete"), "delete");
1246 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1247 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1248 if ($this->object->getLayoutPerPage())
1249 {
1250 $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
1251 }
1252 $form_gui->setDragIcon(ilUtil::getImagePath("icon_st.svg"));
1253 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1254 $up_gui = "ilobjlearningmodulegui";
1255
1256 $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
1257 $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
1258 $ilCtrl->setParameter($this, "obj_id", "");
1259
1260 $ml_head = self::getMultiLangHeader($this->object->getId(), $this);
1261
1262 $this->tpl->setContent($ml_head.$ctpl->get());
1263 }
1264
1271 static function getMultiLangHeader($a_lm_id, $a_gui_class)
1272 {
1273 global $lng, $ilCtrl;
1274
1275 // multi language
1276 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
1277 $ot = ilObjectTranslation::getInstance($a_lm_id);
1278 //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
1279 //$ml = new ilPageMultiLang("lm", $a_lm_id);
1280 if ($ot->getContentActivated())
1281 {
1282 $lng->loadLanguageModule("meta");
1283
1284 // info
1285 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1286 $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1287 $ml_head = $ml_gui->getMultiLangInfo($_GET["transl"]);
1288
1289 // language switch
1290 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1291 $list = new ilAdvancedSelectionListGUI();
1292 $list->setListTitle($lng->txt("actions"));
1293 $list->setId("copage_act");
1294 $entries = false;
1295 if (!in_array($_GET["transl"], array("", "-")))
1296 {
1297 $l = $ot->getMasterLanguage();
1298 $list->addItem($lng->txt("cont_edit_language_version").": ".
1299 $lng->txt("meta_l_".$l), "",
1300 $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage"));
1301 $entries = true;
1302 }
1303
1304 foreach ($ot->getLanguages() as $al => $lang)
1305 {
1306 if ($_GET["transl"] != $al &&
1307 $al != $ot->getMasterLanguage())
1308 {
1309 $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1310 $list->addItem($lng->txt("cont_edit_language_version").": ".
1311 $lng->txt("meta_l_".$al), "",
1312 $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage"));
1313 $ilCtrl->setParameter($a_gui_class, "totransl", $_GET["totransl"]);
1314 }
1315 $entries = true;
1316 }
1317
1318 if ($entries)
1319 {
1320 $ml_head = '<div class="ilFloatLeft">'.$ml_head.'</div><div style="margin: 5px 0;" class="small ilRight">'.$list->getHTML()."</div>";
1321 }
1322
1323 }
1324
1325 return $ml_head;
1326 }
1327
1328
1329 /*
1330 * List all pages of learning module
1331 */
1332 function pages()
1333 {
1334 global $tree, $tpl, $ilToolbar, $ilCtrl, $lng;
1335
1336 $this->setTabs();
1337 $this->setContentSubTabs("pages");
1338
1339 $ilCtrl->setParameter($this, "backcmd", "pages");
1340 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1341 $ilToolbar->addButton($lng->txt("pg_add"),
1342 $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create"));
1343 $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1344
1345 include_once("./Modules/LearningModule/classes/class.ilLMPagesTableGUI.php");
1346 $t = new ilLMPagesTableGUI($this, "pages", $this->object);
1347 $tpl->setContent($t->getHTML());
1348 }
1349
1353 function listLinks()
1354 {
1355 global $tpl;
1356
1357 $this->setTabs();
1358 $this->setContentSubTabs("internal_links");
1359
1360 include_once("./Modules/LearningModule/classes/class.ilLinksTableGUI.php");
1361 $table_gui = new ilLinksTableGUI($this, "listLinks",
1362 $this->object->getId(), $this->object->getType());
1363
1364 $tpl->setContent($table_gui->getHTML());
1365 }
1366
1371 {
1372 global $tpl, $ilToolbar;
1373
1374 $this->setTabs();
1375 $this->setContentSubTabs("maintenance");
1376
1377 $ilToolbar->addButton($this->lng->txt("cont_fix_tree"),
1378 $this->ctrl->getLinkTarget($this, "fixTreeConfirm"));
1379 }
1380
1384 function activatePages()
1385 {
1386 if (is_array($_POST["id"]))
1387 {
1388 foreach($_POST["id"] as $id)
1389 {
1390 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1391 $act = ilLMPage::_lookupActive($id, $this->object->getType());
1392 ilLMPage::_writeActive($id, $this->object->getType(), !$act);
1393 }
1394 }
1395
1396 $this->ctrl->redirect($this, "pages");
1397 }
1398
1402 function pastePage()
1403 {
1405 {
1406 $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
1407 }
1408
1409 // paste selected object
1411
1412 // copy page, if action is copy
1413 if (ilEditClipboard::getAction() == "copy")
1414 {
1415 // check wether page belongs to lm
1417 == $this->object->getID())
1418 {
1419 $lm_page = new ilLMPageObject($this->object, $id);
1420 $new_page = $lm_page->copy();
1421 $id = $new_page->getId();
1422 }
1423 else
1424 {
1425 // get page from other content object into current content object
1427 $lm_obj = $this->ilias->obj_factory->getInstanceByObjId($lm_id);
1428 $lm_page = new ilLMPageObject($lm_obj, $id);
1429 $copied_nodes = array();
1430 $new_page = $lm_page->copyToOtherContObject($this->object, $copied_nodes);
1431 $id = $new_page->getId();
1432 ilLMObject::updateInternalLinks($copied_nodes);
1433 }
1434 }
1435
1436 // cut is not be possible in "all pages" form yet
1437 if (ilEditClipboard::getAction() == "cut")
1438 {
1439 // check wether page belongs not to lm
1441 != $this->object->getID())
1442 {
1444 $lm_obj = $this->ilias->obj_factory->getInstanceByObjId($lm_id);
1445 $lm_page = new ilLMPageObject($lm_obj, $id);
1446 $lm_page->setLMId($this->object->getID());
1447 $lm_page->update();
1448 $page = $lm_page->getPageObject();
1449 $page->buildDom();
1450 $page->setParentId($this->object->getID());
1451 $page->update();
1452 }
1453 }
1454
1455
1457 $this->ctrl->redirect($this, "pages");
1458 }
1459
1463 function copyPage()
1464 {
1465 global $ilUser;
1466
1467 if(!isset($_POST["id"]))
1468 {
1469 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1470 }
1471
1472 $items = ilUtil::stripSlashesArray($_POST["id"]);
1473 ilLMObject::clipboardCopy($this->object->getId(), $items);
1475
1476 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_copied"), true);
1477
1478 $this->ctrl->redirect($this, "pages");
1479 }
1480
1488 function delete($a_parent_subobj_id = 0)
1489 {
1490 if(!isset($_POST["id"]))
1491 {
1492 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1493 }
1494
1495 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
1496 {
1497 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
1498 }
1499
1500 if ($a_parent_subobj_id == 0)
1501 {
1502 $this->setTabs();
1503 }
1504
1505 if ($a_parent_subobj_id != 0)
1506 {
1507 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
1508 $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1509 $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1510 }
1511 else
1512 {
1513 $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
1514 $form_action = $this->ctrl->getFormAction($this);
1515 }
1516
1517 // display confirmation message
1518 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1519 $cgui = new ilConfirmationGUI();
1520 $cgui->setFormAction($form_action);
1521 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1522 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1523 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1524
1525 foreach($_POST["id"] as $id)
1526 {
1527 if ($id != IL_FIRST_NODE)
1528 {
1529 $obj = new ilLMObject($this->object, $id);
1530 $caption = ilUtil::getImageTagByType($obj->getType(), $this->tpl->tplPath).
1531 " ".$obj->getTitle();
1532
1533 $cgui->addItem("id[]", $id, $caption);
1534 }
1535 }
1536
1537 $this->tpl->setContent($cgui->getHTML());
1538 }
1539
1543 function cancelDelete()
1544 {
1545 $this->ctrl->redirect($this, $_GET["backcmd"]);
1546
1547 }
1548
1556 function confirmedDelete($a_parent_subobj_id = 0)
1557 {
1558 $tree = new ilTree($this->object->getId());
1559 $tree->setTableNames('lm_tree','lm_data');
1560 $tree->setTreeTablePK("lm_id");
1561
1562 // check number of objects
1563 if (!$_POST["id"])
1564 {
1565 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1566 }
1567
1568 // delete all selected objects
1569 foreach ($_POST["id"] as $id)
1570 {
1571 if ($id != IL_FIRST_NODE)
1572 {
1573 $obj = ilLMObjectFactory::getInstance($this->object, $id, false);
1574 $node_data = $tree->getNodeData($id);
1575 if (is_object($obj))
1576 {
1577 $obj->setLMId($this->object->getId());
1578
1579 include_once("./Services/History/classes/class.ilHistory.php");
1580 ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
1581 array(ilLMObject::_lookupTitle($id), $id),
1582 $this->object->getType());
1583
1584 $obj->delete();
1585 }
1586 if($tree->isInTree($id))
1587 {
1588 $tree->deleteTree($node_data);
1589 }
1590 }
1591 }
1592
1593 // check the tree
1594 $this->object->checkTree();
1595
1596 // feedback
1597 ilUtil::sendSuccess($this->lng->txt("info_deleted"),true);
1598
1599 if ($a_parent_subobj_id == 0)
1600 {
1601 $this->ctrl->redirect($this, $_GET["backcmd"]);
1602 }
1603 }
1604
1605
1606
1613 function getContextPath($a_endnode_id, $a_startnode_id = 1)
1614 {
1615 $path = "";
1616
1617 $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1618
1619 // count -1, to exclude the learning module itself
1620 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
1621 {
1622 if ($path != "")
1623 {
1624 $path .= " > ";
1625 }
1626
1627 $path .= $tmpPath[$i]["title"];
1628 }
1629
1630 return $path;
1631 }
1632
1633
1634
1640 function showActions($a_actions)
1641 {
1642 foreach ($a_actions as $name => $lng)
1643 {
1644 $d[$name] = array("name" => $name, "lng" => $lng);
1645 }
1646
1647 $notoperations = array();
1648
1649 $operations = array();
1650
1651 if (is_array($d))
1652 {
1653 foreach ($d as $row)
1654 {
1655 if (!in_array($row["name"], $notoperations))
1656 {
1657 $operations[] = $row;
1658 }
1659 }
1660 }
1661
1662 if (count($operations)>0)
1663 {
1664 foreach ($operations as $val)
1665 {
1666 $this->tpl->setCurrentBlock("operation_btn");
1667 $this->tpl->setVariable("BTN_NAME", $val["name"]);
1668 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1669 $this->tpl->parseCurrentBlock();
1670 }
1671
1672 $this->tpl->setCurrentBlock("operation");
1673 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.svg"));
1674 $this->tpl->parseCurrentBlock();
1675 }
1676 }
1677
1681 function perm()
1682 {
1683 $this->setTabs();
1684
1685 $this->setFormAction("addRole", $this->ctrl->getLinkTarget($this, "addRole"));
1686 $this->setFormAction("permSave", $this->ctrl->getLinkTarget($this, "permSave"));
1687 $this->permObject();
1688 }
1689
1690
1694 function permSave()
1695 {
1696 $this->setReturnLocation("permSave", $this->ctrl->getLinkTarget($this, "perm"));
1697 $this->permSaveObject();
1698 }
1699
1703 function info()
1704 {
1705 $this->setTabs();
1706 $this->infoObject();
1707 }
1708
1709
1713 function addRole()
1714 {
1715 $this->setReturnLocation("addRole", $this->ctrl->getLinkTarget($this, "perm"));
1716 $this->addRoleObject();
1717 }
1718
1719
1723 function owner()
1724 {
1725 $this->setTabs();
1726 $this->ownerObject();
1727 }
1728
1729
1733 function view()
1734 {
1735 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
1736 {
1737 $this->prepareOutput();
1738 parent::viewObject();
1739 }
1740 else
1741 {
1742 $this->viewObject();
1743 }
1744 }
1745
1746
1750 function moveChapter($a_parent_subobj_id = 0)
1751 {
1752 if(!isset($_POST["id"]))
1753 {
1754 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1755 }
1756//echo "Hallo::"; exit;
1757 if(count($_POST["id"]) > 1)
1758 {
1759 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1760 }
1761
1762 if(count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE)
1763 {
1764 $this->ilias->raiseError($this->lng->txt("cont_select_item"), $this->ilias->error_obj->MESSAGE);
1765 }
1766
1767 // SAVE POST VALUES
1768 ilEditClipboard::storeContentObject("st", $_POST["id"][0], "move");
1769
1770 ilUtil::sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
1771
1772 if ($a_parent_subobj_id == 0)
1773 {
1774 $this->ctrl->redirect($this, "chapters");
1775 }
1776 }
1777
1778
1782 function copyChapter($a_parent_subobj_id = 0)
1783 {
1784 $this->copyItems();
1785 }
1786
1790 function pasteChapter($a_parent_subobj_id = 0)
1791 {
1792 return $this->insertChapterClip(false);
1793 }
1794
1798 function movePage()
1799 {
1800 global $ilUser;
1801
1802 if(!isset($_POST["id"]))
1803 {
1804 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1805 }
1806
1807 ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_cut"), true);
1808
1809 $items = ilUtil::stripSlashesArray($_POST["id"]);
1810 ilLMObject::clipboardCut($this->object->getId(), $items);
1812
1813 $this->ctrl->redirect($this, "pages");
1814 }
1815
1819 function cancel()
1820 {
1821 if ($_GET["new_type"] == "pg")
1822 {
1823 $this->ctrl->redirect($this, "pages");
1824 }
1825 else
1826 {
1827 $this->ctrl->redirect($this, "chapters");
1828 }
1829 }
1830
1831
1835 function export()
1836 {
1837 $ot = ilObjectTranslation::getInstance($this->object->getId());
1838 $opt = "";
1839 if ($ot->getContentActivated())
1840 {
1841 $format = explode("_", $_POST["format"]);
1842 $opt = ilUtil::stripSlashes($format[1]);
1843 }
1844
1845
1846 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
1847 $cont_exp = new ilContObjectExport($this->object);
1848 $cont_exp->buildExportFile(($opt == "master"));
1849// $this->ctrl->redirect($this, "exportList");
1850 }
1851
1856 {
1857 global $lng, $ilCtrl;
1858
1859 $changelink = "<a href='".$ilCtrl->getLinkTarget($this, "editMenuProperties")."'>".$lng->txt("change")."</a>";
1860 if (!$this->object->isActiveLMMenu())
1861 {
1862 $add = "<br />".$lng->txt("cont_download_no_menu")." ".$changelink;
1863 }
1864 else if (!$this->object->isActiveDownloads())
1865 {
1866 $add = "<br />".$lng->txt("cont_download_no_download")." ".$changelink;
1867 }
1868
1869 $basetype = explode("_", $a_type);
1870 $basetype = $basetype[0];
1871
1872 if ($this->object->getPublicExportFile($basetype) == $a_file)
1873 {
1874 return $lng->txt("yes").$add;
1875 }
1876
1877 return " ";
1878 }
1879
1880
1881
1885 function publishExportFile($a_files)
1886 {
1887 global $ilCtrl;
1888
1889 if(!isset($a_files))
1890 {
1891 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1892 }
1893 else
1894 {
1895 foreach ($a_files as $f)
1896 {
1897 $file = explode(":", $f);
1898 if (is_int(strpos($file[0], "_")))
1899 {
1900 $file[0] = explode("_", $file[0])[0];
1901 }
1902 $export_dir = $this->object->getExportDirectory($file[0]);
1903
1904 if ($this->object->getPublicExportFile($file[0]) ==
1905 $file[1])
1906 {
1907 $this->object->setPublicExportFile($file[0], "");
1908 }
1909 else
1910 {
1911 $this->object->setPublicExportFile($file[0], $file[1]);
1912 }
1913 }
1914 $this->object->update();
1915 }
1916 $ilCtrl->redirectByClass("ilexportgui");
1917 }
1918
1923 {
1924 if(!isset($_POST["file"]))
1925 {
1926 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1927 }
1928
1929 if (count($_POST["file"]) > 1)
1930 {
1931 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1932 }
1933
1934
1935 $export_dir = $this->object->getOfflineDirectory();
1936
1937 $file = basename($_POST["file"][0]);
1938
1939 ilUtil::deliverFile($export_dir."/".$file, $file);
1940 }
1941
1942
1948 {
1949 $this->setTabs();
1950 $this->setContentSubTabs("maintenance");
1951
1952 // display confirmation message
1953 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1954 $cgui = new ilConfirmationGUI();
1955 $cgui->setFormAction($this->ctrl->getFormAction($this));
1956 $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1957 $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1958 $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1959
1960 $this->tpl->setContent($cgui->getHTML());
1961 }
1962
1966 function fixTree()
1967 {
1968 $this->object->fixTree();
1969 ilUtil::sendSuccess($this->lng->txt("cont_tree_fixed"), true);
1970 $this->ctrl->redirect($this, "showMaintenance");
1971 }
1972
1976 function setilLMMenu($a_offline = false, $a_export_format = "",
1977 $a_active = "content", $a_use_global_tabs = false, $a_as_subtabs = false,
1978 $a_cur_page = 0, $a_lang = "", $a_export_all = false)
1979 {
1980 global $ilCtrl,$ilUser, $ilAccess, $ilTabs, $rbacsystem, $ilPluginAdmin, $ilHelp;
1981
1982 $ilHelp->setScreenIdComponent("lm");
1983
1984 if ($a_as_subtabs)
1985 {
1986 $addcmd = "addSubTabTarget";
1987 $getcmd = "getSubTabHTML";
1988 }
1989 else
1990 {
1991 $addcmd = "addTarget";
1992 $getcmd = "getHTML";
1993 }
1994
1995 $active[$a_active] = true;
1996
1997 if (!$this->object->isActiveLMMenu())
1998 {
1999 return "";
2000 }
2001
2002 if ($a_use_global_tabs)
2003 {
2004 $tabs_gui = $ilTabs;
2005 }
2006 else
2007 {
2008 $tabs_gui = new ilTabsGUI();
2009 }
2010
2011 // Determine whether the view of a learning resource should
2012 // be shown in the frameset of ilias, or in a separate window.
2013 //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
2014 $showViewInFrameset = true;
2015
2016 if ($showViewInFrameset && !$a_offline)
2017 {
2018 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
2019 }
2020 else
2021 {
2022 $buttonTarget = "_top";
2023 }
2024
2025 if ($a_export_format == "scorm")
2026 {
2027 $buttonTarget = "";
2028 }
2029
2030 // content
2031 if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2032 {
2033 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2034 $tabs_gui->$addcmd("content",
2035 $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"),
2036 "", "", $buttonTarget, $active["content"]);
2037 if ($active["content"])
2038 {
2039 $ilHelp->setScreenId("content");
2040 $ilHelp->setSubScreenId("content");
2041 }
2042 }
2043 else if ($a_offline)
2044 {
2045 $tabs_gui->setForcePresentationOfSingleTab(true);
2046 }
2047
2048 // table of contents
2049 if($this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2050 {
2051 if (!$a_offline)
2052 {
2053 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2054 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
2055 }
2056 else
2057 {
2058 if ($a_export_all)
2059 {
2060 $link = "./table_of_contents_".$a_lang.".html";
2061 }
2062 else
2063 {
2064 $link = "./table_of_contents.html";
2065 }
2066 }
2067 $tabs_gui->$addcmd("cont_toc", $link,
2068 "", "", $buttonTarget, $active["toc"]);
2069 }
2070
2071 // print view
2072 if($this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2073 {
2074 if (!$a_offline) // has to be implemented for offline mode
2075 {
2076 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2077 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
2078 $tabs_gui->$addcmd("cont_print_view", $link,
2079 "", "", $buttonTarget, $active["print"]);
2080 }
2081 }
2082
2083 // download
2084 if($ilUser->getId() == ANONYMOUS_USER_ID)
2085 {
2086 $is_public = $this->object->isActiveDownloadsPublic();
2087 }
2088 else
2089 {
2090 $is_public = true;
2091 }
2092
2093 if($this->object->isActiveDownloads() && !$a_offline && $is_public &&
2094 $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2095 {
2096 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2097 $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
2098 $tabs_gui->$addcmd("download", $link,
2099 "", "", $buttonTarget, $active["download"]);
2100 }
2101
2102 // info button
2103 if ($a_export_format != "scorm" && !$a_offline)
2104 {
2105 if (!$a_offline)
2106 {
2107 $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2108 $link = $this->ctrl->getLinkTargetByClass(
2109 array("illmpresentationgui", "ilinfoscreengui"), "showSummary");
2110 }
2111 else
2112 {
2113 $link = "./info.html";
2114 }
2115
2116 $tabs_gui->$addcmd('info_short', $link,
2117 "", "", $buttonTarget, $active["info"]);
2118 }
2119
2120 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2121 if(!$a_offline &&
2122 $ilAccess->checkAccess("read", "", $_GET["ref_id"]) && // #14075
2124 {
2125 include_once './Services/Object/classes/class.ilObjectLP.php';
2126 $olp = ilObjectLP::getInstance($this->object->getId());
2127 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
2128 {
2129 $tabs_gui->$addcmd("learning_progress",
2130 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editmanual"),
2131 "", "", $buttonTarget, $active["learning_progress"]);
2132 }
2133 else if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT)
2134 {
2135 $tabs_gui->$addcmd("learning_progress",
2136 $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"),
2137 "", "", $buttonTarget, $active["learning_progress"]);
2138 }
2139 }
2140
2141 // get user defined menu entries
2142 $this->__initLMMenuEditor();
2143 $entries = $this->lmme_obj->getMenuEntries(true);
2144 if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2145 {
2146 foreach ($entries as $entry)
2147 {
2148 // build goto-link for internal resources
2149 if ($entry["type"] == "intern")
2150 {
2151 $entry["link"] = ILIAS_HTTP_PATH."/goto.php?target=".$entry["link"];
2152 }
2153
2154 // add http:// prefix if not exist
2155 if (!strstr($entry["link"],'://') && !strstr($entry["link"],'mailto:'))
2156 {
2157 $entry["link"] = "http://".$entry["link"];
2158 }
2159
2160 if (!strstr($entry["link"],'mailto:'))
2161 {
2162 $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=".$this->ref_id."&structure_id=".$this->obj_id);
2163 }
2164 $tabs_gui->$addcmd($entry["title"],
2165 $entry["link"],
2166 "", "", "_blank", "", true);
2167 }
2168 }
2169
2170 // edit learning module
2171 if (!$a_offline && $a_cur_page > 0)
2172 {
2173 if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
2174 {
2175 //$page_id = $this->getCurrentPageId();
2176 $page_id = $a_cur_page;
2177 $tabs_gui->$addcmd("edit_page", ILIAS_HTTP_PATH."/ilias.php?baseClass=ilLMEditorGUI&ref_id=".$_GET["ref_id"].
2178 "&obj_id=".$page_id."&to_page=1",
2179 "", "", $buttonTarget, $active["edit_page"]);
2180 }
2181 }
2182
2183 // user interface hook [uihk]
2184 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
2185 $plugin_html = false;
2186 foreach ($pl_names as $pl)
2187 {
2188 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
2189 $gui_class = $ui_plugin->getUIClassInstance();
2190 $resp = $gui_class->modifyGUI("Modules/LearningModule", "lm_menu_tabs",
2191 array("lm_menu_tabs" => $tabs_gui));
2192 }
2193
2194 return $tabs_gui->$getcmd();
2195 }
2196
2200 function createPDF()
2201 {
2202 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2203 $cont_exp = new ilContObjectExport($this->object, "pdf");
2204 $cont_exp->buildExportFile();
2205 $this->offlineList();
2206 }
2207
2211 function exportHTML()
2212 {
2213 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2214 $ot = ilObjectTranslation::getInstance($this->object->getId());
2215 $lang = "";
2216 if ($ot->getContentActivated())
2217 {
2218 $format = explode("_", $_POST["format"]);
2219 $lang = ilUtil::stripSlashes($format[1]);
2220 }
2221 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2222 $cont_exp = new ilContObjectExport($this->object, "html", $lang);
2223 $cont_exp->buildExportFile();
2224//echo $this->tpl->get();
2225// $this->ctrl->redirect($this, "exportList");
2226 }
2227
2231 function exportSCORM()
2232 {
2233 require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2234 $cont_exp = new ilContObjectExport($this->object, "scorm");
2235 $cont_exp->buildExportFile();
2236//echo $this->tpl->get();
2237// $this->ctrl->redirect($this, "exportList");
2238 }
2239
2245 function addLocations($a_omit_obj_id = false)
2246 {
2247 global $lng, $tree, $ilLocator, $ilCtrl;
2248
2249 $par_id = $tree->getParentId($_GET["ref_id"]);
2250 $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($par_id));
2251
2252 // parent is not root folder, "shorten" locator
2253 if($par_id != ROOT_FOLDER_ID)
2254 {
2255 $this->ctrl->addLocation("...",
2256 "");
2257 }
2258 else
2259 {
2260 // if parent is root folder and has no custom title
2261 // we adapt it [see $ilLocator->addRepositoryItems()]
2262 if ($parent_title == "ILIAS")
2263 {
2264 $parent_title = $lng->txt("repository");
2265 }
2266 }
2267
2268 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $par_id);
2269 $this->ctrl->addLocation($parent_title,
2270 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
2271 ilFrameTargetInfo::_getFrame("MainContent"), $par_id);
2272 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
2273
2274 if (!$a_omit_obj_id)
2275 {
2276 $obj_id = $_GET["obj_id"];
2277 }
2278 $lmtree = $this->object->getTree();
2279
2280 if (($obj_id != 0) && $lmtree->isInTree($obj_id))
2281 {
2282 $path = $lmtree->getPathFull($obj_id);
2283 }
2284 else
2285 {
2286 $path = $lmtree->getPathFull($lmtree->getRootId());
2287 if ($obj_id != 0)
2288 {
2289 $path[] = array("type" => "pg", "child" => $this->obj_id,
2290 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
2291 }
2292 }
2293
2294 $modifier = 1;
2295
2296 foreach ($path as $key => $row)
2297 {
2298 if ($row["child"] == 1)
2299 {
2300 $this->ctrl->setParameter($this, "obj_id", "");
2301 $this->ctrl->addLocation(
2302 $this->object->getTitle(),
2303 $this->ctrl->getLinkTarget($this, "chapters"), "", $_GET["ref_id"]);
2304 }
2305 else
2306 {
2307 $title = $row["title"];
2308 switch($row["type"])
2309 {
2310 case "st":
2311 $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
2312 $this->ctrl->addLocation(
2313 $title,
2314 $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
2315 break;
2316
2317 case "pg":
2318 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
2319 $this->ctrl->addLocation(
2320 $title,
2321 $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
2322 break;
2323 }
2324 }
2325 }
2326 if (!$a_omit_obj_id)
2327 {
2328 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
2329 }
2330 }
2331
2335
2336
2340 function listQuestions()
2341 {
2342 global $tpl;
2343
2344 $this->setTabs("questions");
2345 $this->setQuestionsSubTabs("question_stats");
2346
2347 include_once("./Modules/LearningModule/classes/class.ilLMQuestionListTableGUI.php");
2348 $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->object);
2349 $tpl->setContent($table->getHTML());
2350
2351 }
2352
2357 {
2358 global $tpl;
2359
2360 $this->setTabs("questions");
2361 $this->setQuestionsSubTabs("blocked_users");
2362
2363 include_once("./Modules/LearningModule/classes/class.ilLMBlockedUsersTableGUI.php");
2364 $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->object);
2365 $tpl->setContent($table->getHTML());
2366
2367 }
2368
2373 {
2374 global $lng, $ilCtrl;
2375
2376 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2377 if (is_array($_POST["userquest_id"]))
2378 {
2379 foreach ($_POST["userquest_id"] as $uqid)
2380 {
2381 $uqid = explode(":", $uqid);
2382 ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
2383 }
2384 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2385 }
2386 $ilCtrl->redirect($this, "listBlockedUsers");
2387 }
2388
2393 {
2394 global $lng, $ilCtrl;
2395
2396 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2397 if (is_array($_POST["userquest_id"]))
2398 {
2399 foreach ($_POST["userquest_id"] as $uqid)
2400 {
2401 $uqid = explode(":", $uqid);
2402 ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
2403 }
2404 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2405 }
2406 $ilCtrl->redirect($this, "listBlockedUsers");
2407 }
2408
2413 {
2414 global $ilCtrl;
2415
2416 if (!is_array($_POST["userquest_id"]))
2417 {
2418 ilUtil::sendFailure($this->lng->txt("no_checkbox"), 1);
2419 $ilCtrl->redirect($this, "listBlockedUsers");
2420 }
2421
2422 $rcps = array();
2423 foreach($_POST["userquest_id"] as $uqid)
2424 {
2425 $uqid = explode(":", $uqid);
2426 $login = ilObjUser::_lookupLogin($uqid[1]);
2427 if (!in_array($login, $rcps))
2428 {
2429 $rcps[] = $login;
2430 }
2431 }
2432 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
2433 ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, 'listBlockedUsers',
2434 array(),
2435 array(
2436 'type' => 'new',
2437 'rcp_to' => implode(',',$rcps),
2438 'sig' => $this->getBlockedUsersMailSignature()
2439 )));
2440 }
2441
2445 protected function getBlockedUsersMailSignature()
2446 {
2447 $link = chr(13).chr(10).chr(13).chr(10);
2448 $link .= $this->lng->txt('cont_blocked_users_mail_link');
2449 $link .= chr(13).chr(10).chr(13).chr(10);
2450 include_once './Services/Link/classes/class.ilLink.php';
2451 $link .= ilLink::_getLink($this->object->getRefId());
2452 return rawurlencode(base64_encode($link));
2453 }
2454
2455
2459
2460
2464 function setTabs($a_act = "")
2465 {
2466 global $lng, $ilHelp;
2467
2468 $ilHelp->setScreenIdComponent("lm");
2469
2470 $this->addTabs($a_act);
2471 parent::setTitleAndDescription();
2472 $this->tpl->setTitle($this->object->getTitle());
2473 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"),
2474 $lng->txt("obj_lm"));
2475 }
2476
2482 function setContentSubTabs($a_active)
2483 {
2484 global $ilTabs, $lng, $ilCtrl;
2485
2486 $lm_set = new ilSetting("lm");
2487
2488 // chapters
2489 $ilTabs->addSubtab("chapters",
2490 $lng->txt("cont_chapters"),
2491 $ilCtrl->getLinkTarget($this, "chapters"));
2492
2493 // all pages
2494 $ilTabs->addSubtab("pages",
2495 $lng->txt("cont_all_pages"),
2496 $ilCtrl->getLinkTarget($this, "pages"));
2497
2498 // export ids
2499 if ($lm_set->get("html_export_ids"))
2500 {
2501 if (!ilObjContentObject::isOnlineHelpModule($this->object->getRefId()))
2502 {
2503 $ilTabs->addSubtab("export_ids",
2504 $lng->txt("cont_html_export_ids"),
2505 $ilCtrl->getLinkTarget($this, "showExportIDsOverview"));
2506 }
2507 }
2508 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId()))
2509 {
2510 $lng->loadLanguageModule("help");
2511 $ilTabs->addSubtab("export_ids",
2512 $lng->txt("cont_online_help_ids"),
2513 $ilCtrl->getLinkTarget($this, "showExportIDsOverview"));
2514
2515 $ilTabs->addSubtab("help_tooltips",
2516 $lng->txt("help_tooltips"),
2517 $ilCtrl->getLinkTarget($this, "showTooltipList"));
2518 }
2519
2520 // list links
2521 $ilTabs->addSubtab("internal_links",
2522 $lng->txt("cont_internal_links"),
2523 $ilCtrl->getLinkTarget($this, "listLinks"));
2524
2525 // web link checker
2526 $ilTabs->addSubtab("link_check",
2527 $lng->txt("link_check"),
2528 $ilCtrl->getLinkTarget($this, "linkChecker"));
2529
2530 $ilTabs->addSubtab("history",
2531 $lng->txt("history"),
2532 $this->ctrl->getLinkTarget($this, "history"));
2533
2534 // maintenance
2535 $ilTabs->addSubtab("maintenance",
2536 $lng->txt("cont_maintenance"),
2537 $ilCtrl->getLinkTarget($this, "showMaintenance"));
2538
2539 // srt files
2540 $ilTabs->addSubtab("srt_files",
2541 $lng->txt("cont_subtitle_files"),
2542 $ilCtrl->getLinkTargetByClass("illmmultisrtuploadgui", ""));
2543
2544 // srt files
2545 $ilTabs->addSubtab("import",
2546 $lng->txt("cont_import"),
2547 $ilCtrl->getLinkTargetByClass("illmimportgui", ""));
2548
2549 $ilTabs->activateSubTab($a_active);
2550 $ilTabs->activateTab("content");
2551 }
2552
2558 function setQuestionsSubTabs($a_active)
2559 {
2560 global $ilTabs, $lng, $ilCtrl;
2561
2562 // chapters
2563 $ilTabs->addSubtab("question_stats",
2564 $lng->txt("cont_question_stats"),
2565 $ilCtrl->getLinkTarget($this, "listQuestions"));
2566
2567 // blocked users
2568 $ilTabs->addSubtab("blocked_users",
2569 $lng->txt("cont_blocked_users"),
2570 $ilCtrl->getLinkTarget($this, "listBlockedUsers"));
2571
2572 $ilTabs->activateSubTab($a_active);
2573 }
2574
2578 function addTabs($a_act = "")
2579 {
2580 global $rbacsystem, $ilUser, $ilTabs, $lng;
2581
2582 $tabs_gui = $ilTabs;
2583
2584 // content
2585 $ilTabs->addTab("content",
2586 $lng->txt("content"),
2587 $this->ctrl->getLinkTarget($this, "chapters"));
2588
2589 // info
2590 $ilTabs->addTab("info",
2591 $lng->txt("info_short"),
2592 $this->ctrl->getLinkTargetByClass("ilinfoscreengui",'showSummary'));
2593
2594 // settings
2595 $ilTabs->addTab("settings",
2596 $lng->txt("settings"),
2597 $this->ctrl->getLinkTarget($this,'properties'));
2598
2599 // questions
2600 $ilTabs->addTab("questions",
2601 $lng->txt("objs_qst"),
2602 $this->ctrl->getLinkTarget($this, "listQuestions"));
2603
2604 // learning progress
2605 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2606 if(ilLearningProgressAccess::checkAccess($this->object->getRefId()) and ($this->object->getType() == 'lm'))
2607 {
2608 $ilTabs->addTab('learning_progress',
2609 $lng->txt("learning_progress"),
2610 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''));
2611 }
2612
2613 if ($this->object->getType() != "lm")
2614 {
2615 // bibliographical data
2616 $ilTabs->addTab("bib_data",
2617 $lng->txt("bib_data"),
2618 $this->ctrl->getLinkTarget($this, "editBibItem"));
2619 }
2620
2621 // meta data
2622 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
2623 $mdgui = new ilObjectMetaDataGUI($this->object);
2624 $mdtab = $mdgui->getTab();
2625 if($mdtab)
2626 {
2627 $ilTabs->addTab("meta",
2628 $lng->txt("meta_data"),
2629 $mdtab);
2630 }
2631
2632 if ($this->object->getType() == "lm")
2633 {
2634 // export
2635 $ilTabs->addTab("export",
2636 $lng->txt("export"),
2637 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
2638 }
2639
2640 // permissions
2641 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
2642 {
2643 $ilTabs->addTab("perm",
2644 $lng->txt("perm_settings"),
2645 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
2646 }
2647
2648 if ($a_act != "")
2649 {
2650 $ilTabs->activateTab($a_act);
2651 }
2652
2653 // presentation view
2654 $ilTabs->addNonTabbedLink("pres_mode", $lng->txt("cont_presentation_view"),
2655 "ilias.php?baseClass=ilLMPresentationGUI&ref_id=".$this->object->getRefID(), "_top");
2656 }
2657
2661 function setSubTabs($a_active)
2662 {
2663 global $ilTabs, $ilSetting;
2664
2665 if (in_array($a_active,
2666 array("settings", "cont_style", "cont_lm_menu", "public_section",
2667 "cont_glossaries", "cont_multilinguality", "obj_multilinguality")))
2668 {
2669 // general properties
2670 $ilTabs->addSubTabTarget("settings",
2671 $this->ctrl->getLinkTarget($this, 'properties'),
2672 "", "");
2673
2674 // style properties
2675 $ilTabs->addSubTabTarget("cont_style",
2676 $this->ctrl->getLinkTarget($this, 'editStyleProperties'),
2677 "", "");
2678
2679 // menu properties
2680 $ilTabs->addSubTabTarget("cont_lm_menu",
2681 $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
2682 "", "");
2683
2684 // glossaries
2685 $ilTabs->addSubTabTarget("cont_glossaries",
2686 $this->ctrl->getLinkTarget($this, 'editGlossaries'),
2687 "", "");
2688
2689 if ($ilSetting->get("pub_section"))
2690 {
2691 // public section
2692 $ilTabs->addSubTabTarget("public_section",
2693 $this->ctrl->getLinkTarget($this, 'editPublicSection'),
2694 "", "");
2695 }
2696
2697 // multilinguality
2698 /* $ilTabs->addSubTabTarget("cont_multilinguality",
2699 $this->ctrl->getLinkTargetByClass("ilPageMultiLangGUI", ''),
2700 "", "");*/
2701
2702 $ilTabs->addSubTabTarget("obj_multilinguality",
2703 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
2704
2705 $ilTabs->setSubTabActive($a_active);
2706 }
2707 }
2708
2710 {
2711 global $ilTabs, $ilToolbar, $ilAccess;
2712
2713
2714 if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->object->getRefId()))
2715 {
2716 ilUtil::sendInfo($this->lng->txt("cont_anonymous_user_missing_perm"));
2717 }
2718
2719 $this->setTabs();
2720 $this->setSubTabs("public_section");
2721 $ilTabs->setTabActive("settings");
2722
2723 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_public_selector.html",
2724 "Modules/LearningModule");
2725
2726 // get learning module object
2727 $this->lm_obj = new ilObjLearningModule($this->ref_id, true);
2728
2729
2730 // public mode
2731 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
2732 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2733 $si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
2734 $si->setOptions($modes);
2735 $si->setValue($this->object->getPublicAccessMode());
2736 $ilToolbar->addInputItem($si, true);
2737 $ilToolbar->addFormButton($this->lng->txt("save"), "savePublicSectionAccess");
2738 $ilToolbar->setFormAction($this->ctrl->getFormAction($this,"savePublicSectionAccess"));
2739
2740 if ($this->object->getPublicAccessMode() == "selected")
2741 {
2742 $this->tpl->setCurrentBlock("select_pages");
2743 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSectionPages"));
2744
2745 include_once ("./Modules/LearningModule/classes/class.ilPublicSectionExplorerGUI.php");
2746 $tree = new ilPublicSectionExplorerGUI($this,"editPublicSection", $this->lm_obj);
2747 $tree->setSelectMode("pages", true);
2748 $tree->setSkipRootNode(true);
2749
2750 $this->tpl->setVariable("EXPLORER",$tree->getHTML());
2751 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2752
2753 $this->tpl->parseCurrentBlock();
2754 }
2755 }
2756
2758 {
2759 //var_dump($_POST["lm_public_mode"]);exit;
2760 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2761 $this->object->updateProperties();
2762 ilLMObject::_writePublicAccessStatus($_POST["pages"],$this->object->getId());
2763 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2764 $this->ctrl->redirect($this, "editPublicSection");
2765 }
2766
2771 {
2772 $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2773 $this->object->updateProperties();
2774 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2775 $this->ctrl->redirect($this, "editPublicSection");
2776 }
2777
2782 {
2783 ilLMObject::_writePublicAccessStatus($_POST["pages"],$this->object->getId());
2784 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2785 $this->ctrl->redirect($this, "editPublicSection");
2786 }
2787
2793 function history()
2794 {
2795 $this->setTabs("content");
2796 $this->setContentSubTabs("history");
2797
2798 require_once("./Services/History/classes/class.ilHistoryTableGUI.php");
2799 $hist_gui = new ilHistoryTableGUI($this,"history",
2800 $this->object->getId() ,$this->object->getType());
2801 $hist_gui->initTable();
2802 $hist_gui->setCommentVisibility($this->object->isActiveHistoryUserComments());
2803
2804 $this->tpl->setContent($hist_gui->getHTML());
2805 }
2806
2815 public function formatInvalidLinkArray(Array $row)
2816 {
2817 $row['title'] = ilLMPageObject::_getPresentationTitle($row['page_id'], $this->object->getPageHeader());
2818
2819 require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
2821 $actions->setSelectionHeaderClass('small');
2822 $actions->setItemLinkClass('xsmall');
2823 $actions->setListTitle($this->lng->txt('actions'));
2824 $actions->setId($row['page_id']);
2825 $this->ctrl->setParameterByClass('ilLMPageObjectGUI', 'obj_id', $row['page_id']);
2826 $actions->addItem(
2827 $this->lng->txt('edit'),
2828 '',
2829 $this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI', 'edit')
2830 );
2831 $this->ctrl->clearParametersByClass('ilLMPageObjectGUI');
2832 $row['action_html'] = $actions->getHTML();
2833
2834 return $row;
2835 }
2836
2837 function linkChecker()
2838 {
2839 global $ilias, $ilUser, $tpl;
2840
2841 $this->__initLinkChecker();
2842
2843 $this->setTabs();
2844 $this->setContentSubTabs("link_check");
2845
2846 require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
2847
2848 $toolbar = new ilToolbarGUI();
2849
2850 // #13684
2851 include_once "Services/Cron/classes/class.ilCronManager.php";
2852 if(ilCronManager::isJobActive("lm_link_check"))
2853 {
2854 include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
2855 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2856
2857 $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
2858 $chb->setValue(1);
2859 $chb->setChecked((bool)ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(),$this->object->getId()));
2860 $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
2861
2862 $toolbar->addInputItem($chb);
2863 $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
2864 $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
2865 }
2866
2867 $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
2868 $tgui->setLinkChecker($this->link_checker_obj)
2869 ->setRowHandler($this)
2870 ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
2871
2872 return $tpl->setContent($tgui->prepareHTML()->getHTML().$toolbar->getHTML());
2873 }
2874
2875 function saveLinkCheck()
2876 {
2877 global $ilDB,$ilUser;
2878
2879 include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
2880
2881 $link_check_notify = new ilLinkCheckNotify($ilDB);
2882 $link_check_notify->setUserId($ilUser->getId());
2883 $link_check_notify->setObjId($this->object->getId());
2884
2885 if($_POST['link_check_message'])
2886 {
2887 ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
2888 $link_check_notify->addNotifier();
2889 }
2890 else
2891 {
2892 ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
2893 $link_check_notify->deleteNotifier();
2894 }
2895 $this->linkChecker();
2896
2897 return true;
2898 }
2899
2900
2901
2903 {
2904 $this->__initLinkChecker();
2905 $this->link_checker_obj->checkLinks();
2906 ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
2907
2908 $this->linkChecker();
2909
2910 return true;
2911 }
2912
2914 {
2915 global $ilDB;
2916
2917 include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
2918
2919 $this->link_checker_obj = new ilLinkChecker($ilDB,false);
2920 $this->link_checker_obj->setObjId($this->object->getId());
2921
2922 return true;
2923 }
2924
2926 {
2927 include_once './Modules/LearningModule/classes/class.ilLMMenuEditor.php';
2928
2929 $this->lmme_obj = new ilLMMenuEditor();
2930 $this->lmme_obj->setObjId($this->object->getId());
2931
2932 return true;
2933 }
2934
2938 function addMenuEntry()
2939 {
2940 global $ilTabs, $ilToolbar, $tpl, $ilCtrl;
2941
2942 $this->setTabs();
2943
2944 $ilTabs->setTabActive("settings");
2945 $this->setSubTabs("cont_lm_menu");
2946
2947 $ilToolbar->addButton($this->lng->txt("lm_menu_select_internal_object"),
2948 $ilCtrl->getLinkTarget($this, "showEntrySelector"));
2949
2950 $form = $this->initMenuEntryForm("create");
2951 $this->tpl->setContent($form->getHTML());
2952 }
2953
2959 public function initMenuEntryForm($a_mode = "edit")
2960 {
2961 global $lng, $ilCtrl;
2962
2963 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
2964 $form = new ilPropertyFormGUI();
2965
2966 // title
2967 $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
2968 $ti->setMaxLength(255);
2969 $ti->setSize(40);
2970 $form->addItem($ti);
2971
2972 // target
2973 $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
2974 $ta->setMaxLength(255);
2975 $ta->setSize(40);
2976 $form->addItem($ta);
2977
2978 if ($a_mode == "edit")
2979 {
2980 $this->__initLMMenuEditor();
2981 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
2982 $ti->setValue($this->lmme_obj->getTitle());
2983 $ta->setValue($this->lmme_obj->getTarget());
2984 }
2985
2986 if (isset($_GET["link_ref_id"]))
2987 {
2988 $link_ref_id = (int) $_GET["link_ref_id"];
2989 $obj_type = ilObject::_lookupType($link_ref_id,true);
2990 $obj_id = ilObject::_lookupObjectId($link_ref_id);
2992
2993 $target_link = $obj_type."_".$link_ref_id;
2994 $ti->setValue($title);
2995 $ta->setValue($target_link);
2996
2997 // link ref id
2998 $hi = new ilHiddenInputGUI("link_ref_id");
2999 $hi->setValue($link_ref_id);
3000 $form->addItem($hi);
3001 }
3002
3003
3004 // save and cancel commands
3005 if ($a_mode == "create")
3006 {
3007 $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
3008 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
3009 $form->setTitle($lng->txt("lm_menu_new_entry"));
3010 }
3011 else
3012 {
3013 $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
3014 $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
3015 $form->setTitle($lng->txt("lm_menu_edit_entry"));
3016 }
3017
3018 $form->setFormAction($ilCtrl->getFormAction($this));
3019
3020 return $form;
3021 }
3022
3026 function saveMenuEntry()
3027 {
3028 global $ilCtrl;
3029
3030 // check title and target
3031 if (empty($_POST["title"]))
3032 {
3033 //$this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
3034 ilUtil::sendFailure($this->lng->txt("please_enter_title") , true);
3035 $ilCtrl->redirect($this, "addMenuEntry");
3036 }
3037 if (empty($_POST["target"]))
3038 {
3039 //$this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
3040 ilUtil::sendFailure($this->lng->txt("please_enter_target"), true);
3041 $ilCtrl->redirect($this, "addMenuEntry");
3042 }
3043
3044 $this->__initLMMenuEditor();
3045 $this->lmme_obj->setTitle($_POST["title"]);
3046 $this->lmme_obj->setTarget($_POST["target"]);
3047 $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
3048
3049 if ($_POST["link_ref_id"])
3050 {
3051 $this->lmme_obj->setLinkType("intern");
3052 }
3053
3054 $this->lmme_obj->create();
3055
3056 ilUtil::sendSuccess($this->lng->txt("msg_entry_added"), true);
3057 $this->ctrl->redirect($this, "editMenuProperties");
3058 }
3059
3064 {
3065 if (empty($_GET["menu_entry"]))
3066 {
3067 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
3068 }
3069
3070 $this->__initLMMenuEditor();
3071 $this->lmme_obj->delete($_GET["menu_entry"]);
3072
3073 ilUtil::sendSuccess($this->lng->txt("msg_entry_removed"), true);
3074 $this->ctrl->redirect($this, "editMenuProperties");
3075 }
3076
3080 function editMenuEntry()
3081 {
3082 global $ilToolbar, $ilCtrl, $ilTabs;
3083
3084 $this->setTabs();
3085
3086 $ilTabs->setTabActive("settings");
3087 $this->setSubTabs("cont_lm_menu");
3088
3089
3090 if (empty($_GET["menu_entry"]))
3091 {
3092 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
3093 }
3094
3095 $ilCtrl->saveParameter($this, array("menu_entry"));
3096 $ilToolbar->addButton($this->lng->txt("lm_menu_select_internal_object"),
3097 $ilCtrl->getLinkTarget($this, "showEntrySelector"));
3098
3099 $form = $this->initMenuEntryForm("edit");
3100 $this->tpl->setContent($form->getHTML());
3101 }
3102
3107 {
3108 if (empty($_REQUEST["menu_entry"]))
3109 {
3110 $this->ilias->raiseError($this->lng->txt("no_menu_entry_id"),$this->ilias->error_obj->MESSAGE);
3111 }
3112
3113 // check title and target
3114 if (empty($_POST["title"]))
3115 {
3116 $this->ilias->raiseError($this->lng->txt("please_enter_title"),$this->ilias->error_obj->MESSAGE);
3117 }
3118 if (empty($_POST["target"]))
3119 {
3120 $this->ilias->raiseError($this->lng->txt("please_enter_target"),$this->ilias->error_obj->MESSAGE);
3121 }
3122
3123 $this->__initLMMenuEditor();
3124 $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
3125 $this->lmme_obj->setTitle($_POST["title"]);
3126 $this->lmme_obj->setTarget($_POST["target"]);
3127 if ($_POST["link_ref_id"])
3128 {
3129 $this->lmme_obj->setLinkType("intern");
3130 }
3131 if (is_int(strpos($_POST["target"] , ".")))
3132 {
3133 $this->lmme_obj->setLinkType("extern");
3134 }
3135 $this->lmme_obj->update();
3136
3137 ilUtil::sendSuccess($this->lng->txt("msg_entry_updated"), true);
3138 $this->ctrl->redirect($this, "editMenuProperties");
3139 }
3140
3142 {
3143 global $ilTabs, $ilCtrl;
3144
3145 $this->setTabs();
3146
3147 $ilTabs->setTabActive("settings");
3148 $this->setSubTabs("cont_lm_menu");
3149
3150 $ilCtrl->saveParameter($this, array("menu_entry"));
3151
3152 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html","Modules/LearningModule");
3153
3154 ilUtil::sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
3155
3156 require_once ("./Modules/LearningModule/classes/class.ilLMMenuObjectSelector.php");
3157 $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this,'test'),$this);
3158
3159 $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
3160 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showEntrySelector'));
3161 $exp->setTargetGet("ref_id");
3162 $exp->setRefId($this->cur_ref_id);
3163
3164 $sel_types = array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs',
3165 "crs", "grp", "book", "tst", "file");
3166 $exp->setSelectableTypes($sel_types);
3167
3168 //$exp->setTargetGet("obj_id");
3169
3170 // build html-output
3171 $exp->setOutput(0);
3172 $output = $exp->getOutput();
3173
3174 // get page ids
3175 foreach ($exp->format_options as $node)
3176 {
3177 if (!$node["container"])
3178 {
3179 $pages[] = $node["child"];
3180 }
3181 }
3182
3183 //$this->tpl->setCurrentBlock("content");
3184 //var_dump($this->object->getPublicAccessMode());
3185 // access mode selector
3186 $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
3187 $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
3188 $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
3189 $select_public_mode = ilUtil::formSelect ($this->object->getPublicAccessMode(),"lm_public_mode",$modes, false, true);
3190 $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
3191
3192 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
3193 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
3194 $this->tpl->setVariable("EXPLORER",$output);
3195 $this->tpl->setVariable("ONCLICK",$js_pages);
3196 $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
3197 $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
3198 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3199 $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
3200 //$this->tpl->parseCurrentBlock();
3201 }
3202
3206 function selectHeader()
3207 {
3208 if(!isset($_POST["id"]))
3209 {
3210 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
3211 }
3212 if(count($_POST["id"]) > 1)
3213 {
3214 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
3215 }
3216 if ($_POST["id"][0] != $this->object->getHeaderPage())
3217 {
3218 $this->object->setHeaderPage($_POST["id"][0]);
3219 }
3220 else
3221 {
3222 $this->object->setHeaderPage(0);
3223 }
3224 $this->object->updateProperties();
3225 $this->ctrl->redirect($this, "pages");
3226 }
3227
3231 function selectFooter()
3232 {
3233 if(!isset($_POST["id"]))
3234 {
3235 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
3236 }
3237 if(count($_POST["id"]) > 1)
3238 {
3239 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
3240 }
3241 if ($_POST["id"][0] != $this->object->getFooterPage())
3242 {
3243 $this->object->setFooterPage($_POST["id"][0]);
3244 }
3245 else
3246 {
3247 $this->object->setFooterPage(0);
3248 }
3249 $this->object->updateProperties();
3250 $this->ctrl->redirect($this, "pages");
3251 }
3252
3256 function saveAllTitles()
3257 {
3258 global $ilCtrl;
3259
3260 ilLMObject::saveTitles($this->object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
3261
3262 $ilCtrl->redirect($this, "chapters");
3263 }
3264
3268 function insertChapter()
3269 {
3270 global $ilCtrl, $lng;
3271
3272 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3273
3276
3277 if (!ilChapterHierarchyFormGUI::getPostFirstChild()) // insert after node id
3278 {
3279 $parent_id = $this->lm_tree->getParentId($node_id);
3280 $target = $node_id;
3281 }
3282 else // insert as first child
3283 {
3284 $parent_id = $node_id;
3286 }
3287
3288 for ($i = 1; $i <= $num; $i++)
3289 {
3290 $chap = new ilStructureObject($this->object);
3291 $chap->setType("st");
3292 $chap->setTitle($lng->txt("cont_new_chap"));
3293 $chap->setLMId($this->object->getId());
3294 $chap->create();
3295 ilLMObject::putInTree($chap, $parent_id, $target);
3296 }
3297
3298 $ilCtrl->redirect($this, "chapters");
3299 }
3300
3305 {
3306 global $ilUser, $ilCtrl, $ilLog;
3307
3308 include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3309
3312
3313 $ilLog->write("InsertChapterClip, num: $num, node_id: $node_id, ".
3314 " getPostFirstChild ".ilChapterHierarchyFormGUI::getPostFirstChild());
3315
3316 if (!$first_child) // insert after node id
3317 {
3318 $parent_id = $this->lm_tree->getParentId($node_id);
3319 $target = $node_id;
3320 }
3321 else // insert as first child
3322 {
3323 $parent_id = $node_id;
3325 }
3326
3327 // copy and paste
3328 $chapters = $ilUser->getClipboardObjects("st", true);
3329 $copied_nodes = array();
3330 foreach ($chapters as $chap)
3331 {
3332 $ilLog->write("Call pasteTree, Target LM: ".$this->object->getId().", Chapter ID: ".$chap["id"]
3333 .", Parent ID: ".$parent_id.", Target: ".$target);
3334 $cid = ilLMObject::pasteTree($this->object, $chap["id"], $parent_id,
3335 $target, $chap["insert_time"], $copied_nodes,
3336 (ilEditClipboard::getAction() == "copy"));
3337 $target = $cid;
3338 }
3339 ilLMObject::updateInternalLinks($copied_nodes);
3340
3341 if (ilEditClipboard::getAction() == "cut")
3342 {
3343 $ilUser->clipboardDeleteObjectsOfType("pg");
3344 $ilUser->clipboardDeleteObjectsOfType("st");
3346 }
3347
3348 $this->object->checkTree();
3349 $ilCtrl->redirect($this, "chapters");
3350 }
3351
3357 public static function _goto($a_target)
3358 {
3359 global $ilAccess, $ilErr, $lng;
3360
3361 if ($ilAccess->checkAccess("read", "", $a_target))
3362 {
3363 $_GET["baseClass"] = "ilLMPresentationGUI";
3364 $_GET["ref_id"] = $a_target;
3365 $_GET["cmd"] = "resume";
3366 include("ilias.php");
3367 exit;
3368 } else if ($ilAccess->checkAccess("visible", "", $a_target))
3369 {
3370 $_GET["baseClass"] = "ilLMPresentationGUI";
3371 $_GET["ref_id"] = $a_target;
3372 $_GET["cmd"] = "infoScreen";
3373 include("ilias.php");
3374 exit;
3375 }
3376 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
3377 {
3378 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
3381 }
3382
3383
3384 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3385 }
3386
3390 function cutItems($a_return = "chapters")
3391 {
3392 global $ilCtrl, $lng;
3393
3394 $items = ilUtil::stripSlashesArray($_POST["id"]);
3395 if (!is_array($items))
3396 {
3397 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3398 $ilCtrl->redirect($this, $a_return);
3399 }
3400
3401 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3402 foreach($items as $k => $item)
3403 {
3404 if ($item < 0)
3405 {
3406 $todel[] = $k;
3407 }
3408 }
3409 foreach($todel as $k)
3410 {
3411 unset($items[$k]);
3412 }
3413 ilLMObject::clipboardCut($this->object->getId(), $items);
3415 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
3416
3417 $ilCtrl->redirect($this, $a_return);
3418 }
3419
3423 function copyItems()
3424 {
3425 global $ilCtrl, $lng;
3426
3427 $items = ilUtil::stripSlashesArray($_POST["id"]);
3428 if (!is_array($items))
3429 {
3430 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3431 $ilCtrl->redirect($this, "chapters");
3432 }
3433
3434 $todel = array(); // delete IDs < 0 (needed for non-js editing)
3435 foreach($items as $k => $item)
3436 {
3437 if ($item < 0)
3438 {
3439 $todel[] = $k;
3440 }
3441 }
3442 foreach($todel as $k)
3443 {
3444 unset($items[$k]);
3445 }
3446 ilLMObject::clipboardCopy($this->object->getId(), $items);
3448 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
3449 $ilCtrl->redirect($this, "chapters");
3450 }
3451
3455 function cutChapter()
3456 {
3457 $this->cutItems("chapters");
3458 }
3459
3463
3470 function showExportIDsOverview($a_validation = false)
3471 {
3472 global $tpl, $ilToolbar, $lng, $ilCtrl;
3473
3474 $this->setTabs();
3475 $this->setContentSubTabs("export_ids");
3476
3477 if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId()))
3478 {
3479 // toolbar
3480 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3481 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3482 $lm_tree = $this->object->getTree();
3483 $childs = $lm_tree->getChilds($lm_tree->readRootId());
3484 $options = array("" => $lng->txt("all"));
3485 foreach ($childs as $c)
3486 {
3487 $options[$c["child"]] = $c["title"];
3488 }
3489 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
3490 $si->setOptions($options);
3491 $si->setValue(ilSession::get("help_chap"));
3492 $ilToolbar->addInputItem($si, true);
3493 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
3494
3495 include_once("./Modules/LearningModule/classes/class.ilHelpMappingTableGUI.php");
3496 $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation, false);
3497 }
3498 else
3499 {
3500 include_once("./Modules/LearningModule/classes/class.ilExportIDTableGUI.php");
3501 $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
3502 }
3503
3504 $tpl->setContent($tbl->getHTML());
3505 }
3506
3514 {
3515 global $ilCtrl;
3516
3517 ilSession::set("help_chap", ilUtil::stripSlashes($_POST["help_chap"]));
3518 $ilCtrl->redirect($this, "showExportIDsOverview");
3519 }
3520
3521
3525 function saveExportIds()
3526 {
3527 global $ilCtrl, $lng;
3528
3529 // check all export ids
3530 $ok = true;
3531 if (is_array($_POST["exportid"]))
3532 {
3533 foreach ($_POST["exportid"] as $pg_id => $exp_id)
3534 {
3535 if ($exp_id != "" && !preg_match("/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
3536 trim($exp_id)))
3537 {
3538 $ok = false;
3539 }
3540 }
3541 }
3542 if (!$ok)
3543 {
3544 ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1").": a-z, A-Z, 0-9, '_'. ".
3545 $lng->txt("cont_exp_ids_not_resp_format3")." ".
3546 $lng->txt("cont_exp_ids_not_resp_format2"));
3547 $this->showExportIDsOverview(true);
3548 return;
3549 }
3550
3551
3552 if (is_array($_POST["exportid"]))
3553 {
3554 foreach ($_POST["exportid"] as $pg_id => $exp_id)
3555 {
3556 ilLMPageObject::saveExportId($this->object->getId(), $pg_id,
3558 }
3559 }
3560
3561 ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true);
3562 $ilCtrl->redirect($this, "showExportIdsOverview");
3563 }
3564
3572 {
3573 global $lng, $ilCtrl;
3574
3575 include_once("./Services/Help/classes/class.ilHelpMapping.php");
3576 if (is_array($_POST["screen_ids"]))
3577 {
3578 foreach ($_POST["screen_ids"] as $chap => $ids)
3579 {
3580 $ids = explode("\n", $ids);
3582 }
3583 }
3584 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3585 $ilCtrl->redirect($this, "showExportIdsOverview");
3586 }
3587
3591
3599 {
3600 global $tpl, $ilToolbar, $ilCtrl, $lng;
3601
3602 $this->setTabs();
3603 $this->setContentSubTabs("help_tooltips");
3604
3605 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3606 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
3607 $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
3608 $ti->setMaxLength(200);
3609 $ti->setSize(20);
3610 $ilToolbar->addInputItem($ti, true);
3611 $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
3612 $ilToolbar->addSeparator();
3613
3614 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3616 if (ilSession::get("help_tt_comp") != "")
3617 {
3618 $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
3619 }
3620 $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
3621 $si->setOptions($options);
3622 $si->setValue(ilSession::get("help_tt_comp"));
3623 $ilToolbar->addInputItem($si, true);
3624 $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
3625
3626 include_once("./Modules/LearningModule/classes/class.ilHelpTooltipTableGUI.php");
3627 $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp"));
3628
3629 $tpl->setContent($tbl->getHTML());
3630 }
3631
3638 function addTooltip()
3639 {
3640 global $lng, $ilCtrl;
3641
3642 $tt_id = ilUtil::stripSlashes($_POST["tooltip_id"]);
3643 if (trim($tt_id) != "")
3644 {
3645 if (is_int(strpos($tt_id, "_")))
3646 {
3647 include_once("./Services/Help/classes/class.ilHelp.php");
3648 ilHelp::addTooltip(trim($tt_id), "");
3649 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3650
3651 $fu = strpos($tt_id, "_");
3652 $comp = substr($tt_id, 0, $fu);
3653 ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
3654 }
3655 else
3656 {
3657 ilUtil::sendFailure($lng->txt("cont_help_no_valid_tooltip_id"), true);
3658 }
3659 }
3660 $ilCtrl->redirect($this, "showTooltipList");
3661 }
3662
3670 {
3671 global $lng, $ilCtrl;
3672
3673 ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"]));
3674 $ilCtrl->redirect($this, "showTooltipList");
3675 }
3676
3677
3684 function saveTooltips()
3685 {
3686 global $ilCtrl, $lng;
3687
3688 include_once("./Services/Help/classes/class.ilHelp.php");
3689
3690 if (is_array($_POST["text"]))
3691 {
3692 foreach ($_POST["text"] as $id => $text)
3693 {
3695 ilUtil::stripSlashes($_POST["tt_id"][(int) $id]));
3696 }
3697 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3698 }
3699 $ilCtrl->redirect($this, "showTooltipList");
3700 }
3701
3706 {
3707 global $lng, $ilCtrl;
3708
3709 if (is_array($_POST["id"]))
3710 {
3711 include_once("./Services/Help/classes/class.ilHelp.php");
3712 foreach ($_POST["id"] as $id)
3713 {
3714 ilHelp::deleteTooltip((int) $id);
3715 }
3716 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3717 }
3718 $ilCtrl->redirect($this, "showTooltipList");
3719 }
3720
3727/* function saveHelpMapping()
3728 {
3729 global $lng, $ilCtrl;
3730
3731 include_once("./Services/Help/classes/class.ilHelpMapping.php");
3732 if (is_array($_POST["screen_ids"]))
3733 {
3734 foreach ($_POST["screen_ids"] as $chap => $ids)
3735 {
3736 $ids = explode("\n", $ids);
3737 ilHelpMapping::saveScreenIdsForChapter($chap, $ids);
3738 }
3739 }
3740 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3741 $ilCtrl->redirect($this, "showExportIdsOverview");
3742 }*/
3743
3744
3748
3754 static function getLayoutOption($a_txt, $a_var, $a_def_option = "")
3755 {
3756 global $lng;
3757
3758 // default layout
3759 $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
3760 if ($a_def_option != "")
3761 {
3762 if (is_file($im = ilUtil::getImagePath("layout_".$a_def_option.".png")))
3763 {
3764 $im_tag = ilUtil::img($im, $a_def_option);
3765 }
3766 $layout->addOption(new ilRadioOption("<table><tr><td>".$im_tag."</td><td><b>".
3767 $lng->txt("cont_lm_default_layout").
3768 "</b>: ".$lng->txt("cont_layout_".$a_def_option).
3769 "</td></tr></table>", ""));
3770 }
3772 {
3773 $im_tag = "";
3774 if (is_file($im = ilUtil::getImagePath("layout_".$l.".png")))
3775 {
3776 $im_tag = ilUtil::img($im, $l);
3777 }
3778 $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>".
3779 $im_tag."</td><td style='padding:5px;'><b>".$lng->txt("cont_layout_".$l)."</b>: ".
3780 $lng->txt("cont_layout_".$l."_desc")."</td></tr></table>", $l));
3781 }
3782
3783 return $layout;
3784 }
3785
3790 {
3791 global $ilCtrl;
3792 $ilCtrl->setParameter($this, "hierarchy", "1");
3793 $this->setPageLayout(true);
3794 }
3795
3796
3800 function setPageLayout($a_in_hierarchy = false)
3801 {
3802 global $tpl, $ilCtrl, $lng;
3803
3804 if (!is_array($_POST["id"]))
3805 {
3806 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3807
3808 if ($a_in_hierarchy)
3809 {
3810 $ilCtrl->redirect($this, "chapters");
3811 }
3812 else
3813 {
3814 $ilCtrl->redirect($this, "pages");
3815 }
3816 }
3817
3818 $this->initSetPageLayoutForm();
3819
3820 $tpl->setContent($this->form->getHTML());
3821 }
3822
3826 public function initSetPageLayoutForm()
3827 {
3828 global $lng, $ilCtrl;
3829
3830 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3831 $this->form = new ilPropertyFormGUI();
3832
3833 if (is_array($_POST["id"]))
3834 {
3835 foreach ($_POST["id"] as $id)
3836 {
3837 $hi = new ilHiddenInputGUI("id[]");
3838 $hi->setValue($id);
3839 $this->form->addItem($hi);
3840 }
3841 }
3842 $layout = self::getLayoutOption($lng->txt("cont_layout"), "layout",
3843 $this->object->getLayout());
3844 $this->form->addItem($layout);
3845
3846 $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
3847 $this->form->addCommandButton("pages", $lng->txt("cancel"));
3848
3849 $this->form->setTitle($lng->txt("cont_set_layout"));
3850 $this->form->setFormAction($ilCtrl->getFormAction($this));
3851
3852 }
3853
3858 {
3859 global $lng, $ilCtrl;
3860
3861 $ilCtrl->setParameter($this, "hierarchy", $_GET["hierarchy"]);
3862
3863 foreach ($_POST["id"] as $id)
3864 {
3866 ilUtil::stripSlashes($_POST["layout"]),
3867 $this->object);
3868 }
3869 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3870
3871 if ($_GET["hierarchy"] == 1)
3872 {
3873 $ilCtrl->redirect($this, "chapters");
3874 }
3875 else
3876 {
3877 $ilCtrl->redirect($this, "pages");
3878 }
3879 }
3880
3881 //
3882 // Auto glossaries
3883 //
3884
3892 {
3893 global $tpl, $ilToolbar, $lng, $ilCtrl, $ilTabs;
3894
3895 $this->setTabs();
3896 $ilTabs->setTabActive("settings");
3897 $this->setSubTabs("cont_glossaries");
3898
3899 $ilToolbar->addButton($lng->txt("add"),
3900 $ilCtrl->getLinkTarget($this, "showLMGlossarySelector"));
3901
3902 include_once("./Modules/LearningModule/classes/class.ilLMGlossaryTableGUI.php");
3903 $tab = new ilLMGlossaryTableGUI($this->object, $this, "editGlossaries");
3904
3905 $tpl->setContent($tab->getHTML());
3906 }
3907
3915 {
3916 global $tpl, $lng, $ilCtrl, $tree, $ilUser, $ilTabs;
3917
3918 $this->setTabs();
3919 $ilTabs->setTabActive("settings");
3920 $this->setSubTabs("cont_glossaries");
3921
3922 include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
3923
3924 $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this,'showLMGlossarySelector'));
3925 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
3926 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,'showLMGlossarySelector'));
3927 $exp->setTargetClass(get_class($this));
3928 $exp->setCmd('confirmGlossarySelection');
3929 $exp->setClickableTypes(array("glo"));
3930 $exp->addFilter("glo");
3931
3932 // build html-output
3933 $exp->setOutput(0);
3934 $tpl->setContent($exp->getOutput());
3935
3936 }
3937
3942 {
3943 global $ilCtrl, $tpl, $lng;
3944
3945 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3946 $cgui = new ilConfirmationGUI();
3947 $ilCtrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
3948 $cgui->setFormAction($ilCtrl->getFormAction($this));
3949 $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
3950 $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
3951 $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
3952 $tpl->setContent($cgui->getHTML());
3953 }
3954
3962 {
3963 $glo_ref_id = (int) $_GET["glo_ref_id"];
3964 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3965 $this->object->autoLinkGlossaryTerms($glo_id);
3966 $this->selectLMGlossary();
3967 }
3968
3969
3977 {
3978 global $ilCtrl, $lng;
3979
3980 $glos = $this->object->getAutoGlossaries();
3981 $glo_ref_id = (int) $_GET["glo_ref_id"];
3982 $glo_id = ilObject::_lookupObjId($glo_ref_id);
3983 if (!in_array($glo_id, $glos))
3984 {
3985 $glos[] = $glo_id;
3986 }
3987 $this->object->setAutoGlossaries($glos);
3988 $this->object->update();
3989
3990 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3991 $ilCtrl->redirect($this, "editGlossaries");
3992 }
3993
4001 {
4002 global $ilCtrl, $lng;
4003
4004 $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
4005 $this->object->update();
4006
4007 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
4008 $ilCtrl->redirect($this, "editGlossaries");
4009 }
4010
4018 {
4019 global $ilCtrl;
4020
4021 $ilCtrl->setParameter($this, "transl", "");
4022 $ilCtrl->redirect($this, "chapters");
4023 }
4024
4032 {
4033 global $ilCtrl;
4034
4035 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
4036 $ilCtrl->redirect($this, "chapters");
4037 }
4038
4040 {
4041 // #12281
4042 return parent::redrawHeaderActionObject();
4043 }
4044
4045}
4046?>
sprintf('%.4f', $callTime)
for($col=0; $col< 50; $col++) $d
$section
Definition: Utf8Test.php:83
global $l
Definition: afr.php:30
$path
Definition: aliased.php:25
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
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")
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.
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.
Upload SRT files to all media objects of a learning module.
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 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.
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.
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="-")
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.
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
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.
owner()
show owner of content object
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.
static getMultiLangHeader($a_lm_id, $a_gui_class)
Get multi lang header.
showExportIDsOverview($a_validation=false)
Show export IDs overview.
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.
initSetPageLayoutForm()
Init set page layout form.
savePublicSectionAccess()
Saves lm access mode.
insertChapter()
Insert (multiple) chapters at node.
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
importFileObject($parent_id=NULL, $a_catch_errors=true)
display status information or report errors messages in case of error
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
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
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="")
Save help mapping.
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.
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
setFormAction($a_cmd, $a_formaction)
set specific form action for command
setTabs()
set admin tabs @access public
setReturnLocation($a_cmd, $a_location)
set specific return location for command
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
$valid
$text
$tbl
Definition: example_048.php:81
$info
Definition: example_052.php:80
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
global $ilCtrl
Definition: ilias.php:18
interface ilLinkCheckerGUIRowHandling
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
global $ilErr
Definition: raiseError.php:16
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
$cmd
Definition: sahs_server.php:35
global $ilDB
$lm_set
if(!is_array($argv)) $options
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:93