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