ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Services/Object/classes/class.ilObjectGUI.php";
5 include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
6 include_once("./Modules/LearningModule/classes/class.ilLMPageObjectGUI.php");
7 include_once("./Modules/LearningModule/classes/class.ilStructureObjectGUI.php");
8 require_once 'Services/LinkChecker/interfaces/interface.ilLinkCheckerGUIRowHandling.php';
9 
22 {
26  protected $tabs;
27 
31  protected $error;
32 
36  protected $rbacsystem;
37 
41  protected $plugin_admin;
42 
46  protected $help;
47 
51  protected $db;
52 
56  protected $log;
57 
58  public $ctrl;
59 
65  public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
66  {
67  global $DIC;
68 
69  $this->lng = $DIC->language();
70  $this->access = $DIC->access();
71  $this->tabs = $DIC->tabs();
72  $this->error = $DIC["ilErr"];
73  $this->settings = $DIC->settings();
74  $this->user = $DIC->user();
75  $this->tpl = $DIC["tpl"];
76  $this->toolbar = $DIC->toolbar();
77  $this->rbacsystem = $DIC->rbac()->system();
78  $this->tree = $DIC->repositoryTree();
79  $this->plugin_admin = $DIC["ilPluginAdmin"];
80  $this->help = $DIC["ilHelp"];
81  $this->locator = $DIC["ilLocator"];
82  $this->db = $DIC->database();
83  $this->log = $DIC["ilLog"];
84  $lng = $DIC->language();
85  $ilCtrl = $DIC->ctrl();
86  //echo "<br>ilobjcontobjgui-constructor-id-$a_id";
87  $this->ctrl = $ilCtrl;
88  $lng->loadLanguageModule("content");
89  $lng->loadLanguageModule("obj");
90  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
91  }
92 
96  public function executeCommand()
97  {
98  $ilAccess = $this->access;
99  $lng = $this->lng;
100  $ilTabs = $this->tabs;
103 
104  if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
105  $this->explorer();
106  return;
107  }
108 
109  if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
110  $this->ctrl->setReturn($this, "explorer");
111  }
112 
113  // get next class that processes or forwards current command
114  $next_class = $this->ctrl->getNextClass($this);
115 
116  // get current command
117  // $cmd = $this->ctrl->getCmd("", array("downloadExportFile"));
118  if ($_GET["to_props"] == 1) {
119  $cmd = $this->ctrl->getCmd("properties");
120  } else {
121  $cmd = $this->ctrl->getCmd("chapters");
122  }
123 
124 
125  //echo "-$cmd-".$next_class."-";
126  switch ($next_class) {
127  case 'illtiproviderobjectsettinggui':
128 
129  $this->setTabs();
130  $ilTabs->setTabActive("settings");
131  $this->setSubTabs("lti_provider");
132 
133  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
134  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
135  $lti_gui->offerLTIRolesForSelection(true);
136  $this->ctrl->forwardCommand($lti_gui);
137  break;
138 
139 
140 
141  case "illearningprogressgui":
142  $this->addHeaderAction();
143  $this->addLocations();
144  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
145  $this->setTabs("learning_progress");
146 
148  $this->ctrl->forwardCommand($new_gui);
149 
150  break;
151 
152  case 'ilobjectmetadatagui':
153  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
154  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
155  }
156 
157  $this->addHeaderAction();
158  $this->addLocations();
159  $this->setTabs("meta");
160 
161  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
162  $md_gui = new ilObjectMetaDataGUI($this->object);
163  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'Educational'); // #9510
164  $md_gui->addMDObserver($this->object, 'MDUpdateListener', 'General');
165  $this->ctrl->forwardCommand($md_gui);
166  break;
167 
168  case "ilobjstylesheetgui":
169  $this->addLocations();
170  include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
171  $this->ctrl->setReturn($this, "editStyleProperties");
172  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
173  $style_gui->omitLocator();
174  if ($cmd == "create" || $_GET["new_type"]=="sty") {
175  $style_gui->setCreationMode(true);
176  }
177  $ret = $this->ctrl->forwardCommand($style_gui);
178  //$ret =& $style_gui->executeCommand();
179 
180  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
181  $style_id = $ret;
182  $this->object->setStyleSheetId($style_id);
183  $this->object->update();
184  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
185  }
186  break;
187 
188  case "illmpageobjectgui":
189 
190  $ilTabs->setBackTarget(
191  $lng->txt("learning module"),
192  $ilCtrl->getLinkTarget($this, "chapters")
193  );
194  $this->ctrl->saveParameter($this, array("obj_id"));
195  $this->addLocations();
196  $this->ctrl->setReturn($this, "chapters");
197 
198  $pg_gui = new ilLMPageObjectGUI($this->object);
199  if ($_GET["obj_id"] != "") {
200  $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
201  $pg_gui->setLMPageObject($obj);
202  }
203  //$ret =& $pg_gui->executeCommand();
204  $ret = $this->ctrl->forwardCommand($pg_gui);
205  if ($cmd == "save" || $cmd == "cancel") {
206  // $this->ctrl->redirect($this, "pages");
207  }
208  break;
209 
210  case "ilstructureobjectgui":
211  $ilTabs->setBackTarget(
212  $lng->txt("learning module"),
213  $ilCtrl->getLinkTarget($this, "chapters")
214  );
215 
216  $this->ctrl->saveParameter($this, array("obj_id"));
217  $this->addLocations();
218  $this->ctrl->setReturn($this, "chapters");
219  $st_gui = new ilStructureObjectGUI($this->object, $this->object->lm_tree);
220  if ($_GET["obj_id"] != "") {
221  $obj = ilLMObjectFactory::getInstance($this->object, $_GET["obj_id"]);
222  $st_gui->setStructureObject($obj);
223  }
224  //$ret =& $st_gui->executeCommand();
225  $ret = $this->ctrl->forwardCommand($st_gui);
226  if ($cmd == "save" || $cmd == "cancel") {
227  if ($_GET["obj_id"] == "") {
228  $this->ctrl->redirect($this, "chapters");
229  } else {
230  $this->ctrl->setCmd("subchap");
231  $this->executeCommand();
232  }
233  }
234  break;
235 
236  case 'ilpermissiongui':
237  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
238  $this->prepareOutput();
239  } else {
240  $this->addHeaderAction();
241  $this->addLocations(true);
242  $this->setTabs("perm");
243  }
244  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
245  $perm_gui = new ilPermissionGUI($this);
246  $ret = $this->ctrl->forwardCommand($perm_gui);
247  break;
248 
249  // infoscreen
250  case 'ilinfoscreengui':
251  $this->addHeaderAction();
252  $this->addLocations(true);
253  $this->setTabs("info");
254  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
255  $info = new ilInfoScreenGUI($this);
256  $info->enablePrivateNotes();
257  $info->enableLearningProgress();
258 
259  $info->enableNews();
260  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
261  $info->enableNewsEditing();
262  $info->setBlockProperty("news", "settings", true);
263  }
264 
265  // show standard meta data section
266  $info->addMetaDataSections(
267  $this->object->getId(),
268  0,
269  $this->object->getType()
270  );
271 
272  $ret = $this->ctrl->forwardCommand($info);
273  break;
274 
275  case "ilexportgui":
276  ilUtil::sendInfo($this->lng->txt("lm_only_one_download_per_type"));
277  $this->addHeaderAction();
278  $this->addLocations(true);
279  $this->setTabs("export");
280  include_once("./Services/Export/classes/class.ilExportGUI.php");
281  $exp_gui = new ilExportGUI($this);
282  // old school -> new school
283  //$exp_gui->addFormat("xml", "", $this, "export");
284  $exp_gui->addFormat("xml");
285  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
286  $ot = ilObjectTranslation::getInstance($this->object->getId());
287  if ($ot->getContentActivated()) {
288  $exp_gui->addFormat("xml_master", "XML (" . $lng->txt("cont_master_language_only") . ")", $this, "export");
289  $exp_gui->addFormat("xml_masternomedia", "XML (" . $lng->txt("cont_master_language_only_no_media") . ")", $this, "export");
290 
291  $lng->loadLanguageModule("meta");
292  $langs = $ot->getLanguages();
293  foreach ($langs as $l => $ldata) {
294  $exp_gui->addFormat("html_" . $l, "HTML (" . $lng->txt("meta_l_" . $l) . ")", $this, "exportHTML");
295  }
296  $exp_gui->addFormat("html_all", "HTML (" . $lng->txt("cont_all_languages") . ")", $this, "exportHTML");
297  } else {
298  $exp_gui->addFormat("html", "", $this, "exportHTML");
299  }
300 
301  $exp_gui->addFormat("scorm", "", $this, "exportSCORM");
302  $exp_gui->addCustomColumn(
303  $lng->txt("cont_public_access"),
304  $this,
305  "getPublicAccessColValue"
306  );
307  $exp_gui->addCustomMultiCommand(
308  $lng->txt("cont_public_access"),
309  $this,
310  "publishExportFile"
311  );
312  $ret = $this->ctrl->forwardCommand($exp_gui);
313  break;
314 
315  case 'ilobjecttranslationgui':
316  $this->addHeaderAction();
317  $this->addLocations(true);
318  //$this->checkPermissionBool("write");
319  //$this->prepareOutput();
320  //$this->tabs_gui->setTabActive('export');
321  $this->setTabs("settings");
322  $this->setSubTabs("obj_multilinguality");
323  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
324  $transgui = new ilObjectTranslationGUI($this);
325  $transgui->setTitleDescrOnlyMode(false);
326  $this->ctrl->forwardCommand($transgui);
327  break;
328 
329 
330  case "ilcommonactiondispatchergui":
331  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
333  $this->ctrl->forwardCommand($gui);
334  break;
335 
336  case 'ilobjectcopygui':
337  $this->prepareOutput();
338  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
339  $cp = new ilObjectCopyGUI($this);
340  $cp->setType('lm');
341  $this->ctrl->forwardCommand($cp);
342  break;
343 
344 /* case "ilpagemultilanggui":
345  $this->addHeaderAction();
346  $this->addLocations(true);
347  $ilCtrl->setReturn($this, "properties");
348  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
349  $ml_gui = new ilPageMultiLangGUI("lm", $this->object->getId());
350  $this->setTabs("settings");
351  $this->setSubTabs("cont_multilinguality");
352  $ret = $this->ctrl->forwardCommand($ml_gui);
353  break;*/
354 
355  case "ilmobmultisrtuploadgui":
356  $this->addHeaderAction();
357  $this->addLocations(true);
358  $this->setTabs("content");
359  $this->setContentSubTabs("srt_files");
360  include_once("./Services/MediaObjects/classes/class.ilMobMultiSrtUploadGUI.php");
361  include_once("./Modules/LearningModule/classes/class.ilLMMultiSrt.php");
362  $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->object));
363  $this->ctrl->forwardCommand($gui);
364  break;
365 
366  case "illmimportgui":
367  $this->addHeaderAction();
368  $this->addLocations(true);
369  $this->setTabs("content");
370  $this->setContentSubTabs("import");
371  include_once("./Modules/LearningModule/classes/class.ilLMImportGUI.php");
372  $gui = new ilLMImportGUI($this->object);
373  $this->ctrl->forwardCommand($gui);
374  break;
375 
376  case "illmeditshorttitlesgui":
377  $this->addHeaderAction();
378  $this->addLocations(true);
379  $this->setTabs("content");
380  $this->setContentSubTabs("short_titles");
381  include_once("./Modules/LearningModule/classes/class.ilLMEditShortTitlesGUI.php");
382  $gui = new ilLMEditShortTitlesGUI($this);
383  $this->ctrl->forwardCommand($gui);
384  break;
385 
386  default:
387  $new_type = $_POST["new_type"]
388  ? $_POST["new_type"]
389  : $_GET["new_type"];
390 
391 
392  if ($cmd == "create" &&
393  !in_array($new_type, array("lm"))) {
394  //$this->addLocations();
395  switch ($new_type) {
396  case "pg":
397  $this->setTabs();
398  $this->ctrl->setCmdClass("ilLMPageObjectGUI");
399  $ret = $this->executeCommand();
400  break;
401 
402  case "st":
403  $this->setTabs();
404  $this->ctrl->setCmdClass("ilStructureObjectGUI");
405  $ret = $this->executeCommand();
406  break;
407  }
408  } else {
409  // creation of new dbk/lm in repository
410  if ($this->getCreationMode() == true &&
411  in_array($new_type, array("lm"))) {
412  $this->prepareOutput();
413  if ($cmd == "") { // this may be due to too big upload files
414  $cmd = "create";
415  }
416  $cmd .= "Object";
417  $ret = $this->$cmd();
418  } else {
419  $this->addHeaderAction();
420  $this->addLocations();
421  $ret = $this->$cmd();
422  }
423  }
424  break;
425  }
426  return $ret;
427  }
428 
429  public static function _forwards()
430  {
431  return array("ilLMPageObjectGUI", "ilStructureObjectGUI","ilObjStyleSheetGUI");
432  }
433 
437  public function properties()
438  {
439  $lng = $this->lng;
440 
441  $lng->loadLanguageModule("style");
442  $this->setTabs("settings");
443  $this->setSubTabs("settings");
444 
445  // lm properties
446  $this->initPropertiesForm();
447  $this->getPropertiesFormValues();
448 
449  if ($this->object->getType() == "lm") {
450  // Edit ecs export settings
451  include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
452  $ecs = new ilECSLearningModuleSettings($this->object);
453  $ecs->addSettingsToForm($this->form, 'lm');
454  }
455 
456  $this->tpl->setContent($this->form->getHTML());
457  }
458 
462  public function initPropertiesForm()
463  {
465  $lng = $this->lng;
467 
468  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
469  $this->form = new ilPropertyFormGUI();
470 
471  // title
472  $ti = new ilTextInputGUI($lng->txt("title"), "title");
473  //$ti->setMaxLength();
474  //$ti->setSize();
475  //$ti->setInfo($lng->txt(""));
476  $ti->setRequired(true);
477  $this->form->addItem($ti);
478 
479  // description
480  $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
481  //$ta->setCols();
482  //$ta->setRows();
483  //$ta->setInfo($lng->txt(""));
484  $this->form->addItem($ta);
485 
486  $lng->loadLanguageModule("rep");
488  $section->setTitle($this->lng->txt('rep_activation_availability'));
489  $this->form->addItem($section);
490 
491  // online
492  $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
493  $this->form->addItem($online);
494 
495  // presentation
497  $section->setTitle($this->lng->txt('cont_presentation'));
498  $this->form->addItem($section);
499 
500  // default layout
501  $layout = self::getLayoutOption($lng->txt("cont_def_layout"), "lm_layout");
502  $this->form->addItem($layout);
503 
504  // layout per page
505  $lpp = new ilCheckboxInputGUI($lng->txt("cont_layout_per_page"), "layout_per_page");
506  $lpp->setInfo($this->lng->txt("cont_layout_per_page_info"));
507  $this->form->addItem($lpp);
508 
509  // page header
510  $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
511  $option = array("st_title" => $this->lng->txt("cont_st_title"),
512  "pg_title" => $this->lng->txt("cont_pg_title"),
513  "none" => $this->lng->txt("cont_none"));
514  $page_header->setOptions($option);
515  $this->form->addItem($page_header);
516 
517  // chapter numeration
518  $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
519  $this->form->addItem($chap_num);
520 
521  // toc mode
522  $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
523  $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
524  "pages" => $this->lng->txt("cont_chapters_and_pages"));
525  $toc_mode->setOptions($option);
526  $this->form->addItem($toc_mode);
527 
528  // synchronize frames
529  /*
530  $synch = new ilCheckboxInputGUI($lng->txt("cont_synchronize_frames"), "cobj_clean_frames");
531  $synch->setInfo($this->lng->txt("cont_synchronize_frames_desc"));
532  $this->form->addItem($synch);*/
533 
534  // show progress icons
535  $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
536  $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
537  $this->form->addItem($progr_icons);
538 
539  // self assessment
541  $section->setTitle($this->lng->txt('cont_self_assessment'));
542  $this->form->addItem($section);
543 
544  // tries
545  $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
546  $radg->setValue(0);
547  $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), 0, $lng->txt("cont_tries_reset_on_visit_info"));
548  $radg->addOption($op1);
549  $op2 = new ilRadioOption($lng->txt("cont_tries_store"), 1, $lng->txt("cont_tries_store_info"));
550  $radg->addOption($op2);
551  $this->form->addItem($radg);
552 
553  // restrict forward navigation
554  $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
555  $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
556  $this->form->addItem($qfeed);
557 
558  // notification
559  $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
560  $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
561  $qfeed->addSubItem($not);
562 
563  // disable default feedback for questions
564  $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
565  $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
566  $this->form->addItem($qfeed);
567 
568  // additional features
570  $section->setTitle($this->lng->txt('obj_features'));
571  $this->form->addItem($section);
572 
573  // public notes
574  if (!$ilSetting->get('disable_comments')) {
575  $this->lng->loadLanguageModule("notes");
576  $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
577  $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
578  $this->form->addItem($pub_nodes);
579  }
580 
581  // history user comments
582  $com = new ilCheckboxInputGUI($lng->txt("enable_hist_user_comments"), "cobj_user_comments");
583  $com->setInfo($this->lng->txt("enable_hist_user_comments_desc"));
584  $this->form->addItem($com);
585 
586  // rating
587  $this->lng->loadLanguageModule('rating');
588  $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
589  $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
590  $this->form->addItem($rate);
591  $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
592  $this->form->addItem($ratep);
593 
594  $this->form->setTitle($lng->txt("cont_lm_properties"));
595  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
596  $this->form->setFormAction($ilCtrl->getFormAction($this));
597  }
598 
602  public function getPropertiesFormValues()
603  {
605 
606  $values = array();
607 
608  $title = $this->object->getTitle();
609  $description = $this->object->getDescription();
610  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
611  $ot = ilObjectTranslation::getInstance($this->object->getId());
612  if ($ot->getContentActivated()) {
613  $title = $ot->getDefaultTitle();
614  $description = $ot->getDefaultDescription();
615  }
616 
617  $values["title"] = $title;
618  $values["description"] = $description;
619  if ($this->object->getOnline()) {
620  $values["cobj_online"] = true;
621  }
622  $values["lm_layout"] = $this->object->getLayout();
623  $values["lm_pg_header"] = $this->object->getPageHeader();
624  if ($this->object->isActiveNumbering()) {
625  $values["cobj_act_number"] = true;
626  }
627  $values["toc_mode"] = $this->object->getTOCMode();
628  if ($this->object->publicNotes()) {
629  $values["cobj_pub_notes"] = true;
630  }
631  if ($this->object->cleanFrames()) {
632  $values["cobj_clean_frames"] = true;
633  }
634  if ($this->object->isActiveHistoryUserComments()) {
635  $values["cobj_user_comments"] = true;
636  }
637  $values["layout_per_page"] = $this->object->getLayoutPerPage();
638  $values["rating"] = $this->object->hasRating();
639  $values["rating_pages"] = $this->object->hasRatingPages();
640  $values["disable_def_feedback"] = $this->object->getDisableDefaultFeedback();
641  $values["progr_icons"] = $this->object->getProgressIcons();
642  $values["store_tries"] = $this->object->getStoreTries();
643  $values["restrict_forw_nav"] = $this->object->getRestrictForwardNavigation();
644 
645  include_once "./Services/Notification/classes/class.ilNotification.php";
646  $values["notification_blocked_users"] = ilNotification::hasNotification(
648  $ilUser->getId(),
649  $this->object->getId()
650  );
651 
652  $this->form->setValuesByArray($values);
653  }
654 
658  public function saveProperties()
659  {
660  $lng = $this->lng;
663 
664  $valid = false;
665  $this->initPropertiesForm();
666  if ($this->form->checkInput()) {
667  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
668  $ot = ilObjectTranslation::getInstance($this->object->getId());
669  if ($ot->getContentActivated()) {
670  $ot->setDefaultTitle($_POST['title']);
671  $ot->setDefaultDescription($_POST['description']);
672  $ot->save();
673  }
674 
675  $this->object->setTitle($_POST['title']);
676  $this->object->setDescription($_POST['description']);
677  $this->object->setLayout($_POST["lm_layout"]);
678  $this->object->setPageHeader($_POST["lm_pg_header"]);
679  $this->object->setTOCMode($_POST["toc_mode"]);
680  $this->object->setOnline($_POST["cobj_online"]);
681  $this->object->setActiveNumbering($_POST["cobj_act_number"]);
682  $this->object->setCleanFrames($_POST["cobj_clean_frames"]);
683  if (!$ilSetting->get('disable_comments')) {
684  $this->object->setPublicNotes($_POST["cobj_pub_notes"]);
685  }
686  $this->object->setHistoryUserComments($_POST["cobj_user_comments"]);
687  $this->object->setLayoutPerPage($_POST["layout_per_page"]);
688  $this->object->setRating($_POST["rating"]);
689  $this->object->setRatingPages($_POST["rating_pages"]);
690  $this->object->setDisableDefaultFeedback((int) $_POST["disable_def_feedback"]);
691  $this->object->setProgressIcons((int) $_POST["progr_icons"]);
692 
693  $add_info = "";
694  if ($_POST["restrict_forw_nav"] && !$_POST["store_tries"]) {
695  $_POST["store_tries"] = 1;
696  $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
697  $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
698  $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
699  }
700 
701  $this->object->setStoreTries((int) $_POST["store_tries"]);
702  $this->object->setRestrictForwardNavigation((int) $_POST["restrict_forw_nav"]);
703  $this->object->updateProperties();
704  $this->object->update();
705 
706  include_once "./Services/Notification/classes/class.ilNotification.php";
709  $ilUser->getId(),
710  $this->object->getId(),
711  (bool) $this->form->getInput("notification_blocked_users")
712  );
713 
714 
715  if ($this->object->getType() == 'lm') {
716  // Update ecs export settings
717  include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
718  $ecs = new ilECSLearningModuleSettings($this->object);
719  if ($ecs->handleSettingsUpdate()) {
720  $valid = true;
721  }
722  } else {
723  $valid = true;
724  }
725  }
726 
727  if ($valid) {
728  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified") . $add_info, true);
729  $this->ctrl->redirect($this, "properties");
730  } else {
731  $lng->loadLanguageModule("style");
732  $this->setTabs("settings");
733  $this->setSubTabs("cont_general_properties");
734 
735  $this->form->setValuesByPost();
736  $this->tpl->setContent($this->form->getHTML());
737  }
738  }
739 
743  public function editStyleProperties()
744  {
745  $tpl = $this->tpl;
746 
747  $this->initStylePropertiesForm();
748  $tpl->setContent($this->form->getHTML());
749  }
750 
754  public function initStylePropertiesForm()
755  {
757  $lng = $this->lng;
758  $ilTabs = $this->tabs;
760 
761  $lng->loadLanguageModule("style");
762  $this->setTabs();
763  $ilTabs->setTabActive("settings");
764  $this->setSubTabs("cont_style");
765 
766  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
767  $this->form = new ilPropertyFormGUI();
768 
769  $fixed_style = $ilSetting->get("fixed_content_style_id");
770  $def_style = $ilSetting->get("default_content_style_id");
771  $style_id = $this->object->getStyleSheetId();
772 
773  if ($fixed_style > 0) {
774  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
775  $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
776  $this->lng->txt("global_fixed") . ")");
777  $this->form->addItem($st);
778  } else {
780  true,
781  false,
782  $_GET["ref_id"]
783  );
784 
785  if ($def_style > 0) {
786  $st_styles[0] = ilObject::_lookupTitle($def_style) . " (" . $this->lng->txt("default") . ")";
787  } else {
788  $st_styles[0] = $this->lng->txt("default");
789  }
790  ksort($st_styles);
791 
792  if ($style_id > 0) {
793  // individual style
794  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
795  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
796  $st->setValue(ilObject::_lookupTitle($style_id));
797  $this->form->addItem($st);
798 
799  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
800 
801  // delete command
802  $this->form->addCommandButton(
803  "editStyle",
804  $lng->txt("cont_edit_style")
805  );
806  $this->form->addCommandButton(
807  "deleteStyle",
808  $lng->txt("cont_delete_style")
809  );
810  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
811  }
812  }
813 
814  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
815  $style_sel = ilUtil::formSelect(
816  $style_id,
817  "style_id",
818  $st_styles,
819  false,
820  true
821  );
822  $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
823  $style_sel->setOptions($st_styles);
824  $style_sel->setValue($style_id);
825  $this->form->addItem($style_sel);
826  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
827  $this->form->addCommandButton(
828  "saveStyleSettings",
829  $lng->txt("save")
830  );
831  $this->form->addCommandButton(
832  "createStyle",
833  $lng->txt("sty_create_ind_style")
834  );
835  }
836  }
837  $this->form->setTitle($lng->txt("cont_style"));
838  $this->form->setFormAction($ilCtrl->getFormAction($this));
839  }
840 
844  public function createStyle()
845  {
847 
848  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
849  }
850 
854  public function editStyle()
855  {
857 
858  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
859  }
860 
864  public function deleteStyle()
865  {
867 
868  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
869  }
870 
874  public function saveStyleSettings()
875  {
877 
878  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
879  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
880  || $this->object->getStyleSheetId() == 0)) {
881  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
882  $this->object->update();
883  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
884  }
885  $this->ctrl->redirect($this, "editStyleProperties");
886  }
887 
891  public function initMenuForm()
892  {
893  $lng = $this->lng;
895 
896  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
897  $form = new ilPropertyFormGUI();
898 
899  // enable menu
900  $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
901  $menu->setChecked($this->object->isActiveLMMenu());
902  $form->addItem($menu);
903 
904  // toc
905  $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
906  $toc->setChecked($this->object->isActiveTOC());
907  $form->addItem($toc);
908 
909  // print view
910  $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
911  $print->setChecked($this->object->isActivePrintView());
912  $form->addItem($print);
913 
914  // prevent glossary appendix
915  $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
916  $glo->setChecked($this->object->isActivePreventGlossaryAppendix());
917  $print->addSubItem($glo);
918 
919  // hide header and footer in print view
920  $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
921  $hhfp->setChecked($this->object->getHideHeaderFooterPrint());
922  $print->addSubItem($hhfp);
923 
924  // downloads
925  $no_download_file_available =
926  " " . $lng->txt("cont_no_download_file_available") .
927  " <a href='" . $ilCtrl->getLinkTargetByClass("ilexportgui", "") . "'>" . $lng->txt("change") . "</a>";
928  $types = array("xml", "html", "scorm");
929  foreach ($types as $type) {
930  if ($this->object->getPublicExportFile($type) != "") {
931  if (is_file($this->object->getExportDirectory($type) . "/" .
932  $this->object->getPublicExportFile($type))) {
933  $no_download_file_available = "";
934  }
935  }
936  }
937  $dl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "cobj_act_downloads");
938  $dl->setInfo($this->lng->txt("cont_downloads_desc") . $no_download_file_available);
939  $dl->setChecked($this->object->isActiveDownloads());
940  $form->addItem($dl);
941 
942  // downloads in public area
943  $pdl = new ilCheckboxInputGUI($this->lng->txt("cont_downloads_public_desc"), "cobj_act_downloads_public");
944  $pdl->setChecked($this->object->isActiveDownloadsPublic());
945  $dl->addSubItem($pdl);
946 
947  $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
948 
949  $form->setTitle($lng->txt("cont_lm_menu"));
950  $form->setFormAction($ilCtrl->getFormAction($this));
951 
952  return $form;
953  }
954 
958  public function editMenuProperties()
959  {
960  $lng = $this->lng;
961  $ilTabs = $this->tabs;
963  $tpl = $this->tpl;
964  $ilToolbar = $this->toolbar;
965 
966  $lng->loadLanguageModule("style");
967  $this->setTabs();
968  $ilTabs->setTabActive("settings");
969  $this->setSubTabs("cont_lm_menu");
970 
971  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
972  $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
973  $ilToolbar->setCloseFormTag(false);
974 
975  $form = $this->initMenuForm();
976  $form->setOpenTag(false);
977  $form->setCloseTag(false);
978 
979  $this->__initLMMenuEditor();
980  $entries = $this->lmme_obj->getMenuEntries();
981  include_once("./Modules/LearningModule/classes/class.ilLMMenuItemsTableGUI.php");
982  $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
983  $table->setOpenFormTag(false);
984 
985  $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
986  }
987 
991  public function saveMenuProperties()
992  {
993  $this->object->setActiveLMMenu((int) $_POST["cobj_act_lm_menu"]);
994  $this->object->setActiveTOC((int) $_POST["cobj_act_toc"]);
995  $this->object->setActivePrintView((int) $_POST["cobj_act_print"]);
996  $this->object->setActivePreventGlossaryAppendix((int) $_POST["cobj_act_print_prev_glo"]);
997  $this->object->setHideHeaderFooterPrint((int) $_POST["hide_head_foot_print"]);
998  $this->object->setActiveDownloads((int) $_POST["cobj_act_downloads"]);
999  $this->object->setActiveDownloadsPublic((int) $_POST["cobj_act_downloads_public"]);
1000  $this->object->updateProperties();
1001 
1002  $this->__initLMMenuEditor();
1003  //var_dump($_POST["menu_entries"]); exit;
1004  $this->lmme_obj->updateActiveStatus($_POST["menu_entries"]);
1005 
1006  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1007  $this->ctrl->redirect($this, "editMenuProperties");
1008  }
1009 
1013  public function explorer()
1014  {
1015  $ilCtrl = $this->ctrl;
1016 
1017  $gui_class = "ilobjlearningmodulegui";
1018 
1019  $ilCtrl->setParameterByClass($gui_class, "active_node", $_GET["active_node"]);
1020 
1021  $this->tpl = new ilTemplate("tpl.main.html", true, true);
1022  // get learning module object
1023  //$this->lm_obj = new ilObjLearningModule($this->ref_id, true);
1024 
1025  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1026 
1027  //$this->tpl = new ilTemplate("tpl.explorer.html", false, false);
1028  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
1029  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
1030 
1031  require_once("./Modules/LearningModule/classes/class.ilLMEditorExplorer.php");
1032  $exp = new ilLMEditorExplorer(
1033  $this->ctrl->getLinkTarget($this, "view"),
1034  $this->object,
1035  $gui_class
1036  );
1037 
1038  $exp->setTargetGet("obj_id");
1039  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "explorer"));
1040 
1041  if ($_GET["lmmovecopy"] == "1") {
1042  $this->proceedDragDrop();
1043  }
1044 
1045 
1046  if ($_GET["lmexpand"] == "") {
1047  $mtree = new ilTree($this->object->getId());
1048  $mtree->setTableNames('lm_tree', 'lm_data');
1049  $mtree->setTreeTablePK("lm_id");
1050  $expanded = $mtree->readRootId();
1051  } else {
1052  $expanded = $_GET["lmexpand"];
1053  }
1054  if ($_GET["active_node"] != "") {
1055  $path = $this->lm_tree->getPathId($_GET["active_node"]);
1056  $exp->setForceOpenPath($path);
1057 
1058  $exp->highlightNode($_GET["active_node"]);
1059  }
1060  $exp->setExpand($expanded);
1061 
1062  // build html-output
1063  $exp->setOutput(0);
1064  $output = $exp->getOutput();
1065 
1066  // asynchronous output
1067  if ($ilCtrl->isAsynch()) {
1068  echo $output;
1069  exit;
1070  }
1071 
1072  include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
1073 
1074  /*if (ilPageEditorGUI::_doJSEditing())
1075  {
1076  //$this->tpl->touchBlock("includejavascript");
1077 
1078  $IDS = "";
1079  for ($i=0;$i<count($exp->iconList);$i++)
1080  {
1081  if ($i>0) $IDS .= ",";
1082  $IDS .= "'".$exp->iconList[$i]."'";
1083  }
1084  $this->tpl->setVariable("ICONIDS",$IDS);
1085  //$this->ctrl->setParameter($this, "lmovecopy", 1);
1086  $this->tpl->setVariable("TESTPFAD",$this->ctrl->getLinkTarget($this, "explorer")."&lmmovecopy=1");
1087  //$this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
1088  $this->tpl->setVariable("POPUPLINK",$this->ctrl->getLinkTarget($this, "popup")."&ptype=movecopytreenode");
1089  }*/
1090 
1091  $this->tpl->setCurrentBlock("content");
1092  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_chap_and_pages"));
1093  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1094  $this->tpl->setVariable("EXPLORER", $output);
1095  $this->ctrl->setParameter($this, "lmexpand", $_GET["lmexpand"]);
1096  $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "explorer"));
1097  $this->tpl->parseCurrentBlock();
1098  $this->tpl->show(false);
1099  exit;
1100  }
1101 
1105  public function popup()
1106  {
1107  include_once "./Services/COPage/classes/class.ilWysiwygUtil.php";
1108  $popup = new ilWysiwygUtil();
1109  $popup->show($_GET["ptype"]);
1110  exit;
1111  }
1112 
1116  public function proceedDragDrop()
1117  {
1118  $ilCtrl = $this->ctrl;
1119 
1120  $this->object->executeDragDrop(
1121  $_POST["il_hform_source_id"],
1122  $_POST["il_hform_target_id"],
1123  $_POST["il_hform_fc"],
1124  $_POST["il_hform_as_subitem"]
1125  );
1126  $ilCtrl->redirect($this, "chapters");
1127  }
1128 
1129  /* protected function initCreationForms($a_new_type)
1130  {
1131  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
1132  self::CFORM_IMPORT => $this->initImportForm());
1133 
1134  return $forms;
1135  }*/
1136 
1137  protected function afterSave(ilObject $a_new_object)
1138  {
1139  $a_new_object->setCleanFrames(true);
1140  $a_new_object->update();
1141 
1142  // create content object tree
1143  $a_new_object->createLMTree();
1144 
1145  // create a first chapter
1146  $a_new_object->addFirstChapterAndPage();
1147 
1148  // always send a message
1149  ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1150  ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
1151  "&baseClass=ilLMEditorGUI");
1152  }
1153 
1157  public function initImportForm($a_new_type)
1158  {
1159  $lng = $this->lng;
1160  $ilCtrl = $this->ctrl;
1161 
1162  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1163  $form = new ilPropertyFormGUI();
1164 
1165  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
1166  $this->ctrl->setParameter($this, "new_type", $new_type);
1167 
1168  $form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
1169  $form->setTableWidth("600px");
1170 
1171  // import file
1172  //$fi = new ilFileInputGUI($this->lng->txt("file"), "xmldoc");
1173  $fi = new ilFileInputGUI($this->lng->txt("file"), "importfile");
1174  $fi->setSuffixes(array("zip"));
1175  $fi->setRequired(true);
1176  $fi->setSize(30);
1177  $form->addItem($fi);
1178 
1179  // validation
1180  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
1181  $cb->setInfo($this->lng->txt(""));
1182  $form->addItem($cb);
1183 
1184  $form->addCommandButton("importFile", $lng->txt("import"));
1185  $form->addCommandButton("cancel", $lng->txt("cancel"));
1186 
1187  $form->setTitle($this->lng->txt("import_" . $new_type));
1188  $form->setFormAction($ilCtrl->getFormAction($this));
1189 
1190  return $form;
1191  }
1192 
1198  public function exportObject()
1199  {
1200  return;
1201  }
1202 
1208  public function importObject()
1209  {
1210  $this->createObject();
1211  return;
1212  }
1213 
1214 
1221  public function importFileObject($parent_id = null, $a_catch_errors = true)
1222  {
1224  $ilErr = $this->error;
1225  $tpl = $this->tpl;
1226 
1227  $form = $this->initImportForm("lm");
1228 
1229  try {
1230  // the new import
1231  parent::importFileObject(null, false);
1232  return;
1234  // we just run through in this case.
1235  $no_manifest = true;
1236  } catch (ilException $e) {
1237  // display message and form again
1238  ilUtil::sendFailure($this->lng->txt("obj_import_file_error") . " <br />" . $e->getMessage());
1239  $form->setValuesByPost();
1240  $tpl->setContent($form->getHtml());
1241  return;
1242  }
1243 
1244  if (!$no_manifest) {
1245  return; // something different has gone wrong, but we have a manifest, this is definitely not "the old" import
1246  }
1247 
1248  // the "old" (pre 5.1) import
1249 
1250  include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
1251 
1252  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"])) {
1253  $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
1254  return;
1255  }
1256 
1257  if ($form->checkInput()) {
1258  // create and insert object in objecttree
1259  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1260  $newObj = new ilObjContentObject();
1261  $newObj->setType($_GET["new_type"]);
1262  $newObj->setTitle($_FILES["importfile"]["name"]);
1263  $newObj->setDescription("");
1264  $newObj->create(true);
1265  $newObj->createReference();
1266  $newObj->putInTree($_GET["ref_id"]);
1267  $newObj->setPermissions($_GET["ref_id"]);
1268 
1269  // create learning module tree
1270  $newObj->createLMTree();
1271 
1272  // since the "new" import already did the extracting
1273  $mess = $newObj->importFromDirectory($this->tmp_import_dir, $_POST["validate"]);
1274 
1275 
1276  // import lm from file
1277  // $mess = $newObj->importFromZipFile($_FILES["importfile"]["tmp_name"], $_FILES["importfile"]["name"],
1278  // $_POST["validate"]);
1279 
1280  if ($mess == "") {
1281  ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true);
1282  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
1283  "&baseClass=ilLMEditorGUI");
1284  } else {
1285  $link = '<a href="' . "ilias.php?ref_id=" . $newObj->getRefId() .
1286  "&baseClass=ilLMEditorGUI" . '" target="_top">' . $this->lng->txt("btn_next") . '</a>';
1287  $tpl->setContent("<br />" . $link . "<br /><br />" . $mess . $link);
1288  }
1289  } else {
1290  $form->setValuesByPost();
1291  $tpl->setContent($form->getHtml());
1292  }
1293  }
1294 
1298  public function chapters()
1299  {
1300  $tree = $this->tree;
1301  $lng = $this->lng;
1302  $ilCtrl = $this->ctrl;
1303  $ilUser = $this->user;
1304 
1305  $this->setTabs();
1306  $this->setContentSubTabs("chapters");
1307 
1308  $ilCtrl->setParameter($this, "backcmd", "chapters");
1309 
1310  include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
1311  $form_gui = new ilChapterHierarchyFormGUI($this->object->getType(), $_GET["transl"]);
1312  $form_gui->setFormAction($ilCtrl->getFormAction($this));
1313  $form_gui->setTitle($this->object->getTitle());
1314  $form_gui->setIcon(ilUtil::getImagePath("icon_lm.svg"));
1315  $form_gui->setTree($this->lm_tree);
1316  $form_gui->setMaxDepth(0);
1317  $form_gui->setCurrentTopNodeId($this->tree->getRootId());
1318  $form_gui->addMultiCommand($lng->txt("delete"), "delete");
1319  $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1320  $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1321  if ($this->object->getLayoutPerPage()) {
1322  $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
1323  }
1324  $form_gui->setDragIcon(ilUtil::getImagePath("icon_st.svg"));
1325  $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1326  $up_gui = "ilobjlearningmodulegui";
1327 
1328  $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
1329  $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
1330  $ilCtrl->setParameter($this, "obj_id", "");
1331 
1332  $ml_head = self::getMultiLangHeader($this->object->getId(), $this);
1333 
1334  $this->tpl->setContent($ml_head . $ctpl->get());
1335  }
1336 
1343  public static function getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode = "")
1344  {
1345  global $DIC;
1346 
1347  $lng = $DIC->language();
1348  $ilCtrl = $DIC->ctrl();
1349 
1350  // multi language
1351  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
1352  $ot = ilObjectTranslation::getInstance($a_lm_id);
1353  //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
1354  //$ml = new ilPageMultiLang("lm", $a_lm_id);
1355  if ($ot->getContentActivated()) {
1356  $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1357  $lng->loadLanguageModule("meta");
1358 
1359  // info
1360  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1361  $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1362  $ml_head = $ml_gui->getMultiLangInfo($_GET["transl"]);
1363 
1364  // language switch
1365  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1367  $list->setListTitle($lng->txt("actions"));
1368  $list->setId("copage_act");
1369  $entries = false;
1370  if (!in_array($_GET["transl"], array("", "-"))) {
1371  $l = $ot->getMasterLanguage();
1372  $list->addItem(
1373  $lng->txt("cont_edit_language_version") . ": " .
1374  $lng->txt("meta_l_" . $l),
1375  "",
1376  $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1377  );
1378  $entries = true;
1379  }
1380 
1381  foreach ($ot->getLanguages() as $al => $lang) {
1382  if ($_GET["transl"] != $al &&
1383  $al != $ot->getMasterLanguage()) {
1384  $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1385  $list->addItem(
1386  $lng->txt("cont_edit_language_version") . ": " .
1387  $lng->txt("meta_l_" . $al),
1388  "",
1389  $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1390  );
1391  $ilCtrl->setParameter($a_gui_class, "totransl", $_GET["totransl"]);
1392  }
1393  $entries = true;
1394  }
1395 
1396  if ($entries) {
1397  $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $list->getHTML() . "</div>";
1398  }
1399  $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1400  }
1401 
1402  return $ml_head;
1403  }
1404 
1405 
1406  /*
1407  * List all pages of learning module
1408  */
1409  public function pages()
1410  {
1411  $tree = $this->tree;
1412  $tpl = $this->tpl;
1413  $ilToolbar = $this->toolbar;
1414  $ilCtrl = $this->ctrl;
1415  $lng = $this->lng;
1416 
1417  $this->setTabs();
1418  $this->setContentSubTabs("pages");
1419 
1420  $ilCtrl->setParameter($this, "backcmd", "pages");
1421  $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1422  $ilToolbar->addButton(
1423  $lng->txt("pg_add"),
1424  $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1425  );
1426  $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1427 
1428  include_once("./Modules/LearningModule/classes/class.ilLMPagesTableGUI.php");
1429  $t = new ilLMPagesTableGUI($this, "pages", $this->object);
1430  $tpl->setContent($t->getHTML());
1431  }
1432 
1436  public function listLinks()
1437  {
1438  $tpl = $this->tpl;
1439 
1440  $this->setTabs();
1441  $this->setContentSubTabs("internal_links");
1442 
1443  include_once("./Modules/LearningModule/classes/class.ilLinksTableGUI.php");
1444  $table_gui = new ilLinksTableGUI(
1445  $this,
1446  "listLinks",
1447  $this->object->getId(),
1448  $this->object->getType()
1449  );
1450 
1451  $tpl->setContent($table_gui->getHTML());
1452  }
1453 
1457  public function showMaintenance()
1458  {
1459  $tpl = $this->tpl;
1460  $ilToolbar = $this->toolbar;
1461 
1462  $this->setTabs();
1463  $this->setContentSubTabs("maintenance");
1464 
1465  $ilToolbar->addButton(
1466  $this->lng->txt("cont_fix_tree"),
1467  $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1468  );
1469  }
1470 
1474  public function activatePages()
1475  {
1476  if (is_array($_POST["id"])) {
1477  foreach ($_POST["id"] as $id) {
1478  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1479  $act = ilLMPage::_lookupActive($id, $this->object->getType());
1480  ilLMPage::_writeActive($id, $this->object->getType(), !$act);
1481  }
1482  }
1483 
1484  $this->ctrl->redirect($this, "pages");
1485  }
1486 
1490  public function pastePage()
1491  {
1492  $ilErr = $this->error;
1493 
1494  if (ilEditClipboard::getContentObjectType() != "pg") {
1495  $ilErr->raiseError($this->lng->txt("no_page_in_clipboard"), $ilErr->MESSAGE);
1496  }
1497 
1498  // paste selected object
1500 
1501  // copy page, if action is copy
1502  if (ilEditClipboard::getAction() == "copy") {
1503  // check wether page belongs to lm
1505  == $this->object->getID()) {
1506  $lm_page = new ilLMPageObject($this->object, $id);
1507  $new_page = $lm_page->copy();
1508  $id = $new_page->getId();
1509  } else {
1510  // get page from other content object into current content object
1512  $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1513  $lm_page = new ilLMPageObject($lm_obj, $id);
1514  $copied_nodes = array();
1515  $new_page = $lm_page->copyToOtherContObject($this->object, $copied_nodes);
1516  $id = $new_page->getId();
1517  ilLMObject::updateInternalLinks($copied_nodes);
1518  }
1519  }
1520 
1521  // cut is not be possible in "all pages" form yet
1522  if (ilEditClipboard::getAction() == "cut") {
1523  // check wether page belongs not to lm
1525  != $this->object->getID()) {
1527  $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1528  $lm_page = new ilLMPageObject($lm_obj, $id);
1529  $lm_page->setLMId($this->object->getID());
1530  $lm_page->update();
1531  $page = $lm_page->getPageObject();
1532  $page->buildDom();
1533  $page->setParentId($this->object->getID());
1534  $page->update();
1535  }
1536  }
1537 
1538 
1540  $this->ctrl->redirect($this, "pages");
1541  }
1542 
1546  public function copyPage()
1547  {
1548  $ilErr = $this->error;
1549 
1550  if (!isset($_POST["id"])) {
1551  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1552  }
1553 
1554  $items = ilUtil::stripSlashesArray($_POST["id"]);
1555  ilLMObject::clipboardCopy($this->object->getId(), $items);
1557 
1558  ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_copied"), true);
1559 
1560  $this->ctrl->redirect($this, "pages");
1561  }
1562 
1570  public function delete($a_parent_subobj_id = 0)
1571  {
1572  $ilErr = $this->error;
1573 
1574  if (!isset($_POST["id"])) {
1575  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1576  }
1577 
1578  if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1579  $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1580  }
1581 
1582  if ($a_parent_subobj_id == 0) {
1583  $this->setTabs();
1584  }
1585 
1586  if ($a_parent_subobj_id != 0) {
1587  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $_GET["backcmd"]);
1588  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1589  $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1590  } else {
1591  $this->ctrl->setParameter($this, "backcmd", $_GET["backcmd"]);
1592  $form_action = $this->ctrl->getFormAction($this);
1593  }
1594 
1595  // display confirmation message
1596  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1597  $cgui = new ilConfirmationGUI();
1598  $cgui->setFormAction($form_action);
1599  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1600  $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1601  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1602 
1603  foreach ($_POST["id"] as $id) {
1604  if ($id != IL_FIRST_NODE) {
1605  $obj = new ilLMObject($this->object, $id);
1606  $caption = ilUtil::getImageTagByType($obj->getType(), $this->tpl->tplPath) .
1607  " " . $obj->getTitle();
1608 
1609  $cgui->addItem("id[]", $id, $caption);
1610  }
1611  }
1612 
1613  $this->tpl->setContent($cgui->getHTML());
1614  }
1615 
1619  public function cancelDelete()
1620  {
1621  $this->ctrl->redirect($this, $_GET["backcmd"]);
1622  }
1623 
1631  public function confirmedDelete($a_parent_subobj_id = 0)
1632  {
1633  $ilErr = $this->error;
1634 
1635  $tree = new ilTree($this->object->getId());
1636  $tree->setTableNames('lm_tree', 'lm_data');
1637  $tree->setTreeTablePK("lm_id");
1638 
1639  // check number of objects
1640  if (!$_POST["id"]) {
1641  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1642  }
1643 
1644  // delete all selected objects
1645  foreach ($_POST["id"] as $id) {
1646  if ($id != IL_FIRST_NODE) {
1647  $obj = ilLMObjectFactory::getInstance($this->object, $id, false);
1648  $node_data = $tree->getNodeData($id);
1649  if (is_object($obj)) {
1650  $obj->setLMId($this->object->getId());
1651 
1652  include_once("./Services/History/classes/class.ilHistory.php");
1654  $this->object->getId(),
1655  "delete_" . $obj->getType(),
1656  array(ilLMObject::_lookupTitle($id), $id),
1657  $this->object->getType()
1658  );
1659 
1660  $obj->delete();
1661  }
1662  if ($tree->isInTree($id)) {
1663  $tree->deleteTree($node_data);
1664  }
1665  }
1666  }
1667 
1668  // check the tree
1669  $this->object->checkTree();
1670 
1671  // feedback
1672  ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
1673 
1674  if ($a_parent_subobj_id == 0) {
1675  $this->ctrl->redirect($this, $_GET["backcmd"]);
1676  }
1677  }
1678 
1679 
1680 
1687  public function getContextPath($a_endnode_id, $a_startnode_id = 1)
1688  {
1689  $path = "";
1690 
1691  $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1692 
1693  // count -1, to exclude the learning module itself
1694  for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1695  if ($path != "") {
1696  $path .= " > ";
1697  }
1698 
1699  $path .= $tmpPath[$i]["title"];
1700  }
1701 
1702  return $path;
1703  }
1704 
1705 
1706 
1712  public function showActions($a_actions)
1713  {
1714  foreach ($a_actions as $name => $lng) {
1715  $d[$name] = array("name" => $name, "lng" => $lng);
1716  }
1717 
1718  $notoperations = array();
1719 
1720  $operations = array();
1721 
1722  if (is_array($d)) {
1723  foreach ($d as $row) {
1724  if (!in_array($row["name"], $notoperations)) {
1725  $operations[] = $row;
1726  }
1727  }
1728  }
1729 
1730  if (count($operations)>0) {
1731  foreach ($operations as $val) {
1732  $this->tpl->setCurrentBlock("operation_btn");
1733  $this->tpl->setVariable("BTN_NAME", $val["name"]);
1734  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1735  $this->tpl->parseCurrentBlock();
1736  }
1737 
1738  $this->tpl->setCurrentBlock("operation");
1739  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1740  $this->tpl->parseCurrentBlock();
1741  }
1742  }
1743 
1747  public function perm()
1748  {
1749  $this->setTabs();
1750 
1751  $this->setFormAction("addRole", $this->ctrl->getLinkTarget($this, "addRole"));
1752  $this->setFormAction("permSave", $this->ctrl->getLinkTarget($this, "permSave"));
1753  $this->permObject();
1754  }
1755 
1756 
1760  public function permSave()
1761  {
1762  $this->setReturnLocation("permSave", $this->ctrl->getLinkTarget($this, "perm"));
1763  $this->permSaveObject();
1764  }
1765 
1769  public function info()
1770  {
1771  $this->setTabs();
1772  $this->infoObject();
1773  }
1774 
1775 
1779  public function addRole()
1780  {
1781  $this->setReturnLocation("addRole", $this->ctrl->getLinkTarget($this, "perm"));
1782  $this->addRoleObject();
1783  }
1784 
1785 
1789  public function owner()
1790  {
1791  $this->setTabs();
1792  $this->ownerObject();
1793  }
1794 
1795 
1799  public function view()
1800  {
1801  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
1802  $this->prepareOutput();
1803  parent::viewObject();
1804  } else {
1805  $this->viewObject();
1806  }
1807  }
1808 
1809 
1813  public function moveChapter($a_parent_subobj_id = 0)
1814  {
1815  $ilErr = $this->error;
1816 
1817  if (!isset($_POST["id"])) {
1818  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1819  }
1820  //echo "Hallo::"; exit;
1821  if (count($_POST["id"]) > 1) {
1822  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1823  }
1824 
1825  if (count($_POST["id"]) == 1 && $_POST["id"][0] == IL_FIRST_NODE) {
1826  $ilErr->raiseError($this->lng->txt("cont_select_item"), $ilErr->MESSAGE);
1827  }
1828 
1829  // SAVE POST VALUES
1830  ilEditClipboard::storeContentObject("st", $_POST["id"][0], "move");
1831 
1832  ilUtil::sendInfo($this->lng->txt("cont_chap_select_target_now"), true);
1833 
1834  if ($a_parent_subobj_id == 0) {
1835  $this->ctrl->redirect($this, "chapters");
1836  }
1837  }
1838 
1839 
1843  public function copyChapter($a_parent_subobj_id = 0)
1844  {
1845  $this->copyItems();
1846  }
1847 
1851  public function pasteChapter($a_parent_subobj_id = 0)
1852  {
1853  return $this->insertChapterClip(false);
1854  }
1855 
1859  public function movePage()
1860  {
1861  $ilErr = $this->error;
1862 
1863  if (!isset($_POST["id"])) {
1864  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1865  }
1866 
1867  ilUtil::sendInfo($this->lng->txt("cont_selected_items_have_been_cut"), true);
1868 
1869  $items = ilUtil::stripSlashesArray($_POST["id"]);
1870  ilLMObject::clipboardCut($this->object->getId(), $items);
1872 
1873  $this->ctrl->redirect($this, "pages");
1874  }
1875 
1879  public function cancel()
1880  {
1881  if ($_GET["new_type"] == "pg") {
1882  $this->ctrl->redirect($this, "pages");
1883  } else {
1884  $this->ctrl->redirect($this, "chapters");
1885  }
1886  }
1887 
1888 
1892  public function export()
1893  {
1894  $ot = ilObjectTranslation::getInstance($this->object->getId());
1895  $opt = "";
1896  if ($ot->getContentActivated()) {
1897  $format = explode("_", $_POST["format"]);
1898  $opt = ilUtil::stripSlashes($format[1]);
1899  }
1900 
1901 
1902  require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
1903  $cont_exp = new ilContObjectExport($this->object);
1904  $cont_exp->buildExportFile($opt);
1905  // $this->ctrl->redirect($this, "exportList");
1906  }
1907 
1911  public function getPublicAccessColValue($a_type, $a_file)
1912  {
1913  $lng = $this->lng;
1914  $ilCtrl = $this->ctrl;
1915 
1916  $changelink = "<a href='" . $ilCtrl->getLinkTarget($this, "editMenuProperties") . "'>" . $lng->txt("change") . "</a>";
1917  if (!$this->object->isActiveLMMenu()) {
1918  $add = "<br />" . $lng->txt("cont_download_no_menu") . " " . $changelink;
1919  } elseif (!$this->object->isActiveDownloads()) {
1920  $add = "<br />" . $lng->txt("cont_download_no_download") . " " . $changelink;
1921  }
1922 
1923  $basetype = explode("_", $a_type);
1924  $basetype = $basetype[0];
1925 
1926  if ($this->object->getPublicExportFile($basetype) == $a_file) {
1927  return $lng->txt("yes") . $add;
1928  }
1929 
1930  return " ";
1931  }
1932 
1933 
1934 
1938  public function publishExportFile($a_files)
1939  {
1940  $ilCtrl = $this->ctrl;
1941 
1942  if (!isset($a_files)) {
1943  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1944  } else {
1945  foreach ($a_files as $f) {
1946  $file = explode(":", $f);
1947  if (is_int(strpos($file[0], "_"))) {
1948  $file[0] = explode("_", $file[0])[0];
1949  }
1950  $export_dir = $this->object->getExportDirectory($file[0]);
1951 
1952  if ($this->object->getPublicExportFile($file[0]) ==
1953  $file[1]) {
1954  $this->object->setPublicExportFile($file[0], "");
1955  } else {
1956  $this->object->setPublicExportFile($file[0], $file[1]);
1957  }
1958  }
1959  $this->object->update();
1960  }
1961  $ilCtrl->redirectByClass("ilexportgui");
1962  }
1963 
1967  public function downloadPDFFile()
1968  {
1969  $ilErr = $this->error;
1970 
1971  if (!isset($_POST["file"])) {
1972  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1973  }
1974 
1975  if (count($_POST["file"]) > 1) {
1976  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1977  }
1978 
1979 
1980  $export_dir = $this->object->getOfflineDirectory();
1981 
1982  $file = basename($_POST["file"][0]);
1983 
1984  ilUtil::deliverFile($export_dir . "/" . $file, $file);
1985  }
1986 
1987 
1992  public function fixTreeConfirm()
1993  {
1994  $this->setTabs();
1995  $this->setContentSubTabs("maintenance");
1996 
1997  // display confirmation message
1998  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1999  $cgui = new ilConfirmationGUI();
2000  $cgui->setFormAction($this->ctrl->getFormAction($this));
2001  $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
2002  $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
2003  $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
2004  $issues = $this->object->checkStructure();
2005  $mess = "";
2006  if (count($issues) > 0) {
2007  $mess = "Found Issues: <br>" . implode("<br>", $issues);
2008  }
2009  $this->tpl->setContent($cgui->getHTML() . $mess);
2010  }
2011 
2015  public function fixTree()
2016  {
2017  $this->object->fixTree();
2018  ilUtil::sendSuccess($this->lng->txt("cont_tree_fixed"), true);
2019  $this->ctrl->redirect($this, "showMaintenance");
2020  }
2021 
2025  public function setilLMMenu(
2026  $a_offline = false,
2027  $a_export_format = "",
2028  $a_active = "content",
2029  $a_use_global_tabs = false,
2030  $a_as_subtabs = false,
2031  $a_cur_page = 0,
2032  $a_lang = "",
2033  $a_export_all = false
2034  ) {
2035  $ilCtrl = $this->ctrl;
2036  $ilUser = $this->user;
2037  $ilAccess = $this->access;
2038  $ilTabs = $this->tabs;
2040  $ilPluginAdmin = $this->plugin_admin;
2041  $ilHelp = $this->help;
2042 
2043  $ilHelp->setScreenIdComponent("lm");
2044 
2045  if ($a_as_subtabs) {
2046  $addcmd = "addSubTabTarget";
2047  $getcmd = "getSubTabHTML";
2048  } else {
2049  $addcmd = "addTarget";
2050  $getcmd = "getHTML";
2051  }
2052 
2053  $active[$a_active] = true;
2054 
2055  if (!$this->object->isActiveLMMenu()) {
2056  return "";
2057  }
2058 
2059  if ($a_use_global_tabs) {
2060  $tabs_gui = $ilTabs;
2061  } else {
2062  $tabs_gui = new ilTabsGUI();
2063  }
2064 
2065  // workaround for preventing tooltips in export
2066  if ($a_offline) {
2067  $tabs_gui->setSetupMode(true);
2068  }
2069 
2070  // Determine whether the view of a learning resource should
2071  // be shown in the frameset of ilias, or in a separate window.
2072  $showViewInFrameset = true;
2073 
2074  if ($showViewInFrameset && !$a_offline) {
2075  $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
2076  } else {
2077  $buttonTarget = "_top";
2078  }
2079 
2080  if ($a_export_format == "scorm") {
2081  $buttonTarget = "";
2082  }
2083 
2084  // content
2085  if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2086  $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2087  $tabs_gui->$addcmd(
2088  "content",
2089  $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"),
2090  "",
2091  "",
2092  $buttonTarget,
2093  $active["content"]
2094  );
2095  if ($active["content"]) {
2096  $ilHelp->setScreenId("content");
2097  $ilHelp->setSubScreenId("content");
2098  }
2099  } elseif ($a_offline) {
2100  $tabs_gui->setForcePresentationOfSingleTab(true);
2101  }
2102 
2103  // table of contents
2104  if ($this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2105  if (!$a_offline) {
2106  $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2107  $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
2108  } else {
2109  if ($a_export_all) {
2110  $link = "./table_of_contents_" . $a_lang . ".html";
2111  } else {
2112  $link = "./table_of_contents.html";
2113  }
2114  }
2115  $tabs_gui->$addcmd(
2116  "cont_toc",
2117  $link,
2118  "",
2119  "",
2120  $buttonTarget,
2121  $active["toc"]
2122  );
2123  }
2124 
2125  // print view
2126  if ($this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2127  if (!$a_offline) { // has to be implemented for offline mode
2128  $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2129  $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
2130  $tabs_gui->$addcmd(
2131  "cont_print_view",
2132  $link,
2133  "",
2134  "",
2135  $buttonTarget,
2136  $active["print"]
2137  );
2138  }
2139  }
2140 
2141  // download
2142  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
2143  $is_public = $this->object->isActiveDownloadsPublic();
2144  } else {
2145  $is_public = true;
2146  }
2147 
2148  if ($this->object->isActiveDownloads() && !$a_offline && $is_public &&
2149  $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2150  $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2151  $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
2152  $tabs_gui->$addcmd(
2153  "download",
2154  $link,
2155  "",
2156  "",
2157  $buttonTarget,
2158  $active["download"]
2159  );
2160  }
2161 
2162  // info button
2163  if ($a_export_format != "scorm" && !$a_offline) {
2164  if (!$a_offline) {
2165  $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2166  $link = $this->ctrl->getLinkTargetByClass(
2167  array("illmpresentationgui", "ilinfoscreengui"),
2168  "showSummary"
2169  );
2170  } else {
2171  $link = "./info.html";
2172  }
2173 
2174  $tabs_gui->$addcmd(
2175  'info_short',
2176  $link,
2177  "",
2178  "",
2179  $buttonTarget,
2180  $active["info"]
2181  );
2182  }
2183 
2184  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2185  if (!$a_offline &&
2186  $ilAccess->checkAccess("read", "", $_GET["ref_id"]) && // #14075
2188  include_once './Services/Object/classes/class.ilObjectLP.php';
2189  $olp = ilObjectLP::getInstance($this->object->getId());
2190  if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
2191  $tabs_gui->$addcmd(
2192  "learning_progress",
2193  $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editManual"),
2194  "",
2195  "",
2196  $buttonTarget,
2197  $active["learning_progress"]
2198  );
2199  } elseif ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
2200  $tabs_gui->$addcmd(
2201  "learning_progress",
2202  $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"),
2203  "",
2204  "",
2205  $buttonTarget,
2206  $active["learning_progress"]
2207  );
2208  }
2209  }
2210 
2211  // get user defined menu entries
2212  $this->__initLMMenuEditor();
2213  $entries = $this->lmme_obj->getMenuEntries(true);
2214  if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2215  foreach ($entries as $entry) {
2216  // build goto-link for internal resources
2217  if ($entry["type"] == "intern") {
2218  $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
2219  }
2220 
2221  // add http:// prefix if not exist
2222  if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
2223  $entry["link"] = "http://" . $entry["link"];
2224  }
2225 
2226  if (!strstr($entry["link"], 'mailto:')) {
2227  $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->ref_id . "&structure_id=" . $this->obj_id);
2228  }
2229  $tabs_gui->$addcmd(
2230  $entry["title"],
2231  $entry["link"],
2232  "",
2233  "",
2234  "_blank",
2235  "",
2236  true
2237  );
2238  }
2239  }
2240 
2241  // edit learning module
2242  if (!$a_offline && $a_cur_page > 0) {
2243  if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
2244  //$page_id = $this->getCurrentPageId();
2245  $page_id = $a_cur_page;
2246  $tabs_gui->$addcmd(
2247  "edit_page",
2248  ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] .
2249  "&obj_id=" . $page_id . "&to_page=1",
2250  "",
2251  "",
2252  $buttonTarget,
2253  $active["edit_page"]
2254  );
2255  }
2256  }
2257 
2258  // user interface hook [uihk]
2259  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
2260  $plugin_html = false;
2261  foreach ($pl_names as $pl) {
2262  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
2263  $gui_class = $ui_plugin->getUIClassInstance();
2264  $resp = $gui_class->modifyGUI(
2265  "Modules/LearningModule",
2266  "lm_menu_tabs",
2267  array("lm_menu_tabs" => $tabs_gui)
2268  );
2269  }
2270 
2271  return $tabs_gui->$getcmd();
2272  }
2273 
2277  public function createPDF()
2278  {
2279  require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2280  $cont_exp = new ilContObjectExport($this->object, "pdf");
2281  $cont_exp->buildExportFile();
2282  $this->offlineList();
2283  }
2284 
2288  public function exportHTML()
2289  {
2290  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2291  $ot = ilObjectTranslation::getInstance($this->object->getId());
2292  $lang = "";
2293  if ($ot->getContentActivated()) {
2294  $format = explode("_", $_POST["format"]);
2295  $lang = ilUtil::stripSlashes($format[1]);
2296  }
2297  require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2298  $cont_exp = new ilContObjectExport($this->object, "html", $lang);
2299  $cont_exp->buildExportFile();
2300  //echo $this->tpl->get();
2301 // $this->ctrl->redirect($this, "exportList");
2302  }
2303 
2307  public function exportSCORM()
2308  {
2309  require_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2310  $cont_exp = new ilContObjectExport($this->object, "scorm");
2311  $cont_exp->buildExportFile();
2312  //echo $this->tpl->get();
2313 // $this->ctrl->redirect($this, "exportList");
2314  }
2315 
2321  public function addLocations($a_omit_obj_id = false)
2322  {
2323  $lng = $this->lng;
2324  $tree = $this->tree;
2325  $ilLocator = $this->locator;
2326  $ilCtrl = $this->ctrl;
2327 
2328  $par_id = $tree->getParentId($_GET["ref_id"]);
2329  $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($par_id));
2330 
2331  // parent is not root folder, "shorten" locator
2332  if ($par_id != ROOT_FOLDER_ID) {
2333  $this->ctrl->addLocation(
2334  "...",
2335  ""
2336  );
2337  } else {
2338  // if parent is root folder and has no custom title
2339  // we adapt it [see $ilLocator->addRepositoryItems()]
2340  if ($parent_title == "ILIAS") {
2341  $parent_title = $lng->txt("repository");
2342  }
2343  }
2344 
2345  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $par_id);
2346  $this->ctrl->addLocation(
2347  $parent_title,
2348  $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
2349  ilFrameTargetInfo::_getFrame("MainContent"),
2350  $par_id
2351  );
2352  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
2353 
2354  if (!$a_omit_obj_id) {
2355  $obj_id = $_GET["obj_id"];
2356  }
2357  $lmtree = $this->object->getTree();
2358 
2359  if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
2360  $path = $lmtree->getPathFull($obj_id);
2361  } else {
2362  $path = $lmtree->getPathFull($lmtree->getRootId());
2363  if ($obj_id != 0) {
2364  $path[] = array("type" => "pg", "child" => $this->obj_id,
2365  "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
2366  }
2367  }
2368 
2369  $modifier = 1;
2370 
2371  foreach ($path as $key => $row) {
2372  if ($row["child"] == 1) {
2373  $this->ctrl->setParameter($this, "obj_id", "");
2374  $this->ctrl->addLocation(
2375  $this->object->getTitle(),
2376  $this->ctrl->getLinkTarget($this, "chapters"),
2377  "",
2378  $_GET["ref_id"]
2379  );
2380  } else {
2381  $title = $row["title"];
2382  switch ($row["type"]) {
2383  case "st":
2384  $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
2385  $this->ctrl->addLocation(
2386  $title,
2387  $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view")
2388  );
2389  break;
2390 
2391  case "pg":
2392  $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
2393  $this->ctrl->addLocation(
2394  $title,
2395  $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit")
2396  );
2397  break;
2398  }
2399  }
2400  }
2401  if (!$a_omit_obj_id) {
2402  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
2403  }
2404  }
2405 
2409 
2410 
2414  public function listQuestions()
2415  {
2416  $tpl = $this->tpl;
2417 
2418  $this->setTabs("questions");
2419  $this->setQuestionsSubTabs("question_stats");
2420 
2421  include_once("./Modules/LearningModule/classes/class.ilLMQuestionListTableGUI.php");
2422  $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->object);
2423  $tpl->setContent($table->getHTML());
2424  }
2425 
2429  public function listBlockedUsers()
2430  {
2431  $tpl = $this->tpl;
2432 
2433  $this->setTabs("questions");
2434  $this->setQuestionsSubTabs("blocked_users");
2435 
2436  include_once("./Modules/LearningModule/classes/class.ilLMBlockedUsersTableGUI.php");
2437  $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->object);
2438  $tpl->setContent($table->getHTML());
2439  }
2440 
2444  public function resetNumberOfTries()
2445  {
2446  $lng = $this->lng;
2447  $ilCtrl = $this->ctrl;
2448 
2449  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2450  if (is_array($_POST["userquest_id"])) {
2451  foreach ($_POST["userquest_id"] as $uqid) {
2452  $uqid = explode(":", $uqid);
2453  ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
2454  }
2455  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2456  }
2457  $ilCtrl->redirect($this, "listBlockedUsers");
2458  }
2459 
2463  public function unlockQuestion()
2464  {
2465  $lng = $this->lng;
2466  $ilCtrl = $this->ctrl;
2467 
2468  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
2469  if (is_array($_POST["userquest_id"])) {
2470  foreach ($_POST["userquest_id"] as $uqid) {
2471  $uqid = explode(":", $uqid);
2472  ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
2473  }
2474  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
2475  }
2476  $ilCtrl->redirect($this, "listBlockedUsers");
2477  }
2478 
2482  public function sendMailToBlockedUsers()
2483  {
2484  $ilCtrl = $this->ctrl;
2485 
2486  if (!is_array($_POST["userquest_id"])) {
2487  ilUtil::sendFailure($this->lng->txt("no_checkbox"), 1);
2488  $ilCtrl->redirect($this, "listBlockedUsers");
2489  }
2490 
2491  $rcps = array();
2492  foreach ($_POST["userquest_id"] as $uqid) {
2493  $uqid = explode(":", $uqid);
2494  $login = ilObjUser::_lookupLogin($uqid[1]);
2495  if (!in_array($login, $rcps)) {
2496  $rcps[] = $login;
2497  }
2498  }
2499  require_once 'Services/Mail/classes/class.ilMailFormCall.php';
2501  $this,
2502  'listBlockedUsers',
2503  array(),
2504  array(
2505  'type' => 'new',
2506  'rcp_to' => implode(',', $rcps),
2507  'sig' => $this->getBlockedUsersMailSignature()
2508  )
2509  ));
2510  }
2511 
2515  protected function getBlockedUsersMailSignature()
2516  {
2517  $link = chr(13) . chr(10) . chr(13) . chr(10);
2518  $link .= $this->lng->txt('cont_blocked_users_mail_link');
2519  $link .= chr(13) . chr(10) . chr(13) . chr(10);
2520  include_once './Services/Link/classes/class.ilLink.php';
2521  $link .= ilLink::_getLink($this->object->getRefId());
2522  return rawurlencode(base64_encode($link));
2523  }
2524 
2525 
2529 
2530 
2534  public function setTabs($a_act = "")
2535  {
2536  $lng = $this->lng;
2537  $ilHelp = $this->help;
2538 
2539  $ilHelp->setScreenIdComponent("lm");
2540 
2541  $this->addTabs($a_act);
2542  parent::setTitleAndDescription();
2543  $this->tpl->setTitle($this->object->getTitle());
2544  $this->tpl->setTitleIcon(
2545  ilUtil::getImagePath("icon_lm.svg"),
2546  $lng->txt("obj_lm")
2547  );
2548  }
2549 
2555  public function setContentSubTabs($a_active)
2556  {
2557  $ilTabs = $this->tabs;
2558  $lng = $this->lng;
2559  $ilCtrl = $this->ctrl;
2560 
2561  $lm_set = new ilSetting("lm");
2562 
2563  // chapters
2564  $ilTabs->addSubtab(
2565  "chapters",
2566  $lng->txt("cont_chapters"),
2567  $ilCtrl->getLinkTarget($this, "chapters")
2568  );
2569 
2570  // all pages
2571  $ilTabs->addSubtab(
2572  "pages",
2573  $lng->txt("cont_all_pages"),
2574  $ilCtrl->getLinkTarget($this, "pages")
2575  );
2576 
2577  // all pages
2578  $ilTabs->addSubtab(
2579  "short_titles",
2580  $lng->txt("cont_short_titles"),
2581  $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
2582  );
2583 
2584  // export ids
2585  if ($lm_set->get("html_export_ids")) {
2586  if (!ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2587  $ilTabs->addSubtab(
2588  "export_ids",
2589  $lng->txt("cont_html_export_ids"),
2590  $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2591  );
2592  }
2593  }
2594  if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
2595  $lng->loadLanguageModule("help");
2596  $ilTabs->addSubtab(
2597  "export_ids",
2598  $lng->txt("cont_online_help_ids"),
2599  $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
2600  );
2601 
2602  $ilTabs->addSubtab(
2603  "help_tooltips",
2604  $lng->txt("help_tooltips"),
2605  $ilCtrl->getLinkTarget($this, "showTooltipList")
2606  );
2607  }
2608 
2609  // list links
2610  $ilTabs->addSubtab(
2611  "internal_links",
2612  $lng->txt("cont_internal_links"),
2613  $ilCtrl->getLinkTarget($this, "listLinks")
2614  );
2615 
2616  // web link checker
2617  $ilTabs->addSubtab(
2618  "link_check",
2619  $lng->txt("link_check"),
2620  $ilCtrl->getLinkTarget($this, "linkChecker")
2621  );
2622 
2623  $ilTabs->addSubtab(
2624  "history",
2625  $lng->txt("history"),
2626  $this->ctrl->getLinkTarget($this, "history")
2627  );
2628 
2629  // maintenance
2630  $ilTabs->addSubtab(
2631  "maintenance",
2632  $lng->txt("cont_maintenance"),
2633  $ilCtrl->getLinkTarget($this, "showMaintenance")
2634  );
2635 
2636  // srt files
2637  $ilTabs->addSubtab(
2638  "srt_files",
2639  $lng->txt("cont_subtitle_files"),
2640  $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
2641  );
2642 
2643  // srt files
2644  $ilTabs->addSubtab(
2645  "import",
2646  $lng->txt("cont_import"),
2647  $ilCtrl->getLinkTargetByClass("illmimportgui", "")
2648  );
2649 
2650  $ilTabs->activateSubTab($a_active);
2651  $ilTabs->activateTab("content");
2652  }
2653 
2659  public function setQuestionsSubTabs($a_active)
2660  {
2661  $ilTabs = $this->tabs;
2662  $lng = $this->lng;
2663  $ilCtrl = $this->ctrl;
2664 
2665  // chapters
2666  $ilTabs->addSubtab(
2667  "question_stats",
2668  $lng->txt("cont_question_stats"),
2669  $ilCtrl->getLinkTarget($this, "listQuestions")
2670  );
2671 
2672  // blocked users
2673  $ilTabs->addSubtab(
2674  "blocked_users",
2675  $lng->txt("cont_blocked_users"),
2676  $ilCtrl->getLinkTarget($this, "listBlockedUsers")
2677  );
2678 
2679  $ilTabs->activateSubTab($a_active);
2680  }
2681 
2685  public function addTabs($a_act = "")
2686  {
2688  $ilUser = $this->user;
2689  $ilTabs = $this->tabs;
2690  $lng = $this->lng;
2691 
2692  $tabs_gui = $ilTabs;
2693 
2694  // content
2695  $ilTabs->addTab(
2696  "content",
2697  $lng->txt("content"),
2698  $this->ctrl->getLinkTarget($this, "chapters")
2699  );
2700 
2701  // info
2702  $ilTabs->addTab(
2703  "info",
2704  $lng->txt("info_short"),
2705  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
2706  );
2707 
2708  // settings
2709  $ilTabs->addTab(
2710  "settings",
2711  $lng->txt("settings"),
2712  $this->ctrl->getLinkTarget($this, 'properties')
2713  );
2714 
2715  // questions
2716  $ilTabs->addTab(
2717  "questions",
2718  $lng->txt("objs_qst"),
2719  $this->ctrl->getLinkTarget($this, "listQuestions")
2720  );
2721 
2722  // learning progress
2723  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2724  if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) and ($this->object->getType() == 'lm')) {
2725  $ilTabs->addTab(
2726  'learning_progress',
2727  $lng->txt("learning_progress"),
2728  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
2729  );
2730  }
2731 
2732  if ($this->object->getType() != "lm") {
2733  // bibliographical data
2734  $ilTabs->addTab(
2735  "bib_data",
2736  $lng->txt("bib_data"),
2737  $this->ctrl->getLinkTarget($this, "editBibItem")
2738  );
2739  }
2740 
2741  // meta data
2742  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
2743  $mdgui = new ilObjectMetaDataGUI($this->object);
2744  $mdtab = $mdgui->getTab();
2745  if ($mdtab) {
2746  $ilTabs->addTab(
2747  "meta",
2748  $lng->txt("meta_data"),
2749  $mdtab
2750  );
2751  }
2752 
2753  if ($this->object->getType() == "lm") {
2754  // export
2755  $ilTabs->addTab(
2756  "export",
2757  $lng->txt("export"),
2758  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
2759  );
2760  }
2761 
2762  // permissions
2763  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
2764  $ilTabs->addTab(
2765  "perm",
2766  $lng->txt("perm_settings"),
2767  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
2768  );
2769  }
2770 
2771  if ($a_act != "") {
2772  $ilTabs->activateTab($a_act);
2773  }
2774 
2775  // presentation view
2776  $ilTabs->addNonTabbedLink(
2777  "pres_mode",
2778  $lng->txt("cont_presentation_view"),
2779  "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->object->getRefID(),
2780  "_top"
2781  );
2782  }
2783 
2787  public function setSubTabs($a_active)
2788  {
2789  $ilTabs = $this->tabs;
2791 
2792  if (in_array(
2793  $a_active,
2794  array("settings", "cont_style", "cont_lm_menu", "public_section",
2795  "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
2796  "lti_provider")
2797  )) {
2798  // general properties
2799  $ilTabs->addSubTabTarget(
2800  "settings",
2801  $this->ctrl->getLinkTarget($this, 'properties'),
2802  "",
2803  ""
2804  );
2805 
2806  // style properties
2807  $ilTabs->addSubTabTarget(
2808  "cont_style",
2809  $this->ctrl->getLinkTarget($this, 'editStyleProperties'),
2810  "",
2811  ""
2812  );
2813 
2814  // menu properties
2815  $ilTabs->addSubTabTarget(
2816  "cont_lm_menu",
2817  $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
2818  "",
2819  ""
2820  );
2821 
2822  // glossaries
2823  $ilTabs->addSubTabTarget(
2824  "cont_glossaries",
2825  $this->ctrl->getLinkTarget($this, 'editGlossaries'),
2826  "",
2827  ""
2828  );
2829 
2830  if ($ilSetting->get("pub_section")) {
2831  // public section
2832  $ilTabs->addSubTabTarget(
2833  "public_section",
2834  $this->ctrl->getLinkTarget($this, 'editPublicSection'),
2835  "",
2836  ""
2837  );
2838  }
2839 
2840  // multilinguality
2841  /* $ilTabs->addSubTabTarget("cont_multilinguality",
2842  $this->ctrl->getLinkTargetByClass("ilPageMultiLangGUI", ''),
2843  "", "");*/
2844 
2845  $ilTabs->addSubTabTarget(
2846  "obj_multilinguality",
2847  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
2848  );
2849 
2850  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2851  if ($lti_settings->hasSettingsAccess()) {
2852  $ilTabs->addSubTabTarget(
2853  'lti_provider',
2854  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
2855  );
2856  }
2857 
2858  $ilTabs->setSubTabActive($a_active);
2859  }
2860  }
2861 
2862  public function editPublicSection()
2863  {
2864  $ilTabs = $this->tabs;
2865  $ilToolbar = $this->toolbar;
2866  $ilAccess = $this->access;
2867 
2868 
2869  if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->object->getRefId())) {
2870  ilUtil::sendInfo($this->lng->txt("cont_anonymous_user_missing_perm"));
2871  }
2872 
2873  $this->setTabs();
2874  $this->setSubTabs("public_section");
2875  $ilTabs->setTabActive("settings");
2876 
2877  $this->tpl->addBlockFile(
2878  "ADM_CONTENT",
2879  "adm_content",
2880  "tpl.lm_public_selector.html",
2881  "Modules/LearningModule"
2882  );
2883 
2884  // get learning module object
2885  $this->lm_obj = new ilObjLearningModule($this->ref_id, true);
2886 
2887 
2888  // public mode
2889  $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
2890  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
2891  $si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
2892  $si->setOptions($modes);
2893  $si->setValue($this->object->getPublicAccessMode());
2894  $ilToolbar->addInputItem($si, true);
2895  $ilToolbar->addFormButton($this->lng->txt("save"), "savePublicSectionAccess");
2896  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "savePublicSectionAccess"));
2897 
2898  if ($this->object->getPublicAccessMode() == "selected") {
2899  $this->tpl->setCurrentBlock("select_pages");
2900  $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSectionPages"));
2901 
2902  include_once("./Modules/LearningModule/classes/class.ilPublicSectionExplorerGUI.php");
2903  $tree = new ilPublicSectionExplorerGUI($this, "editPublicSection", $this->lm_obj);
2904  $tree->setSelectMode("pages", true);
2905  $tree->setSkipRootNode(true);
2906 
2907  $this->tpl->setVariable("EXPLORER", $tree->getHTML());
2908  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
2909 
2910  $this->tpl->parseCurrentBlock();
2911  }
2912  }
2913 
2914  public function savePublicSection()
2915  {
2916  //var_dump($_POST["lm_public_mode"]);exit;
2917  $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2918  $this->object->updateProperties();
2919  ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2920  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2921  $this->ctrl->redirect($this, "editPublicSection");
2922  }
2923 
2927  public function savePublicSectionAccess()
2928  {
2929  $this->object->setPublicAccessMode($_POST["lm_public_mode"]);
2930  $this->object->updateProperties();
2931  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2932  $this->ctrl->redirect($this, "editPublicSection");
2933  }
2934 
2938  public function savePublicSectionPages()
2939  {
2940  ilLMObject::_writePublicAccessStatus($_POST["pages"], $this->object->getId());
2941  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2942  $this->ctrl->redirect($this, "editPublicSection");
2943  }
2944 
2950  public function history()
2951  {
2952  $this->setTabs("content");
2953  $this->setContentSubTabs("history");
2954 
2955  require_once("./Services/History/classes/class.ilHistoryTableGUI.php");
2956  $hist_gui = new ilHistoryTableGUI(
2957  $this,
2958  "history",
2959  $this->object->getId(),
2960  $this->object->getType()
2961  );
2962  $hist_gui->initTable();
2963  $hist_gui->setCommentVisibility($this->object->isActiveHistoryUserComments());
2964 
2965  $this->tpl->setContent($hist_gui->getHTML());
2966  }
2967 
2977  {
2978  $row['title'] = ilLMPageObject::_getPresentationTitle($row['page_id'], $this->object->getPageHeader());
2979 
2980  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
2982  $actions->setSelectionHeaderClass('small');
2983  $actions->setItemLinkClass('xsmall');
2984  $actions->setListTitle($this->lng->txt('actions'));
2985  $actions->setId($row['page_id']);
2986  $this->ctrl->setParameterByClass('ilLMPageObjectGUI', 'obj_id', $row['page_id']);
2987  $actions->addItem(
2988  $this->lng->txt('edit'),
2989  '',
2990  $this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI', 'edit')
2991  );
2992  $this->ctrl->clearParametersByClass('ilLMPageObjectGUI');
2993  $row['action_html'] = $actions->getHTML();
2994 
2995  return $row;
2996  }
2997 
2998  public function linkChecker()
2999  {
3000  $ilUser = $this->user;
3001  $tpl = $this->tpl;
3002 
3003  $this->__initLinkChecker();
3004 
3005  $this->setTabs();
3006  $this->setContentSubTabs("link_check");
3007 
3008  require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
3009 
3010  $toolbar = new ilToolbarGUI();
3011 
3012  // #13684
3013  include_once "Services/Cron/classes/class.ilCronManager.php";
3014  if (ilCronManager::isJobActive("lm_link_check")) {
3015  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
3016  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3017 
3018  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
3019  $chb->setValue(1);
3020  $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
3021  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
3022 
3023  $toolbar->addInputItem($chb);
3024  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
3025  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
3026  }
3027 
3028  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
3029  $tgui->setLinkChecker($this->link_checker_obj)
3030  ->setRowHandler($this)
3031  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
3032 
3033  return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
3034  }
3035 
3036  public function saveLinkCheck()
3037  {
3038  $ilDB = $this->db;
3039  $ilUser = $this->user;
3040 
3041  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
3042 
3043  $link_check_notify = new ilLinkCheckNotify($ilDB);
3044  $link_check_notify->setUserId($ilUser->getId());
3045  $link_check_notify->setObjId($this->object->getId());
3046 
3047  if ($_POST['link_check_message']) {
3048  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
3049  $link_check_notify->addNotifier();
3050  } else {
3051  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
3052  $link_check_notify->deleteNotifier();
3053  }
3054  $this->linkChecker();
3055 
3056  return true;
3057  }
3058 
3059 
3060 
3061  public function refreshLinkCheck()
3062  {
3063  $this->__initLinkChecker();
3064  $this->link_checker_obj->checkLinks();
3065  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
3066 
3067  $this->linkChecker();
3068 
3069  return true;
3070  }
3071 
3072  public function __initLinkChecker()
3073  {
3074  $ilDB = $this->db;
3075 
3076  include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
3077 
3078  $this->link_checker_obj = new ilLinkChecker($ilDB, false);
3079  $this->link_checker_obj->setObjId($this->object->getId());
3080 
3081  return true;
3082  }
3083 
3084  public function __initLMMenuEditor()
3085  {
3086  include_once './Modules/LearningModule/classes/class.ilLMMenuEditor.php';
3087 
3088  $this->lmme_obj = new ilLMMenuEditor();
3089  $this->lmme_obj->setObjId($this->object->getId());
3090 
3091  return true;
3092  }
3093 
3097  public function addMenuEntry()
3098  {
3099  $ilTabs = $this->tabs;
3100  $ilToolbar = $this->toolbar;
3101  $tpl = $this->tpl;
3102  $ilCtrl = $this->ctrl;
3103 
3104  $this->setTabs();
3105 
3106  $ilTabs->setTabActive("settings");
3107  $this->setSubTabs("cont_lm_menu");
3108 
3109  $ilToolbar->addButton(
3110  $this->lng->txt("lm_menu_select_internal_object"),
3111  $ilCtrl->getLinkTarget($this, "showEntrySelector")
3112  );
3113 
3114  $form = $this->initMenuEntryForm("create");
3115  $this->tpl->setContent($form->getHTML());
3116  }
3117 
3123  public function initMenuEntryForm($a_mode = "edit")
3124  {
3125  $lng = $this->lng;
3126  $ilCtrl = $this->ctrl;
3127 
3128  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3129  $form = new ilPropertyFormGUI();
3130 
3131  // title
3132  $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
3133  $ti->setMaxLength(255);
3134  $ti->setSize(40);
3135  $form->addItem($ti);
3136 
3137  // target
3138  $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
3139  $ta->setMaxLength(255);
3140  $ta->setSize(40);
3141  $form->addItem($ta);
3142 
3143  if ($a_mode == "edit") {
3144  $this->__initLMMenuEditor();
3145  $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
3146  $ti->setValue($this->lmme_obj->getTitle());
3147  $ta->setValue($this->lmme_obj->getTarget());
3148  }
3149 
3150  if (isset($_GET["link_ref_id"])) {
3151  $link_ref_id = (int) $_GET["link_ref_id"];
3152  $obj_type = ilObject::_lookupType($link_ref_id, true);
3153  $obj_id = ilObject::_lookupObjectId($link_ref_id);
3155 
3156  $target_link = $obj_type . "_" . $link_ref_id;
3157  $ti->setValue($title);
3158  $ta->setValue($target_link);
3159 
3160  // link ref id
3161  $hi = new ilHiddenInputGUI("link_ref_id");
3162  $hi->setValue($link_ref_id);
3163  $form->addItem($hi);
3164  }
3165 
3166 
3167  // save and cancel commands
3168  if ($a_mode == "create") {
3169  $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
3170  $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
3171  $form->setTitle($lng->txt("lm_menu_new_entry"));
3172  } else {
3173  $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
3174  $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
3175  $form->setTitle($lng->txt("lm_menu_edit_entry"));
3176  }
3177 
3178  $form->setFormAction($ilCtrl->getFormAction($this));
3179 
3180  return $form;
3181  }
3182 
3186  public function saveMenuEntry()
3187  {
3188  $ilCtrl = $this->ctrl;
3189 
3190  // check title and target
3191  if (empty($_POST["title"])) {
3192  ilUtil::sendFailure($this->lng->txt("please_enter_title"), true);
3193  $ilCtrl->redirect($this, "addMenuEntry");
3194  }
3195  if (empty($_POST["target"])) {
3196  ilUtil::sendFailure($this->lng->txt("please_enter_target"), true);
3197  $ilCtrl->redirect($this, "addMenuEntry");
3198  }
3199 
3200  $this->__initLMMenuEditor();
3201  $this->lmme_obj->setTitle($_POST["title"]);
3202  $this->lmme_obj->setTarget($_POST["target"]);
3203  $this->lmme_obj->setLinkRefId($_POST["link_ref_id"]);
3204 
3205  if ($_POST["link_ref_id"]) {
3206  $this->lmme_obj->setLinkType("intern");
3207  }
3208 
3209  $this->lmme_obj->create();
3210 
3211  ilUtil::sendSuccess($this->lng->txt("msg_entry_added"), true);
3212  $this->ctrl->redirect($this, "editMenuProperties");
3213  }
3214 
3218  public function deleteMenuEntry()
3219  {
3220  $ilErr = $this->error;
3221 
3222  if (empty($_GET["menu_entry"])) {
3223  $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3224  }
3225 
3226  $this->__initLMMenuEditor();
3227  $this->lmme_obj->delete($_GET["menu_entry"]);
3228 
3229  ilUtil::sendSuccess($this->lng->txt("msg_entry_removed"), true);
3230  $this->ctrl->redirect($this, "editMenuProperties");
3231  }
3232 
3236  public function editMenuEntry()
3237  {
3238  $ilToolbar = $this->toolbar;
3239  $ilCtrl = $this->ctrl;
3240  $ilTabs = $this->tabs;
3241  $ilErr = $this->error;
3242 
3243  $this->setTabs();
3244 
3245  $ilTabs->setTabActive("settings");
3246  $this->setSubTabs("cont_lm_menu");
3247 
3248 
3249  if (empty($_GET["menu_entry"])) {
3250  $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3251  }
3252 
3253  $ilCtrl->saveParameter($this, array("menu_entry"));
3254  $ilToolbar->addButton(
3255  $this->lng->txt("lm_menu_select_internal_object"),
3256  $ilCtrl->getLinkTarget($this, "showEntrySelector")
3257  );
3258 
3259  $form = $this->initMenuEntryForm("edit");
3260  $this->tpl->setContent($form->getHTML());
3261  }
3262 
3266  public function updateMenuEntry()
3267  {
3268  $ilErr = $this->error;
3269 
3270  if (empty($_REQUEST["menu_entry"])) {
3271  $ilErr->raiseError($this->lng->txt("no_menu_entry_id"), $ilErr->MESSAGE);
3272  }
3273 
3274  // check title and target
3275  if (empty($_POST["title"])) {
3276  $ilErr->raiseError($this->lng->txt("please_enter_title"), $ilErr->MESSAGE);
3277  }
3278  if (empty($_POST["target"])) {
3279  $ilErr->raiseError($this->lng->txt("please_enter_target"), $ilErr->MESSAGE);
3280  }
3281 
3282  $this->__initLMMenuEditor();
3283  $this->lmme_obj->readEntry($_REQUEST["menu_entry"]);
3284  $this->lmme_obj->setTitle($_POST["title"]);
3285  $this->lmme_obj->setTarget($_POST["target"]);
3286  if ($_POST["link_ref_id"]) {
3287  $this->lmme_obj->setLinkType("intern");
3288  }
3289  if (is_int(strpos($_POST["target"], "."))) {
3290  $this->lmme_obj->setLinkType("extern");
3291  }
3292  $this->lmme_obj->update();
3293 
3294  ilUtil::sendSuccess($this->lng->txt("msg_entry_updated"), true);
3295  $this->ctrl->redirect($this, "editMenuProperties");
3296  }
3297 
3298  public function showEntrySelector()
3299  {
3300  $ilTabs = $this->tabs;
3301  $ilCtrl = $this->ctrl;
3302 
3303  $this->setTabs();
3304 
3305  $ilTabs->setTabActive("settings");
3306  $this->setSubTabs("cont_lm_menu");
3307 
3308  $ilCtrl->saveParameter($this, array("menu_entry"));
3309 
3310  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_menu_object_selector.html", "Modules/LearningModule");
3311 
3312  ilUtil::sendInfo($this->lng->txt("lm_menu_select_object_to_add"));
3313 
3314  require_once("./Modules/LearningModule/classes/class.ilLMMenuObjectSelector.php");
3315  $exp = new ilLMMenuObjectSelector($this->ctrl->getLinkTarget($this, 'test'), $this);
3316 
3317  $exp->setExpand($_GET["lm_menu_expand"] ? $_GET["lm_menu_expand"] : $this->tree->readRootId());
3318  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showEntrySelector'));
3319  $exp->setTargetGet("ref_id");
3320  $exp->setRefId($this->cur_ref_id);
3321 
3322  $sel_types = array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs',
3323  "crs", "grp", "book", "tst", "file");
3324  $exp->setSelectableTypes($sel_types);
3325 
3326  //$exp->setTargetGet("obj_id");
3327 
3328  // build html-output
3329  $exp->setOutput(0);
3330  $output = $exp->getOutput();
3331 
3332  // get page ids
3333  foreach ($exp->format_options as $node) {
3334  if (!$node["container"]) {
3335  $pages[] = $node["child"];
3336  }
3337  }
3338 
3339  //$this->tpl->setCurrentBlock("content");
3340  //var_dump($this->object->getPublicAccessMode());
3341  // access mode selector
3342  $this->tpl->setVariable("TXT_SET_PUBLIC_MODE", $this->lng->txt("set_public_mode"));
3343  $this->tpl->setVariable("TXT_CHOOSE_PUBLIC_MODE", $this->lng->txt("choose_public_mode"));
3344  $modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
3345  $select_public_mode = ilUtil::formSelect($this->object->getPublicAccessMode(), "lm_public_mode", $modes, false, true);
3346  $this->tpl->setVariable("SELECT_PUBLIC_MODE", $select_public_mode);
3347 
3348  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("choose_public_pages"));
3349  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
3350  $this->tpl->setVariable("EXPLORER", $output);
3351  $this->tpl->setVariable("ONCLICK", $js_pages);
3352  $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
3353  $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
3354  $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
3355  $this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
3356  //$this->tpl->parseCurrentBlock();
3357  }
3358 
3362  public function selectHeader()
3363  {
3364  $ilErr = $this->error;
3365 
3366  if (!isset($_POST["id"])) {
3367  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3368  }
3369  if (count($_POST["id"]) > 1) {
3370  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3371  }
3372  if ($_POST["id"][0] != $this->object->getHeaderPage()) {
3373  $this->object->setHeaderPage($_POST["id"][0]);
3374  } else {
3375  $this->object->setHeaderPage(0);
3376  }
3377  $this->object->updateProperties();
3378  $this->ctrl->redirect($this, "pages");
3379  }
3380 
3384  public function selectFooter()
3385  {
3386  $ilErr = $this->error;
3387 
3388  if (!isset($_POST["id"])) {
3389  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
3390  }
3391  if (count($_POST["id"]) > 1) {
3392  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
3393  }
3394  if ($_POST["id"][0] != $this->object->getFooterPage()) {
3395  $this->object->setFooterPage($_POST["id"][0]);
3396  } else {
3397  $this->object->setFooterPage(0);
3398  }
3399  $this->object->updateProperties();
3400  $this->ctrl->redirect($this, "pages");
3401  }
3402 
3406  public function saveAllTitles()
3407  {
3408  $ilCtrl = $this->ctrl;
3409 
3410  ilLMObject::saveTitles($this->object, ilUtil::stripSlashesArray($_POST["title"]), $_GET["transl"]);
3411 
3412  ilUtil::sendSuccess($this->lng->txt("lm_save_titles"), true);
3413  $ilCtrl->redirect($this, "chapters");
3414  }
3415 
3419  public function insertChapter()
3420  {
3421  $ilCtrl = $this->ctrl;
3422  $lng = $this->lng;
3423 
3424  include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3425 
3428 
3429  if (!ilChapterHierarchyFormGUI::getPostFirstChild()) { // insert after node id
3430  $parent_id = $this->lm_tree->getParentId($node_id);
3431  $target = $node_id;
3432  } else { // insert as first child
3433  $parent_id = $node_id;
3435  }
3436 
3437  for ($i = 1; $i <= $num; $i++) {
3438  $chap = new ilStructureObject($this->object);
3439  $chap->setType("st");
3440  $chap->setTitle($lng->txt("cont_new_chap"));
3441  $chap->setLMId($this->object->getId());
3442  $chap->create();
3443  ilLMObject::putInTree($chap, $parent_id, $target);
3444  }
3445 
3446  $ilCtrl->redirect($this, "chapters");
3447  }
3448 
3452  public function insertChapterClip()
3453  {
3454  $ilUser = $this->user;
3455  $ilCtrl = $this->ctrl;
3456  $ilLog = $this->log;
3457 
3458  include_once("./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
3459 
3462 
3463  $ilLog->write("InsertChapterClip, num: $num, node_id: $node_id, " .
3464  " getPostFirstChild " . ilChapterHierarchyFormGUI::getPostFirstChild());
3465 
3466  if (!$first_child) { // insert after node id
3467  $parent_id = $this->lm_tree->getParentId($node_id);
3468  $target = $node_id;
3469  } else { // insert as first child
3470  $parent_id = $node_id;
3472  }
3473 
3474  // copy and paste
3475  $chapters = $ilUser->getClipboardObjects("st", true);
3476  $copied_nodes = array();
3477  foreach ($chapters as $chap) {
3478  $ilLog->write("Call pasteTree, Target LM: " . $this->object->getId() . ", Chapter ID: " . $chap["id"]
3479  . ", Parent ID: " . $parent_id . ", Target: " . $target);
3480  $cid = ilLMObject::pasteTree(
3481  $this->object,
3482  $chap["id"],
3483  $parent_id,
3484  $target,
3485  $chap["insert_time"],
3486  $copied_nodes,
3487  (ilEditClipboard::getAction() == "copy")
3488  );
3489  $target = $cid;
3490  }
3491  ilLMObject::updateInternalLinks($copied_nodes);
3492 
3493  if (ilEditClipboard::getAction() == "cut") {
3494  $ilUser->clipboardDeleteObjectsOfType("pg");
3495  $ilUser->clipboardDeleteObjectsOfType("st");
3497  }
3498 
3499  $this->object->checkTree();
3500  $ilCtrl->redirect($this, "chapters");
3501  }
3502 
3508  public static function _goto($a_target)
3509  {
3510  global $DIC;
3511 
3512  $ilAccess = $DIC->access();
3513  $ilErr = $DIC["ilErr"];
3514  $lng = $DIC->language();
3515 
3516  if ($ilAccess->checkAccess("read", "", $a_target)) {
3517  $_GET["baseClass"] = "ilLMPresentationGUI";
3518  $_GET["ref_id"] = $a_target;
3519  $_GET["cmd"] = "resume";
3520  include("ilias.php");
3521  exit;
3522  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
3523  $_GET["baseClass"] = "ilLMPresentationGUI";
3524  $_GET["ref_id"] = $a_target;
3525  $_GET["cmd"] = "infoScreen";
3526  include("ilias.php");
3527  exit;
3528  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
3529  ilUtil::sendFailure(sprintf(
3530  $lng->txt("msg_no_perm_read_item"),
3532  ), true);
3534  }
3535 
3536 
3537  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
3538  }
3539 
3543  public function cutItems($a_return = "chapters")
3544  {
3545  $ilCtrl = $this->ctrl;
3546  $lng = $this->lng;
3547 
3548  $items = ilUtil::stripSlashesArray($_POST["id"]);
3549  if (!is_array($items)) {
3550  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3551  $ilCtrl->redirect($this, $a_return);
3552  }
3553 
3554  $todel = array(); // delete IDs < 0 (needed for non-js editing)
3555  foreach ($items as $k => $item) {
3556  if ($item < 0) {
3557  $todel[] = $k;
3558  }
3559  }
3560  foreach ($todel as $k) {
3561  unset($items[$k]);
3562  }
3563  ilLMObject::clipboardCut($this->object->getId(), $items);
3565  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
3566 
3567  $ilCtrl->redirect($this, $a_return);
3568  }
3569 
3573  public function copyItems()
3574  {
3575  $ilCtrl = $this->ctrl;
3576  $lng = $this->lng;
3577 
3578  $items = ilUtil::stripSlashesArray($_POST["id"]);
3579  if (!is_array($items)) {
3580  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3581  $ilCtrl->redirect($this, "chapters");
3582  }
3583 
3584  $todel = array(); // delete IDs < 0 (needed for non-js editing)
3585  foreach ($items as $k => $item) {
3586  if ($item < 0) {
3587  $todel[] = $k;
3588  }
3589  }
3590  foreach ($todel as $k) {
3591  unset($items[$k]);
3592  }
3593  ilLMObject::clipboardCopy($this->object->getId(), $items);
3595  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
3596  $ilCtrl->redirect($this, "chapters");
3597  }
3598 
3602  public function cutChapter()
3603  {
3604  $this->cutItems("chapters");
3605  }
3606 
3610 
3617  public function showExportIDsOverview($a_validation = false)
3618  {
3619  $tpl = $this->tpl;
3620  $ilToolbar = $this->toolbar;
3621  $lng = $this->lng;
3622  $ilCtrl = $this->ctrl;
3623 
3624  $this->setTabs();
3625  $this->setContentSubTabs("export_ids");
3626 
3627  if (ilObjContentObject::isOnlineHelpModule($this->object->getRefId())) {
3628  // toolbar
3629  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3630  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3631  $lm_tree = $this->object->getTree();
3632  $childs = $lm_tree->getChilds($lm_tree->readRootId());
3633  $options = array("" => $lng->txt("all"));
3634  foreach ($childs as $c) {
3635  $options[$c["child"]] = $c["title"];
3636  }
3637  $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
3638  $si->setOptions($options);
3639  $si->setValue(ilSession::get("help_chap"));
3640  $ilToolbar->addInputItem($si, true);
3641  $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
3642 
3643  include_once("./Modules/LearningModule/classes/class.ilHelpMappingTableGUI.php");
3644  $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation, false);
3645  } else {
3646  include_once("./Modules/LearningModule/classes/class.ilExportIDTableGUI.php");
3647  $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
3648  }
3649 
3650  $tpl->setContent($tbl->getHTML());
3651  }
3652 
3659  public function filterHelpChapters()
3660  {
3661  $ilCtrl = $this->ctrl;
3662 
3663  ilSession::set("help_chap", ilUtil::stripSlashes($_POST["help_chap"]));
3664  $ilCtrl->redirect($this, "showExportIDsOverview");
3665  }
3666 
3667 
3671  public function saveExportIds()
3672  {
3673  $ilCtrl = $this->ctrl;
3674  $lng = $this->lng;
3675 
3676  // check all export ids
3677  $ok = true;
3678  if (is_array($_POST["exportid"])) {
3679  foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3680  if ($exp_id != "" && !preg_match(
3681  "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
3682  trim($exp_id)
3683  )) {
3684  $ok = false;
3685  }
3686  }
3687  }
3688  if (!$ok) {
3689  ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
3690  $lng->txt("cont_exp_ids_not_resp_format3") . " " .
3691  $lng->txt("cont_exp_ids_not_resp_format2"));
3692  $this->showExportIDsOverview(true);
3693  return;
3694  }
3695 
3696 
3697  if (is_array($_POST["exportid"])) {
3698  foreach ($_POST["exportid"] as $pg_id => $exp_id) {
3700  $this->object->getId(),
3701  $pg_id,
3702  ilUtil::stripSlashes($exp_id),
3703  ilLMObject::_lookupType($pg_id)
3704  );
3705  }
3706  }
3707 
3708  ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true);
3709  $ilCtrl->redirect($this, "showExportIdsOverview");
3710  }
3711 
3718  public function saveHelpMapping()
3719  {
3720  $lng = $this->lng;
3721  $ilCtrl = $this->ctrl;
3722 
3723  include_once("./Services/Help/classes/class.ilHelpMapping.php");
3724  if (is_array($_POST["screen_ids"])) {
3725  foreach ($_POST["screen_ids"] as $chap => $ids) {
3726  $ids = explode("\n", $ids);
3728  }
3729  }
3730  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3731  $ilCtrl->redirect($this, "showExportIdsOverview");
3732  }
3733 
3737 
3744  public function showTooltipList()
3745  {
3746  $tpl = $this->tpl;
3747  $ilToolbar = $this->toolbar;
3748  $ilCtrl = $this->ctrl;
3749  $lng = $this->lng;
3750 
3751  $this->setTabs();
3752  $this->setContentSubTabs("help_tooltips");
3753 
3754  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
3755  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
3756  $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
3757  $ti->setMaxLength(200);
3758  $ti->setSize(20);
3759  $ilToolbar->addInputItem($ti, true);
3760  $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
3761  $ilToolbar->addSeparator();
3762 
3763  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
3765  if (ilSession::get("help_tt_comp") != "") {
3766  $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
3767  }
3768  $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
3769  $si->setOptions($options);
3770  $si->setValue(ilSession::get("help_tt_comp"));
3771  $ilToolbar->addInputItem($si, true);
3772  $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
3773 
3774  include_once("./Modules/LearningModule/classes/class.ilHelpTooltipTableGUI.php");
3775  $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp"));
3776 
3777  $tpl->setContent($tbl->getHTML());
3778  }
3779 
3786  public function addTooltip()
3787  {
3788  $lng = $this->lng;
3789  $ilCtrl = $this->ctrl;
3790 
3791  $tt_id = ilUtil::stripSlashes($_POST["tooltip_id"]);
3792  if (trim($tt_id) != "") {
3793  if (is_int(strpos($tt_id, "_"))) {
3794  include_once("./Services/Help/classes/class.ilHelp.php");
3795  ilHelp::addTooltip(trim($tt_id), "");
3796  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3797 
3798  $fu = strpos($tt_id, "_");
3799  $comp = substr($tt_id, 0, $fu);
3800  ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
3801  } else {
3802  ilUtil::sendFailure($lng->txt("cont_help_no_valid_tooltip_id"), true);
3803  }
3804  }
3805  $ilCtrl->redirect($this, "showTooltipList");
3806  }
3807 
3814  public function filterTooltips()
3815  {
3816  $lng = $this->lng;
3817  $ilCtrl = $this->ctrl;
3818 
3819  ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"]));
3820  $ilCtrl->redirect($this, "showTooltipList");
3821  }
3822 
3823 
3830  public function saveTooltips()
3831  {
3832  $ilCtrl = $this->ctrl;
3833  $lng = $this->lng;
3834 
3835  include_once("./Services/Help/classes/class.ilHelp.php");
3836 
3837  if (is_array($_POST["text"])) {
3838  foreach ($_POST["text"] as $id => $text) {
3840  (int) $id,
3842  ilUtil::stripSlashes($_POST["tt_id"][(int) $id])
3843  );
3844  }
3845  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3846  }
3847  $ilCtrl->redirect($this, "showTooltipList");
3848  }
3849 
3853  public function deleteTooltips()
3854  {
3855  $lng = $this->lng;
3856  $ilCtrl = $this->ctrl;
3857 
3858  if (is_array($_POST["id"])) {
3859  include_once("./Services/Help/classes/class.ilHelp.php");
3860  foreach ($_POST["id"] as $id) {
3861  ilHelp::deleteTooltip((int) $id);
3862  }
3863  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3864  }
3865  $ilCtrl->redirect($this, "showTooltipList");
3866  }
3867 
3874  /* function saveHelpMapping()
3875  {
3876  global $lng, $ilCtrl;
3877 
3878  include_once("./Services/Help/classes/class.ilHelpMapping.php");
3879  if (is_array($_POST["screen_ids"]))
3880  {
3881  foreach ($_POST["screen_ids"] as $chap => $ids)
3882  {
3883  $ids = explode("\n", $ids);
3884  ilHelpMapping::saveScreenIdsForChapter($chap, $ids);
3885  }
3886  }
3887  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3888  $ilCtrl->redirect($this, "showExportIdsOverview");
3889  }*/
3890 
3891 
3895 
3901  public static function getLayoutOption($a_txt, $a_var, $a_def_option = "")
3902  {
3903  global $DIC;
3904 
3905  $lng = $DIC->language();
3906 
3907  // default layout
3908  $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
3909  if ($a_def_option != "") {
3910  if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
3911  $im_tag = ilUtil::img($im, $a_def_option);
3912  }
3913  $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><b>" .
3914  $lng->txt("cont_lm_default_layout") .
3915  "</b>: " . $lng->txt("cont_layout_" . $a_def_option) .
3916  "</td></tr></table>", ""));
3917  }
3919  $im_tag = "";
3920  if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
3921  $im_tag = ilUtil::img($im, $l);
3922  }
3923  $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
3924  $im_tag . "</td><td style='padding:5px;'><b>" . $lng->txt("cont_layout_" . $l) . "</b>: " .
3925  $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
3926  }
3927 
3928  return $layout;
3929  }
3930 
3934  public function setPageLayoutInHierarchy()
3935  {
3936  $ilCtrl = $this->ctrl;
3937  $ilCtrl->setParameter($this, "hierarchy", "1");
3938  $this->setPageLayout(true);
3939  }
3940 
3941 
3945  public function setPageLayout($a_in_hierarchy = false)
3946  {
3947  $tpl = $this->tpl;
3948  $ilCtrl = $this->ctrl;
3949  $lng = $this->lng;
3950 
3951  if (!is_array($_POST["id"])) {
3952  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
3953 
3954  if ($a_in_hierarchy) {
3955  $ilCtrl->redirect($this, "chapters");
3956  } else {
3957  $ilCtrl->redirect($this, "pages");
3958  }
3959  }
3960 
3961  $this->initSetPageLayoutForm();
3962 
3963  $tpl->setContent($this->form->getHTML());
3964  }
3965 
3969  public function initSetPageLayoutForm()
3970  {
3971  $lng = $this->lng;
3972  $ilCtrl = $this->ctrl;
3973 
3974  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3975  $this->form = new ilPropertyFormGUI();
3976 
3977  if (is_array($_POST["id"])) {
3978  foreach ($_POST["id"] as $id) {
3979  $hi = new ilHiddenInputGUI("id[]");
3980  $hi->setValue($id);
3981  $this->form->addItem($hi);
3982  }
3983  }
3984  $layout = self::getLayoutOption(
3985  $lng->txt("cont_layout"),
3986  "layout",
3987  $this->object->getLayout()
3988  );
3989  $this->form->addItem($layout);
3990 
3991  $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
3992  $this->form->addCommandButton("pages", $lng->txt("cancel"));
3993 
3994  $this->form->setTitle($lng->txt("cont_set_layout"));
3995  $this->form->setFormAction($ilCtrl->getFormAction($this));
3996  }
3997 
4001  public function savePageLayout()
4002  {
4003  $lng = $this->lng;
4004  $ilCtrl = $this->ctrl;
4005 
4006  $ilCtrl->setParameter($this, "hierarchy", $_GET["hierarchy"]);
4007 
4008  foreach ($_POST["id"] as $id) {
4010  ilUtil::stripSlashes($id),
4011  ilUtil::stripSlashes($_POST["layout"]),
4012  $this->object
4013  );
4014  }
4015  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
4016 
4017  if ($_GET["hierarchy"] == 1) {
4018  $ilCtrl->redirect($this, "chapters");
4019  } else {
4020  $ilCtrl->redirect($this, "pages");
4021  }
4022  }
4023 
4024  //
4025  // Auto glossaries
4026  //
4027 
4034  public function editGlossaries()
4035  {
4036  $tpl = $this->tpl;
4037  $ilToolbar = $this->toolbar;
4038  $lng = $this->lng;
4039  $ilCtrl = $this->ctrl;
4040  $ilTabs = $this->tabs;
4041 
4042  $this->setTabs();
4043  $ilTabs->setTabActive("settings");
4044  $this->setSubTabs("cont_glossaries");
4045 
4046  $ilToolbar->addButton(
4047  $lng->txt("add"),
4048  $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
4049  );
4050 
4051  include_once("./Modules/LearningModule/classes/class.ilLMGlossaryTableGUI.php");
4052  $tab = new ilLMGlossaryTableGUI($this->object, $this, "editGlossaries");
4053 
4054  $tpl->setContent($tab->getHTML());
4055  }
4056 
4063  public function showLMGlossarySelector()
4064  {
4065  $tpl = $this->tpl;
4066  $lng = $this->lng;
4067  $ilCtrl = $this->ctrl;
4068  $tree = $this->tree;
4069  $ilUser = $this->user;
4070  $ilTabs = $this->tabs;
4071 
4072  $this->setTabs();
4073  $ilTabs->setTabActive("settings");
4074  $this->setSubTabs("cont_glossaries");
4075 
4076  include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
4077 
4078  $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
4079  $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
4080  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
4081  $exp->setTargetClass(get_class($this));
4082  $exp->setCmd('confirmGlossarySelection');
4083  $exp->setClickableTypes(array("glo"));
4084  $exp->addFilter("glo");
4085 
4086  // build html-output
4087  $exp->setOutput(0);
4088  $tpl->setContent($exp->getOutput());
4089  }
4090 
4094  public function confirmGlossarySelection()
4095  {
4096  $ilCtrl = $this->ctrl;
4097  $tpl = $this->tpl;
4098  $lng = $this->lng;
4099 
4100  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
4101  $cgui = new ilConfirmationGUI();
4102  $ilCtrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
4103  $cgui->setFormAction($ilCtrl->getFormAction($this));
4104  $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
4105  $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
4106  $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
4107  $tpl->setContent($cgui->getHTML());
4108  }
4109 
4116  public function selectLMGlossaryLink()
4117  {
4118  $glo_ref_id = (int) $_GET["glo_ref_id"];
4119  $glo_id = ilObject::_lookupObjId($glo_ref_id);
4120  $this->object->autoLinkGlossaryTerms($glo_ref_id);
4121  $this->selectLMGlossary();
4122  }
4123 
4124 
4131  public function selectLMGlossary()
4132  {
4133  $ilCtrl = $this->ctrl;
4134  $lng = $this->lng;
4135 
4136  $glos = $this->object->getAutoGlossaries();
4137  $glo_ref_id = (int) $_GET["glo_ref_id"];
4138  $glo_id = ilObject::_lookupObjId($glo_ref_id);
4139  if (!in_array($glo_id, $glos)) {
4140  $glos[] = $glo_id;
4141  }
4142  $this->object->setAutoGlossaries($glos);
4143  $this->object->update();
4144 
4145  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
4146  $ilCtrl->redirect($this, "editGlossaries");
4147  }
4148 
4155  public function removeLMGlossary()
4156  {
4157  $ilCtrl = $this->ctrl;
4158  $lng = $this->lng;
4159 
4160  $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
4161  $this->object->update();
4162 
4163  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
4164  $ilCtrl->redirect($this, "editGlossaries");
4165  }
4166 
4173  public function editMasterLanguage()
4174  {
4175  $ilCtrl = $this->ctrl;
4176 
4177  $ilCtrl->setParameter($this, "transl", "");
4178  if ($_GET["lang_switch_mode"] == "short_titles") {
4179  $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
4180  }
4181  $ilCtrl->redirect($this, "chapters");
4182  }
4183 
4190  public function switchToLanguage()
4191  {
4192  $ilCtrl = $this->ctrl;
4193 
4194  $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
4195  if ($_GET["lang_switch_mode"] == "short_titles") {
4196  $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
4197  }
4198  $ilCtrl->redirect($this, "chapters");
4199  }
4200 
4201  public function redrawHeaderAction()
4202  {
4203  // #12281
4204  return parent::redrawHeaderActionObject();
4205  }
4206 }
listBlockedUsers()
List blocked users.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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)
Class ilObjectMetaDataGUI.
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
sendMailToBlockedUsers()
Send Mail to blocked users.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
editMasterLanguage()
Edit master language.
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
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.
$format
Definition: metadata.php:141
Import related features for learning modules.
setPageLayoutInHierarchy()
Set layout for multipl pages.
showActions($a_actions)
show possible action (form buttons)
selectLMGlossary()
Select lm glossary.
This class represents a selection list property in a property form.
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.
global $DIC
Definition: saml.php:7
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
$tbl
Definition: example_048.php:81
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
activatePages()
activates or deactivates pages
setReturnLocation($a_cmd, $a_location)
set specific return location for command
static getPostNodeId()
Get node ID of _POST input.
static getAvailableLayouts()
get all available lm layouts
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
setFormAction($a_cmd, $a_formaction)
set specific form action for command
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Save help mapping.
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
editMenuProperties()
Edit menu properies.
viewObject()
list childs of current object
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
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.
owner()
show owner of content object
$a_type
Definition: workflow.php:92
setChecked($a_checked)
Set Checked.
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
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
if($format !==null) $name
Definition: metadata.php:146
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.
if(isset($_POST['submit'])) $form
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.
special template class to simplify handling of ITX/PEAR
omitLocator($a_omit=true)
setTitle($a_title)
Set Title.
selectLMGlossaryLink()
Select a glossary and link all its terms.
$text
Definition: errorreport.php:18
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.
This class represents a text property in a property form.
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)
Page multilinguality GUI class.
$ilUser
Definition: imgupload.php:18
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
setMaxLength($a_maxlength)
Set Max Length.
publishExportFile($a_files)
download export file
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
getID()
Return the unique ID value assigned to this spreadsheet workbook.
Definition: PHPExcel.php:1135
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
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
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.
User interface class for advanced drop-down selection lists.
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
settings()
Definition: settings.php:2
static _getPresentationTitle( $a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn&#39;t have to be page title, it may be chapter title + page title or chapter tit...
setContentSubTabs($a_active)
Set pages tabs.
Class ilStructreObject.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
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.
global $l
Definition: afr.php:30
Create new PHPExcel object
obj_idprivate
Class ilObjStyleSheetGUI.
global $ilSetting
Definition: privfeed.php:17
confirmGlossarySelection()
Confirm glossary selection.
static unlock($a_q_id, $a_user_id)
Reset tries.
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.
Class ilObjContentObjectGUI.
getCreationMode()
get creation mode
$i
Definition: disco.tpl.php:19
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
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.
if(empty($password)) $table
Definition: pwgen.php:24
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.
$info
Definition: index.php:5
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.
$key
Definition: croninfo.php:18
setSuffixes($a_suffixes)
Set Accepted Suffixes.
Class ilObjUserTrackingGUI.
showTooltipList()
Show export IDs overview.
$_POST["username"]
setRequired($a_required)
Set Required.
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
Confirmation screen class.
insertChapter()
Insert (multiple) chapters at node.
Handler class for multi srt upload in learning modules.
static _goto($a_target)
redirect script