ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilObjContentObjectGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
35 {
36  protected \ILIAS\LearningModule\InternalGUIService $gui;
37  protected \ILIAS\LearningModule\InternalDomainService $domain;
39  protected \ILIAS\LearningModule\ReadingTime\SettingsGUI $reading_time_gui;
42  protected string $lang_switch_mode;
44  protected ilTabsGUI $tabs;
45  protected ilHelpGUI $help;
46  protected ilDBInterface $db;
47  protected ilLogger $log;
48  protected \ILIAS\DI\UIServices $ui;
50 
51  protected bool $to_props = false;
52  protected int $requested_obj_id = 0;
53  protected string $requested_new_type = "";
54  protected string $requested_baseClass = "";
55  protected int $requested_ref_id = 0;
56  protected string $requested_transl = "";
57  protected string $requested_backcmd = "";
58  protected int $requested_menu_entry = 0;
59  protected int $requested_lm_menu_expand = 0;
60  protected int $requested_search_root_expand = 0;
61  protected bool $requested_hierarchy = false;
62  protected int $requested_root_id = 0;
63  protected int $requested_glo_id = 0;
64  protected int $requested_glo_ref_id = 0;
65  protected string $requested_lang_switch_mode = "";
66  protected int $requested_active_node = 0;
67  protected int $requested_lmexpand = 0;
68  protected int $requested_link_ref_id = 0;
69  protected string $requested_totransl = "";
70  protected bool $requested_lmmovecopy = false;
73  protected \ILIAS\Style\Content\Service $content_style_service;
74 
75  protected ilLMTree $lm_tree;
76 
84  public function __construct(
85  $a_data,
86  int $a_id = 0,
87  bool $a_call_by_reference = true,
88  bool $a_prepare_output = false
89  ) {
90  global $DIC;
91 
92  $this->lng = $DIC->language();
93  $this->access = $DIC->access();
94  $this->tabs = $DIC->tabs();
95  $this->settings = $DIC->settings();
96  $this->user = $DIC->user();
97  $this->tpl = $DIC["tpl"];
98  $this->toolbar = $DIC->toolbar();
99  $this->rbacsystem = $DIC->rbac()->system();
100  $this->tree = $DIC->repositoryTree();
101  $this->help = $DIC["ilHelp"];
102  $this->locator = $DIC["ilLocator"];
103  $this->db = $DIC->database();
104  $this->log = $DIC["ilLog"];
105  $this->ui = $DIC->ui();
106  $lng = $DIC->language();
107  $ilCtrl = $DIC->ctrl();
108  $this->ctrl = $ilCtrl;
109  $this->component_repository = $DIC["component.repository"];
110  $lng->loadLanguageModule("content");
111  $lng->loadLanguageModule("obj");
112  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
113 
114  $this->edit_request = $DIC
115  ->learningModule()
116  ->internal()
117  ->gui()
118  ->editing()
119  ->request();
120 
122  $this->to_props = $req->getToProps();
123  $this->requested_obj_id = $req->getObjId();
124  $this->requested_ref_id = $req->getRefId();
125  $this->requested_root_id = $req->getRootId();
126  $this->requested_glo_id = $req->getGlossaryId();
127  $this->requested_glo_ref_id = $req->getGlossaryRefId();
128  $this->requested_menu_entry = $req->getMenuEntry();
129  $this->requested_lm_menu_expand = $req->getLMMenuExpand();
130  $this->requested_search_root_expand = $req->getSearchRootExpand();
131  $this->requested_new_type = $req->getNewType();
132  $this->requested_baseClass = $req->getBaseClass();
133  $this->requested_transl = $req->getTranslation();
134  $this->requested_backcmd = $req->getBackCmd();
135  $this->requested_hierarchy = $req->getHierarchy();
136  $this->lang_switch_mode = $req->getLangSwitchMode();
137  $this->requested_active_node = $req->getActiveNode();
138  $this->requested_lmexpand = $req->getLMExpand();
139  $this->requested_link_ref_id = $req->getLinkRefId();
140  $this->requested_totransl = $req->getToTranslation();
141  $this->requested_lmmovecopy = $req->getLMMoveCopy();
142  $this->content_style_service = $DIC
143  ->contentStyle();
144 
145  $id = (isset($this->object))
146  ? $this->object->getId()
147  : 0;
148  $this->reading_time_gui = new \ILIAS\LearningModule\ReadingTime\SettingsGUI($id);
149  $this->domain = $DIC->learningModule()->internal()->domain();
150  $this->gui = $DIC->learningModule()->internal()->gui();
151  }
152 
153  protected function checkCtrlPath(): void
154  {
155  if (!$this->getCreationMode()) {
156  $baseclass = strtolower($this->requested_baseClass);
157  $next_class = strtolower($this->ctrl->getNextClass());
158  // all calls must be routed through illmpresentationgui or
159  // illmeditorgui...
160  if (!in_array($baseclass, ["illmpresentationgui", "illmeditorgui"])) {
161  // ...except the comman action handler routes to
162  // activation/condition GUI, see https://mantis.ilias.de/view.php?id=32858
163  if (in_array($next_class, ["ilcommonactiondispatchergui"])) {
164  return;
165  }
166  throw new ilLMException("Wrong ctrl path");
167  }
168  }
169  }
170 
175  public function executeCommand(): void
176  {
177  $ilAccess = $this->access;
178  $lng = $this->lng;
179  $ilTabs = $this->tabs;
180  $ilCtrl = $this->ctrl;
181 
182  $this->checkCtrlPath();
183 
184  if ($this->ctrl->getRedirectSource() == "ilinternallinkgui") {
185  throw new ilLMException("No Explorer found.");
186  //$this->explorer();
187  //return "";
188  }
189 
190  if ($this->ctrl->getCmdClass() == "ilinternallinkgui") {
191  $this->ctrl->setReturn($this, "explorer");
192  }
193 
194  // get next class that processes or forwards current command
195  $next_class = $this->ctrl->getNextClass($this);
196 
197  // get current command
198  if ($this->to_props) {
199  $cmd = $this->ctrl->getCmd("properties");
200  } else {
201  $cmd = $this->ctrl->getCmd("chapters");
202  }
203 
204  switch ($next_class) {
205  case 'illtiproviderobjectsettinggui':
206 
207  $this->setTabs();
208  $ilTabs->setTabActive("settings");
209  $this->setSubTabs("lti_provider");
210 
211  $lti_gui = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
212  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->lm->getRefId()));
213  $lti_gui->offerLTIRolesForSelection(true);
214  $this->ctrl->forwardCommand($lti_gui);
215  break;
216 
217 
218 
219  case "illearningprogressgui":
220  $this->addHeaderAction();
221  $this->addLocations();
222  $this->setTabs("learning_progress");
223 
224  $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->lm->getRefId());
225  $this->ctrl->forwardCommand($new_gui);
226 
227  break;
228 
229  case 'ilobjectmetadatagui':
230  if (!$ilAccess->checkAccess('write', '', $this->lm->getRefId())) {
231  throw new ilPermissionException($this->lng->txt('permission_denied'));
232  }
233 
234  $this->addHeaderAction();
235  $this->addLocations();
236  $this->setTabs("meta");
237 
238  $md_gui = new ilObjectMetaDataGUI($this->lm);
239  $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'Educational'); // #9510
240  $md_gui->addMDObserver($this->lm, 'MDUpdateListener', 'General');
241  $this->ctrl->forwardCommand($md_gui);
242  break;
243 
244  case "ilobjectcontentstylesettingsgui":
245  $this->checkPermission("write");
246  $this->addHeaderAction();
247  $this->setTitleAndDescription();
248  $this->addLocations();
249  $this->setTabs("settings");
250  $this->setSubTabs("cont_style");
251 
252  $settings_gui = $this->content_style_service
253  ->gui()
254  ->objectSettingsGUIForRefId(
255  null,
256  $this->object->getRefId()
257  );
258  $this->ctrl->forwardCommand($settings_gui);
259  break;
260 
261 
262  case "illmpageobjectgui":
263  $this->setTitleAndDescription();
264  $ilTabs->setBackTarget(
265  $lng->txt("learning module"),
266  $ilCtrl->getLinkTarget($this, "chapters")
267  );
268  $this->ctrl->saveParameter($this, array("obj_id"));
269  $this->addLocations();
270  $this->ctrl->setReturn($this, "chapters");
271 
272  $pg_gui = new ilLMPageObjectGUI($this->lm);
273  if ($this->requested_obj_id > 0) {
275  $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
276  $pg_gui->setLMPageObject($obj);
277  }
278  $this->ctrl->forwardCommand($pg_gui);
279  break;
280 
281  case "ilstructureobjectgui":
282  $ilTabs->setBackTarget(
283  $lng->txt("learning module"),
284  $ilCtrl->getLinkTarget($this, "chapters")
285  );
286 
287  $this->ctrl->saveParameter($this, array("obj_id"));
288  $this->addLocations();
289  $this->ctrl->setReturn($this, "chapters");
290  $st_gui = new ilStructureObjectGUI($this->lm, $this->lm->lm_tree);
291  if ($this->requested_obj_id > 0) {
293  $obj = ilLMObjectFactory::getInstance($this->lm, $this->requested_obj_id);
294  $st_gui->setStructureObject($obj);
295  }
296  $this->ctrl->forwardCommand($st_gui);
297  if ($cmd == "save" || $cmd == "cancel") {
298  if ($this->requested_obj_id == 0) {
299  $this->ctrl->redirect($this, "chapters");
300  } else {
301  // $this->ctrl->setCmd("subchap");
302  $this->executeCommand();
303  }
304  }
305  break;
306 
307  case 'ilpermissiongui':
308  if (strtolower($this->requested_baseClass) == "iladministrationgui") {
309  $this->prepareOutput();
310  } else {
311  $this->addHeaderAction();
312  $this->addLocations(true);
313  $this->setTabs("perm");
314  }
315  $perm_gui = new ilPermissionGUI($this);
316  $this->ctrl->forwardCommand($perm_gui);
317  break;
318 
319  // infoscreen
320  case 'ilinfoscreengui':
321  if (!$this->object->isInfoEnabled()) {
322  return;
323  }
324  $this->addHeaderAction();
325  $this->addLocations(true);
326  $this->setTabs("info");
327  $info = new ilInfoScreenGUI($this);
328  $info->enablePrivateNotes();
329  $info->enableLearningProgress();
330  $info->enableNews();
331  if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
332  $info->enableNewsEditing();
333  $info->setBlockProperty("news", "settings", true);
334  }
335 
336  // show standard meta data section
337  $info->addMetaDataSections(
338  $this->lm->getId(),
339  0,
340  $this->lm->getType()
341  );
342 
343  $this->ctrl->forwardCommand($info);
344  break;
345 
346  case "ilexportgui":
347  switch ($cmd) {
348  case "doExportXML":
349  case "doExportHTML":
350  case "showExportOptionsXML":
351  case "showExportOptionsHTML":
352  $this->$cmd();
353  break;
354  default:
355  // it is important to reset the "transl" parameter here
356  // otherwise it will effect the HTML export and overwrite the selected language
357  $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "transl", "");
358  $this->ctrl->setParameterByClass(ilLMEditorGUI::class, "transl", "");
359  $exp_gui = new ilExportGUI($this);
360  $this->ctrl->forwardCommand($exp_gui);
361  $this->addHeaderAction();
362  $this->addLocations(true);
363  $this->setTabs("export");
364  }
365  break;
366 
367  case 'ilobjecttranslationgui':
368  $this->addHeaderAction();
369  $this->addLocations(true);
370  $this->setTabs("settings");
371  $this->setSubTabs("obj_multilinguality");
372  $transgui = new ilObjectTranslationGUI($this);
373  $transgui->setTitleDescrOnlyMode(false);
374  $this->ctrl->forwardCommand($transgui);
375  break;
376 
377 
378  case "ilcommonactiondispatchergui":
380  $this->prepareOutput();
381  $this->ctrl->forwardCommand($gui);
382  break;
383 
384  case 'ilobjectcopygui':
385  $this->prepareOutput();
386  $cp = new ilObjectCopyGUI($this);
387  $cp->setType('lm');
388  $this->ctrl->forwardCommand($cp);
389  break;
390 
391  case "ilmobmultisrtuploadgui":
392  $this->addHeaderAction();
393  $this->addLocations(true);
394  $this->setTabs("content");
395  $this->setContentSubTabs("srt_files");
396  $gui = new ilMobMultiSrtUploadGUI(new ilLMMultiSrt($this->lm));
397  $this->ctrl->forwardCommand($gui);
398  break;
399 
400  case "illmimportgui":
401  $this->addHeaderAction();
402  $this->addLocations(true);
403  $this->setTabs("content");
404  $this->setContentSubTabs("import");
405  $gui = new ilLMImportGUI($this->lm);
406  $this->ctrl->forwardCommand($gui);
407  break;
408 
409  case "illmeditshorttitlesgui":
410  $this->addHeaderAction();
411  $this->addLocations(true);
412  $this->setTabs("content");
413  $this->setContentSubTabs("short_titles");
415  $lm_gui = $this;
416  $gui = new ilLMEditShortTitlesGUI(
417  $lm_gui,
418  $this->edit_request->getTranslation()
419  );
420  $this->ctrl->forwardCommand($gui);
421  break;
422 
423  case strtolower(EditSubObjectsGUI::class):
424  $this->addHeaderAction();
425  $this->addLocations(true);
426  $this->setTabs("content");
427  if ($this->edit_request->getSubType() === "pg") {
428  $this->setContentSubTabs("sub_pages");
429  } else {
430  $this->setContentSubTabs("sub_chapters");
431  }
432 
433  $gui = $this->gui->editing()->editSubObjectsGUI(
434  $this->edit_request->getSubType(),
435  $this->lm,
436  $this->lng->txt("cont_chapters")
437  );
438  $this->ctrl->forwardCommand($gui);
439  break;
440 
441  default:
442  $new_type = $this->requested_new_type;
443 
444  if ($cmd == "create" &&
445  !in_array($new_type, array("lm"))) {
446  switch ($new_type) {
447  case "pg":
448  $this->ctrl->redirectByClass(ilLMPageObjectGUI::class, $this->ctrl->getCmd());
449  break;
450 
451  case "st":
452  $this->ctrl->redirectByClass(ilStructureObjectGUI::class, $this->ctrl->getCmd());
453  break;
454  }
455  } else {
456  // creation of new dbk/lm in repository
457  if ($this->getCreationMode() === true &&
458  $new_type === "lm") {
459  $this->prepareOutput();
460  if ($cmd == "") { // this may be due to too big upload files
461  $cmd = "create";
462  }
463  $cmd .= "Object";
464  } else {
465  $this->addHeaderAction();
466  $this->addLocations();
467  }
468  $this->$cmd();
469  }
470  break;
471  }
472  }
473 
474  protected function buildExportOptionsFormHTML(): ILIAS\UI\Component\Input\Container\Form\Standard
475  {
476  $this->lng->loadLanguageModule('exp');
477  $ot = ilObjectTranslation::getInstance($this->lm->getId());
478  $items = [];
479  if ($ot->getContentActivated()) {
480  $this->lng->loadLanguageModule("meta");
481  $langs = $ot->getLanguages();
482  foreach ($langs as $l => $ldata) {
483  $items["html_" . $l] = $this->lng->txt("meta_l_" . $l);
484  }
485  $items["html_all"] = $this->lng->txt("cont_all_languages");
486  }
487  if (!$ot->getContentActivated()) {
488  $items["exportHTML"] = "HTML";
489  }
490  $select = $this->ui->factory()->input()->field()->select($this->lng->txt("language"), $items)
491  ->withRequired(true);
492  $section = $this->ui->factory()->input()->field()->section(
493  [$select],
494  $this->lng->txt("export_options")
495  );
496  return $this->ui->factory()->input()->container()->form()->standard(
497  $this->ctrl->getLinkTargetByClass(ilObjContentObjectGUI::class, "doExportHTML"),
498  [$section]
499  )->withSubmitLabel($this->lng->txt("export"));
500  }
501 
502  protected function buildExportOptionsFormXML(): ILIAS\UI\Component\Input\Container\Form\Standard
503  {
504  $this->lng->loadLanguageModule('exp');
505  $ot = ilObjectTranslation::getInstance($this->lm->getId());
506  $items = [];
507  if ($ot->getContentActivated()) {
508  $items["xml_master"] = $this->lng->txt("cont_master_language_only");
509  $items["xml_masternomedia"] = $this->lng->txt("cont_master_language_only_no_media");
510  $this->lng->loadLanguageModule("meta");
511  $langs = $ot->getLanguages();
512  }
513  $select = $this->ui->factory()->input()->field()->select($this->lng->txt("export_type"), $items)
514  ->withRequired(true);
515  $section = $this->ui->factory()->input()->field()->section(
516  [$select],
517  $this->lng->txt("export_options")
518  );
519  return $this->ui->factory()->input()->container()->form()->standard(
520  $this->ctrl->getLinkTargetByClass(ilObjContentObjectGUI::class, "doExportXML"),
521  [$section]
522  )->withSubmitLabel($this->lng->txt("export"));
523  }
524 
525  protected function showExportOptionsXML(): void
526  {
527  $this->addHeaderAction();
528  $this->addLocations(true);
529  $this->setTabs("export");
530  $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($this->buildExportOptionsFormXML()));
531  }
532 
533  protected function showExportOptionsHTML(): void
534  {
535  $ot = ilObjectTranslation::getInstance($this->lm->getId());
536  if ($ot->getContentActivated()) {
537  $this->addHeaderAction();
538  $this->addLocations(true);
539  $this->setTabs("export");
540  $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($this->buildExportOptionsFormHTML()));
541  }
542  if (!$ot->getContentActivated()) {
543  $this->doExportHTML();
544  }
545  }
546 
547  protected function doExportXML(): void
548  {
549  $form = $this->buildExportOptionsFormXML()->withRequest($this->request);
550  $format = "";
551  if (!is_null($form->getData())) {
552  $format = explode("_", $form->getData()[0][0]);
553  }
554  if (is_null($form->getData())) {
555  $this->addHeaderAction();
556  $this->addLocations(true);
557  $this->setTabs("export");
558  $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($form));
559  return;
560  }
561  $opt = ilUtil::stripSlashes($format[1]);
562  $cont_exp = new ilContObjectExport($this->lm);
563  $cont_exp->buildExportFile($opt);
564  $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
565  }
566 
567  protected function doExportHTML(): void
568  {
569  $ot = ilObjectTranslation::getInstance($this->lm->getId());
570  $form = $this->buildExportOptionsFormHTML()->withRequest($this->request);
571  $lang = "";
572  if ($ot->getContentActivated() and !is_null($form->getData())) {
573  $format = explode("_", $form->getData()[0][0]);
574  $lang = ilUtil::stripSlashes($format[1]);
575  }
576  if ($ot->getContentActivated() and is_null($form->getData())) {
577  $this->addHeaderAction();
578  $this->addLocations(true);
579  $this->setTabs("export");
580  $this->ui->mainTemplate()->setContent($this->ui->renderer()->render($form));
581  return;
582  }
583  $cont_exp = new ilContObjectExport($this->lm, "html", $lang);
584  $cont_exp->buildExportFile();
585  $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
586  }
587 
591  public function properties(): void
592  {
593  $lng = $this->lng;
594 
595  $lng->loadLanguageModule("style");
596  $this->setTabs("settings");
597  $this->setSubTabs("settings");
598 
599  // lm properties
600  $this->initPropertiesForm();
601  $this->getPropertiesFormValues();
602 
603  // Edit ecs export settings
604  $ecs = new ilECSLearningModuleSettings($this->lm);
605  $ecs->addSettingsToForm($this->form, 'lm');
606 
607  $this->tpl->setContent($this->form->getHTML());
608  }
609 
613  public function initPropertiesForm(): void
614  {
615  $obj_service = $this->object_service;
616 
617  $ilCtrl = $this->ctrl;
618  $lng = $this->lng;
620 
621  $this->form = new ilPropertyFormGUI();
622 
623  // title
624  $ti = new ilTextInputGUI($lng->txt("title"), "title");
625  $ti->setRequired(true);
626  $this->form->addItem($ti);
627 
628  // description
629  $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
630  $this->form->addItem($ta);
631 
632  $lng->loadLanguageModule("rep");
633  $section = new ilFormSectionHeaderGUI();
634  $section->setTitle($this->lng->txt('rep_activation_availability'));
635  $this->form->addItem($section);
636 
637  // online
638  $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
639  $this->form->addItem($online);
640 
641  // presentation
642  $section = new ilFormSectionHeaderGUI();
643  $section->setTitle($this->lng->txt('cont_presentation'));
644  $this->form->addItem($section);
645 
646  // tile image
647  $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->addTileImage();
648 
649  // page header
650  $page_header = new ilSelectInputGUI($lng->txt("cont_page_header"), "lm_pg_header");
651  $option = array("st_title" => $this->lng->txt("cont_st_title"),
652  "pg_title" => $this->lng->txt("cont_pg_title"),
653  "none" => $this->lng->txt("cont_none"));
654  $page_header->setOptions($option);
655  $this->form->addItem($page_header);
656 
657  // chapter numeration
658  $chap_num = new ilCheckboxInputGUI($lng->txt("cont_act_number"), "cobj_act_number");
659  $this->form->addItem($chap_num);
660 
661  // toc mode
662  $toc_mode = new ilSelectInputGUI($lng->txt("cont_toc_mode"), "toc_mode");
663  $option = array("chapters" => $this->lng->txt("cont_chapters_only"),
664  "pages" => $this->lng->txt("cont_chapters_and_pages"));
665  $toc_mode->setOptions($option);
666  $this->form->addItem($toc_mode);
667 
668  // show progress icons
669  $progr_icons = new ilCheckboxInputGUI($lng->txt("cont_progress_icons"), "progr_icons");
670  $progr_icons->setInfo($this->lng->txt("cont_progress_icons_info"));
671  $this->form->addItem($progr_icons);
672 
673  $this->reading_time_gui->addSettingToForm($this->form);
674 
675  // self assessment
676  $section = new ilFormSectionHeaderGUI();
677  $section->setTitle($this->lng->txt('cont_self_assessment'));
678  $this->form->addItem($section);
679 
680  // tries
681  $radg = new ilRadioGroupInputGUI($lng->txt("cont_tries"), "store_tries");
682  $radg->setValue("0");
683  $op1 = new ilRadioOption($lng->txt("cont_tries_reset_on_visit"), "0", $lng->txt("cont_tries_reset_on_visit_info"));
684  $radg->addOption($op1);
685  $op2 = new ilRadioOption($lng->txt("cont_tries_store"), "1", $lng->txt("cont_tries_store_info"));
686  $radg->addOption($op2);
687  $this->form->addItem($radg);
688 
689  // restrict forward navigation
690  $qfeed = new ilCheckboxInputGUI($lng->txt("cont_restrict_forw_nav"), "restrict_forw_nav");
691  $qfeed->setInfo($this->lng->txt("cont_restrict_forw_nav_info"));
692  $this->form->addItem($qfeed);
693 
694  // notification
695  $not = new ilCheckboxInputGUI($lng->txt("cont_notify_on_blocked_users"), "notification_blocked_users");
696  $not->setInfo($this->lng->txt("cont_notify_on_blocked_users_info"));
697  $qfeed->addSubItem($not);
698 
699  // disable default feedback for questions
700  $qfeed = new ilCheckboxInputGUI($lng->txt("cont_disable_def_feedback"), "disable_def_feedback");
701  $qfeed->setInfo($this->lng->txt("cont_disable_def_feedback_info"));
702  $this->form->addItem($qfeed);
703 
704  // additional features
705  $section = new ilFormSectionHeaderGUI();
706  $section->setTitle($this->lng->txt('obj_features'));
707  $this->form->addItem($section);
708 
709  // public notes
710  if (!$ilSetting->get('disable_comments')) {
711  $this->lng->loadLanguageModule("notes");
712  $pub_nodes = new ilCheckboxInputGUI($lng->txt("notes_comments"), "cobj_pub_notes");
713  $pub_nodes->setInfo($this->lng->txt("cont_lm_comments_desc"));
714  $this->form->addItem($pub_nodes);
715  }
716 
717  // rating
718  $this->lng->loadLanguageModule('rating');
719  $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
720  $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
721  $this->form->addItem($rate);
722  $ratep = new ilCheckboxInputGUI($this->lng->txt('lm_activate_rating'), 'rating_pages');
723  $this->form->addItem($ratep);
724 
725  $this->form->setTitle($lng->txt("cont_lm_properties"));
726  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
727  $this->form->setFormAction($ilCtrl->getFormAction($this));
728 
730  $this->object->getId(),
731  $this->form,
732  [
734  ]
735  );
736  }
737 
741  public function getPropertiesFormValues(): void
742  {
743  $ilUser = $this->user;
744 
745  $values = array();
746 
747  $title = $this->lm->getTitle();
748  $description = $this->lm->getLongDescription();
749  $ot = ilObjectTranslation::getInstance($this->lm->getId());
750  if ($ot->getContentActivated()) {
751  $title = $ot->getDefaultTitle();
752  $description = $ot->getDefaultDescription();
753  }
754 
755  $values["title"] = $title;
756  $values["description"] = $description;
757  if (!$this->lm->getOfflineStatus()) {
758  $values["cobj_online"] = true;
759  }
760  //$values["lm_layout"] = $this->lm->getLayout();
761  $values["lm_pg_header"] = $this->lm->getPageHeader();
762  if ($this->lm->isActiveNumbering()) {
763  $values["cobj_act_number"] = true;
764  }
765  $values["toc_mode"] = $this->lm->getTOCMode();
766  if ($this->lm->publicNotes()) {
767  $values["cobj_pub_notes"] = true;
768  }
769  if ($this->lm->cleanFrames()) {
770  $values["cobj_clean_frames"] = true;
771  }
772  //$values["layout_per_page"] = $this->lm->getLayoutPerPage();
773  $values["rating"] = $this->lm->hasRating();
774  $values["rating_pages"] = $this->lm->hasRatingPages();
775  $values["disable_def_feedback"] = $this->lm->getDisableDefaultFeedback();
776  $values["progr_icons"] = $this->lm->getProgressIcons();
777  $values["store_tries"] = (string) (int) $this->lm->getStoreTries();
778  $values["restrict_forw_nav"] = $this->lm->getRestrictForwardNavigation();
779 
780  $values["notification_blocked_users"] = ilNotification::hasNotification(
782  $ilUser->getId(),
783  $this->lm->getId()
784  );
785 
786  $values["cont_show_info_tab"] = $this->object->isInfoEnabled();
787  $this->form->setValuesByArray($values, true);
788  }
789 
793  public function saveProperties(): void
794  {
795  $lng = $this->lng;
796  $ilUser = $this->user;
798  $obj_service = $this->object_service;
799 
800  $add_info = "";
801 
802  $valid = false;
803  $this->initPropertiesForm();
804  $form = $this->form;
805  if ($form->checkInput()) {
806  $ot = ilObjectTranslation::getInstance($this->lm->getId());
807  if ($ot->getContentActivated()) {
808  $ot->setDefaultTitle($form->getInput('title'));
809  $ot->setDefaultDescription($form->getInput('description'));
810  $ot->save();
811  }
812 
813  $this->lm->setTitle($form->getInput('title'));
814  $this->lm->setDescription($form->getInput('description'));
815  $this->lm->setPageHeader($form->getInput("lm_pg_header"));
816  $this->lm->setTOCMode($form->getInput("toc_mode"));
817  $this->lm->setOfflineStatus(!($form->getInput('cobj_online')));
818  $this->lm->setActiveNumbering((bool) $form->getInput("cobj_act_number"));
819  $this->lm->setCleanFrames((bool) $form->getInput("cobj_clean_frames"));
820  if (!$ilSetting->get('disable_comments')) {
821  $this->lm->setPublicNotes($form->getInput("cobj_pub_notes"));
822  }
823  $this->lm->setRating((bool) $form->getInput("rating"));
824  $this->lm->setRatingPages((bool) $form->getInput("rating_pages"));
825  $this->lm->setDisableDefaultFeedback((int) $form->getInput("disable_def_feedback"));
826  $this->lm->setProgressIcons((int) $form->getInput("progr_icons"));
827  $this->reading_time_gui->saveSettingFromForm($this->form);
828 
829  $add_info = "";
830  $store_tries = $form->getInput("store_tries");
831  if ($form->getInput("restrict_forw_nav") && !$form->getInput("store_tries")) {
832  $store_tries = 1;
833  $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
834  $add_info = str_replace("$1", $lng->txt("cont_tries_store"), $add_info);
835  $add_info = str_replace("$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
836  }
837 
838  $this->lm->setStoreTries((int) $store_tries);
839  $this->lm->setRestrictForwardNavigation((int) $form->getInput("restrict_forw_nav"));
840  $this->lm->updateProperties();
841  $this->lm->update();
842 
843  // tile image
844  $obj_service->commonSettings()->legacyForm($this->form, $this->lm)->saveTileImage();
845 
848  $ilUser->getId(),
849  $this->lm->getId(),
850  (bool) $this->form->getInput("notification_blocked_users")
851  );
852 
853  // services
855  $this->object->getId(),
856  $this->form,
857  array(
859  )
860  );
861 
862 
863  // Update ecs export settings
864  $ecs = new ilECSLearningModuleSettings($this->lm);
865  if ($ecs->handleSettingsUpdate($form)) {
866  $valid = true;
867  }
868  }
869 
870  if ($valid) {
871  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified") . $add_info, true);
872  $this->ctrl->redirect($this, "properties");
873  } else {
874  $lng->loadLanguageModule("style");
875  $this->setTabs("settings");
876  $this->setSubTabs("cont_general_properties");
877 
878  $this->form->setValuesByPost();
879  $this->tpl->setContent($this->form->getHTML());
880  }
881  }
882 
883  public function initMenuForm(): ilPropertyFormGUI
884  {
885  $lng = $this->lng;
886  $ilCtrl = $this->ctrl;
887 
888  $form = new ilPropertyFormGUI();
889 
890  // enable menu
891  $menu = new ilCheckboxInputGUI($this->lng->txt("cont_active"), "cobj_act_lm_menu");
892  $menu->setChecked($this->lm->isActiveLMMenu());
893  $form->addItem($menu);
894 
895  // toc
896  /*
897  $toc = new ilCheckboxInputGUI($this->lng->txt("cont_toc"), "cobj_act_toc");
898 
899  $toc->setChecked($this->lm->isActiveTOC());
900  $form->addItem($toc);*/
901 
902  // print view
903  $print = new ilCheckboxInputGUI($this->lng->txt("cont_print_view"), "cobj_act_print");
904  $print->setChecked($this->lm->isActivePrintView());
905  $form->addItem($print);
906 
907  // prevent glossary appendix
908  $glo = new ilCheckboxInputGUI($this->lng->txt("cont_print_view_pre_glo"), "cobj_act_print_prev_glo");
909  $glo->setChecked($this->lm->isActivePreventGlossaryAppendix());
910  $print->addSubItem($glo);
911 
912  // hide header and footer in print view
913  $hhfp = new ilCheckboxInputGUI($this->lng->txt("cont_hide_head_foot_print"), "hide_head_foot_print");
914  $hhfp->setChecked($this->lm->getHideHeaderFooterPrint());
915  $print->addSubItem($hhfp);
916 
917  $form->addCommandButton("saveMenuProperties", $lng->txt("save"));
918 
919  $form->setTitle($lng->txt("cont_lm_menu"));
920  $form->setFormAction($ilCtrl->getFormAction($this));
921 
922  return $form;
923  }
924 
925  public function editMenuProperties(): void
926  {
927  $lng = $this->lng;
928  $ilTabs = $this->tabs;
929  $ilCtrl = $this->ctrl;
930  $tpl = $this->tpl;
931  $ilToolbar = $this->toolbar;
932 
933  $lng->loadLanguageModule("style");
934  $this->setTabs();
935  $ilTabs->setTabActive("settings");
936  $this->setSubTabs("cont_lm_menu");
937 
938  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
939  $ilToolbar->addFormButton($this->lng->txt("add_menu_entry"), "addMenuEntry");
940  $ilToolbar->setCloseFormTag(false);
941 
942  $form = $this->initMenuForm();
943  $form->setOpenTag(false);
944  $form->setCloseTag(false);
945 
946  $this->__initLMMenuEditor();
947  $entries = $this->lmme_obj->getMenuEntries();
948  $table = new ilLMMenuItemsTableGUI($this, "editMenuProperties", $this->lmme_obj);
949  $table->setOpenFormTag(false);
950 
951  $tpl->setContent($form->getHTML() . "<br />" . $table->getHTML());
952  }
953 
954  public function saveMenuProperties(): void
955  {
956  $form = $this->initMenuForm();
957  if ($form->checkInput()) {
958  $this->lm->setActiveLMMenu((int) $form->getInput("cobj_act_lm_menu"));
959  //$this->lm->setActiveTOC((int) $form->getInput("cobj_act_toc"));
960  $this->lm->setActivePrintView((int) $form->getInput("cobj_act_print"));
961  $this->lm->setActivePreventGlossaryAppendix((int) $form->getInput("cobj_act_print_prev_glo"));
962  $this->lm->setHideHeaderFooterPrint((int) $form->getInput("hide_head_foot_print"));
963  $this->lm->updateProperties();
964  }
965 
966  $this->__initLMMenuEditor();
967  $this->lmme_obj->updateActiveStatus($this->edit_request->getMenuEntries());
968 
969  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
970  $this->ctrl->redirect($this, "editMenuProperties");
971  }
972 
973  public function proceedDragDrop(): void
974  {
975  $ilCtrl = $this->ctrl;
976 
978  $this->lm->executeDragDrop(
979  $req->getHFormPar("source_id"),
980  $req->getHFormPar("target_id"),
981  $req->getHFormPar("fc"),
982  $req->getHFormPar("as_subitem")
983  );
984  $ilCtrl->redirect($this, "chapters");
985  }
986 
987  protected function afterSave(ilObject $new_object): void
988  {
989  $new_object->setCleanFrames(true);
990  $new_object->update();
991 
992  // create content object tree
993  $new_object->createLMTree();
994 
995  // create a first chapter
996  $new_object->addFirstChapterAndPage();
997 
998  // always send a message
999  $this->tpl->setOnScreenMessage('success', $this->lng->txt($this->type . "_added"), true);
1000  $this->ctrl->setParameterByClass(ilObjLearningModuleGUI::class, "ref_id", $new_object->getRefId());
1001  $this->ctrl->redirectByClass([ilLMEditorGUI::class, ilObjLearningModuleGUI::class], "");
1002  }
1003 
1007  public function delete(int $a_parent_subobj_id = 0): void
1008  {
1009  $ids = $this->edit_request->getIds();
1010 
1011  if (count($ids) == 0) {
1012  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1013  $this->cancelDelete();
1014  }
1015 
1016  if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1017  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"), true);
1018  $this->cancelDelete();
1019  }
1020 
1021  if ($a_parent_subobj_id == 0) {
1022  $this->setTabs("content");
1023  }
1024 
1025  if ($a_parent_subobj_id != 0) {
1026  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "backcmd", $this->requested_backcmd);
1027  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_parent_subobj_id);
1028  $form_action = $this->ctrl->getFormActionByClass("ilStructureObjectGUI");
1029  } else {
1030  $this->ctrl->setParameter($this, "backcmd", $this->requested_backcmd);
1031  $form_action = $this->ctrl->getFormAction($this);
1032  }
1033 
1034  // display confirmation message
1035  $cgui = new ilConfirmationGUI();
1036  $cgui->setFormAction($form_action);
1037  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1038  $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
1039  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
1040 
1041  foreach ($ids as $id) {
1042  if ($id != ilTree::POS_FIRST_NODE) {
1043  $obj = new ilLMObject($this->lm, $id);
1044  $caption = $obj->getTitle();
1045 
1046  $cgui->addItem("id[]", $id, $caption);
1047  }
1048  }
1049 
1050  $this->tpl->setContent($cgui->getHTML());
1051  }
1052 
1053  public function cancelDelete(): void
1054  {
1055  $this->ctrl->redirect($this, $this->requested_backcmd);
1056  }
1057 
1065  public function confirmedDelete(int $a_parent_subobj_id = 0): void
1066  {
1067  $tree = new ilLMTree($this->lm->getId());
1068 
1069  $ids = $this->edit_request->getIds();
1070 
1071  // check number of objects
1072  if (count($ids) == 0) {
1073  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1074  $this->ctrl->redirect($this, "cancelDelete");
1075  }
1076 
1077  // delete all selected objects
1078  foreach ($ids as $id) {
1079  if ($id != ilTree::POS_FIRST_NODE) {
1080  $obj = ilLMObjectFactory::getInstance($this->lm, $id, false);
1081  $node_data = $tree->getNodeData($id);
1082  if (is_object($obj)) {
1083  $obj->setLMId($this->lm->getId());
1084 
1086  $this->lm->getId(),
1087  "delete_" . $obj->getType(),
1088  array(ilLMObject::_lookupTitle($id), $id),
1089  $this->lm->getType()
1090  );
1091 
1092  $obj->delete();
1093  }
1094  if ($tree->isInTree($id)) {
1095  $tree->deleteTree($node_data);
1096  }
1097  }
1098  }
1099 
1100  // check the tree
1101  $this->lm->checkTree();
1102 
1103  // feedback
1104  $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
1105 
1106  if ($a_parent_subobj_id == 0) {
1107  $this->ctrl->redirect($this, $this->requested_backcmd);
1108  }
1109  }
1110 
1111 
1115  public function chapters(): void
1116  {
1117  $this->gui->ctrl()->setParameterByClass(EditSubObjectsGUI::class, "sub_type", "st");
1118  $this->gui->ctrl()->redirectByClass(EditSubObjectsGUI::class);
1119  }
1120 
1121  public static function getMultiLangHeader(
1122  int $a_lm_id,
1123  object $a_gui_class,
1124  string $a_mode = ""
1125  ): string {
1126  global $DIC;
1127 
1128  $lng = $DIC->language();
1129  $ilCtrl = $DIC->ctrl();
1130 
1131  $edit_request = $DIC
1132  ->learningModule()
1133  ->internal()
1134  ->gui()
1135  ->editing()
1136  ->request();
1137 
1138  $ui_renderer = $DIC->ui()->renderer();
1139  $ui_factory = $DIC->ui()->factory();
1140 
1141  $requested_transl = $edit_request->getTranslation();
1142  $requested_totransl = $edit_request->getToTranslation();
1143 
1144  $ml_head = "";
1145 
1146  // multi language
1147  $ot = ilObjectTranslation::getInstance($a_lm_id);
1148  if ($ot->getContentActivated()) {
1149  $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", $a_mode);
1150  $lng->loadLanguageModule("meta");
1151 
1152  // info
1153  $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id);
1154  $ml_head = $ml_gui->getMultiLangInfo($requested_transl);
1155 
1156  $actions = [];
1157 
1158  // language switch
1159  $entries = false;
1160  if (!in_array($requested_transl, array("", "-"))) {
1161  $l = $ot->getMasterLanguage();
1162  $actions[] = $ui_factory->link()->standard(
1163  $lng->txt("cont_edit_language_version") . ": " .
1164  $lng->txt("meta_l_" . $l),
1165  $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")
1166  );
1167  $entries = true;
1168  }
1169 
1170  foreach ($ot->getLanguages() as $al => $lang) {
1171  if ($requested_transl != $al &&
1172  $al != $ot->getMasterLanguage()) {
1173  $ilCtrl->setParameter($a_gui_class, "totransl", $al);
1174  $actions[] = $ui_factory->link()->standard(
1175  $lng->txt("cont_edit_language_version") . ": " .
1176  $lng->txt("meta_l_" . $al),
1177  $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")
1178  );
1179  $ilCtrl->setParameter($a_gui_class, "totransl", $requested_totransl);
1180  }
1181  $entries = true;
1182  }
1183 
1184  if ($entries) {
1185  $dd = $ui_factory->dropdown()->standard($actions)->withLabel($lng->txt("actions"));
1186 
1187  $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $ui_renderer->render($dd) . "</div>";
1188  }
1189  $ilCtrl->setParameter($a_gui_class, "lang_switch_mode", "");
1190  }
1191 
1192  return $ml_head;
1193  }
1194 
1195  public function pages(): void
1196  {
1197  $tpl = $this->tpl;
1198  $ilToolbar = $this->toolbar;
1199  $ilCtrl = $this->ctrl;
1200  $lng = $this->lng;
1201 
1202  $this->setTabs();
1203  $this->setContentSubTabs("pages");
1204 
1205  $ilCtrl->setParameter($this, "backcmd", "pages");
1206  $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "pg");
1207  $ilToolbar->addButton(
1208  $lng->txt("pg_add"),
1209  $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "create")
1210  );
1211  $ilCtrl->setParameterByClass("illmpageobjectgui", "new_type", "");
1212 
1213  $t = new ilLMPagesTableGUI($this, "pages", $this->lm);
1214  $tpl->setContent($t->getHTML());
1215  }
1216 
1220  public function listLinks(): void
1221  {
1222  $tpl = $this->tpl;
1223 
1224  $this->setTabs();
1225  $this->setContentSubTabs("internal_links");
1226 
1227  $table_gui = new ilLinksTableGUI(
1228  $this,
1229  "listLinks",
1230  $this->lm->getId(),
1231  $this->lm->getType()
1232  );
1233 
1234  $tpl->setContent($table_gui->getHTML());
1235  }
1236 
1240  public function showMaintenance(): void
1241  {
1242  $ilToolbar = $this->toolbar;
1243 
1244  $this->setTabs();
1245  $this->setContentSubTabs("maintenance");
1246 
1247  $ilToolbar->addButton(
1248  $this->lng->txt("cont_fix_tree"),
1249  $this->ctrl->getLinkTarget($this, "fixTreeConfirm")
1250  );
1251  }
1252 
1256  public function activatePages(): void
1257  {
1258  $ids = $this->edit_request->getIds();
1259  foreach ($ids as $id) {
1260  $act = ilLMPage::_lookupActive($id, $this->lm->getType());
1261  ilLMPage::_writeActive($id, $this->lm->getType(), !$act);
1262  }
1263 
1264  $this->ctrl->redirect($this, "pages");
1265  }
1266 
1270  public function pastePage(): void
1271  {
1272  if (ilEditClipboard::getContentObjectType() != "pg") {
1273  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_page_in_clipboard"), true);
1274  $this->ctrl->redirect($this, "pages");
1275  }
1276 
1277  // paste selected object
1279 
1280  // copy page, if action is copy
1281  if (ilEditClipboard::getAction() == "copy") {
1282  // check wether page belongs to lm
1284  == $this->lm->getId()) {
1285  $lm_page = new ilLMPageObject($this->lm, $id);
1286  $new_page = $lm_page->copy($this->lm);
1287  $id = $new_page->getId();
1288  } else {
1289  // get page from other content object into current content object
1292  $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1293  $lm_page = new ilLMPageObject($lm_obj, $id);
1294  $copied_nodes = array();
1295  $new_page = $lm_page->copyToOtherContObject($this->lm, $copied_nodes);
1296  $id = $new_page->getId();
1297  ilLMObject::updateInternalLinks($copied_nodes);
1298  }
1299  }
1300 
1301  // cut is not be possible in "all pages" form yet
1302  if (ilEditClipboard::getAction() == "cut") {
1303  // check wether page belongs not to lm
1305  != $this->lm->getId()) {
1308  $lm_obj = ilObjectFactory::getInstanceByObjId($lm_id);
1309  $lm_page = new ilLMPageObject($lm_obj, $id);
1310  $lm_page->setLMId($this->lm->getId());
1311  $lm_page->update();
1312  $page = $lm_page->getPageObject();
1313  $page->buildDom();
1314  $page->setParentId($this->lm->getId());
1315  $page->update();
1316  }
1317  }
1318 
1319 
1321  $this->ctrl->redirect($this, "pages");
1322  }
1323 
1324  public function copyPage(): void
1325  {
1326  $ids = $this->edit_request->getIds();
1327  if (count($ids) == 0) {
1328  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1329  $this->ctrl->redirect($this, "pages");
1330  }
1331 
1332  ilLMObject::clipboardCopy($this->lm->getId(), $ids);
1334 
1335  $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_copied"), true);
1336 
1337  $this->ctrl->redirect($this, "pages");
1338  }
1339 
1340  public function getContextPath(
1341  int $a_endnode_id,
1342  int $a_startnode_id = 1
1343  ): string {
1344  $path = "";
1345 
1346  $tmpPath = $this->lm_tree->getPathFull($a_endnode_id, $a_startnode_id);
1347 
1348  // count -1, to exclude the learning module itself
1349  for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1350  if ($path != "") {
1351  $path .= " > ";
1352  }
1353 
1354  $path .= $tmpPath[$i]["title"];
1355  }
1356 
1357  return $path;
1358  }
1359 
1360  public function showActions(array $a_actions): void
1361  {
1362  $d = null;
1363  foreach ($a_actions as $name => $lng) {
1364  $d[$name] = array("name" => $name, "lng" => $lng);
1365  }
1366 
1367  $notoperations = array();
1368 
1369  $operations = array();
1370 
1371  if (is_array($d)) {
1372  foreach ($d as $row) {
1373  if (!in_array($row["name"], $notoperations)) {
1374  $operations[] = $row;
1375  }
1376  }
1377  }
1378 
1379  if (count($operations) > 0) {
1380  foreach ($operations as $val) {
1381  $this->tpl->setCurrentBlock("operation_btn");
1382  $this->tpl->setVariable("BTN_NAME", $val["name"]);
1383  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
1384  $this->tpl->parseCurrentBlock();
1385  }
1386 
1387  $this->tpl->setCurrentBlock("operation");
1388  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("nav/arrow_downright.svg"));
1389  $this->tpl->parseCurrentBlock();
1390  }
1391  }
1392 
1393  public function view(): void
1394  {
1395  if (strtolower($this->requested_baseClass) == "iladministrationgui") {
1396  $this->prepareOutput();
1397  parent::viewObject();
1398  } else {
1399  $this->viewObject();
1400  }
1401  }
1402 
1403 
1407  public function moveChapter(int $a_parent_subobj_id = 0): void
1408  {
1409  $ids = $this->edit_request->getIds();
1410  if (count($ids) == 0) {
1411  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"));
1412  if ($a_parent_subobj_id == 0) {
1413  $this->ctrl->redirect($this, "chapters");
1414  }
1415  return;
1416  }
1417  if (count($ids) > 1) {
1418  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"));
1419  if ($a_parent_subobj_id == 0) {
1420  $this->ctrl->redirect($this, "chapters");
1421  }
1422  return;
1423  }
1424 
1425  if (count($ids) == 1 && $ids[0] == ilTree::POS_FIRST_NODE) {
1426  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_item"));
1427  if ($a_parent_subobj_id == 0) {
1428  $this->ctrl->redirect($this, "chapters");
1429  }
1430  }
1431 
1432  // SAVE POST VALUES
1433  ilEditClipboard::storeContentObject("st", $ids[0], "move");
1434 
1435  $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_chap_select_target_now"), true);
1436 
1437  if ($a_parent_subobj_id == 0) {
1438  $this->ctrl->redirect($this, "chapters");
1439  }
1440  }
1441 
1442  public function copyChapter(): void
1443  {
1444  $this->copyItems();
1445  }
1446 
1447  public function pasteChapter(): void
1448  {
1449  $this->insertChapterClip();
1450  }
1451 
1452  public function movePage(): void
1453  {
1454  $ids = $this->edit_request->getIds();
1455  if (count($ids) == 0) {
1456  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1457  $this->ctrl->redirect($this, "pages");
1458  }
1459 
1460  $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_selected_items_have_been_cut"), true);
1461 
1462  ilLMObject::clipboardCut($this->lm->getId(), $ids);
1464 
1465  $this->ctrl->redirect($this, "pages");
1466  }
1467 
1468  public function cancel(): void
1469  {
1470  if ($this->requested_new_type == "pg") {
1471  $this->ctrl->redirect($this, "pages");
1472  } else {
1473  $this->ctrl->redirect($this, "chapters");
1474  }
1475  }
1476 
1477  public function export(): void
1478  {
1479  $ot = ilObjectTranslation::getInstance($this->lm->getId());
1480  $opt = "";
1481  if ($ot->getContentActivated()) {
1482  $format = explode("_", $this->edit_request->getFormat());
1483  $opt = ilUtil::stripSlashes($format[1]);
1484  }
1485 
1486 
1487  $cont_exp = new ilContObjectExport($this->lm);
1488  $cont_exp->buildExportFile($opt);
1489  }
1490 
1491  public function fixTreeConfirm(): void
1492  {
1493  $this->setTabs();
1494  $this->setContentSubTabs("maintenance");
1495 
1496  // display confirmation message
1497  $cgui = new ilConfirmationGUI();
1498  $cgui->setFormAction($this->ctrl->getFormAction($this));
1499  $cgui->setHeaderText($this->lng->txt("cont_fix_tree_confirm"));
1500  $cgui->setCancel($this->lng->txt("cancel"), "showMaintenance");
1501  $cgui->setConfirm($this->lng->txt("cont_fix_tree"), "fixTree");
1502  $issues = $this->lm->checkStructure();
1503  $mess = "";
1504  if (count($issues) > 0) {
1505  $mess = "Found Issues: <br>" . implode("<br>", $issues);
1506  }
1507  $this->tpl->setContent($cgui->getHTML() . $mess);
1508  }
1509 
1510  public function fixTree(): void
1511  {
1512  $this->lm->fixTree();
1513  $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_tree_fixed"), true);
1514  $this->ctrl->redirect($this, "showMaintenance");
1515  }
1516 
1517  public function exportHTML(): void
1518  {
1519  $ot = ilObjectTranslation::getInstance($this->lm->getId());
1520  $lang = "";
1521  if ($ot->getContentActivated()) {
1522  $format = explode("_", $this->edit_request->getFormat());
1523  $lang = ilUtil::stripSlashes($format[1]);
1524  }
1525  $cont_exp = new ilContObjectExport($this->lm, "html", $lang);
1526  $cont_exp->buildExportFile();
1527  }
1528 
1533  public function addLocations(
1534  bool $a_omit_obj_id = false
1535  ): void {
1537 
1538  $obj_id = 0;
1539  if (!$a_omit_obj_id) {
1541  }
1542  $lmtree = $this->lm->getTree();
1543  if (($obj_id != 0) && $lmtree->isInTree($obj_id)) {
1544  $path = $lmtree->getPathFull($obj_id);
1545  } else {
1546  $path = $lmtree->getPathFull($lmtree->getRootId());
1547  if ($obj_id != 0) {
1548  $path[] = array("type" => "pg", "child" => $this->obj_id,
1549  "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
1550  }
1551  }
1552 
1553  foreach ($path as $key => $row) {
1554  if ($row["child"] == 1) {
1555  $this->ctrl->setParameter($this, "obj_id", null);
1556  $locator->addItem($this->lm->getTitle(), $this->ctrl->getLinkTarget($this, "chapters"));
1557  } else {
1558  $title = $row["title"];
1559  switch ($row["type"]) {
1560  case "st":
1561  $this->ctrl->setParameterByClass("ilstructureobjectgui", "obj_id", $row["child"]);
1562  $locator->addItem($title, $this->ctrl->getLinkTargetByClass("ilstructureobjectgui", "view"));
1563  break;
1564 
1565  case "pg":
1566  $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $row["child"]);
1567  $locator->addItem($title, $this->ctrl->getLinkTargetByClass("illmpageobjectgui", "edit"));
1568  break;
1569  }
1570  }
1571  }
1572  if (!$a_omit_obj_id) {
1573  $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1574  }
1575  }
1576 
1580 
1581 
1582  public function listQuestions(): void
1583  {
1584  $tpl = $this->tpl;
1585 
1586  $this->setTabs("questions");
1587  $this->setQuestionsSubTabs("question_stats");
1588 
1589  $table = new ilLMQuestionListTableGUI($this, "listQuestions", $this->lm);
1590  $tpl->setContent($table->getHTML());
1591  }
1592 
1593  public function listBlockedUsers(): void
1594  {
1595  $tpl = $this->tpl;
1596 
1597  $this->setTabs("questions");
1598  $this->setQuestionsSubTabs("blocked_users");
1599 
1600  $table = new ilLMBlockedUsersTableGUI($this, "listBlockedUsers", $this->lm);
1601  $tpl->setContent($table->getHTML());
1602  }
1603 
1604  public function resetNumberOfTries(): void
1605  {
1606  $lng = $this->lng;
1607  $ilCtrl = $this->ctrl;
1608 
1609  $user_q_ids = $this->edit_request->getUserQuestionIds();
1610  if (count($user_q_ids) > 0) {
1611  foreach ($user_q_ids as $uqid) {
1612  $uqid = explode(":", $uqid);
1613  ilPageQuestionProcessor::resetTries((int) $uqid[0], (int) $uqid[1]);
1614  }
1615  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1616  }
1617  $ilCtrl->redirect($this, "listBlockedUsers");
1618  }
1619 
1620  public function unlockQuestion(): void
1621  {
1622  $lng = $this->lng;
1623  $ilCtrl = $this->ctrl;
1624 
1625  $user_q_ids = $this->edit_request->getUserQuestionIds();
1626  if (count($user_q_ids) > 0) {
1627  foreach ($user_q_ids as $uqid) {
1628  $uqid = explode(":", $uqid);
1629  ilPageQuestionProcessor::unlock((int) $uqid[0], (int) $uqid[1]);
1630  }
1631  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1632  }
1633  $ilCtrl->redirect($this, "listBlockedUsers");
1634  }
1635 
1636  public function sendMailToBlockedUsers(): void
1637  {
1638  $ilCtrl = $this->ctrl;
1639 
1640  $user_q_ids = $this->edit_request->getUserQuestionIds();
1641  if (count($user_q_ids) == 0) {
1642  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), 1);
1643  $ilCtrl->redirect($this, "listBlockedUsers");
1644  }
1645 
1646  $rcps = array();
1647  foreach ($user_q_ids as $uqid) {
1648  $uqid = explode(":", $uqid);
1649  $login = ilObjUser::_lookupLogin($uqid[1]);
1650  if (!in_array($login, $rcps)) {
1651  $rcps[] = $login;
1652  }
1653  }
1655  $this,
1656  'listBlockedUsers',
1657  array(),
1658  array(
1659  'type' => 'new',
1660  'rcp_to' => implode(',', $rcps),
1661  'sig' => $this->getBlockedUsersMailSignature()
1662  )
1663  ));
1664  }
1665 
1666  protected function getBlockedUsersMailSignature(): string
1667  {
1668  $link = chr(13) . chr(10) . chr(13) . chr(10);
1669  $link .= $this->lng->txt('cont_blocked_users_mail_link');
1670  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1671  $link .= ilLink::_getLink($this->lm->getRefId());
1672  return rawurlencode(base64_encode($link));
1673  }
1674 
1675 
1679 
1680  protected function setTabs(string $a_act = ""): void
1681  {
1682  parent::setTitleAndDescription();
1683  $ilHelp = $this->help;
1684  $ilHelp->setScreenIdComponent("lm");
1685  $this->addTabs($a_act);
1686  }
1687 
1688  public function setContentSubTabs(string $a_active): void
1689  {
1690  $ilTabs = $this->tabs;
1691  $lng = $this->lng;
1692  $ilCtrl = $this->ctrl;
1693 
1694  $lm_set = new ilSetting("lm");
1695 
1696  // chapters
1697  $this->ctrl->setParameterByClass(static::class, "sub_type", "st");
1698  $ilTabs->addSubTab(
1699  "sub_chapters",
1700  $lng->txt("objs_st"),
1701  $this->ctrl->getLinkTargetByClass(EditSubObjectsGUI::class)
1702  );
1703 
1704 
1705  // all pages
1706  $ilTabs->addSubTab(
1707  "pages",
1708  $lng->txt("cont_all_pages"),
1709  $ilCtrl->getLinkTarget($this, "pages")
1710  );
1711 
1712  // all pages
1713  $ilTabs->addSubTab(
1714  "short_titles",
1715  $lng->txt("cont_short_titles"),
1716  $ilCtrl->getLinkTargetByClass("illmeditshorttitlesgui", "")
1717  );
1718 
1719  // export ids
1720  if ($lm_set->get("html_export_ids")) {
1721  if (!ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1722  $ilTabs->addSubTab(
1723  "export_ids",
1724  $lng->txt("cont_html_export_ids"),
1725  $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1726  );
1727  }
1728  }
1729  if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
1730  $lng->loadLanguageModule("help");
1731  $ilTabs->addSubTab(
1732  "export_ids",
1733  $lng->txt("cont_online_help_ids"),
1734  $ilCtrl->getLinkTarget($this, "showExportIDsOverview")
1735  );
1736 
1737  $ilTabs->addSubTab(
1738  "help_tooltips",
1739  $lng->txt("help_tooltips"),
1740  $ilCtrl->getLinkTarget($this, "showTooltipList")
1741  );
1742  }
1743 
1744  // list links
1745  $ilTabs->addSubTab(
1746  "internal_links",
1747  $lng->txt("cont_internal_links"),
1748  $ilCtrl->getLinkTarget($this, "listLinks")
1749  );
1750 
1751  // maintenance
1752  $ilTabs->addSubTab(
1753  "maintenance",
1754  $lng->txt("cont_maintenance"),
1755  $ilCtrl->getLinkTarget($this, "showMaintenance")
1756  );
1757 
1758  // srt files
1759  $ilTabs->addSubTab(
1760  "srt_files",
1761  $lng->txt("cont_subtitle_files"),
1762  $ilCtrl->getLinkTargetByClass("ilmobmultisrtuploadgui", "")
1763  );
1764 
1765  // srt files
1766  $ilTabs->addSubTab(
1767  "import",
1768  $lng->txt("cont_import"),
1769  $ilCtrl->getLinkTargetByClass("illmimportgui", "")
1770  );
1771 
1772  $ilTabs->activateSubTab($a_active);
1773  $ilTabs->activateTab("content");
1774  }
1775 
1776  public function setQuestionsSubTabs(string $a_active): void
1777  {
1778  $ilTabs = $this->tabs;
1779  $lng = $this->lng;
1780  $ilCtrl = $this->ctrl;
1781 
1782  // chapters
1783  $ilTabs->addSubTab(
1784  "question_stats",
1785  $lng->txt("cont_question_stats"),
1786  $ilCtrl->getLinkTarget($this, "listQuestions")
1787  );
1788 
1789  // blocked users
1790  $ilTabs->addSubTab(
1791  "blocked_users",
1792  $lng->txt("cont_blocked_users"),
1793  $ilCtrl->getLinkTarget($this, "listBlockedUsers")
1794  );
1795 
1796  $ilTabs->activateSubTab($a_active);
1797  }
1798 
1799  public function addTabs(string $a_act = ""): void
1800  {
1801  $rbacsystem = $this->rbacsystem;
1802  $ilTabs = $this->tabs;
1803  $lng = $this->lng;
1804 
1805  // content -> pages
1806  $this->ctrl->setParameterByClass(static::class, "sub_type", "st");
1807  $ilTabs->addTab(
1808  "content",
1809  $lng->txt("content"),
1810  $this->ctrl->getLinkTargetByClass(EditSubObjectsGUI::class)
1811  );
1812 
1813  // info
1814  if ($this->object->isInfoEnabled()) {
1815  $ilTabs->addTab(
1816  "info",
1817  $lng->txt("info_short"),
1818  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", 'showSummary')
1819  );
1820  }
1821 
1822  // settings
1823  $ilTabs->addTab(
1824  "settings",
1825  $lng->txt("settings"),
1826  $this->ctrl->getLinkTarget($this, 'properties')
1827  );
1828 
1829  // questions
1830  $ilTabs->addTab(
1831  "questions",
1832  $lng->txt("objs_qst"),
1833  $this->ctrl->getLinkTarget($this, "listQuestions")
1834  );
1835 
1836  // learning progress
1837  if (ilLearningProgressAccess::checkAccess($this->lm->getRefId()) and ($this->lm->getType() == 'lm')) {
1838  $ilTabs->addTab(
1839  'learning_progress',
1840  $lng->txt("learning_progress"),
1841  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), '')
1842  );
1843  }
1844 
1845  // meta data
1846  $mdgui = new ilObjectMetaDataGUI($this->lm);
1847  $mdtab = $mdgui->getTab();
1848  if ($mdtab) {
1849  $ilTabs->addTab(
1850  "meta",
1851  $lng->txt("meta_data"),
1852  $mdtab
1853  );
1854  }
1855 
1856  // export
1857  $ilTabs->addTab(
1858  "export",
1859  $lng->txt("export"),
1860  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1861  );
1862 
1863  // permissions
1864  if ($rbacsystem->checkAccess('edit_permission', $this->lm->getRefId())) {
1865  $ilTabs->addTab(
1866  "perm",
1867  $lng->txt("perm_settings"),
1868  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
1869  );
1870  }
1871 
1872  if ($a_act != "") {
1873  $ilTabs->activateTab($a_act);
1874  }
1875 
1876  // presentation view
1877  $ilTabs->addNonTabbedLink(
1878  "pres_mode",
1879  $lng->txt("cont_presentation_view"),
1880  "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $this->lm->getRefId()
1881  );
1882  }
1883 
1884  public function setSubTabs(string $a_active): void
1885  {
1886  $ilTabs = $this->tabs;
1888 
1889  if (in_array(
1890  $a_active,
1891  array("settings", "cont_style", "cont_lm_menu", "public_section",
1892  "cont_glossaries", "cont_multilinguality", "obj_multilinguality",
1893  "lti_provider")
1894  )) {
1895  // general properties
1896  $ilTabs->addSubTabTarget(
1897  "settings",
1898  $this->ctrl->getLinkTarget($this, 'properties'),
1899  "",
1900  ""
1901  );
1902 
1903  // style properties
1904  $ilTabs->addSubTabTarget(
1905  "cont_style",
1906  $this->ctrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", ""),
1907  "",
1908  "ilObjectContentStyleSettingsGUI"
1909  );
1910 
1911  // menu properties
1912  $ilTabs->addSubTabTarget(
1913  "cont_lm_menu",
1914  $this->ctrl->getLinkTarget($this, 'editMenuProperties'),
1915  "",
1916  ""
1917  );
1918 
1919  // glossaries
1920  $ilTabs->addSubTabTarget(
1921  "cont_glossaries",
1922  $this->ctrl->getLinkTarget($this, 'editGlossaries'),
1923  "",
1924  ""
1925  );
1926 
1927  $ilTabs->addSubTabTarget(
1928  "obj_multilinguality",
1929  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
1930  );
1931 
1932  $lti_settings = new ilLTIProviderObjectSettingGUI($this->lm->getRefId());
1933  if ($lti_settings->hasSettingsAccess()) {
1934  $ilTabs->addSubTabTarget(
1935  'lti_provider',
1936  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1937  );
1938  }
1939 
1940  $ilTabs->setSubTabActive($a_active);
1941  }
1942  }
1943 
1944  public function __initLMMenuEditor(): void
1945  {
1946  $this->lmme_obj = new ilLMMenuEditor();
1947  $this->lmme_obj->setObjId($this->lm->getId());
1948  }
1949 
1953  public function addMenuEntry(?ilPropertyFormGUI $form = null): void
1954  {
1955  $ilTabs = $this->tabs;
1956  $ilToolbar = $this->toolbar;
1957  $ilCtrl = $this->ctrl;
1958 
1959  $this->setTabs();
1960 
1961  $ilTabs->setTabActive("settings");
1962  $this->setSubTabs("cont_lm_menu");
1963 
1964  $ilToolbar->addButton(
1965  $this->lng->txt("lm_menu_select_internal_object"),
1966  $ilCtrl->getLinkTarget($this, "showEntrySelector")
1967  );
1968 
1969  if (is_null($form)) {
1970  $form = $this->initMenuEntryForm("create");
1971  }
1972  $this->tpl->setContent($form->getHTML());
1973  }
1974 
1975  public function initMenuEntryForm(string $a_mode = "edit"): ilPropertyFormGUI
1976  {
1977  $lng = $this->lng;
1978  $ilCtrl = $this->ctrl;
1979 
1980  $form = new ilPropertyFormGUI();
1981 
1982  // title
1983  $ti = new ilTextInputGUI($this->lng->txt("lm_menu_entry_title"), "title");
1984  $ti->setMaxLength(255);
1985  $ti->setSize(40);
1986  $ti->setRequired(true);
1987  $form->addItem($ti);
1988 
1989  // target
1990  $ta = new ilTextInputGUI($this->lng->txt("lm_menu_entry_target"), "target");
1991  $ta->setMaxLength(255);
1992  $ta->setSize(40);
1993  $ta->setRequired(true);
1994  $form->addItem($ta);
1995 
1996  if ($a_mode == "edit") {
1997  $this->__initLMMenuEditor();
1998  $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
1999  $ti->setValue($this->lmme_obj->getTitle());
2000  $ta->setValue($this->lmme_obj->getTarget());
2001  }
2002 
2003  if ($this->requested_link_ref_id > 0) {
2004  $link_ref_id = $this->requested_link_ref_id;
2005  $obj_type = ilObject::_lookupType($link_ref_id, true);
2006  $obj_id = ilObject::_lookupObjectId($link_ref_id);
2007  $title = ilObject::_lookupTitle($obj_id);
2008 
2009  $target_link = $obj_type . "_" . $link_ref_id;
2010  $ti->setValue($title);
2011  $ta->setValue($target_link);
2012 
2013  // link ref id
2014  $hi = new ilHiddenInputGUI("link_ref_id");
2015  $hi->setValue($link_ref_id);
2016  $form->addItem($hi);
2017  }
2018 
2019 
2020  // save and cancel commands
2021  if ($a_mode == "create") {
2022  $form->addCommandButton("saveMenuEntry", $lng->txt("save"));
2023  $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2024  $form->setTitle($lng->txt("lm_menu_new_entry"));
2025  } else {
2026  $form->addCommandButton("updateMenuEntry", $lng->txt("save"));
2027  $form->addCommandButton("editMenuProperties", $lng->txt("cancel"));
2028  $form->setTitle($lng->txt("lm_menu_edit_entry"));
2029  }
2030 
2031  $form->setFormAction($ilCtrl->getFormAction($this));
2032 
2033  return $form;
2034  }
2035 
2036  public function saveMenuEntry(): void
2037  {
2038  $form = $this->initMenuEntryForm("create");
2039  if ($form->checkInput()) {
2040  $this->__initLMMenuEditor();
2041  $this->lmme_obj->setTitle($form->getInput("title"));
2042  $this->lmme_obj->setTarget($form->getInput("target"));
2043  $this->lmme_obj->setLinkRefId((int) $form->getInput("link_ref_id"));
2044 
2045  if ($form->getInput("link_ref_id")) {
2046  $this->lmme_obj->setLinkType("intern");
2047  }
2048 
2049  $this->lmme_obj->create();
2050 
2051  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_added"), true);
2052  $this->ctrl->redirect($this, "editMenuProperties");
2053  } else {
2054  $form->setValuesByPost();
2055  $this->addMenuEntry($form);
2056  }
2057  }
2058 
2059  public function deleteMenuEntry(): void
2060  {
2061  if (empty($this->requested_menu_entry)) {
2062  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2063  $this->ctrl->redirect($this, "editMenuProperties");
2064  }
2065 
2066  $this->__initLMMenuEditor();
2067  $this->lmme_obj->delete($this->requested_menu_entry);
2068 
2069  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_removed"), true);
2070  $this->ctrl->redirect($this, "editMenuProperties");
2071  }
2072 
2073  public function editMenuEntry(?ilPropertyFormGUI $form = null): void
2074  {
2075  $ilToolbar = $this->toolbar;
2076  $ilCtrl = $this->ctrl;
2077  $ilTabs = $this->tabs;
2078 
2079  $this->setTabs();
2080 
2081  $ilTabs->setTabActive("settings");
2082  $this->setSubTabs("cont_lm_menu");
2083 
2084 
2085  if (empty($this->requested_menu_entry)) {
2086  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2087  $this->ctrl->redirect($this, "editMenuProperties");
2088  }
2089 
2090  $ilCtrl->saveParameter($this, array("menu_entry"));
2091  $ilToolbar->addButton(
2092  $this->lng->txt("lm_menu_select_internal_object"),
2093  $ilCtrl->getLinkTarget($this, "showEntrySelector")
2094  );
2095 
2096  if (is_null($form)) {
2097  $form = $this->initMenuEntryForm("edit");
2098  }
2099  $this->tpl->setContent($form->getHTML());
2100  }
2101 
2102  public function updateMenuEntry(): void
2103  {
2104  $form = $this->initMenuEntryForm("edit");
2105  if ($form->checkInput()) {
2106  if ($this->edit_request->getMenuEntry() == "") {
2107  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_menu_entry_id"), true);
2108  $this->ctrl->redirect($this, "editMenuProperties");
2109  }
2110 
2111  $this->__initLMMenuEditor();
2112  $this->lmme_obj->readEntry($this->edit_request->getMenuEntry());
2113  $this->lmme_obj->setTitle($form->getInput("title"));
2114  $this->lmme_obj->setTarget($form->getInput("target"));
2115  if ($form->getInput("link_ref_id")) {
2116  $this->lmme_obj->setLinkType("intern");
2117  }
2118  if (is_int(strpos($form->getInput("target"), "."))) {
2119  $this->lmme_obj->setLinkType("extern");
2120  }
2121  $this->lmme_obj->update();
2122  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_entry_updated"), true);
2123  $this->ctrl->redirect($this, "editMenuProperties");
2124  } else {
2125  $form->setValuesByPost();
2126  $this->editMenuEntry($form);
2127  }
2128  }
2129 
2130  public function showEntrySelector(): void
2131  {
2132  $ilTabs = $this->tabs;
2133  $ilCtrl = $this->ctrl;
2134 
2135  $this->setTabs();
2136 
2137  $ilTabs->setTabActive("settings");
2138  $this->setSubTabs("cont_lm_menu");
2139 
2140  $ilCtrl->saveParameter($this, array("menu_entry"));
2141 
2142  $this->tpl->setOnScreenMessage('info', $this->lng->txt("lm_menu_select_object_to_add"));
2143 
2145  $this,
2146  "showEntrySelector",
2147  $this,
2148  "addMenuEntry",
2149  "link_ref_id"
2150  );
2151  //$exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "glo", "fold"));
2152  $exp->setClickableTypes(array('mcst', 'mep', 'cat', 'lm','glo','frm','exc','tst','svy', 'chat', 'wiki', 'sahs', "crs", "grp", "book", "tst", "file"));
2153  if (!$exp->handleCommand()) {
2154  $this->tpl->setContent($exp->getHTML());
2155  }
2156  }
2157 
2161  public function selectHeader(): void
2162  {
2163  $ids = $this->edit_request->getIds();
2164  if (count($ids) == 0) {
2165  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2166  $this->ctrl->redirect($this, "pages");
2167  }
2168  if (count($ids) > 1) {
2169  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2170  $this->ctrl->redirect($this, "pages");
2171  }
2172  if ($ids[0] != $this->lm->getHeaderPage()) {
2173  $this->lm->setHeaderPage($ids[0]);
2174  } else {
2175  $this->lm->setHeaderPage(0);
2176  }
2177  $this->lm->updateProperties();
2178  $this->ctrl->redirect($this, "pages");
2179  }
2180 
2184  public function selectFooter(): void
2185  {
2186  $ids = $this->edit_request->getIds();
2187  if (count($ids) == 0) {
2188  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
2189  $this->ctrl->redirect($this, "pages");
2190  }
2191  if (count($ids) > 1) {
2192  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
2193  $this->ctrl->redirect($this, "pages");
2194  }
2195  if ($ids[0] != $this->lm->getFooterPage()) {
2196  $this->lm->setFooterPage($ids[0]);
2197  } else {
2198  $this->lm->setFooterPage(0);
2199  }
2200  $this->lm->updateProperties();
2201  $this->ctrl->redirect($this, "pages");
2202  }
2203 
2207  public function saveAllTitles(): void
2208  {
2209  $ilCtrl = $this->ctrl;
2210 
2212  $this->lm,
2213  $this->edit_request->getTitles(),
2215  );
2216 
2217  $this->tpl->setOnScreenMessage('success', $this->lng->txt("lm_save_titles"), true);
2218  $ilCtrl->redirect($this, "chapters");
2219  }
2220 
2221  public static function _goto(string $a_target): void
2222  {
2223  global $DIC;
2224  $main_tpl = $DIC->ui()->mainTemplate();
2225 
2226  $ilAccess = $DIC->access();
2227  $ilErr = $DIC["ilErr"];
2228  $lng = $DIC->language();
2229  $ctrl = $DIC->ctrl();
2230 
2231  if ($ilAccess->checkAccess("read", "", $a_target)) {
2232  $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2233  if (ilObjLearningModuleAccess::_lookupSetting("lm_starting_point") == "first") {
2234  $ctrl->redirectByClass("ilLMPresentationGUI", "");
2235  } else {
2236  $ctrl->redirectByClass("ilLMPresentationGUI", "resume");
2237  }
2238  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
2239  $ctrl->setParameterByClass("ilLMPresentationGUI", "ref_id", $a_target);
2240  $ctrl->redirectByClass("ilLMPresentationGUI", "infoScreen");
2241  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2242  $main_tpl->setOnScreenMessage('failure', sprintf(
2243  $lng->txt("msg_no_perm_read_item"),
2245  ), true);
2247  }
2248 
2249 
2250  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
2251  }
2252 
2253  public function cutItems(array $ids): void
2254  {
2255  $ilCtrl = $this->ctrl;
2256  $lng = $this->lng;
2257 
2258  if (count($ids) == 0) {
2259  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2260  $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2261  }
2262 
2263  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2264  foreach ($ids as $k => $item) {
2265  if ($item < 0) {
2266  $todel[] = $k;
2267  }
2268  }
2269  foreach ($todel as $k) {
2270  unset($ids[$k]);
2271  }
2272  ilLMObject::clipboardCut($this->lm->getId(), $ids);
2274  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_cut"), true);
2275 
2276  $ilCtrl->redirect($this, $this->edit_request->getBackCmd());
2277  }
2278 
2282  public function copyItems(array $ids): void
2283  {
2284  $ilCtrl = $this->ctrl;
2285  $lng = $this->lng;
2286 
2287  if (count($ids) == 0) {
2288  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2289  $ilCtrl->redirect($this, "chapters");
2290  }
2291 
2292  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2293  foreach ($ids as $k => $item) {
2294  if ($item < 0) {
2295  $todel[] = $k;
2296  }
2297  }
2298  foreach ($todel as $k) {
2299  unset($ids[$k]);
2300  }
2301  ilLMObject::clipboardCopy($this->lm->getId(), $ids);
2303  $this->tpl->setOnScreenMessage('info', $lng->txt("cont_selected_items_have_been_copied"), true);
2304  $ilCtrl->redirect($this, "chapters");
2305  }
2306 
2310  public function cutChapter(): void
2311  {
2312  $this->cutItems("chapters");
2313  }
2314 
2318 
2319  public function showExportIDsOverview(bool $a_validation = false): void
2320  {
2321  $tpl = $this->tpl;
2322  $ilToolbar = $this->toolbar;
2323  $lng = $this->lng;
2324  $ilCtrl = $this->ctrl;
2325 
2326  $this->setTabs();
2327  $this->setContentSubTabs("export_ids");
2328 
2329  if (ilObjContentObject::isOnlineHelpModule($this->lm->getRefId())) {
2330  // toolbar
2331  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2332  $lm_tree = $this->lm->getTree();
2333  $childs = $lm_tree->getChilds($lm_tree->readRootId());
2334  $options = array("" => $lng->txt("all"));
2335  foreach ($childs as $c) {
2336  $options[$c["child"]] = $c["title"];
2337  }
2338  $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_chap");
2339  $si->setOptions($options);
2340  $si->setValue(ilSession::get("help_chap"));
2341  $ilToolbar->addInputItem($si, true);
2342  $ilToolbar->addFormButton($lng->txt("help_filter"), "filterHelpChapters");
2343 
2344  $tbl = new ilHelpMappingTableGUI($this, "showExportIDsOverview", $a_validation);
2345  } else {
2346  $tbl = new ilExportIDTableGUI($this, "showExportIDsOverview", $a_validation, false);
2347  }
2348 
2349  $tpl->setContent($tbl->getHTML());
2350  }
2351 
2352  public function filterHelpChapters(): void
2353  {
2354  $ilCtrl = $this->ctrl;
2355  ilSession::set("help_chap", $this->edit_request->getHelpChap());
2356  $ilCtrl->redirect($this, "showExportIDsOverview");
2357  }
2358 
2359  public function saveExportIds(): void
2360  {
2361  $ilCtrl = $this->ctrl;
2362  $lng = $this->lng;
2363 
2364  // check all export ids
2365  $ok = true;
2366  foreach ($this->edit_request->getExportIds() as $exp_id) {
2367  if ($exp_id != "" && !preg_match(
2368  "/^([a-zA-Z]+)[0-9a-zA-Z_]*$/",
2369  trim($exp_id)
2370  )) {
2371  $ok = false;
2372  }
2373  }
2374  if (!$ok) {
2375  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " .
2376  $lng->txt("cont_exp_ids_not_resp_format3") . " " .
2377  $lng->txt("cont_exp_ids_not_resp_format2"));
2378  $this->showExportIDsOverview(true);
2379  return;
2380  }
2381 
2382 
2383  foreach ($this->edit_request->getExportIds() as $pg_id => $exp_id) {
2385  $this->lm->getId(),
2386  $pg_id,
2387  ilUtil::stripSlashes($exp_id),
2388  ilLMObject::_lookupType($pg_id)
2389  );
2390  }
2391 
2392  $this->tpl->setOnScreenMessage('success', $lng->txt("cont_saved_export_ids"), true);
2393  $ilCtrl->redirect($this, "showExportIdsOverview");
2394  }
2395 
2396  public function saveHelpMapping(): void
2397  {
2398  $lng = $this->lng;
2399  $ilCtrl = $this->ctrl;
2400  $help_map = $this->help->internal()->domain()->map();
2401 
2402  foreach ($this->edit_request->getScreenIds() as $chap => $ids) {
2403  $ids = explode("\n", $ids);
2404  $help_map->saveScreenIdsForChapter($chap, $ids);
2405  }
2406  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2407  $ilCtrl->redirect($this, "showExportIdsOverview");
2408  }
2409 
2413 
2414  public function showTooltipList(): void
2415  {
2416  $tpl = $this->tpl;
2417  $ilToolbar = $this->toolbar;
2418  $ilCtrl = $this->ctrl;
2419  $lng = $this->lng;
2420 
2421  $this->setTabs();
2422  $this->setContentSubTabs("help_tooltips");
2423 
2424  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2425  $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id");
2426  $ti->setMaxLength(200);
2427  $ti->setSize(20);
2428  $ilToolbar->addInputItem($ti, true);
2429  $ilToolbar->addFormButton($lng->txt("add"), "addTooltip");
2430  $ilToolbar->addSeparator();
2431 
2432  $options = $this->help->internal()->domain()->tooltips()->getTooltipComponents();
2433  if (ilSession::get("help_tt_comp") != "") {
2434  $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp");
2435  }
2436  $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp");
2437  $si->setOptions($options);
2438  $si->setValue(ilSession::get("help_tt_comp"));
2439  $ilToolbar->addInputItem($si, true);
2440  $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips");
2441 
2442  $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", (string) ilSession::get("help_tt_comp"));
2443 
2444  $tpl->setContent($tbl->getHTML());
2445  }
2446 
2447  public function addTooltip(): void
2448  {
2449  $lng = $this->lng;
2450  $ilCtrl = $this->ctrl;
2451 
2452  $tt_id = $this->edit_request->getTooltipId();
2453  if (trim($tt_id) != "") {
2454  if (is_int(strpos($tt_id, "_"))) {
2455  $this->help->internal()->domain()->tooltips()->addTooltip(trim($tt_id), "");
2456  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2457 
2458  $fu = strpos($tt_id, "_");
2459  $comp = substr($tt_id, 0, $fu);
2460  ilSession::set("help_tt_comp", ilUtil::stripSlashes($comp));
2461  } else {
2462  $this->tpl->setOnScreenMessage('failure', $lng->txt("cont_help_no_valid_tooltip_id"), true);
2463  }
2464  }
2465  $ilCtrl->redirect($this, "showTooltipList");
2466  }
2467 
2468  public function filterTooltips(): void
2469  {
2470  $ilCtrl = $this->ctrl;
2471 
2473  "help_tt_comp",
2474  $this->edit_request->getTooltipComponent()
2475  );
2476  $ilCtrl->redirect($this, "showTooltipList");
2477  }
2478 
2479  public function saveTooltips(): void
2480  {
2481  $ilCtrl = $this->ctrl;
2482  $lng = $this->lng;
2483 
2484  $tooltip_ids = $this->edit_request->getTooltipIds();
2485  foreach ($this->edit_request->getTooltipTexts() as $id => $text) {
2486  $this->help->internal()->domain()->tooltips()->updateTooltip(
2487  (int) $id,
2488  $text,
2489  $tooltip_ids[(int) $id]
2490  );
2491  }
2492  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2493  $ilCtrl->redirect($this, "showTooltipList");
2494  }
2495 
2496  public function deleteTooltips(): void
2497  {
2498  $lng = $this->lng;
2499  $ilCtrl = $this->ctrl;
2500 
2501  $ids = $this->edit_request->getIds();
2502  if (count($ids) > 0) {
2503  foreach ($ids as $id) {
2504  $this->help->internal()->domain()->tooltips()->deleteTooltip($id);
2505  }
2506  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2507  }
2508  $ilCtrl->redirect($this, "showTooltipList");
2509  }
2510 
2514 
2515  public static function getLayoutOption(
2516  string $a_txt,
2517  string $a_var,
2518  string $a_def_option = ""
2520  global $DIC;
2521 
2522  $im_tag = "";
2523 
2524  $lng = $DIC->language();
2525 
2526  // default layout
2527  $layout = new ilRadioGroupInputGUI($a_txt, $a_var);
2528  if ($a_def_option != "") {
2529  if (is_file($im = ilUtil::getImagePath("layout_" . $a_def_option . ".png"))) {
2530  $im_tag = ilUtil::img($im, $a_def_option);
2531  }
2532  $layout->addOption(new ilRadioOption("<table><tr><td>" . $im_tag . "</td><td><strong>" .
2533  $lng->txt("cont_lm_default_layout") .
2534  "</strong>: " . $lng->txt("cont_layout_" . $a_def_option) .
2535  "</td></tr></table>", ""));
2536  }
2537  foreach (ilObjContentObject::getAvailableLayouts() as $l) {
2538  $im_tag = "";
2539  if (is_file($im = ilUtil::getImagePath("layout_" . $l . ".png"))) {
2540  $im_tag = ilUtil::img($im, $l);
2541  }
2542  $layout->addOption(new ilRadioOption("<table><tr><td style='padding: 0px 5px 5px;'>" .
2543  $im_tag . "</td><td style='padding:5px;'><strong>" . $lng->txt("cont_layout_" . $l) . "</strong>: " .
2544  $lng->txt("cont_layout_" . $l . "_desc") . "</td></tr></table>", $l));
2545  }
2546 
2547  return $layout;
2548  }
2549 
2553  public function setPageLayoutInHierarchy(): void
2554  {
2555  $ilCtrl = $this->ctrl;
2556  $ilCtrl->setParameter($this, "hierarchy", "1");
2557  $this->setPageLayout(true);
2558  }
2559 
2560 
2564  public function setPageLayout(
2565  bool $a_in_hierarchy = false
2566  ): void {
2567  $tpl = $this->tpl;
2568  $ilCtrl = $this->ctrl;
2569  $lng = $this->lng;
2570 
2571  $ids = $this->edit_request->getIds();
2572  if (count($ids) == 0) {
2573  $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2574 
2575  if ($a_in_hierarchy) {
2576  $ilCtrl->redirect($this, "chapters");
2577  } else {
2578  $ilCtrl->redirect($this, "pages");
2579  }
2580  }
2581 
2582  $this->initSetPageLayoutForm();
2583 
2584  $tpl->setContent($this->form->getHTML());
2585  }
2586 
2587  public function initSetPageLayoutForm(): void
2588  {
2589  $lng = $this->lng;
2590  $ilCtrl = $this->ctrl;
2591 
2592  $this->form = new ilPropertyFormGUI();
2593 
2594  $ids = $this->edit_request->getIds();
2595  foreach ($ids as $id) {
2596  $hi = new ilHiddenInputGUI("id[]");
2597  $hi->setValue($id);
2598  $this->form->addItem($hi);
2599  }
2600  $layout = self::getLayoutOption(
2601  $lng->txt("cont_layout"),
2602  "layout",
2603  $this->lm->getLayout()
2604  );
2605  $this->form->addItem($layout);
2606 
2607  $this->form->addCommandButton("savePageLayout", $lng->txt("save"));
2608  $this->form->addCommandButton("pages", $lng->txt("cancel"));
2609 
2610  $this->form->setTitle($lng->txt("cont_set_layout"));
2611  $this->form->setFormAction($ilCtrl->getFormAction($this));
2612  }
2613 
2614  public function savePageLayout(): void
2615  {
2616  $lng = $this->lng;
2617  $ilCtrl = $this->ctrl;
2618 
2619  $ilCtrl->setParameter($this, "hierarchy", $this->requested_hierarchy);
2620 
2621  $ids = $this->edit_request->getIds();
2622  foreach ($ids as $id) {
2624  $id,
2625  $this->edit_request->getLayout(),
2626  $this->lm
2627  );
2628  }
2629  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2630 
2631  if ($this->requested_hierarchy) {
2632  $ilCtrl->redirect($this, "chapters");
2633  } else {
2634  $ilCtrl->redirect($this, "pages");
2635  }
2636  }
2637 
2638  //
2639  // Auto glossaries
2640  //
2641 
2645  public function editGlossaries(): void
2646  {
2647  $tpl = $this->tpl;
2648  $ilToolbar = $this->toolbar;
2649  $lng = $this->lng;
2650  $ilCtrl = $this->ctrl;
2651  $ilTabs = $this->tabs;
2652 
2653  $this->setTabs();
2654  $ilTabs->setTabActive("settings");
2655  $this->setSubTabs("cont_glossaries");
2656 
2657  $ilToolbar->addButton(
2658  $lng->txt("add"),
2659  $ilCtrl->getLinkTarget($this, "showLMGlossarySelector")
2660  );
2661 
2662  $tab = new ilLMGlossaryTableGUI($this->lm, $this, "editGlossaries");
2663 
2664  $tpl->setContent($tab->getHTML());
2665  }
2666 
2667  public function showLMGlossarySelector(): void
2668  {
2669  $tpl = $this->tpl;
2670  $ilCtrl = $this->ctrl;
2671  $tree = $this->tree;
2672  $ilTabs = $this->tabs;
2673 
2674  $this->setTabs();
2675  $ilTabs->setTabActive("settings");
2676  $this->setSubTabs("cont_glossaries");
2677 
2678  $exp = new ilSearchRootSelector($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2679  $exp->setExpand($this->requested_search_root_expand ?: $tree->readRootId());
2680  $exp->setPathOpen($this->object->getRefId());
2681  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showLMGlossarySelector'));
2682  $exp->setTargetClass(get_class($this));
2683  $exp->setCmd('confirmGlossarySelection');
2684  $exp->setClickableTypes(array("glo"));
2685  $exp->addFilter("glo");
2686 
2687  // build html-output
2688  $exp->setOutput(0);
2689  $tpl->setContent($exp->getOutput());
2690  }
2691 
2692  public function confirmGlossarySelection(): void
2693  {
2694  $ilCtrl = $this->ctrl;
2695  $tpl = $this->tpl;
2696  $lng = $this->lng;
2697 
2698  $cgui = new ilConfirmationGUI();
2699  $ilCtrl->setParameter($this, "glo_ref_id", $this->requested_root_id);
2700  $cgui->setFormAction($ilCtrl->getFormAction($this));
2701  $cgui->setHeaderText($lng->txt("cont_link_glo_in_lm"));
2702  $cgui->setCancel($lng->txt("no"), "selectLMGlossary");
2703  $cgui->setConfirm($lng->txt("yes"), "selectLMGlossaryLink");
2704  $tpl->setContent($cgui->getHTML());
2705  }
2706 
2707  public function selectLMGlossaryLink(): void
2708  {
2709  $glo_ref_id = $this->requested_glo_ref_id;
2710  $this->lm->autoLinkGlossaryTerms($glo_ref_id);
2711  $this->selectLMGlossary();
2712  }
2713 
2714  public function selectLMGlossary(): void
2715  {
2716  $ilCtrl = $this->ctrl;
2717  $lng = $this->lng;
2718 
2719  $glos = $this->lm->getAutoGlossaries();
2720  $glo_ref_id = $this->requested_glo_ref_id;
2721  $glo_id = ilObject::_lookupObjId($glo_ref_id);
2722  if (!in_array($glo_id, $glos)) {
2723  $glos[] = $glo_id;
2724  }
2725  $this->lm->setAutoGlossaries($glos);
2726  $this->lm->update();
2727 
2728  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2729  $ilCtrl->redirect($this, "editGlossaries");
2730  }
2731 
2732  public function removeLMGlossary(): void
2733  {
2734  $ilCtrl = $this->ctrl;
2735  $lng = $this->lng;
2736 
2737  $this->lm->removeAutoGlossary($this->requested_glo_id);
2738  $this->lm->update();
2739 
2740  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
2741  $ilCtrl->redirect($this, "editGlossaries");
2742  }
2743 
2744  public function editMasterLanguage(): void
2745  {
2746  $ilCtrl = $this->ctrl;
2747 
2748  $ilCtrl->setParameter($this, "transl", "-");
2749  if ($this->lang_switch_mode == "short_titles") {
2750  $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2751  }
2752  $ilCtrl->redirect($this, "chapters");
2753  }
2754 
2755  public function switchToLanguage(): void
2756  {
2757  $ilCtrl = $this->ctrl;
2758 
2759  $ilCtrl->setParameter($this, "transl", $this->requested_totransl);
2760  if ($this->lang_switch_mode == "short_titles") {
2761  $ilCtrl->redirectByClass("illmeditshorttitlesgui", "");
2762  }
2763  $ilCtrl->redirect($this, "chapters");
2764  }
2765 
2766  public function redrawHeaderAction(): void
2767  {
2768  // #12281
2769  parent::redrawHeaderActionObject();
2770  }
2771 
2775  protected function learningProgress(): void
2776  {
2777  $this->ctrl->redirectByClass(array('illearningprogressgui'), '');
2778  }
2779 }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
showExportIDsOverview(bool $a_validation=false)
static get(string $a_var)
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static setAction(string $a_action)
static resetTries(int $a_q_id, int $a_user_id)
Reset tries for user and question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectMetaDataGUI.
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLayoutOption(string $a_txt, string $a_var, string $a_def_option="")
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Import related features for learning modules.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
setPageLayoutInHierarchy()
Set layout for multiple pages.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
moveChapter(int $a_parent_subobj_id=0)
move a single chapter (selection)
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object.
static storeContentObject(string $a_type, int $a_id, string $a_action="cut")
GUI class for the workflow of copying objects.
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects.
const ROOT_FOLDER_ID
Definition: constants.php:32
copyItems(array $ids)
Copy items to clipboard.
setPageLayout(bool $a_in_hierarchy=false)
Set layout for multiple pages.
prepareOutput(bool $show_sub_objects=true)
Interface Observer Contains several chained tasks and infos about them.
setCloseTag(bool $a_val)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
Help GUI class.
$valid
listLinks()
List all broken links.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
activatePages()
activates or deactivates pages
isInTree(?int $a_node_id)
get all information of a node.
static getAvailableLayouts()
get all available lm layouts
addLocations(bool $a_omit_obj_id=false)
display locator
ilStructureObjectGUI: ilConditionHandlerGUI, ilObjectMetaDataGUI ilStructureObjectGUI: ILIAS ...
ilComponentRepository $component_repository
setParameterByClass(string $a_class, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteTree(array $a_node)
delete node and the whole subtree under this node
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions" ...
setOptions(array $a_options)
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
$c
Definition: deliver.php:9
setOpenTag(bool $a_open)
getContextPath(int $a_endnode_id, int $a_startnode_id=1)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
saveAllTitles()
Save all titles of chapters/pages.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getPropertiesFormValues()
Get values for properties form.
$ilErr
Definition: raiseError.php:17
$path
Definition: ltiservices.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
catch(\Exception $e) $req
Definition: xapiproxy.php:78
static _lookupTitle(int $a_obj_id)
const POS_FIRST_NODE
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
ilLanguage $lng
static _goto(string $a_target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
selectFooter()
select page as footer
This class represents a property in a property form.
UIFactory $ui_factory
ILIAS LearningModule ReadingTime SettingsGUI $reading_time_gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
$GLOBALS["DIC"]
Definition: wac.php:30
GUI class for LTI provider object settings.
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
setFormAction(string $a_formaction)
properties()
edit properties form
selectHeader()
select page as header
$text
Definition: xapiexit.php:21
setScreenIdComponent(string $a_comp)
Class ilObjectGUI Basic methods of all Output classes.
static getInstance(int $obj_id)
global $DIC
Definition: shib_login.php:25
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilToolbarGUI $toolbar
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupObjectId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectService $object_service
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMenuEntry(?ilPropertyFormGUI $form=null)
display add menu entry form
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS LearningModule InternalDomainService $domain
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
static getMultiLangHeader(int $a_lm_id, object $a_gui_class, string $a_mode="")
static redirect(string $a_script)
ILIAS Style Content Service $content_style_service
User Interface for Learning Module Page Objects Editing.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static unlock(int $a_q_id, int $a_user_id)
Unlock question for user.
form( $class_path, string $cmd, string $submit_caption="")
static saveExportId(int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
$lm_set
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn&#39;t have to be page title, it may be chapter title + page title or chapter tit...
global $ilSetting
Definition: privfeed.php:32
initMenuEntryForm(string $a_mode="edit")
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
ilAccessHandler $access
__construct( $a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=false)
static _lookupType(int $a_obj_id, int $a_lm_id=0)
initPropertiesForm()
Init properties form.
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
Class ilObjContentObjectGUI.
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static _lookupContObjID(int $a_id)
get learning module id for lm object
ILIAS LearningModule InternalGUIService $gui
setTabs()
set admin tabs
const CMD_LIST_EXPORT_FILES
editGlossaries()
Edit automatically linked glossaries.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
static _lookupType(int $id, bool $reference=false)
addHeaderAction()
Add header action menu.
ilLocatorGUI $locator
UIRenderer $ui_renderer
ilSetting $settings
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static set(string $a_var, $a_val)
Set a value.
confirmedDelete(int $a_parent_subobj_id=0)
delete page object or structure objects
editMenuEntry(?ilPropertyFormGUI $form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
GUI class for object translation handling.
static isOnlineHelpModule(int $a_id, bool $a_as_obj_id=false)
Is module an online module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static _lookupLogin(int $a_user_id)