ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilPageObjectGUI.php
Go to the documentation of this file.
1<?php
2
21
34{
35 public const PRESENTATION = "presentation";
36 public const EDIT = "edit";
37 public const PREVIEW = "preview";
38 public const OFFLINE = "offline";
39 public const PRINTING = "print";
40 protected int $requested_ref_id;
41 protected int $requested_pg_id;
42 protected string $requested_file_id;
43 protected string $requested_transl;
44 protected int $requested_old_nr;
47 protected string $exp_target_script = "";
48 protected string $exp_id = "";
49 protected string $exp_frame = "";
50 protected string $act_meth = "";
51 protected object $act_obj;
52 public string $page_back_title = "";
53 protected int $notes_parent_id = 0;
55 protected int $styleid = 0;
56 protected bool $enabledpagefocus;
57 protected string $link_xml;
58 protected int $old_nr = 0;
59
60 protected int $id;
61 protected string $language;
63 protected ilLanguage $lng;
64 protected ilCtrl $ctrl;
67 protected ilLogger $log;
68 protected ilObjUser $user;
69 protected ilHelpGUI $help;
71 protected string $output_mode = "";
72 public string $presentation_title = "";
73 public string $target_script = "";
74 public string $return_location = "";
75 public string $target_var = "";
76 public string $template_output_var = "";
77 public bool $output2template = false;
78 public string $link_params = "";
79 public string $sourcecode_download_script = "";
80 public bool $change_comments = false;
81 public bool $activation = false;
82 public bool $activated = true;
83 public bool $editpreview = false;
84 public bool $use_meta_data = false;
86 public int $meta_data_sub_obj_id = 0;
87 public string $meta_data_type = "";
88 public ?object $meta_data_observer_obj = null;
89 public string $meta_data_observer_func = "";
90 public bool $link_xml_set = false;
91 public bool $enableediting = true;
92 public bool $rawpagecontent = false;
93 public bool $enabledcontentincludes = false;
94 public bool $compare_mode = false;
95 public ?ilPageConfig $page_config = null;
96 public bool $tabs_enabled = true;
97 public bool $render_page_container = false;
98 private bool $abstract_only = false;
99 protected string $parent_type = "";
100 protected string $file_download_link = '';
101 protected string $fullscreen_link = '';
102 protected string $link_frame = '';
103 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices $tool_context;
104 public string $pl_start = "{{{{{";
105 public string $pl_end = "}}}}}";
106 protected \ILIAS\DI\UIServices $ui;
107 protected \ILIAS\COPage\PageLinker $page_linker;
108 protected string $abstract_pcid = ""; // pcid of single paragraph
110 protected string $open_place_holder = "";
111 protected int $requested_user_id = 0;
112 protected int $requested_q_id = 0;
113 protected int $requested_history_mode = 0;
114 protected bool $enabled_news = false;
115 protected int $news_obj_id = 0;
116 protected string $news_obj_type = "";
117 protected ?array $tab_hook = null;
118 protected string $view_page_link = "";
119 protected string $view_page_target = "";
120 protected string $offline_directory = "";
121 protected bool $notes_enabled = false;
122 protected string $prependinghtml = "";
123 protected string $header = "";
124 protected string $int_link_return = "";
125 protected bool $enabled_href = true;
126 // $adv_ref_id - $adv_type - $adv_subtype:
127 // Object, that defines the adv md records being used.
128 protected ?int $adv_ref_id = null;
129 protected ?string $adv_type = null;
130 protected ?string $adv_subtype = null;
131 protected string $concrete_lang = "";
132 protected string $profile_back_url = "";
133
135
143 public function __construct(
144 string $a_parent_type,
145 int $a_id,
146 int $a_old_nr = 0,
147 bool $a_prevent_get_id = false,
148 string $a_lang = "",
149 string $concrete_lang = ""
150 ) {
151 global $DIC;
152
153 $this->log = ilLoggerFactory::getLogger('copg');
154 $this->tpl = $DIC->ui()->mainTemplate();
155 $this->ctrl = $DIC->ctrl();
156 $this->lng = $DIC->language();
157 $this->tabs_gui = $DIC->tabs();
158 $this->access = $DIC->access();
159 $this->user = $DIC->user();
160 $this->help = $DIC["ilHelp"];
161 $this->ui = $DIC->ui();
162 $this->toolbar = $DIC->toolbar();
163 $this->component_factory = $DIC["component.factory"];
164
165 $this->request = $DIC
166 ->copage()
167 ->internal()
168 ->gui()
169 ->page()
170 ->editRequest();
171
172 $this->requested_old_nr = $this->request->getInt("old_nr");
173 $this->requested_transl = $this->request->getString("transl");
174 $this->requested_file_id = $this->request->getString("file_id");
175 $this->requested_ref_id = $this->request->getInt("ref_id");
176 $this->requested_pg_id = $this->request->getInt("pg_id");
177 $this->concrete_lang = $concrete_lang;
178
179 $this->setParentType($a_parent_type);
180 $this->setId($a_id);
181 if ($a_old_nr == 0 && !$a_prevent_get_id && $this->requested_old_nr > 0) {
182 $a_old_nr = $this->requested_old_nr;
183 }
184 $this->setOldNr($a_old_nr);
185
186 if ($a_lang == "" && $this->requested_transl != '') {
187 $this->setLanguage($this->requested_transl);
188 } else {
189 if ($a_lang == "") {
190 $a_lang = "-";
191 }
192 $this->setLanguage($a_lang);
193 }
194
195
196 $this->setOutputMode(self::PRESENTATION);
197 $this->setEnabledPageFocus(true);
198 $this->initPageObject();
199 $this->setPageConfig($this->getPageObject()->getPageConfig());
200
201 $this->page_linker = new ilPageLinker(get_class($this));
202
203 $this->output2template = true;
204
205 $this->template_output_var = "PAGE_CONTENT";
206 $this->change_comments = false;
207 $this->page_back_title = $this->lng->txt("page");
208 $this->lng->loadLanguageModule("content");
209 $this->lng->loadLanguageModule("copg");
210
211 $this->tool_context = $DIC->globalScreen()->tool()->context();
212
213 $this->setTemplateOutput(false);
214
215 $this->ctrl->saveParameter($this, "transl");
216
217
218 $this->requested_user_id = $this->request->getInt("user");
219 $this->requested_q_id = $this->request->getInt("q_id");
220 $this->requested_history_mode = $this->request->getInt("history_mode");
221
222 $this->edit_repo = $DIC
223 ->copage()
224 ->internal()
225 ->repo()
226 ->edit();
227
228 $this->afterConstructor();
229 }
230
231 public function setTemplate(ilGlobalTemplateInterface $main_tpl): void
232 {
233 $this->tpl = $main_tpl;
234 }
235
236 public function afterConstructor(): void
237 {
238 }
239
244 public function setAdvMdRecordObject(
245 int $a_adv_ref_id,
246 string $a_adv_type,
247 string $a_adv_subtype = "-"
248 ): void {
249 $this->adv_ref_id = $a_adv_ref_id;
250 $this->adv_type = $a_adv_type;
251 $this->adv_subtype = $a_adv_subtype;
252 }
253
257 public function getAdvMdRecordObject(): ?array
258 {
259 if ($this->adv_type === null) {
260 return null;
261 }
262 return [$this->adv_ref_id, $this->adv_type, $this->adv_subtype];
263 }
264
268 final protected function initPageObject(): void
269 {
271 $this->getParentType(),
272 $this->getId(),
273 $this->getOldNr(),
274 $this->getLanguage()
275 );
276 $page->setConcreteLang($this->concrete_lang);
277 $this->setPageObject($page);
278 }
279
280 public function setParentType(string $a_val): void
281 {
282 $this->parent_type = $a_val;
283 }
284
285 public function getParentType(): string
286 {
287 return $this->parent_type;
288 }
289
290 public function setId(int $a_val): void
291 {
292 $this->id = $a_val;
293 }
294
295 public function getId(): int
296 {
297 return $this->id;
298 }
299
303 public function setOldNr(int $a_val): void
304 {
305 $this->old_nr = $a_val;
306 }
307
308 public function getOldNr(): int
309 {
310 return $this->old_nr;
311 }
312
313 public function setLanguage(string $a_val): void
314 {
315 $this->language = $a_val;
316 }
317
318 public function getLanguage(): string
319 {
320 if ($this->language == "") {
321 return "-";
322 }
323
324 return $this->language;
325 }
326
327 public function setEnablePCType(
328 string $a_pc_type,
329 bool $a_val
330 ): void {
331 $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
332 }
333
334 public function getEnablePCType(string $a_pc_type): bool
335 {
336 return $this->getPageConfig()->getEnablePCType($a_pc_type);
337 }
338
339 public function setPageConfig(ilPageConfig $a_val): void
340 {
341 $this->page_config = $a_val;
342 }
343
344 public function getPageConfig(): ilPageConfig
345 {
346 return $this->page_config;
347 }
348
349 public function setPageObject(ilPageObject $a_pg_obj): void
350 {
351 $this->obj = $a_pg_obj;
352 }
353
354 public function getPageObject(): ilPageObject
355 {
356 return $this->obj;
357 }
358
362 public function setOutputMode(
363 string $a_mode = self::PRESENTATION
364 ): void {
365 $this->output_mode = $a_mode;
366 }
367
368 public function getOutputMode(): string
369 {
370 return $this->output_mode;
371 }
372
373 public function setTemplateOutput(bool $a_output = true): void
374 {
375 $this->output2template = $a_output;
376 }
377
378 public function outputToTemplate(): bool
379 {
380 return $this->output2template;
381 }
382
383 public function setPresentationTitle(string $a_title = ""): void
384 {
385 $this->presentation_title = $a_title;
386 }
387
388 public function getPresentationTitle(): string
389 {
390 return $this->presentation_title;
391 }
392
393 public function setHeader(string $a_title = ""): void
394 {
395 $this->header = $a_title;
396 }
397
398 public function getHeader(): string
399 {
400 return $this->header;
401 }
402
403 public function setLinkParams(string $l_params = ""): void
404 {
405 $this->link_params = $l_params;
406 }
407
408 public function getLinkParams(): string
409 {
410 return $this->link_params;
411 }
412
413 public function setLinkFrame(string $l_frame = ""): void
414 {
415 $this->link_frame = $l_frame;
416 }
417
418 public function getLinkFrame(): string
419 {
420 return $this->link_frame;
421 }
422
423 public function setPageLinker(\ILIAS\COPage\PageLinker $page_linker): void
424 {
425 $this->page_linker = $page_linker;
426 }
427
428 public function getLinkXML(): string
429 {
430 return $this->link_xml;
431 }
432
433 public function setQuestionHTML(array $question_html): void
434 {
435 $this->getPageConfig()->setQuestionHTML($question_html);
436 }
437
438 public function getQuestionHTML(): array
439 {
440 return $this->getPageConfig()->getQuestionHTML();
441 }
442
443 public function setTemplateTargetVar(string $a_variable): void
444 {
445 $this->target_var = $a_variable;
446 }
447
448 public function getTemplateTargetVar(): string
449 {
450 return $this->target_var;
451 }
452
453 public function getTemplateOutputVar(): string
454 {
455 return $this->template_output_var;
456 }
457
458 public function setSourcecodeDownloadScript(string $script_name): void
459 {
460 $this->sourcecode_download_script = $script_name;
461 }
462
463 public function getSourcecodeDownloadScript(): string
464 {
465 return $this->sourcecode_download_script;
466 }
467
468 public function setTabs(ilTabsGUI $a_tabs): void
469 {
470 $this->tabs_gui = $a_tabs;
471 }
472
473 public function setPageBackTitle(string $a_title): void
474 {
475 $this->page_back_title = $a_title;
476 }
477
478 public function setFileDownloadLink(string $a_download_link): void
479 {
480 $this->file_download_link = $a_download_link;
481 }
482
483 public function getFileDownloadLink(): string
484 {
485 return $this->file_download_link;
486 }
487
488 public function setFullscreenLink(string $a_fullscreen_link): void
489 {
490 $this->fullscreen_link = $a_fullscreen_link;
491 }
492
493 public function getFullscreenLink(): string
494 {
495 return $this->fullscreen_link;
496 }
497
498 public function setIntLinkReturn(string $a_return): void
499 {
500 $this->int_link_return = $a_return;
501 }
502
503 public function enableChangeComments(bool $a_enabled): void
504 {
505 $this->change_comments = $a_enabled;
506 }
507
508 public function isEnabledChangeComments(): bool
509 {
510 return $this->change_comments;
511 }
512
513 public function enableNotes(bool $a_enabled, int $a_parent_id): void
514 {
515 $this->notes_enabled = $a_enabled;
516 $this->notes_parent_id = $a_parent_id;
517 }
518
519 public function isEnabledNotes(): bool
520 {
521 return $this->notes_enabled;
522 }
523
527 public function setOfflineDirectory(string $offdir): void
528 {
529 $this->offline_directory = $offdir;
530 }
531
532 public function getOfflineDirectory(): string
533 {
534 return $this->offline_directory;
535 }
536
537
541 public function setViewPageLink(string $a_link, string $a_target = ""): void
542 {
543 $this->view_page_link = $a_link;
544 $this->view_page_target = $a_target;
545 }
546
547 public function getViewPageLink(): string
548 {
549 return $this->view_page_link;
550 }
551
552 public function getViewPageTarget(): string
553 {
554 return $this->view_page_target;
555 }
556
557 public function getViewPageText(): string
558 {
559 return $this->lng->txt("cont_presentation_view");
560 }
561
562 public function setActivationListener(
563 object $a_obj,
564 string $a_meth
565 ): void {
566 $this->act_obj = $a_obj;
567 $this->act_meth = $a_meth;
568 }
569
570 public function setEnabledNews(
571 bool $a_enabled,
572 int $a_news_obj_id = 0,
573 string $a_news_obj_type = ""
574 ): void {
575 $this->enabled_news = $a_enabled;
576 $this->news_obj_id = $a_news_obj_id;
577 $this->news_obj_type = $a_news_obj_type;
578 }
579
580 public function getEnabledNews(): bool
581 {
582 return $this->enabled_news;
583 }
584
585 public function setTabHook(
586 object $a_object,
587 string $a_function
588 ): void {
589 $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
590 }
591
595 public function setEditPreview(
596 bool $a_editpreview
597 ): void {
598 $this->editpreview = $a_editpreview;
599 }
600
601 public function getEditPreview(): bool
602 {
603 return $this->editpreview;
604 }
605
606 public function setEnabledTabs(bool $a_enabledtabs): void
607 {
608 $this->tabs_enabled = $a_enabledtabs;
609 }
610
611 public function getEnabledTabs(): bool
612 {
613 return $this->tabs_enabled;
614 }
615
616 public function setEnabledPageFocus(bool $a_enabledpagefocus): void
617 {
618 $this->enabledpagefocus = $a_enabledpagefocus;
619 }
620
621 public function setOpenPlaceHolder(string $a_val): void
622 {
623 $this->open_place_holder = $a_val;
624 }
625
626 public function getOpenPlaceHolder(): string
627 {
628 return $this->open_place_holder;
629 }
630
631 public function getEnabledPageFocus(): bool
632 {
633 return $this->enabledpagefocus;
634 }
635
636 public function setPrependingHtml(string $a_prependinghtml): void
637 {
638 $this->prependinghtml = $a_prependinghtml;
639 }
640
641 public function getPrependingHtml(): string
642 {
643 return $this->prependinghtml;
644 }
645
646 public function setEnableEditing(bool $a_enableediting): void
647 {
648 $this->enableediting = $a_enableediting;
649 }
650
651 public function getEnableEditing(): bool
652 {
653 return $this->enableediting;
654 }
655
659 public function setRawPageContent(bool $a_rawpagecontent): void
660 {
661 $this->rawpagecontent = $a_rawpagecontent;
662 }
663
664 public function getRawPageContent(): bool
665 {
666 return $this->rawpagecontent;
667 }
668
669 public function setStyleId(int $a_styleid): void
670 {
671 $this->styleid = $a_styleid;
672 }
673
674 public function getStyleId(): int
675 {
676 return $this->styleid;
677 }
678
679 public function setCompareMode(bool $a_val): void
680 {
681 $this->compare_mode = $a_val;
682 }
683
684 public function getCompareMode(): bool
685 {
686 return $this->compare_mode;
687 }
688
692 public function setAbstractOnly(
693 bool $a_val,
694 string $pcid = ""
695 ): void {
696 $this->abstract_only = $a_val;
697 $this->abstract_pcid = $pcid;
698 }
699
700 public function getAbstractOnly(): bool
701 {
702 return $this->abstract_only;
703 }
704
705 public function setRenderPageContainer(bool $a_val): void
706 {
707 $this->render_page_container = $a_val;
708 }
709
710 public function getRenderPageContainer(): bool
711 {
712 return $this->render_page_container;
713 }
714
715 public function getDisabledText(): string
716 {
717 return $this->lng->txt("inactive");
718 }
719
720 public function getEnabledHref(): bool
721 {
722 return $this->enabled_href;
723 }
724
725 public function setEnabledHref(bool $enable): void
726 {
727 $this->enabled_href = $enable;
728 }
729
738 public function activateMetaDataEditor(
739 ilObject $a_rep_obj,
740 string $a_type,
741 int $a_sub_obj_id,
742 object $a_observer_obj = null,
743 string $a_observer_func = ""
744 ): void {
745 $this->use_meta_data = true;
746 $this->meta_data_rep_obj = $a_rep_obj;
747 $this->meta_data_sub_obj_id = $a_sub_obj_id;
748 $this->meta_data_type = $a_type;
749 $this->meta_data_observer_obj = $a_observer_obj;
750 $this->meta_data_observer_func = $a_observer_func;
751 }
752
753 public function determineFileDownloadLink(): string
754 {
755 $file_download_link = $this->getFileDownloadLink();
756 if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline") {
757 $file_download_link = $this->ctrl->getLinkTarget($this, "downloadFile");
758 }
759 return $file_download_link;
760 }
761
762 public function determineFullscreenLink(): string
763 {
764 $fullscreen_link = $this->getFullscreenLink();
765 if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline") {
766 $fullscreen_link = $this->ctrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
767 }
768 return $fullscreen_link;
769 }
770
771 public function determineSourcecodeDownloadScript(): string
772 {
773 $l = $this->sourcecode_download_script;
774 if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline") {
775 $l = $this->ctrl->getLinkTarget($this, "");
776 }
777 return $l;
778 }
779
783 public function getComponentPluginsXML(): string
784 {
785 $xml = "";
786 if ($this->getOutputMode() == "edit") {
787 foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
788 if ($plugin->isValidParentType($this->getPageObject()->getParentType())) {
789 $xml .= '<ComponentPlugin Name="' . $plugin->getPluginName() .
790 '" InsertText="' . $plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT) . '" />';
791 }
792 }
793 }
794 if ($xml != "") {
795 $xml = "<ComponentPlugins>" . $xml . "</ComponentPlugins>";
796 }
797 return $xml;
798 }
799
800
804 public function executeCommand(): string
805 {
806 $ret = "";
807 $next_class = $this->ctrl->getNextClass($this);
808 if ($next_class !== "") {
809 $this->ctrl->setReturn($this, "edit");
810 }
811 $this->log->debug("next_class: " . $next_class);
812 if ($next_class == "" && $this->ctrl->getCmd() == "edit") {
813 $this->tabs_gui->clearTargets();
814 } else {
815 $this->getTabs();
816 }
817
818
819 switch ($next_class) {
820 case 'ilobjectmetadatagui':
821 $this->setBackToEditTabs();
822 $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
823 if (is_object($this->meta_data_observer_obj)) {
824 $md_gui->addMDObserver(
825 $this->meta_data_observer_obj,
826 $this->meta_data_observer_func,
827 "General"
828 );
829 }
830 // set adv metadata record dobject
831 if ($this->adv_type != "") {
832 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
833 }
834 $this->ctrl->forwardCommand($md_gui);
835 break;
836
837 case "ileditclipboardgui":
838 $this->setBackToEditTabs();
839
840 $return_cmd = $this->ctrl->getLinkTargetByClass(
841 ilPageEditorGUI::class,
842 "insertFromClipboard"
843 );
844 $clip_gui = new ilEditClipboardGUI($return_cmd);
845 $clip_gui->setPageBackTitle($this->page_back_title);
846 $ret = $this->ctrl->forwardCommand($clip_gui);
847 break;
848
849 // notes
850 case "ilnotegui":
851 $html = $this->edit();
852 $this->tabs_gui->setTabActive("edit");
853 return $html;
854
855 case 'ilpublicuserprofilegui':
856 $profile_gui = new ilPublicUserProfileGUI($this->requested_user_id);
857 $ret = $this->ctrl->forwardCommand($profile_gui);
858 break;
859
860 case "ilpageeditorgui":
861 $this->setEditorToolContext();
862
863 if (!$this->getEnableEditing()) {
864 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
865 $this->ctrl->redirect($this, "preview");
866 }
867 $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
868 $page_editor->setHeader($this->getHeader());
869 $page_editor->setPageBackTitle($this->page_back_title);
870 $page_editor->setIntLinkReturn($this->int_link_return);
871 //$page_editor->executeCommand();
872 $ret = $this->ctrl->forwardCommand($page_editor);
873 break;
874
875 case 'ilnewsitemgui':
876 $news_item_gui = new ilNewsItemGUI();
877 $news_item_gui->setEnableEdit(true);
878 $news_item_gui->setContextObjId($this->news_obj_id);
879 $news_item_gui->setContextObjType($this->news_obj_type);
880 $news_item_gui->setContextSubObjId($this->obj->getId());
881 $news_item_gui->setContextSubObjType("pg");
882
883 $ret = $this->ctrl->forwardCommand($news_item_gui);
884 break;
885
886 case "ilpropertyformgui":
887 $form = $this->initOpenedContentForm();
888 $this->ctrl->forwardCommand($form);
889 break;
890
891 case "ilinternallinkgui":
892 $this->lng->loadLanguageModule("content");
893 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
894
895 $link_gui->filterLinkType("PageObject_FAQ");
896 $link_gui->filterLinkType("GlossaryItem");
897 $link_gui->filterLinkType("Media_Media");
898 $link_gui->filterLinkType("Media_FAQ");
899
900 $link_gui->setFilterWhiteList(true);
901 $this->ctrl->forwardCommand($link_gui);
902 break;
903
904 case "ilquestioneditgui":
905 $this->setQEditTabs("question");
906 $edit_gui = new ilQuestionEditGUI();
907 $edit_gui->setPageConfig($this->getPageConfig());
908 $edit_gui->setSelfAssessmentEditingMode(true);
909 $ret = $this->ctrl->forwardCommand($edit_gui);
910 $this->tpl->setContent($ret);
911 break;
912
913 case 'ilassquestionfeedbackeditinggui':
914
915 $this->onFeedbackEditingForwarding();
916
917 // set tabs
918 $this->setQEditTabs("feedback");
919
920 // load required lang mods
921 $this->lng->loadLanguageModule("assessment");
922
923 // set context tabs
924 $questionGUI = assQuestionGUI::_getQuestionGUI(
926 $this->requested_q_id
927 ),
928 $this->requested_q_id
929 );
930 $questionGUI->object->setObjId(0);
931 $questionGUI->object->setSelfAssessmentEditingMode(true);
932 $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
933
934 // forward to ilAssQuestionFeedbackGUI
935 $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $this->ctrl, $this->access, $this->tpl, $this->tabs_gui, $this->lng);
936 $this->ctrl->forwardCommand($gui);
937 break;
938
939
940 case 'ilLearninghistorygui':
941 $user_id = null;
942 if ($this->getPageObject()->getParentType() == "prtf") {
943 $user_id = ilObject::_lookupOwner($this->getPageObject()->getPortfolioId());
944 }
945 $hist_gui = new ilLearningHistoryGUI();
946 $hist_gui->setUserId($user_id);
947 $this->ctrl->forwardCommand($hist_gui);
948 break;
949
950 default:
951 $cmd = $this->ctrl->getCmd("preview");
952 // presentation view
953 if ($this->getViewPageLink() != "" && $cmd != "edit") {
954 $this->tabs_gui->addNonTabbedLink(
955 "pres_view",
956 $this->getViewPageText(),
957 $this->getViewPageLink(),
958 $this->getViewPageTarget()
959 );
960 }
961 $ret = $this->$cmd();
962 if ($this->getOutputMode() == self::PREVIEW && $cmd == "preview") {
963 $this->showEditToolbar();
964 }
965 break;
966 }
967 //echo "+$ret+";
968 return (string) $ret;
969 }
970
974 public function setQEditTabs(string $a_active): void
975 {
976 $this->tabs_gui->clearTargets();
977
978 $this->tabs_gui->setBackTarget(
979 $this->lng->txt("back"),
980 $this->ctrl->getLinkTarget($this, "edit")
981 );
982
983 $this->ctrl->setParameterByClass("ilquestioneditgui", "q_id", $this->requested_q_id);
984 $this->tabs_gui->addTab(
985 "question",
986 $this->lng->txt("question"),
987 $this->ctrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion")
988 );
989
990 $this->ctrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $this->requested_q_id);
991 $this->tabs_gui->addTab(
992 "feedback",
993 $this->lng->txt("feedback"),
994 $this->ctrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
995 );
996
997 $this->tabs_gui->activateTab($a_active);
998 }
999
1000 public function onFeedbackEditingForwarding(): void
1001 {
1002 }
1003
1004 public function deactivatePage(): void
1005 {
1006 $this->getPageObject()->setActivationStart(null);
1007 $this->getPageObject()->setActivationEnd(null);
1008 $this->getPageObject()->setActive(false);
1009 $this->getPageObject()->update();
1010 $this->ctrl->redirect($this, "edit");
1011 }
1012
1013 public function activatePage(): void
1014 {
1015 $this->getPageObject()->setActivationStart(null);
1016 $this->getPageObject()->setActivationEnd(null);
1017 $this->getPageObject()->setActive(true);
1018 $this->getPageObject()->update();
1019 $this->ctrl->redirect($this, "edit");
1020 }
1021
1025 protected function showEditToolbar(): void
1026 {
1027 $ui = $this->ui;
1028 $lng = $this->lng;
1029 if ($this->getEnableEditing()) {
1030 $b = $ui->factory()->button()->standard(
1031 $lng->txt("edit_page"),
1032 $this->ctrl->getLinkTarget($this, "edit")
1033 );
1034 $this->toolbar->addComponent($b);
1035 }
1036 }
1037
1041 public function showPage(): string
1042 {
1043 $main_tpl = $this->tpl;
1044 $sn_arr = [];
1045
1046 $sel_js_mode = '';
1047 $paragraph_plugin_string = '';
1048 $disable_auto_margins = '';
1049
1050 // jquery and jquery ui are always provided for components
1053
1054 // $this->initSelfAssessmentRendering();
1056
1057 $main_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1058
1059 // needed for overlays in iim
1060 ilOverlayGUI::initJavascript();
1061
1063
1064 // init template
1065 if ($this->getOutputMode() == "edit") {
1066 $this->initEditing();
1067 if (!$this->getPageObject()->getEditLock()) {
1068 return "";
1069 }
1070
1071 $this->getPageObject()->buildDom();
1072
1073 $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1074
1075 $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1076 // to do: status dependent class
1077 $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1078
1079 // user comment
1080 if ($this->isEnabledChangeComments()) {
1081 $tpl->setCurrentBlock("change_comment");
1082 $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1083 $tpl->parseCurrentBlock();
1084 }
1085
1086 if ($this->getPageConfig()->getUsePageContainer()) {
1087 $tpl->setVariable("PAGE_CONTAINER_CLASS", "ilc_page_cont_PageContainer");
1088 }
1089
1090 $tpl->setVariable(
1091 "WYSIWYG_ACTION",
1092 $this->ctrl->getFormActionByClass("ilpageeditorgui", "", "", true)
1093 );
1094
1095 // determine media, html and javascript mode
1096 $sel_js_mode = "enable";
1097
1098 // show prepending html
1099 $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1100 $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1101
1102
1103 // get js files for JS enabled editing
1104 if ($sel_js_mode == "enable") {
1105
1106 // add int link parts
1107 $tpl->setCurrentBlock("int_link_prep");
1108 $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1109 $this->ctrl->getLinkTargetByClass(
1110 array("ilpageeditorgui", "ilinternallinkgui"),
1111 "",
1112 false,
1113 true,
1114 false
1115 )
1116 ));
1117 $tpl->parseCurrentBlock();
1118
1119 $editor_init = new \ILIAS\COPage\Editor\UI\Init();
1120 $editor_init->initUI($main_tpl, $this->getOpenPlaceHolder());
1121 }
1122 } else {
1123 // presentation or preview here
1124
1125 $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1126 if ($this->getEnabledPageFocus()) {
1127 $tpl->touchBlock("page_focus");
1128 }
1129
1130 // presentation
1131 if ($this->isPageContainerToBeRendered()) {
1132 $tpl->touchBlock("page_container_1");
1133 $tpl->touchBlock("page_container_2");
1134 $tpl->touchBlock("page_container_3");
1135 }
1136
1137 // history
1138 $c_old_nr = $this->getPageObject()->old_nr;
1139 if ($c_old_nr > 0 || $this->getCompareMode() || ($this->requested_history_mode == 1)) {
1140 $hist_info =
1141 $this->getPageObject()->getHistoryInfo($c_old_nr);
1142
1143 if (!$this->getCompareMode()) {
1144 $this->ctrl->setParameter($this, "history_mode", "1");
1145
1146 // previous revision
1147 if (isset($hist_info["previous"])) {
1148 $tpl->setCurrentBlock("previous_rev");
1149 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1150 $this->ctrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1151 $tpl->setVariable(
1152 "HREF_PREV",
1153 $this->ctrl->getLinkTarget($this, "preview")
1154 );
1155 } else {
1156 $tpl->setCurrentBlock("previous_rev_disabled");
1157 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1158 }
1159 $tpl->parseCurrentBlock();
1160
1161 // next revision
1162 if ($c_old_nr > 0) {
1163 $tpl->setCurrentBlock("next_rev");
1164 $tpl->setVariable("TXT_NEXT_REV", $this->lng->txt("cont_next_rev"));
1165 $this->ctrl->setParameter($this, "old_nr", $hist_info["next"]["nr"] ?? 0);
1166 $tpl->setVariable(
1167 "HREF_NEXT",
1168 $this->ctrl->getLinkTarget($this, "preview")
1169 );
1170 $tpl->parseCurrentBlock();
1171
1172 // latest revision
1173 $tpl->setCurrentBlock("latest_rev");
1174 $tpl->setVariable("TXT_LATEST_REV", $this->lng->txt("cont_latest_rev"));
1175 $this->ctrl->setParameter($this, "old_nr", "");
1176 $tpl->setVariable(
1177 "HREF_LATEST",
1178 $this->ctrl->getLinkTarget($this, "preview")
1179 );
1180 $tpl->parseCurrentBlock();
1181 }
1182
1183 $this->ctrl->setParameter($this, "history_mode", "");
1184
1185 // rollback
1186 if ($c_old_nr > 0 && $this->user->getId() != ANONYMOUS_USER_ID) {
1187 $tpl->setCurrentBlock("rollback");
1188 $this->ctrl->setParameter($this, "old_nr", $c_old_nr);
1189 $tpl->setVariable(
1190 "HREF_ROLLBACK",
1191 $this->ctrl->getLinkTarget($this, "rollbackConfirmation")
1192 );
1193 $this->ctrl->setParameter($this, "old_nr", "");
1194 $tpl->setVariable(
1195 "TXT_ROLLBACK",
1196 $this->lng->txt("cont_rollback")
1197 );
1198 $tpl->parseCurrentBlock();
1199 }
1200 }
1201
1202 $tpl->setCurrentBlock("hist_nav");
1203 $tpl->setVariable("TXT_REVISION", $this->lng->txt("cont_revision"));
1204 $tpl->setVariable(
1205 "VAL_REVISION_DATE",
1206 ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))
1207 );
1208 $tpl->setVariable(
1209 "VAL_REV_USER",
1210 ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])
1211 );
1212 $tpl->parseCurrentBlock();
1213 }
1214 }
1215 if ($this->getOutputMode() != self::PRESENTATION &&
1216 $this->getOutputMode() != self::OFFLINE &&
1217 $this->getOutputMode() != self::PREVIEW &&
1218 $this->getOutputMode() != self::PRINTING) {
1219 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1220 }
1221
1222 // output media object edit list (of media links)
1223 if ($this->getOutputMode() == "edit") {
1225 $this->obj->getParentType() . ":pg",
1226 $this->obj->getId(),
1227 $this->obj->getLanguage()
1228 );
1229 $mob_links = array();
1230 foreach ($links as $link) {
1231 if ($link["type"] == "mob") {
1232 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
1233 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
1234 }
1235 }
1236 }
1237
1238 // linked media objects
1239 if (count($mob_links) > 0) {
1240 $tpl->setCurrentBlock("med_link");
1241 $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1242 $tpl->setVariable(
1243 "SEL_MED_LINKS",
1244 ilLegacyFormElementsUtil::formSelect(0, "mob_id", $mob_links, false, true)
1245 );
1246 $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1247 $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1248 //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1249 $tpl->parseCurrentBlock();
1250 }
1251
1252 // content snippets used
1253 $this->getPageObject()->buildDom();
1255 $this->getPageObject(),
1256 $this->getPageObject()->getDomDoc()
1257 );
1258 if (count($snippets) > 0) {
1259 foreach ($snippets as $s) {
1260 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1261 }
1262 $tpl->setCurrentBlock("med_link");
1263 $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1264 $tpl->setVariable(
1265 "SEL_SNIPPETS",
1266 ilLegacyFormElementsUtil::formSelect(0, "ci_id", $sn_arr, false, true)
1267 );
1268 $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1269 $tpl->parseCurrentBlock();
1270 }
1271
1272 // scheduled activation?
1273 if (!$this->getPageObject()->getActive() &&
1274 $this->getPageObject()->getActivationStart() != "" &&
1275 $this->getPageConfig()->getEnableScheduledActivation()) {
1276 $tpl->setCurrentBlock("activation_txt");
1277 $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $this->lng->txt("cont_scheduled_activation"));
1278 $tpl->setVariable(
1279 "SA_FROM",
1281 new ilDateTime(
1282 $this->getPageObject()->getActivationStart(),
1284 )
1285 )
1286 );
1287 $tpl->setVariable(
1288 "SA_TO",
1290 new ilDateTime(
1291 $this->getPageObject()->getActivationEnd(),
1293 )
1294 )
1295 );
1296 $tpl->parseCurrentBlock();
1297 }
1298 }
1299
1300 $reload_tree = $this->request->getString("reloadTree");
1301 if ($reload_tree == "y") {
1302 $tpl->setCurrentBlock("reload_tree");
1303 $tpl->setVariable(
1304 "LINK_TREE",
1305 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false)
1306 );
1307 $tpl->parseCurrentBlock();
1308 }
1309 // }
1310 // get content
1311 $builded = $this->obj->buildDom();
1312
1313 // manage hierarchical ids
1314 if ($this->getOutputMode() == "edit") {
1315
1316 // add pc ids, if necessary
1317 if (!$this->obj->checkPCIds()) {
1318 $this->obj->insertPCIds();
1319 $this->obj->update(true, true);
1320 }
1321
1322 $this->obj->addFileSizes();
1323 $this->obj->addHierIDs();
1324
1325 $hids = $this->obj->getHierIds();
1326 $row1_ids = $this->obj->getFirstRowIds();
1327 $col1_ids = $this->obj->getFirstColumnIds();
1328 $litem_ids = $this->obj->getListItemIds();
1329 $fitem_ids = $this->obj->getFileItemIds();
1330
1331 // standard menues
1332 $hids = $this->obj->getHierIds();
1333 foreach ($hids as $hid) {
1334 $tpl->setCurrentBlock("add_dhtml");
1335 $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
1336 $tpl->parseCurrentBlock();
1337 }
1338
1339 // column menues for tables
1340 foreach ($col1_ids as $hid) {
1341 $tpl->setCurrentBlock("add_dhtml");
1342 $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
1343 $tpl->parseCurrentBlock();
1344 }
1345
1346 // row menues for tables
1347 foreach ($row1_ids as $hid) {
1348 $tpl->setCurrentBlock("add_dhtml");
1349 $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
1350 $tpl->parseCurrentBlock();
1351 }
1352
1353 // list item menues
1354 foreach ($litem_ids as $hid) {
1355 $tpl->setCurrentBlock("add_dhtml");
1356 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1357 $tpl->parseCurrentBlock();
1358 }
1359
1360 // file item menues
1361 foreach ($fitem_ids as $hid) {
1362 $tpl->setCurrentBlock("add_dhtml");
1363 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1364 $tpl->parseCurrentBlock();
1365 }
1366 } else {
1367 $this->obj->addFileSizes();
1368 }
1369
1370 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; exit;
1371 //echo "<br>-".htmlentities($this->getLinkXML())."-"; exit;
1372
1373 // set default link xml, if nothing was set yet
1374 if (!$this->link_xml_set) {
1375 $this->setDefaultLinkXml();
1376 }
1377
1378 $template_xml = '';
1379
1380 $link_xml = $this->getLinkXML();
1381
1382 // disable/enable auto margins
1383 if ($this->getStyleId() > 0) {
1384 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1385 $style = new ilObjStyleSheet($this->getStyleId());
1386 $template_xml = $style->getTemplateXML();
1387 $disable_auto_margins = "n";
1388 if ($style->lookupStyleSetting("disable_auto_margins")) {
1389 $disable_auto_margins = "y";
1390 }
1391 }
1392 }
1393
1394 $append_footnotes = "y";
1395 if ($this->getAbstractOnly()) {
1396 if (!$this->abstract_pcid) {
1397 $content = "<dummy><PageObject><PageContent><Paragraph>" .
1398 $this->obj->getFirstParagraphText() . $link_xml .
1399 "</Paragraph></PageContent></PageObject></dummy>";
1400 } else {
1401 $append_footnotes = "n";
1402 $par = $this->obj->getParagraphForPCID($this->abstract_pcid);
1403 $content = "<dummy><PageObject><PageContent><Paragraph Characteristic='" . $par->getCharacteristic() . "'>" .
1404 $par->getText() . $link_xml .
1405 "</Paragraph></PageContent></PageObject>" . $this->obj->getMultimediaXML() . "</dummy>";
1406 }
1407 } else {
1408 $content = $this->obj->getXMLFromDom(
1409 false,
1410 true,
1411 true,
1412 $link_xml . $template_xml . $this->getComponentPluginsXML(),
1413 false,
1414 $this->getStyleId()
1415 );
1416 }
1417
1418 // check validation errors
1419 if ($builded !== true) {
1420 $this->displayValidationError($builded);
1421 } else {
1422 $this->displayValidationError((string) $this->edit_repo->getPageError());
1423 }
1424 $this->edit_repo->clearPageError();
1425
1426 // get title
1427 $pg_title = $this->getPresentationTitle();
1428 $col_path = '';
1429 $row_path = '';
1430 $cell_path = '';
1431 $item_path = '';
1432 if ($this->getOutputMode() == "edit") {
1433 $col_path = ilUtil::getImagePath("col.svg");
1434 $row_path = ilUtil::getImagePath("row.svg");
1435 $item_path = ilUtil::getImagePath("icon_peadl.svg");
1436 $cell_path = ilUtil::getImagePath("cell.svg");
1437 }
1438
1439 if ($this->getOutputMode() != "offline") {
1440 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1441 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
1442 } else {
1443 $enlarge_path = "images/enlarge.svg";
1444 $wb_path = "";
1445 }
1446 $pg_title_class = ($this->getOutputMode() == "print")
1447 ? "ilc_PrintPageTitle"
1448 : "";
1449
1450 // page splitting only for learning modules and
1451 // digital books
1452 $enable_split_new = ($this->obj->getParentType() == "lm")
1453 ? "y"
1454 : "n";
1455
1456 // page splitting to next page only for learning modules and
1457 // digital books if next page exists in tree
1458 if (($this->obj->getParentType() == "lm") &&
1460 $this->obj->getParentId(),
1461 $this->obj->getId()
1462 )) {
1463 $enable_split_next = "y";
1464 } else {
1465 $enable_split_next = "n";
1466 }
1467
1468 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1469
1470
1471 if ($this->getPageConfig()->getEnablePCType("Tabs")) {
1474 }
1475
1476 // needed for placeholders
1477 $this->tpl->addCss(ilObjStyleSheet::getPlaceHolderStylePath());
1478
1479 $file_download_link = $this->determineFileDownloadLink();
1480 $fullscreen_link = $this->determineFullscreenLink();
1481 $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1482
1483 // default values for various parameters (should be used by
1484 // all instances in the future)
1485 $media_mode = ($this->getOutputMode() == "edit")
1486 ? $this->user->getPref("ilPageEditor_MediaMode")
1487 : "enable";
1488
1489 $paste = (ilEditClipboard::getAction() == "copy" &&
1490 $this->getOutputMode() == "edit");
1491
1492 $flv_video_player = ilPlayerUtil::getFlashVideoPlayerFilename(true);
1493
1494 $cfg = $this->getPageConfig();
1495
1496 $current_ts = time();
1497
1498 $enable_href = $this->getEnabledHref();
1499 if ($this->getOutputMode() == self::EDIT) {
1500 $enable_href = false;
1501 }
1502
1503 // added UTF-8 encoding otherwise umlaute are converted too
1504 $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"),
1505 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1506 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1507 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1508 'img_col' => $col_path,
1509 'img_row' => $row_path,
1510 'img_cell' => $cell_path,
1511 'img_item' => $item_path,
1512 'acc_save_url' => "./ilias.php?baseClass=ilaccordionpropertiesstoragegui&cmd=setOpenedTab" .
1513 "&user_id=" . $this->user->getId(),
1514 'append_footnotes' => $append_footnotes,
1515 'compare_mode' => $this->getCompareMode() ? "y" : "n",
1516 'enable_split_new' => $enable_split_new,
1517 'enable_split_next' => $enable_split_next,
1518 'link_params' => $this->link_params,
1519 'file_download_link' => $file_download_link,
1520 'fullscreen_link' => $fullscreen_link,
1521 'img_path' => $img_path,
1522 'parent_id' => $this->obj->getParentId(),
1523 'download_script' => $this->sourcecode_download_script,
1524 'encoded_download_script' => urlencode($this->sourcecode_download_script),
1525 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1526 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1527 'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1528 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1529 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1530 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1531 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1532 'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1533 'paste' => $paste ? "y" : "n",
1534 'media_mode' => $media_mode,
1535 'javascript' => $sel_js_mode,
1536 'paragraph_plugins' => $paragraph_plugin_string,
1537 'disable_auto_margins' => $disable_auto_margins,
1538 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1539 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1540 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1541 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1542 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1543 'enable_learning_history' => $cfg->getEnablePCType("LearningHistory") ? "y" : "n",
1544 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1545 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1546 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1547 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1548 'current_ts' => $current_ts,
1549 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1550 'flv_video_player' => $flv_video_player,
1551 'page_perma_link' => $this->getPagePermaLink(),
1552 'activated_protection' =>
1553 ($this->getPageConfig()->getSectionProtection() == \ilPageConfig::SEC_PROTECT_PROTECTED) ? "y" : "n",
1554 'protection_text' => $this->lng->txt("cont_sec_protected_text"),
1555 'enable_href' => $enable_href
1556 );
1557 if ($this->link_frame != "") { // todo other link types
1558 $params["pg_frame"] = $this->link_frame;
1559 }
1560
1561 //$content = str_replace("&nbsp;", "", $content);
1562
1563 // this ensures that cache is emptied with every update
1564 $params["version"] = ILIAS_VERSION;
1565 // ensure no cache hit, if included files/media objects have been changed
1566 $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1567
1568
1569 // should be modularized
1570 $md5_adds = ilPCSection::getCacheTriggerString($this->getPageObject());
1571 // run xslt
1572 $md5 = md5(serialize($params) . $link_xml . $template_xml . $md5_adds);
1573
1574 //$a = microtime();
1575
1576 // check cache (same parameters, non-edit mode and rendered time
1577 // > last change
1578 $is_error = false;
1579 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1580 !$this->getCompareMode() &&
1581 !$this->getAbstractOnly() &&
1582 $md5 == $this->obj->getRenderMd5() &&
1583 ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1584 $this->obj->getRenderedTime() != "" &&
1585 $this->obj->old_nr == 0) {
1586 // cache hit
1587 $output = $this->obj->getRenderedContent();
1588 } else {
1589 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1590 $this->log->debug("Calling XSLT, content: " . substr($content, 0, 100));
1591 try {
1592 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1593 $xh = xslt_create();
1594 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1595 } catch (Exception $e) {
1596 $output = "";
1597 if ($this->getOutputMode() == "edit") {
1598 $output = "<pre>" . $e->getMessage() . "<br>" . htmlentities($content) . "</pre>";
1599 $is_error = true;
1600 }
1601 }
1602 if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1603 && !$this->getAbstractOnly()
1604 && $this->obj->old_nr == 0) {
1605 $this->obj->writeRenderedContent($output, $md5);
1606 }
1607 xslt_free($xh);
1608 }
1609
1610 if (!$is_error) {
1611 // unmask user html
1612 if (($this->getOutputMode() != "edit" ||
1613 $this->user->getPref("ilPageEditor_HTMLMode") != "disable")
1614 && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
1615 $output = str_replace("&lt;", "<", $output);
1616 $output = str_replace("&gt;", ">", $output);
1617 }
1618 $output = str_replace("&amp;", "&", $output);
1619
1620 $output = ilMathJax::getInstance()->insertLatexImages($output);
1621
1622 // insert page snippets
1623 //$output = $this->insertContentIncludes($output);
1624
1625 // insert resource blocks
1626 $output = $this->insertResources($output);
1627
1628 // insert page toc
1629 if ($this->getPageConfig()->getEnablePageToc()) {
1630 $output = $this->insertPageToc($output);
1631 }
1632
1633 // insert advanced output trigger
1634 $output = $this->insertAdvTrigger($output);
1635
1636 // workaround for preventing template engine
1637 // from hiding paragraph text that is enclosed
1638 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1639 $output = $this->replaceCurlyBrackets($output);
1640
1641 // remove all newlines (important for code / pre output)
1642 $output = str_replace("\n", "", $output);
1643
1644 //echo htmlentities($output);
1645 $output = $this->postOutputProcessing($output);
1646 //echo htmlentities($output);
1647 if ($this->getOutputMode() == "edit" &&
1648 !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
1649 $output = '<div class="copg-disabled-page"><div class="ilCopgDisabledText">' . $this->getDisabledText() . '</div>' . $output . '</div>';
1650 }
1651
1652 // for all page components...
1654 foreach ($defs as $def) {
1655 //ilCOPagePCDef::requirePCClassByName($def["name"]);
1656 $pc_class = $def["pc_class"];
1657 $pc_obj = new $pc_class($this->getPageObject());
1658 $pc_obj->setSourcecodeDownloadScript($this->determineSourcecodeDownloadScript());
1659 $pc_obj->setFileDownloadLink($this->determineFileDownloadLink());
1660 $pc_obj->setFullscreenLink($this->determineFullscreenLink());
1661 $pc_obj->setProfileBackUrl($this->getProfileBackUrl());
1662
1663 // post xsl page content modification by pc elements
1664 $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode(), $this->getAbstractOnly());
1665 }
1666 }
1667
1668 $this->addResourcesToTemplate($main_tpl);
1669
1670 // $output = $this->selfAssessmentRendering($output);
1671
1672 // output
1673 if ($this->ctrl->isAsynch() && !$this->getRawPageContent() &&
1674 $this->getOutputMode() == "edit") {
1675 // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1676 $up_pc = $this->request->getString("updated_pc_id_str");
1677 if ($up_pc != "") {
1678 echo $up_pc;
1679 }
1680 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1681 $tpl->setCurrentBlock("edit_page");
1682 $tpl->parseCurrentBlock();
1683 echo $tpl->get("edit_page");
1684 exit;
1685 }
1686 if ($this->outputToTemplate()) {
1687 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1688 $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1689 return $output;
1690 } else {
1691 if ($this->getRawPageContent()) { // e.g. needed in glossaries
1692 return $output;
1693 } else {
1694 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1695 return $tpl->get();
1696 }
1697 }
1698 }
1699
1700 public function replaceCurlyBrackets(string $output): string
1701 {
1702 //echo "<br><br>".htmlentities($output);
1703
1704 while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1705 is_int($end = strpos($output, "<!--ParEnd-->", $start))) {
1706 $output = substr($output, 0, $start) .
1707 str_replace(
1708 array("{","}"),
1709 array("&#123;","&#125;"),
1710 substr($output, $start + 15, $end - ($start + 15))
1711 ) .
1712 substr($output, $end + 13);
1713 }
1714
1715 // $output = str_replace("{", "&#123;", $output);
1716 // $output = str_replace("}", "&#125;", $output);
1717 //echo "<br><br>".htmlentities($output);
1718 return $output;
1719 }
1720
1724 public function getActivationCaptions(): array
1725 {
1726 return array("deactivatePage" => $this->lng->txt("cont_deactivate_page"),
1727 "activatePage" => $this->lng->txt("cont_activate_page"));
1728 }
1729
1733 public function setEditMode(): void
1734 {
1735 $media_mode = $this->request->getString("media_mode");
1736 $html_mode = $this->request->getString("html_mode");
1737 $js_mode = $this->request->getString("js_mode");
1738 if ($media_mode != "") {
1739 if ($media_mode == "disable") {
1740 $this->user->writePref("ilPageEditor_MediaMode", "disable");
1741 } else {
1742 $this->user->writePref("ilPageEditor_MediaMode", "");
1743 }
1744 }
1745 if ($html_mode != "") {
1746 if ($html_mode == "disable") {
1747 $this->user->writePref("ilPageEditor_HTMLMode", "disable");
1748 } else {
1749 $this->user->writePref("ilPageEditor_HTMLMode", "");
1750 }
1751 }
1752 if ($js_mode != "") {
1753 if ($js_mode == "disable") {
1754 $this->user->writePref("ilPageEditor_JavaScript", "disable");
1755 } else {
1756 $this->user->writePref("ilPageEditor_JavaScript", "");
1757 }
1758 }
1759
1760 $this->ctrl->redirect($this, "edit");
1761 }
1762
1763
1767 public static function getTinyMenu(
1768 string $a_par_type,
1769 bool $a_int_links = false,
1770 bool $a_wiki_links = false,
1771 bool $a_keywords = false,
1772 $a_style_id = 0,
1773 $a_paragraph_styles = true,
1774 $a_save_return = true,
1775 $a_anchors = false,
1776 $a_save_new = true,
1777 $a_user_links = false,
1778 \ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper = null
1779 ): string {
1780 global $DIC;
1781
1782 $lng = $DIC->language();
1783 $ctrl = $DIC->ctrl();
1784 $ui = $DIC->ui();
1785
1786 $style_service = $DIC->contentStyle()->internal();
1787 $style_access_manager = $style_service->domain()->access(
1788 0,
1789 $DIC->user()->getId()
1790 );
1791 $char_manager = $style_service->domain()->characteristic(
1792 $a_style_id,
1793 $style_access_manager
1794 );
1795
1796 $aset = new ilSetting("adve");
1797
1798 $f = static function (string $type, string $code) use ($char_manager, $lng): string {
1799 $title = $char_manager->getPresentationTitle("text_inline", $type);
1800 if ($title === $type) {
1801 $title = $lng->txt("cont_char_style_" . $code);
1802 }
1803 return $title;
1804 };
1805
1806 // character styles
1807 $chars = [];
1808 if ($a_style_id === 0) {
1809 $chars = array(
1810 "Comment" => array("code" => "com", "txt" => $f("Comment", "com")),
1811 "Quotation" => array("code" => "quot", "txt" => $f("Quotation", "quot")),
1812 "Accent" => array("code" => "acc", "txt" => $f("Accent", "acc")),
1813 "Code" => array("code" => "code", "txt" => $f("Code", "code"))
1814 );
1815 }
1816 foreach (ilPCParagraphGUI::_getTextCharacteristics($a_style_id, true) as $c) {
1817 if (in_array($c, ["Strong", "Important", "Emph"])) {
1818 continue;
1819 }
1820 if (!isset($chars[$c])) {
1821 $title = $char_manager->getPresentationTitle("text_inline", $c);
1822 switch ($c) {
1823 case "CodeInline":
1824 $chars["Code"] = array("code" => "code", "txt" => $f("Code", "code"));
1825 break;
1826 case "Comment":
1827 $chars["Comment"] = array("code" => "com", "txt" => $f("Comment", "com"));
1828 break;
1829 case "Quotation":
1830 $chars["Quotation"] = array("code" => "quot", "txt" => $f("Quotation", "quot"));
1831 break;
1832 case "Accent":
1833 $chars["Accent"] = array("code" => "acc", "txt" => $f("Accent", "acc"));
1834 break;
1835 default:
1836 $chars[$c] = array("code" => "", "txt" => $title);
1837 break;
1838 }
1839 }
1840 }
1841 $char_formats = [];
1842 foreach ($chars as $key => $char) {
1844 $a_par_type,
1845 "active_" . $char["code"],
1846 true
1847 )) {
1848 $t = "text_inline";
1849 $tag = "span";
1850 switch ($key) {
1851 case "Code": $tag = "code"; break;
1852 }
1853 $html = '<' . $tag . ' class="ilc_' . $t . '_' . $key . '" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char["txt"] . "</" . $tag . ">";
1854 $char_formats[] = ["text" => $html, "action" => "selection.format", "data" => ["format" => $key]];
1855 }
1856 }
1857
1858
1859 $numbered_list = '<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 110-2zM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 01-.5-.5V5h-.5a.5.5 0 010-1H6zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2H4.5a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 010-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 110-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 110-1H6c.6 0 1 .4 1 1z" fill-rule="evenodd"></path></svg>';
1860
1861 $bullet_list = '<svg width="24" height="24"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1z" fill-rule="evenodd"></path></svg>';
1862
1863 $indent = '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z" fill-rule="evenodd"></path></svg>';
1864
1865 $outdent = '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm1.6-3.8a1 1 0 01-1.2 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 011.2 1.6L6.8 12l1.8 1.2z" fill-rule="evenodd"></path></svg>';
1866
1867 // menu
1868 $str = "str";
1869 $emp = "emp";
1870 $imp = "imp";
1871 if ($aset->get("use_physical")) {
1872 $str = "B";
1873 $emp = "I";
1874 $imp = "U";
1875 }
1876 $c_formats = [];
1877 foreach (["str", "emp", "imp", "sup", "sub"] as $c) {
1879 $a_par_type,
1880 "active_" . $c,
1881 true
1882 )) {
1883 switch ($c) {
1884 case "str":
1885 $c_formats[] = ["text" => '<span class="ilc_text_inline_Strong">' . $str . '</span>',
1886 "action" => "selection.format",
1887 "data" => ["format" => "Strong"],
1888 "aria-label" => $lng->txt("cont_text_str")
1889 ];
1890 break;
1891 case "emp":
1892 $c_formats[] = ["text" => '<span class="ilc_text_inline_Emph">' . $emp . '</span>',
1893 "action" => "selection.format",
1894 "data" => ["format" => "Emph"],
1895 "aria-label" => $lng->txt("cont_text_emp")
1896 ];
1897 break;
1898 case "imp":
1899 $c_formats[] = ["text" => '<span class="ilc_text_inline_Important">' . $imp . '</span>',
1900 "action" => "selection.format",
1901 "data" => ["format" => "Important"],
1902 "aria-label" => $lng->txt("cont_text_imp")
1903 ];
1904 break;
1905 case "sup":
1906 $c_formats[] = ["text" => 'x<sup>2</sup>',
1907 "action" => "selection.format",
1908 "data" => ["format" => "Sup"],
1909 "aria-label" => $lng->txt("cont_text_sup")
1910 ];
1911 break;
1912 case "sub":
1913 $c_formats[] = ["text" => 'x<sub>2</sub>',
1914 "action" => "selection.format",
1915 "data" => ["format" => "Sub"],
1916 "aria-label" => $lng->txt("cont_text_sub")
1917 ];
1918 break;
1919 }
1920 }
1921 }
1922 $c_formats[] = ["text" => "<i>A</i>",
1923 "action" => $char_formats,
1924 "aria-label" => $lng->txt("copg_more_character_formats")
1925 ];
1926 $c_formats[] = ["text" => '<i><b><u>T</u></b><sub>x</sub></i>',
1927 "action" => "selection.removeFormat",
1928 "data" => [],
1929 "aria-label" => $lng->txt("copg_remove_formats")
1930 ];
1931 $menu = [
1932 "cont_char_format" => $c_formats,
1933 "cont_lists" => [
1934 [
1935 "text" => $bullet_list,
1936 "action" => "list.bullet",
1937 "data" => [],
1938 "aria-label" => $lng->txt("cont_bullet_list")
1939 ],
1940 [
1941 "text" => $numbered_list,
1942 "action" => "list.number",
1943 "data" => [],
1944 "aria-label" => $lng->txt("cont_numbered_list")
1945 ],
1946 [
1947 "text" => $outdent,
1948 "action" => "list.outdent",
1949 "data" => [],
1950 "aria-label" => $lng->txt("cont_list_outdent")
1951 ],
1952 [
1953 "text" => $indent,
1954 "action" => "list.indent",
1955 "data" => [],
1956 "aria-label" => $lng->txt("cont_list_indent")
1957 ]
1958 ]
1959 ];
1960
1961 // more...
1962
1963 // links
1964 $links = [];
1965 if ($a_wiki_links) {
1966 $links[] = ["text" => $lng->txt("cont_wiki_link_dialog"), "action" => "link.wikiSelection", "data" => [
1967 "url" => $ctrl->getLinkTargetByClass("ilwikipagegui", "")]];
1968 $links[] = ["text" => "[[" . $lng->txt("cont_wiki_page") . "]]", "action" => "link.wiki", "data" => []];
1969 }
1970 if ($a_int_links) {
1971 $links[] = ["text" => $lng->txt("cont_text_iln_link"), "action" => "link.internal", "data" => []];
1972 }
1974 $a_par_type,
1975 "active_xln",
1976 true
1977 )) {
1978 $links[] = ["text" => $lng->txt("cont_text_xln"), "action" => "link.external", "data" => []];
1979 }
1980 if ($a_user_links) {
1981 $links[] = ["text" => $lng->txt("cont_link_user"), "action" => "link.user", "data" => []];
1982 }
1983
1984
1985 // more
1986 $menu["cont_more_functions"] = [];
1987 $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_link") . '<i class="mce-ico mce-i-link"></i>', "action" => $links];
1988
1989 if ($a_keywords) {
1990 $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_keyword"), "action" => "selection.keyword", "data" => []];
1991 }
1992 $mathJaxSetting = new ilSetting("MathJax");
1994 $a_par_type,
1995 "active_tex",
1996 true
1997 )) {
1998 if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
1999 $menu["cont_more_functions"][] = ["text" => 'Tex', "action" => "selection.tex", "data" => []];
2000 }
2001 }
2003 $a_par_type,
2004 "active_fn",
2005 true
2006 )) {
2007 $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_footnote"), "action" => "selection.fn", "data" => []];
2008 }
2009 if ($a_anchors) {
2010 $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_anchor"), "action" => "selection.anchor", "data" => []];
2011 }
2012
2013 $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2014
2015 foreach ($menu as $section_title => $section) {
2016 foreach ($section as $item) {
2017 if (is_array($item["action"])) {
2018 $buttons = [];
2019 foreach ($item["action"] as $i) {
2020 $buttons[] = $ui_wrapper->getButton(
2021 $i["text"],
2022 "par-action",
2023 $i["action"],
2024 $i["data"],
2025 "",
2026 $i["aria-label"] ?? ""
2027 );
2028 }
2029 $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($item["text"])
2030 ->withAriaLabel($item["aria-label"] ?? "");
2031 $btpl->setCurrentBlock("button");
2032 $btpl->setVariable("BUTTON", $ui->renderer()->renderAsync($dd));
2033 } else {
2034 $b = $ui_wrapper->getRenderedButton(
2035 $item["text"],
2036 "par-action",
2037 $item["action"],
2038 $item["data"],
2039 "",
2040 $item["aria-label"] ?? ""
2041 );
2042 $btpl->setCurrentBlock("button");
2043 $btpl->setVariable("BUTTON", $b);
2044 }
2045 $btpl->parseCurrentBlock();
2046 }
2047 $btpl->setCurrentBlock("section");
2048 $btpl->setVariable("TXT_SECTION", $lng->txt($section_title));
2049 $btpl->parseCurrentBlock();
2050 }
2051
2052
2053 if ($a_paragraph_styles) {
2054 $sel = new \ILIAS\COPage\Editor\Components\Paragraph\ParagraphStyleSelector($ui_wrapper, $a_style_id);
2055 $dd = $sel->getStyleSelector("");
2056 $btpl->setCurrentBlock("par_edit");
2057 $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2058
2059 $btpl->setVariable("STYLE_SELECTOR", $ui->renderer()->render($dd));
2060
2061 $btpl->parseCurrentBlock();
2062 }
2063
2064 // block styles
2065 $sel = new \ILIAS\COPage\Editor\Components\Section\SectionStyleSelector($ui_wrapper, $a_style_id);
2066 $dd = $sel->getStyleSelector("", $type = "par-action", $action = "sec.class", $attr = "class", true);
2067 $btpl->setVariable("TXT_BLOCK", $lng->txt("cont_sur_block_format"));
2068 $btpl->setVariable("BLOCK_STYLE_SELECTOR", $ui->renderer()->render($dd));
2069
2070
2071 $btpl->setVariable("TINY_HEADER", $lng->txt("cont_text_editing"));
2072 $btpl->setVariable(
2073 "SPLIT_BUTTON",
2074 $ui_wrapper->getRenderedButton($lng->txt("cont_quit_text_editing"), "par-action", "save.return")
2075 );
2076
2077 /*
2078 $btpl->setVariable(
2079 "CANCEL_BUTTON",
2080 $ui_wrapper->getRenderedButton($lng->txt("cancel"), "par-action", "component.cancel")
2081 );*/
2082
2083 $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2084 $btpl->setVariable("SRC_LOADER", \ilUtil::getImagePath("loader.svg"));
2085 $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type, true, $a_style_id));
2087 "ilAdvSelListAnchorElement_char_style_selection",
2088 $lng->txt("cont_more_character_styles"),
2089 "iltinymenu_bd"
2090 );
2091
2092 return $btpl->get();
2093 }
2094
2095 public function setDefaultLinkXml(): void
2096 {
2097 $this->page_linker->setProfileBackUrl($this->getProfileBackUrl());
2098 $this->page_linker->setOffline($this->getOutputMode() == self::OFFLINE);
2099 $this->setLinkXml($this->page_linker->getLinkXML($this->getPageObject()->getInternalLinks()));
2100 }
2101
2102 public function setLinkXml(string $xml): void
2103 {
2104 $this->link_xml = $xml;
2105 $this->link_xml_set = true;
2106 }
2107
2108
2109 public function getProfileBackUrl(): string
2110 {
2111 if ($this->profile_back_url != "") {
2112 return $this->profile_back_url;
2113 }
2114 if ($this->getOutputMode() === self::OFFLINE ||
2115 $this->getOutputMode() === self::PRINTING) {
2116 return "";
2117 }
2118 return $this->ctrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
2119 }
2120
2121 public function setProfileBackUrl(string $url): void
2122 {
2123 $this->profile_back_url = $url;
2124 }
2125
2126
2127 public function downloadFile(): void
2128 {
2129 $file_id = 0;
2130 $download_ok = false;
2131
2132 $pg_obj = $this->getPageObject();
2133 $pg_obj->buildDom();
2134 $int_links = $pg_obj->getInternalLinks();
2135 $req_file_id = $this->requested_file_id;
2136 foreach ($int_links as $il) {
2137 if ($il["Target"] == str_replace("_file_", "_dfile_", $req_file_id)) {
2138 $file = explode("_", $req_file_id);
2139 $file_id = (int) $file[count($file) - 1];
2140 $download_ok = true;
2141 }
2142 }
2143 if (in_array($req_file_id, $pg_obj->getAllFileObjIds())) {
2144 $file = explode("_", $req_file_id);
2145 $file_id = (int) $file[count($file) - 1];
2146 $download_ok = true;
2147 }
2148
2149 $pcs = ilPageContentUsage::getUsagesOfPage($pg_obj->getId(), $pg_obj->getParentType() . ":pg", 0, false);
2150 foreach ($pcs as $pc) {
2151 $files = ilObjFile::_getFilesOfObject("mep:pg", $pc["id"], 0);
2152 $file = explode("_", $req_file_id);
2153 $file_id = (int) $file[count($file) - 1];
2154 if (in_array($file_id, $files)) {
2155 $download_ok = true;
2156 }
2157 }
2158
2159 if ($download_ok) {
2160 $fileObj = new ilObjFile($file_id, false);
2161 $fileObj->sendFile();
2162 exit;
2163 }
2164 }
2165
2166 public function displayMediaFullscreen(): void
2167 {
2168 $this->displayMedia(true);
2169 }
2170
2171 public function displayMedia(bool $a_fullscreen = false): void
2172 {
2173 $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2174 $tpl->setCurrentBlock("ilMedia");
2175
2176 //$int_links = $page_object->getInternalLinks();
2177 $med_links = ilMediaItem::_getMapAreasIntLinks($this->request->getMobId());
2178
2179 // @todo
2180 $link_xml = $this->page_linker->getLinkXML($med_links);
2181
2182 $media_obj = new ilObjMediaObject($this->request->getMobId());
2183 if ($this->request->getPageType() === "mep") {
2184 $pg_obj = new ilMediaPoolPage($this->request->getPageId());
2185 } else {
2186 $pg_obj = $this->getPageObject();
2187 }
2188 $pg_obj->buildDom();
2189
2190 $xml = "<dummy>";
2191 if ($this->requested_pg_id > 0) {
2192 $xml .= $pg_obj->getMediaAliasElement($this->request->getMobId());
2193 } else {
2194 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2195 }
2196 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2197 $xml .= $link_xml;
2198 $xml .= "</dummy>";
2199
2200 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2201 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2202 $xh = xslt_create();
2203
2204 $mode = "media";
2205 if ($a_fullscreen) {
2206 $mode = "fullscreen";
2207 }
2208
2209 //echo "<b>XML:</b>".htmlentities($xml);
2210 // determine target frames for internal links
2211 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
2212 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2213 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
2214 'link_params' => "ref_id=" . $this->requested_ref_id,'fullscreen_link' => "",
2215 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
2216 'ref_id' => $this->requested_ref_id, 'webspace_path' => $wb_path);
2217 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2218 //echo "<br><br>".htmlentities($output);
2219 //echo xslt_error($xh);
2220 xslt_free($xh);
2221
2222 // unmask user html
2225 $tpl->setVariable("MEDIA_CONTENT", $output);
2226
2227 // add js
2229 //$tpl->fillJavaScriptFiles();
2230 //$tpl->fillCssFiles();
2231
2232 $tpl->printToStdout();
2233 exit;
2234 }
2235
2239 public function download_paragraph(): void
2240 {
2241 $pg_obj = $this->getPageObject();
2242 $pg_obj->send_paragraph(
2243 $this->request->getString("par_id"),
2244 $this->request->getString("downloadtitle")
2245 );
2246 }
2247
2248 public function insertPageToc(string $a_output): string
2249 {
2250 // extract all headings
2251 $offsets = [];
2252 $cpos = 0;
2253 while (is_int($pos = strpos($a_output, "ilPageTocH", $cpos))) {
2254 $offsets[] = $pos;
2255 $cpos = $pos + 1;
2256 }
2257
2258 $page_heads = array();
2259 foreach ($offsets as $os) {
2260 $level = (int) substr($a_output, $os + 10, 1);
2261 if (in_array($level, array(1,2,3))) {
2262 $anchor = str_replace(
2263 "TocH",
2264 "TocA",
2265 substr($a_output, $os, strpos($a_output, "-->", $os) - $os)
2266 );
2267
2268 // get heading
2269 $tag_start = stripos($a_output, "<h" . $level . " ", $os);
2270 $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
2271 $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2272
2273 // get headings text
2274 $text_start = stripos($head, ">") + 1;
2275 $text_end = strripos($head, "<!--", $text_start);
2276 $text = substr($head, $text_start, $text_end - $text_start);
2277 $page_heads[] = array("level" => $level, "text" => $text,
2278 "anchor" => $anchor);
2279 }
2280 }
2281 if (count($page_heads) > 1) {
2282 $list = new ilNestedList();
2283 $list->setAutoNumbering(true);
2284 $list->setListClass("ilc_page_toc_PageTOCList");
2285 $list->setItemClass("ilc_page_toc_PageTOCItem");
2286 $i = 0;
2287 $c_depth = 1;
2288 $c_par[1] = 0;
2289 $c_par[2] = 0;
2290 $page_toc_ph = "<!--PageTocPH-->";
2291 foreach ($page_heads as $ind => $h) {
2292 $i++;
2293 $par = 0;
2294
2295 // check if we have a parent for one level up
2296 $par = 0;
2297 if ($h["level"] == 2 && $c_par[1] > 0) {
2298 $par = $c_par[1];
2299 }
2300 if ($h["level"] == 3 && $c_par[2] > 0) {
2301 $par = $c_par[2];
2302 }
2303
2304 $h["text"] = str_replace($page_toc_ph, "", $h["text"]);
2305
2306 // add the list node
2307 $list->addListNode(
2308 "<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>",
2309 $i,
2310 $par
2311 );
2312
2313 // set the node as current parent of the level
2314 if ($h["level"] == 1) {
2315 $c_par[1] = $i;
2316 $c_par[2] = 0;
2317 }
2318 if ($h["level"] == 2) {
2319 $c_par[2] = $i;
2320 }
2321 }
2322
2323 $tpl = new ilTemplate(
2324 "tpl.page_toc.html",
2325 true,
2326 true,
2327 "Services/COPage"
2328 );
2329 $tpl->setVariable("PAGE_TOC", $list->getHTML());
2330 $tpl->setVariable("TXT_PAGE_TOC", $this->lng->txt("cont_page_toc"));
2331 $tpl->setVariable("TXT_HIDE", $this->lng->txt("hide"));
2332 $tpl->setVariable("TXT_SHOW", $this->lng->txt("show"));
2333
2334 $a_output = str_replace(
2335 "{{{{{PageTOC}}}}}",
2336 $tpl->get(),
2337 $a_output
2338 );
2339 $numbers = $list->getNumbers();
2340
2341 if (count($numbers) > 0) {
2342 foreach ($numbers as $n) {
2343 $a_output = (strpos($a_output, $page_toc_ph) !== false)
2344 ? substr_replace($a_output, $n . " ", strpos($a_output, $page_toc_ph), strlen($page_toc_ph))
2345 : $a_output;
2346 }
2347 }
2348 } else {
2349 $a_output = str_replace(
2350 "{{{{{PageTOC}}}}}",
2351 "",
2352 $a_output
2353 );
2354 }
2355
2356 return $a_output;
2357 }
2358
2359 public function insertResources(string $a_output): string
2360 {
2361 // this is edit mode only
2362 if ($this->getEnablePCType("Resources") &&
2363 ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview")) {
2365 }
2366 return $a_output;
2367 }
2368
2369
2370
2374 public function insertAdvTrigger(string $a_output): string
2375 {
2376 if (!$this->getAbstractOnly()) {
2377 $a_output = str_replace(
2378 "{{{{{LV_show_adv}}}}}",
2379 $this->lng->txt("cont_show_adv"),
2380 $a_output
2381 );
2382 $a_output = str_replace(
2383 "{{{{{LV_hide_adv}}}}}",
2384 $this->lng->txt("cont_hide_adv"),
2385 $a_output
2386 );
2387 } else {
2388 $a_output = str_replace(
2389 "{{{{{LV_show_adv}}}}}",
2390 "",
2391 $a_output
2392 );
2393 $a_output = str_replace(
2394 "{{{{{LV_hide_adv}}}}}",
2395 "",
2396 $a_output
2397 );
2398 }
2399
2400 return $a_output;
2401 }
2402
2403
2408 public function postOutputProcessing(string $a_output): string
2409 {
2410 return $a_output;
2411 }
2412
2413
2417 public function previewHistory(): void
2418 {
2419 $this->preview();
2420 }
2421
2422 public function preview(): string
2423 {
2424 $this->setOutputMode(self::PREVIEW);
2425 $this->tabs_gui->activateTab("cont_preview");
2426 return $this->showPage();
2427 }
2428
2432 protected function setEditorToolContext(): void
2433 {
2434 $collection = $this->tool_context->current()->getAdditionalData();
2435 if ($collection->exists(ilCOPageEditGSToolProvider::SHOW_EDITOR)) {
2436 $collection->replace(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2437 } else {
2438 $collection->add(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2439 }
2440 }
2441
2442 protected function initEditing(): void
2443 {
2444 // editing allowed?
2445 if (!$this->getEnableEditing()) {
2446 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
2447 $this->ctrl->redirect($this, "preview");
2448 }
2449
2450 // not so nive workaround for container pages, bug #0015831
2451 $ptype = $this->getParentType();
2452 if ($ptype == "cont" && $this->requested_ref_id > 0) {
2453 $ptype = ilObject::_lookupType($this->requested_ref_id, true);
2454 }
2455 $this->setScreenIdComponent();
2456 $this->help->setScreenId("edit_" . $ptype);
2457
2458 // edit lock
2459 if (!$this->getPageObject()->getEditLock()) {
2460 $this->showEditLockInfo();
2461 return;
2462 } else {
2463 $this->setEditorToolContext();
2464 }
2465
2466 $this->lng->toJS("paste");
2467 $this->lng->toJS("delete");
2468 $this->lng->toJS("cont_delete_content");
2469 $this->lng->toJS("copg_confirm_el_deletion");
2470 $this->lng->toJS("cont_saving");
2471 $this->lng->toJS("cont_ed_par");
2472 $this->lng->toJS("cont_no_block");
2473 $this->lng->toJS("copg_error");
2474 $this->lng->toJS("cont_ed_click_to_add_pg");
2475 $this->lng->toJS("cont_ed_new_item_after");
2476 $this->lng->toJS("cont_ed_new_item_before");
2477 $this->lng->toJS("cont_ed_item_up");
2478 $this->lng->toJS("cont_ed_item_down");
2479 $this->lng->toJS("cont_ed_delete_item");
2480 $this->lng->toJS("copg_edit_iframe_title");
2481 $this->lng->toJS("copg_par_format_selection");
2482 // workaroun: we need this js for the new editor version, e.g. for new section form to work
2483 // @todo: solve this in a smarter way
2484 $this->tpl->addJavaScript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
2487 }
2488
2489 protected function showEditLockInfo(): void
2490 {
2491 $info = $this->lng->txt("content_no_edit_lock");
2492 $lock = $this->getPageObject()->getEditLockInfo();
2493 $info .= "</br>" . $this->lng->txt("content_until") . ": " .
2494 ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2495 $info .= "</br>" . $this->lng->txt("obj_usr") . ": " .
2496 ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2497
2498 $back_link = $this->ui->factory()->link()->standard(
2499 $this->lng->txt("back"),
2500 $this->ctrl->getLinkTarget($this, "finishEditing")
2501 );
2502
2503 $mbox = $this->ui->factory()->messageBox()->info($info)
2504 ->withLinks([$back_link]);
2505 $rendered_mbox = $this->ui->renderer()->render($mbox);
2506
2507 if (!$this->ctrl->isAsynch()) {
2508 $this->tpl->setContent($rendered_mbox);
2509 } else {
2510 echo $rendered_mbox;
2511 exit;
2512 }
2513 }
2514
2515 public function edit(): string
2516 {
2517 $this->setOutputMode(self::EDIT);
2518 $html = $this->showPage();
2519
2520 if ($this->isEnabledNotes()) {
2521 $html .= "<br /><br />" . $this->getNotesHTML();
2522 }
2523
2524 return $html;
2525 }
2526
2527 public function getBlockingInfoMessage(): string
2528 {
2529 $ui = $this->ui;
2530
2531 $lock = $this->getPageObject()->getEditLockInfo();
2532 $info = $this->lng->txt("cont_got_lock_release");
2533 $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)), $info);
2534
2535 $mbox = $ui->factory()->messageBox()->info($info);
2536
2537 return $ui->renderer()->render($mbox);
2538 }
2539
2540 public function insertJSAtPlaceholder(): string
2541 {
2542 $pl_pc_id = $this->request->getPlaceholderPCId();
2543 $this->obj->buildDom();
2544 $this->obj->addHierIDs();
2545 $this->setOpenPlaceHolder($pl_pc_id);
2546 return $this->edit();
2547 }
2548
2549 public function presentation(string $a_mode = self::PRESENTATION): string
2550 {
2551 $this->setOutputMode($a_mode);
2552
2553 return $this->showPage();
2554 }
2555
2556 public function getHTML(): string
2557 {
2558 $this->getTabs("preview");
2559 return $this->showPage();
2560 }
2561
2565 public function showMediaFullscreen(int $a_style_id = 0): void
2566 {
2567 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
2568 $this->tpl->setCurrentBlock("ContentStyle");
2569 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
2570 $this->tpl->parseCurrentBlock();
2571
2572 $this->tpl->setVariable(
2573 "PAGETITLE",
2574 " - " . ilObject::_lookupTitle($this->request->getMobId())
2575 );
2576 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2577 $this->tpl->setCurrentBlock("ilMedia");
2578
2579 $media_obj = new ilObjMediaObject($this->request->getMobId());
2580 if ($this->requested_pg_id > 0) {
2581 $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $this->requested_pg_id);
2582 $pg_obj->buildDom();
2583
2584 $xml = "<dummy>";
2585 // todo: we get always the first alias now (problem if mob is used multiple
2586 // times in page)
2587 $xml .= $pg_obj->getMediaAliasElement($this->request->getMobId());
2588 } else {
2589 $xml = "<dummy>";
2590 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2591 }
2592 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2593 $xml .= "</dummy>";
2594
2595 //echo htmlentities($xml); exit;
2596
2597 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2598 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2599 $xh = xslt_create();
2600
2601 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
2602 $mode = "fullscreen";
2603 $params = array('mode' => $mode,
2604 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
2605 'webspace_path' => $wb_path);
2606 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2607 xslt_error($xh);
2608 xslt_free($xh);
2609
2610 // unmask user html
2611 $this->tpl->setVariable("MEDIA_CONTENT", $output);
2612 }
2613
2619 public function displayValidationError($a_error): void
2620 {
2621 if (is_array($a_error)) {
2622 $error_str = "<b>Error(s):</b><br>";
2623 foreach ($a_error as $error) {
2624 $err_mess = implode(" - ", $error);
2625 if (!is_int(strpos($err_mess, ":0:"))) {
2626 $error_str .= htmlentities($err_mess) . "<br />";
2627 }
2628 }
2629 $this->tpl->setVariable("MESSAGE", $error_str);
2630 }
2631 }
2632
2633 protected function setBackToEditTabs(): void
2634 {
2635 $this->tabs_gui->clearTargets();
2636 $this->tabs_gui->setBackTarget(
2637 $this->lng->txt("back"),
2638 $this->ctrl->getLinkTarget($this, "edit")
2639 );
2640 }
2641
2645 public function history(): string
2646 {
2647 if (!$this->getEnableEditing()) {
2648 return "";
2649 }
2650
2651 $this->setBackToEditTabs();
2652
2653 $this->tpl->addJavaScript("./Services/COPage/js/page_history.js");
2654
2655 $table_gui = new ilPageHistoryTableGUI($this, "history");
2656 $table_gui->setId("hist_table");
2657 $entries = $this->getPageObject()->getHistoryEntries();
2658 $entries[] = array('page_id' => $this->getPageObject()->getId(),
2659 'parent_type' => $this->getPageObject()->getParentType(),
2660 'hdate' => $this->getPageObject()->getLastChange(),
2661 'parent_id' => $this->getPageObject()->getParentId(),
2662 'nr' => 0,
2663 'sortkey' => 999999,
2664 'user' => $this->getPageObject()->last_change_user);
2665 $table_gui->setData($entries);
2666 return $table_gui->getHTML();
2667 }
2668
2672 public function rollbackConfirmation(): void
2673 {
2674 if (!$this->getEnableEditing()) {
2675 return;
2676 }
2677
2678 $c_gui = new ilConfirmationGUI();
2679
2680 // set confirm/cancel commands
2681 $this->ctrl->setParameter($this, "rollback_nr", $this->requested_old_nr);
2682 $c_gui->setFormAction($this->ctrl->getFormAction($this, "rollback"));
2683 $c_gui->setHeaderText($this->lng->txt("cont_rollback_confirmation"));
2684 $c_gui->setCancel($this->lng->txt("cancel"), "history");
2685 $c_gui->setConfirm($this->lng->txt("confirm"), "rollback");
2686
2687 $hentry = $this->obj->getHistoryEntry($this->requested_old_nr);
2688
2689 $c_gui->addItem(
2690 "id[]",
2691 $this->requested_old_nr,
2693 );
2694
2695 $this->tpl->setContent($c_gui->getHTML());
2696 }
2697
2701 public function rollback(): void
2702 {
2703 if (!$this->getEnableEditing()) {
2704 return;
2705 }
2706
2707 $hentry = $this->obj->getHistoryEntry(
2708 $this->request->getString("rollback_nr")
2709 );
2710
2711 if ($hentry["content"] != "") {
2712 $this->obj->setXMLContent($hentry["content"]);
2713 $this->obj->buildDom(true);
2714 if ($this->obj->update()) {
2715 $this->ctrl->redirect($this, "history");
2716 }
2717 }
2718 $this->ctrl->redirect($this, "history");
2719 }
2720
2721 public function setScreenIdComponent(): void
2722 {
2723 $this->help->setScreenIdComponent("copg");
2724 }
2725
2726 public function getTabs(string $a_activate = ""): void
2727 {
2728 if (in_array($this->getOutputMode(), [self::OFFLINE])) {
2729 return;
2730 }
2731 $this->setScreenIdComponent();
2732
2733 if (!$this->getEnabledTabs()) {
2734 return;
2735 }
2736
2737 // back to upper context
2738 if (!$this->getEditPreview()) {
2739 $this->tabs_gui->addTarget("pg", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
2740 } else {
2741 $this->tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
2742 }
2743
2744 if ($this->use_meta_data) {
2745 $mdgui = new ilObjectMetaDataGUI(
2746 $this->meta_data_rep_obj,
2747 $this->meta_data_type,
2748 $this->meta_data_sub_obj_id
2749 );
2750 $mdtab = $mdgui->getTab();
2751 if ($mdtab) {
2752 $this->tabs_gui->addTarget(
2753 "meta_data",
2754 $mdtab,
2755 "",
2756 "ilobjectmetadatagui"
2757 );
2758 }
2759 }
2760
2761 $lm_set = new ilSetting("lm");
2762
2763 /*
2764 if ($this->getEnableEditing() && $lm_set->get("page_history", 1)) {
2765 $this->tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
2766 if ($this->requested_history_mode == 1 || $this->ctrl->getCmd() == "compareVersion") {
2767 $this->tabs_gui->activateTab("history");
2768 }
2769 }*/
2770
2771 /*
2772 if ($this->getEnableEditing() && $this->user->getId() != ANONYMOUS_USER_ID) {
2773 $this->tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilEditClipboardGUI"), "view"), "view", "ilEditClipboardGUI");
2774 }*/
2775
2776 if ($this->getPageConfig()->getEnableScheduledActivation()) {
2777 $this->tabs_gui->addTarget(
2778 "cont_activation",
2779 $this->ctrl->getLinkTarget($this, "editActivation"),
2780 "editActivation",
2781 get_class($this)
2782 );
2783 }
2784
2785 if ($this->getEnabledNews()) {
2786 $this->tabs_gui->addTarget(
2787 "news",
2788 $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
2789 "",
2790 "ilnewsitemgui"
2791 );
2792 }
2793
2794 // external hook to add tabs
2795 if (is_array($this->tab_hook)) {
2796 $func = $this->tab_hook["func"];
2797 $this->tab_hook["obj"]->$func();
2798 }
2799 }
2800
2804 public function compareVersion(): string
2805 {
2806 if (!$this->getEnableEditing()) {
2807 return "";
2808 }
2809
2810 $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
2811 $compare = $this->obj->compareVersion(
2812 $this->request->getInt("left"),
2813 $this->request->getInt("right")
2814 );
2815
2816 // left page
2817 $lpage = $compare["l_page"];
2818 $cfg = $this->getPageConfig();
2819 $cfg->setPreventHTMLUnmasking(true);
2820
2821 $this->setOutputMode(self::PREVIEW);
2822 $this->setPageObject($lpage);
2823 $this->setPresentationTitle($this->getPresentationTitle());
2824 $this->setCompareMode(true);
2825
2826 $lhtml = $this->showPage();
2827 $lhtml = $this->replaceDiffTags($lhtml);
2828 $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
2829 $tpl->setVariable("LEFT", $lhtml);
2830
2831 // right page
2832 $rpage = $compare["r_page"];
2833 $this->setPageObject($rpage);
2834 $this->setPresentationTitle($this->getPresentationTitle());
2835 $this->setCompareMode(true);
2836 $this->setOutputMode(self::PREVIEW);
2837
2838 $rhtml = $this->showPage();
2839 $rhtml = $this->replaceDiffTags($rhtml);
2840 $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
2841 $tpl->setVariable("RIGHT", $rhtml);
2842
2843 $tpl->setVariable("TXT_NEW", $this->lng->txt("cont_pc_new"));
2844 $tpl->setVariable("TXT_MODIFIED", $this->lng->txt("cont_pc_modified"));
2845 $tpl->setVariable("TXT_DELETED", $this->lng->txt("cont_pc_deleted"));
2846
2847 return $tpl->get();
2848 }
2849
2850 public function replaceDiffTags(string $a_html): string
2851 {
2852 $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
2853 $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
2854 $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
2855 $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
2856
2857 return $a_html;
2858 }
2859
2863 public function editActivation(): void
2864 {
2865 $this->setBackToEditTabs();
2866
2867 $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
2868 $this->initActivationForm();
2869 $this->getActivationFormValues();
2870 $atpl->setVariable("FORM", $this->form->getHTML());
2871 $atpl->setCurrentBlock("updater");
2872 $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
2873 $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
2874 $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
2875 $atpl->parseCurrentBlock();
2876 $this->tpl->setContent($atpl->get());
2877 }
2878
2882 public function initActivationForm(): void
2883 {
2884 $this->form = new ilPropertyFormGUI();
2885 $this->form->setFormAction($this->ctrl->getFormAction($this));
2886 $this->form->setTitle($this->lng->txt("cont_page_activation"));
2887
2888 // activation type radio
2889 $rad = new ilRadioGroupInputGUI($this->lng->txt("cont_activation"), "activation");
2890 $rad_op1 = new ilRadioOption($this->lng->txt("cont_activated"), "activated");
2891
2892 $rad->addOption($rad_op1);
2893 $rad_op2 = new ilRadioOption($this->lng->txt("cont_deactivated"), "deactivated");
2894 $rad->addOption($rad_op2);
2895 $rad_op3 = new ilRadioOption($this->lng->txt("cont_scheduled_activation"), "scheduled");
2896
2897 $dt_prop = new ilDateTimeInputGUI($this->lng->txt("cont_start"), "start");
2898 $dt_prop->setRequired(true);
2899 $dt_prop->setShowTime(true);
2900 $rad_op3->addSubItem($dt_prop);
2901 $dt_prop2 = new ilDateTimeInputGUI($this->lng->txt("cont_end"), "end");
2902 $dt_prop2->setRequired(true);
2903 $dt_prop2->setShowTime(true);
2904 $rad_op3->addSubItem($dt_prop2);
2905
2906 // show activation information
2907 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
2908 $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
2909 $rad_op3->addSubItem($cb);
2910
2911
2912 $rad->addOption($rad_op3);
2913
2914 $this->form->addCommandButton("saveActivation", $this->lng->txt("save"));
2915
2916 $this->form->addItem($rad);
2917 }
2918
2922 public function getActivationFormValues(): void
2923 {
2924 $activation = "deactivated";
2925 if ($this->getPageObject()->getActive()) {
2926 $activation = "activated";
2927 }
2928
2929 $dt_prop = $this->form->getItemByPostVar("start");
2930 if ($this->getPageObject()->getActivationStart() != "") {
2931 $activation = "scheduled";
2932 $dt_prop->setDate(new ilDateTime(
2933 $this->getPageObject()->getActivationStart(),
2935 ));
2936 }
2937 $dt_prop = $this->form->getItemByPostVar("end");
2938 if ($this->getPageObject()->getActivationEnd() != "") {
2939 $activation = "scheduled";
2940 $dt_prop->setDate(new ilDateTime(
2941 $this->getPageObject()->getActivationEnd(),
2943 ));
2944 }
2945
2946 $this->form->getItemByPostVar("activation")->setValue($activation);
2947 $this->form->getItemByPostVar("show_activation_info")->setChecked($this->getPageObject()->getShowActivationInfo());
2948 }
2949
2953 public function saveActivation(): void
2954 {
2955 $this->initActivationForm();
2956
2957 if ($this->form->checkInput()) {
2958 $this->getPageObject()->setActive(true);
2959 $this->getPageObject()->setActivationStart(null);
2960 $this->getPageObject()->setActivationEnd(null);
2961 $this->getPageObject()->setShowActivationInfo(
2962 $this->request->getString("show_activation_info")
2963 );
2964 $activation = $this->request->getString("activation");
2965 if ($activation == "deactivated") {
2966 $this->getPageObject()->setActive(false);
2967 }
2968 if ($activation == "scheduled") {
2969 $this->getPageObject()->setActive(false);
2970 $this->getPageObject()->setActivationStart(
2971 $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME)
2972 );
2973 $this->getPageObject()->setActivationEnd(
2974 $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME)
2975 );
2976 }
2977 $this->getPageObject()->update();
2978 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
2979 $this->ctrl->redirect($this, "editActivation");
2980 }
2981 $this->form->setValuesByPost();
2982 $this->tpl->setContent($this->form->getHTML());
2983 }
2984
2988 public function getNotesHTML(
2989 object $a_content_object = null,
2990 bool $a_enable_private_notes = true,
2991 bool $a_enable_public_notes = false,
2992 bool $a_enable_notes_deletion = false,
2993 callable $a_callback = null,
2994 bool $export = false
2995 ): string {
2996 // scorm 2004 page gui
2997 if (!$a_content_object) {
2998 $notes_gui = new ilNoteGUI(
2999 $this->notes_parent_id,
3000 $this->obj->getId(),
3001 "pg"
3002 );
3003
3004 $a_enable_private_notes = true;
3005 $a_enable_public_notes = true;
3006 $a_enable_notes_deletion = false;
3007 $notes_gui->setUseObjectTitleHeader(false);
3008 }
3009 // wiki page gui, blog posting gui
3010 else {
3011 $notes_gui = new ilNoteGUI(
3012 $a_content_object->getParentId(),
3013 $a_content_object->getId(),
3014 $a_content_object->getParentType()
3015 );
3016 $notes_gui->setUseObjectTitleHeader(false);
3017 }
3018
3019 if ($a_enable_private_notes) {
3020 $notes_gui->enablePrivateNotes();
3021 }
3022 if ($a_enable_public_notes) {
3023 $notes_gui->enablePublicNotes();
3024 if ($a_enable_notes_deletion) {
3025 $notes_gui->enablePublicNotesDeletion(true);
3026 }
3027 }
3028 if ($export) {
3029 $notes_gui->setExportMode();
3030 }
3031
3032 if ($a_callback) {
3033 $notes_gui->addObserver($a_callback);
3034 }
3035
3036 $next_class = $this->ctrl->getNextClass($this);
3037 if ($next_class == "ilnotegui") {
3038 $html = $this->ctrl->forwardCommand($notes_gui);
3039 } else {
3040 $html = $notes_gui->getCommentsHTML();
3041 }
3042 return $html;
3043 }
3044
3048 public function processAnswer(): void
3049 {
3051 $this->request->getString("type"),
3052 $this->request->getString("id"),
3053 $this->request->getString("answer")
3054 );
3055 }
3056
3057
3058 //
3059 // Initially opened content (e.g. used in learning modules), that
3060 // is presented in another than the main content area (e.g. a picture in
3061 // the bottom left area)
3062 //
3063
3067 public function initialOpenedContent(): void
3068 {
3069 $this->tabs_gui->activateTab("edit");
3070 $form = $this->initOpenedContentForm();
3071 $this->tpl->setContent($form->getHTML());
3072 }
3073
3075 {
3076 $form = new ilPropertyFormGUI();
3077
3078 // link input
3079 $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3080 $ac->setAllowedLinkTypes(ilLinkInputGUI::INT);
3081 $ac->setInternalLinkDefault("Media_Media", 0);
3082 $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3083 $val = $this->obj->getInitialOpenedContent();
3084 if (($val["id"] ?? '') != "" && ($val["type"] ?? '') != "") {
3085 $ac->setValue($val["type"] . "|" . $val["id"] . "|" . $val["target"]);
3086 }
3087
3088 $form->addItem($ac);
3089
3090 $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3091 $form->addCommandButton("edit", $this->lng->txt("cancel"));
3092 $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3093 $form->setFormAction($this->ctrl->getFormAction($this));
3094
3095 return $form;
3096 }
3097
3098 public function saveInitialOpenedContent(): void
3099 {
3100 $this->obj->saveInitialOpenedContent(
3101 $this->request->getString("opened_content_ajax_type"),
3102 $this->request->getInt("opened_content_ajax_id"),
3103 $this->request->getString("opened_content_ajax_target")
3104 );
3105
3106 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"));
3107 $this->ctrl->redirect($this, "edit");
3108 }
3109
3113
3114
3118 public function switchToLanguage(): void
3119 {
3120 $l = $this->request->getString("totransl");
3121 $p = $this->getPageObject();
3122 if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l)) {
3123 $this->confirmPageTranslationCreation();
3124 return;
3125 }
3126 $this->ctrl->setParameter($this, "transl", $l);
3127 $this->ctrl->redirect($this, "edit");
3128 }
3129
3133 public function confirmPageTranslationCreation(): void
3134 {
3135 $l = $this->request->getString("totransl");
3136 $this->ctrl->setParameter($this, "totransl", $l);
3137 $this->lng->loadLanguageModule("meta");
3138
3139 $cgui = new ilConfirmationGUI();
3140 $cgui->setFormAction($this->ctrl->getFormAction($this));
3141 $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
3142 $this->lng->txt("meta_l_" . $l));
3143 $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
3144 $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");
3145 $this->tpl->setContent($cgui->getHTML());
3146 }
3147
3151 public function editMasterLanguage(): void
3152 {
3153 $this->ctrl->setParameter($this, "transl", "-");
3154 $this->ctrl->redirect($this, "edit");
3155 }
3156
3160 public function createPageTranslation(): void
3161 {
3162 $l = $this->request->getString("totransl");
3163
3165 $this->getPageObject()->getParentType(),
3166 $this->getPageObject()->getId(),
3167 0,
3168 "-"
3169 );
3170 $p->copyPageToTranslation($l);
3171 $this->ctrl->setParameter($this, "transl", $l);
3172 $this->ctrl->redirect($this, "edit");
3173 }
3174
3178 public function releasePageLock(): void
3179 {
3180 $this->getPageObject()->releasePageLock();
3181 $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_page_lock_released"), true);
3182 $this->finishEditing();
3183 }
3184
3185 public function finishEditing(): void
3186 {
3187 $this->ctrl->redirect($this, "preview");
3188 }
3189
3190 protected function isPageContainerToBeRendered(): bool
3191 {
3192 return (
3193 $this->getRenderPageContainer() || ($this->getOutputMode() == self::PREVIEW && $this->getPageConfig()->getUsePageContainer())
3194 );
3195 }
3196
3197 public function getPagePermaLink(): string
3198 {
3199 return "";
3200 }
3201
3206 {
3207 $collector = new \ILIAS\COPage\ResourcesCollector($this->getOutputMode(), $this->getPageObject());
3208
3209 foreach ($collector->getJavascriptFiles() as $js) {
3210 $tpl->addJavaScript($js);
3211 }
3212
3213 foreach ($collector->getCssFiles() as $css) {
3214 $tpl->addCss($css);
3215 }
3216
3217 foreach ($collector->getOnloadCode() as $code) {
3218 $tpl->addOnLoadCode($code);
3219 }
3220 }
3221
3225 public function getAdditionalPageActions(): array
3226 {
3227 return [];
3228 }
3229}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Page component editing request.
const IL_CAL_UNIX
const IL_CAL_DATETIME
return true
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
static _getQuestionType(int $question_id)
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
static addCss()
Add required css.
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getWebspaceDir(string $mode="filesystem")
get webspace directory
setFormAction(string $a_formaction)
special template class to simplify handling of ITX/PEAR
Help GUI class.
Internal link selector.
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
language handling
Learning history main GUI class.
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a external and/or internal link in a property form.
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
static isActivated()
Checks whether Map feature is activated.
static getInstance()
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.
static _getMapAreasIntLinks(int $a_mob_id)
get all internal links of map areas of a mob
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTitle(int $a_page_id)
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for NewsItem entities.
Notes GUI class.
static hasSuccessorPage(int $a_cont_obj_id, int $a_page_id)
checks if page has a successor page
Class ilObjFile.
static includePresentationJS(ilGlobalTemplateInterface $a_tpl=null)
Include media object presentation JS.
static isTypeAllowed(string $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
User class.
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...
static _lookupType(int $id, bool $reference=false)
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupTitle(int $obj_id)
static collectContentIncludes(ilPageObject $a_page, DOMDocument $a_domdoc)
get all content includes that are used within the page
static getCharStyleSelector(string $a_par_type, bool $a_use_callback=true, int $a_style_id=0)
Get character style selector.
static insertResourcesIntoPageContent(string $a_content)
Insert resources (see also ilContainerContentGUI::determinePageEmbeddedBlocks for presentation)
static getCacheTriggerString(ilPageObject $a_page)
Get page cache update trigger string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsagesOfPage(int $a_usage_id, string $a_usage_type, int $a_hist_nr=0, bool $a_all_hist_nrs=false, string $a_lang="-")
Get page content usages for page.
Page Editor GUI class.
static lookupSettingByParentType(string $a_par_type, string $a_name, string $a_default='0')
Lookup setting by parent type.
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...
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
Class ilPageObjectGUI.
setLinkFrame(string $l_frame="")
setTabs(ilTabsGUI $a_tabs)
setLanguage(string $a_val)
setParentType(string $a_val)
setViewPageLink(string $a_link, string $a_target="")
set link for "view page" button
rollback()
Rollback to a previous version.
setAdvMdRecordObject(int $a_adv_ref_id, string $a_adv_type, string $a_adv_subtype="-")
Set object, that defines the adv md records being used.
EditSessionRepository $edit_repo
setStyleId(int $a_styleid)
processAnswer()
Process answer.
showPage()
display content of page
setEnabledHref(bool $enable)
displayValidationError($a_error)
display validation error
setEditMode()
Set edit mode.
saveActivation()
Save Activation.
showEditToolbar()
Show edit toolbar.
displayMedia(bool $a_fullscreen=false)
setPresentationTitle(string $a_title="")
getNotesHTML(object $a_content_object=null, bool $a_enable_private_notes=true, bool $a_enable_public_notes=false, bool $a_enable_notes_deletion=false, callable $a_callback=null, bool $export=false)
Get html for public and/or private notes.
releasePageLock()
Release page lock.
getActivationFormValues()
Get values for activation form.
enableNotes(bool $a_enabled, int $a_parent_id)
setEnabledPageFocus(bool $a_enabledpagefocus)
setIntLinkReturn(string $a_return)
setPageConfig(ilPageConfig $a_val)
ilAccessHandler $access
setPageLinker(\ILIAS\COPage\PageLinker $page_linker)
initialOpenedContent()
Initially opened content.
confirmPageTranslationCreation()
Confirm page translation creation.
editActivation()
Edit activation (only, if scheduled page activation is activated in administration)
setPrependingHtml(string $a_prependinghtml)
setEnabledNews(bool $a_enabled, int $a_news_obj_id=0, string $a_news_obj_type="")
setHeader(string $a_title="")
ilPropertyFormGUI $form
getEnablePCType(string $a_pc_type)
insertResources(string $a_output)
addResourcesToTemplate(ilGlobalTemplateInterface $tpl)
Add resources to template.
compareVersion()
Compares two revisions of the page.
enableChangeComments(bool $a_enabled)
presentation(string $a_mode=self::PRESENTATION)
setAbstractOnly(bool $a_val, string $pcid="")
Get only abstract (first text paragraph)
setPageBackTitle(string $a_title)
setRawPageContent(bool $a_rawpagecontent)
Set Get raw page content only.
setOldNr(int $a_val)
Set old nr (historic page)
setEnabledTabs(bool $a_enabledtabs)
replaceCurlyBrackets(string $output)
setEnablePCType(string $a_pc_type, bool $a_val)
static getTinyMenu(string $a_par_type, bool $a_int_links=false, bool $a_wiki_links=false, bool $a_keywords=false, $a_style_id=0, $a_paragraph_styles=true, $a_save_return=true, $a_anchors=false, $a_save_new=true, $a_user_links=false, \ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper=null)
Get Tiny Menu.
replaceDiffTags(string $a_html)
editMasterLanguage()
Edit master language.
setRenderPageContainer(bool $a_val)
previewHistory()
Preview history.
setOutputMode(string $a_mode=self::PRESENTATION)
setOpenPlaceHolder(string $a_val)
showMediaFullscreen(int $a_style_id=0)
show fullscreen view of media object
setLinkParams(string $l_params="")
createPageTranslation()
Create page translation.
setTemplateOutput(bool $a_output=true)
activateMetaDataEditor(ilObject $a_rep_obj, string $a_type, int $a_sub_obj_id, object $a_observer_obj=null, string $a_observer_func="")
Activate meda data editor.
getAdditionalPageActions()
Get additional page actions.
ilGlobalTemplateInterface $tpl
history()
Get history table as HTML.
setEnableEditing(bool $a_enableediting)
ILIAS COPage PageLinker $page_linker
rollbackConfirmation()
Rollback confirmation.
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
executeCommand()
execute command
initPageObject()
Init page object.
switchToLanguage()
Switch to language.
setProfileBackUrl(string $url)
getComponentPluginsXML()
Put information about activated plugins into XML.
getTabs(string $a_activate="")
setOfflineDirectory(string $offdir)
insertPageToc(string $a_output)
ilComponentFactory $component_factory
setSourcecodeDownloadScript(string $script_name)
setPageObject(ilPageObject $a_pg_obj)
setEditPreview(bool $a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
setEditorToolContext()
Set editor tool context.
ILIAS DI UIServices $ui
getActivationCaptions()
Get captions for activation action menu entries.
initActivationForm()
Init activation form.
EditGUIRequest $request
__construct(string $a_parent_type, int $a_id, int $a_old_nr=0, bool $a_prevent_get_id=false, string $a_lang="", string $concrete_lang="")
setQuestionHTML(array $question_html)
setFullscreenLink(string $a_fullscreen_link)
setFileDownloadLink(string $a_download_link)
setActivationListener(object $a_obj, string $a_meth)
setTemplate(ilGlobalTemplateInterface $main_tpl)
setTabHook(object $a_object, string $a_function)
download_paragraph()
download source code paragraph
getAdvMdRecordObject()
Get adv md record type.
postOutputProcessing(string $a_output)
Finalizing output processing.
setQEditTabs(string $a_active)
Set question editing tabs.
insertAdvTrigger(string $a_output)
Insert adv content trigger.
setTemplateTargetVar(string $a_variable)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static saveQuestionAnswer(string $a_type, int $a_id, string $a_answer)
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.
static getFlashVideoPlayerFilename(bool $a_fullpath=false)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
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...
This class represents a property in a property form.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static addTooltip(string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$c
Definition: cli.php:38
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: feed.php:28
const ILIAS_VERSION
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
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...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
if(strpos( $jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:54
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
exit
Definition: login.php:28
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
$i
Definition: metadata.php:41
$xml
Definition: metadata.php:351
string $key
Consumer key/client ID value.
Definition: System.php:193
form( $class_path, string $cmd)
Class ChatMainBarProvider \MainMenu\Provider.
$type
$url
$lng
$lm_set