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