ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
class.ilPageObjectGUI.php
Go to the documentation of this file.
1<?php
2
22
35{
36 public const PRESENTATION = "presentation";
37 public const EDIT = "edit";
38 public const PREVIEW = "preview";
39 public const OFFLINE = "offline";
40 public const PRINTING = "print";
41 protected \ILIAS\TestQuestionPool\Questions\PublicInterface $questioninfo;
42 protected \ILIAS\COPage\Page\PageManager $pm;
43 protected \ILIAS\COPage\Link\LinkManager $link;
44 protected \ILIAS\COPage\InternalGUIService $gui;
45 protected \ILIAS\COPage\PC\PCDefinition $pc_definition;
46 protected \ILIAS\COPage\Xsl\XslManager $xsl;
47 protected \ILIAS\COPage\Editor\GUIService $editor_gui;
48 protected \ILIAS\Notes\Service $notes;
49 protected int $requested_ref_id;
50 protected int $requested_pg_id;
51 protected string $requested_file_id;
52 protected string $requested_transl;
53 protected int $requested_old_nr;
56 protected string $exp_target_script = "";
57 protected string $exp_id = "";
58 protected string $exp_frame = "";
59 protected string $act_meth = "";
60 protected object $act_obj;
61 public string $page_back_title = "";
62 protected int $notes_parent_id = 0;
64 protected int $styleid = 0;
65 protected bool $enabledpagefocus;
66 protected string $link_xml;
67 protected int $old_nr = 0;
68
69 protected int $id;
70 protected string $language;
72 protected ilLanguage $lng;
73 protected ilCtrl $ctrl;
76 protected ilLogger $log;
77 protected ilObjUser $user;
78 protected ilHelpGUI $help;
80 protected string $output_mode = "";
81 public string $presentation_title = "";
82 public string $target_script = "";
83 public string $return_location = "";
84 public string $target_var = "";
85 public string $template_output_var = "";
86 public bool $output2template = false;
87 public string $link_params = "";
88 public string $sourcecode_download_script = "";
89 public bool $activation = false;
90 public bool $activated = true;
91 public bool $editpreview = false;
92 public bool $use_meta_data = false;
94 public int $meta_data_sub_obj_id = 0;
95 public string $meta_data_type = "";
96 public ?object $meta_data_observer_obj = null;
97 public string $meta_data_observer_func = "";
98 public bool $link_xml_set = false;
99 public bool $enableediting = true;
100 public bool $rawpagecontent = false;
101 public bool $enabledcontentincludes = false;
102 public bool $compare_mode = false;
104 public bool $tabs_enabled = true;
105 public bool $render_page_container = false;
106 private bool $abstract_only = false;
107 protected string $parent_type = "";
108 protected string $file_download_link = '';
109 protected string $fullscreen_link = '';
110 protected string $link_frame = '';
111 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices $tool_context;
112 public string $pl_start = "{{{{{";
113 public string $pl_end = "}}}}}";
114 protected \ILIAS\DI\UIServices $ui;
115 protected \ILIAS\COPage\PageLinker $page_linker;
116 protected string $abstract_pcid = ""; // pcid of single paragraph
118 protected string $open_place_holder = "";
119 protected int $requested_user_id = 0;
120 protected int $requested_q_id = 0;
121 protected int $requested_history_mode = 0;
122 protected bool $enabled_news = false;
123 protected int $news_obj_id = 0;
124 protected string $news_obj_type = "";
125 protected ?array $tab_hook = null;
126 protected string $view_page_link = "";
127 protected string $view_page_target = "";
128 protected string $offline_directory = "";
129 protected bool $notes_enabled = false;
130 protected string $prependinghtml = "";
131 protected string $header = "";
132 protected string $int_link_return = "";
133 protected bool $enabled_href = true;
134 // $adv_ref_id - $adv_type - $adv_subtype:
135 // Object, that defines the adv md records being used.
136 protected ?int $adv_ref_id = null;
137 protected ?string $adv_type = null;
138 protected ?string $adv_subtype = null;
139 protected string $concrete_lang = "";
140 protected string $profile_back_url = "";
141
143 protected \ILIAS\COPage\Compare\PageCompare $compare;
144
152 public function __construct(
153 string $a_parent_type,
154 int $a_id,
155 int $a_old_nr = 0,
156 bool $a_prevent_get_id = false,
157 string $a_lang = "",
158 string $concrete_lang = ""
159 ) {
160 global $DIC;
161
162 $this->log = ilLoggerFactory::getLogger('copg');
163 $this->tpl = $DIC->ui()->mainTemplate();
164 $this->ctrl = $DIC->ctrl();
165 $this->lng = $DIC->language();
166 $this->tabs_gui = $DIC->tabs();
167 $this->access = $DIC->access();
168 $this->user = $DIC->user();
169 $this->help = $DIC["ilHelp"];
170 $this->ui = $DIC->ui();
171 $this->toolbar = $DIC->toolbar();
172 $this->component_factory = $DIC["component.factory"];
173
174 $this->request = $DIC
175 ->copage()
176 ->internal()
177 ->gui()
178 ->page()
179 ->editRequest();
180
181 $this->questioninfo = $DIC->testQuestion();
182
183 $this->requested_old_nr = $this->request->getInt("old_nr");
184 $this->requested_transl = $this->request->getString("transl");
185 $this->requested_file_id = $this->request->getString("file_id");
186 $this->requested_ref_id = $this->request->getInt("ref_id");
187 $this->requested_pg_id = $this->request->getInt("pg_id");
188 $this->concrete_lang = $concrete_lang;
189
190 $this->setParentType($a_parent_type);
191 $this->setId($a_id);
192 if ($a_old_nr == 0 && !$a_prevent_get_id && $this->requested_old_nr > 0) {
193 $a_old_nr = $this->requested_old_nr;
194 }
195 $this->setOldNr($a_old_nr);
196
197 if ($a_lang == "" && $this->requested_transl != '') {
198 $this->setLanguage($this->requested_transl);
199 } else {
200 if ($a_lang == "") {
201 $a_lang = "-";
202 }
203 $this->setLanguage($a_lang);
204 }
205
206
207 $this->setOutputMode(self::PRESENTATION);
208 $this->setEnabledPageFocus(true);
209 $this->initPageObject();
210 $this->setPageConfig($this->getPageObject()->getPageConfig());
211
212 $this->page_linker = new ilPageLinker(get_class($this));
213
214 $this->output2template = true;
215
216 $this->template_output_var = "PAGE_CONTENT";
217 $this->page_back_title = $this->lng->txt("page");
218 $this->lng->loadLanguageModule("content");
219 $this->lng->loadLanguageModule("copg");
220
221 $this->tool_context = $DIC->globalScreen()->tool()->context();
222
223 $this->setTemplateOutput(false);
224
225 $this->ctrl->saveParameter($this, "transl");
226
227
228 $this->requested_user_id = $this->request->getInt("user");
229 $this->requested_q_id = $this->request->getInt("q_id");
230 $this->requested_history_mode = $this->request->getInt("history_mode");
231
232 $int_service = $DIC
233 ->copage()
234 ->internal();
235
236 $this->edit_repo = $int_service
237 ->repo()
238 ->edit();
239
240 $this->afterConstructor();
241 $this->xsl = $int_service->domain()->xsl();
242 $this->compare = $int_service->domain()->compare();
243 $this->pc_definition = $DIC
244 ->copage()
245 ->internal()
246 ->domain()
247 ->pc()
248 ->definition();
249 $this->gui = $DIC->copage()->internal()->gui();
250 $this->link = $DIC->copage()->internal()->domain()->link();
251 $this->pm = $DIC->copage()->internal()->domain()->page();
252 $this->editor_gui = $DIC->copage()->internal()->gui()->edit();
253 $this->notes = $DIC->notes();
254 }
255
256 public function setTemplate(ilGlobalTemplateInterface $main_tpl): void
257 {
258 $this->tpl = $main_tpl;
259 }
260
261 public function afterConstructor(): void
262 {
263 }
264
269 public function setAdvMdRecordObject(
270 int $a_adv_ref_id,
271 string $a_adv_type,
272 string $a_adv_subtype = "-"
273 ): void {
274 $this->adv_ref_id = $a_adv_ref_id;
275 $this->adv_type = $a_adv_type;
276 $this->adv_subtype = $a_adv_subtype;
277 }
278
282 public function getAdvMdRecordObject(): ?array
283 {
284 if ($this->adv_type === null) {
285 return null;
286 }
287 return [$this->adv_ref_id, $this->adv_type, $this->adv_subtype];
288 }
289
293 final protected function initPageObject(): void
294 {
296 $this->getParentType(),
297 $this->getId(),
298 $this->getOldNr(),
299 $this->getLanguage()
300 );
301 $page->setConcreteLang($this->concrete_lang);
302 $this->setPageObject($page);
303 }
304
305 public function setParentType(string $a_val): void
306 {
307 $this->parent_type = $a_val;
308 }
309
310 public function getParentType(): string
311 {
312 return $this->parent_type;
313 }
314
315 public function setId(int $a_val): void
316 {
317 $this->id = $a_val;
318 }
319
320 public function getId(): int
321 {
322 return $this->id;
323 }
324
328 public function setOldNr(int $a_val): void
329 {
330 $this->old_nr = $a_val;
331 }
332
333 public function getOldNr(): int
334 {
335 return $this->old_nr;
336 }
337
338 public function setLanguage(string $a_val): void
339 {
340 $this->language = $a_val;
341 }
342
343 public function getLanguage(): string
344 {
345 if ($this->language == "") {
346 return "-";
347 }
348
349 return $this->language;
350 }
351
352 public function setEnablePCType(
353 string $a_pc_type,
354 bool $a_val
355 ): void {
356 $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
357 }
358
359 public function getEnablePCType(string $a_pc_type): bool
360 {
361 return $this->getPageConfig()->getEnablePCType($a_pc_type);
362 }
363
364 public function setPageConfig(ilPageConfig $a_val): void
365 {
366 $this->page_config = $a_val;
367 }
368
369 public function getPageConfig(): ilPageConfig
370 {
371 return $this->page_config;
372 }
373
374 public function setPageObject(ilPageObject $a_pg_obj): void
375 {
376 $this->obj = $a_pg_obj;
377 }
378
379 public function getPageObject(): ilPageObject
380 {
381 return $this->obj;
382 }
383
387 public function setOutputMode(
388 string $a_mode = self::PRESENTATION
389 ): void {
390 $this->output_mode = $a_mode;
391 }
392
393 public function getOutputMode(): string
394 {
395 return $this->output_mode;
396 }
397
398 public function setTemplateOutput(bool $a_output = true): void
399 {
400 $this->output2template = $a_output;
401 }
402
403 public function outputToTemplate(): bool
404 {
405 return $this->output2template;
406 }
407
408 public function setPresentationTitle(string $a_title = ""): void
409 {
410 $this->presentation_title = $a_title;
411 }
412
413 public function getPresentationTitle(): string
414 {
415 return $this->presentation_title;
416 }
417
418 public function setHeader(string $a_title = ""): void
419 {
420 $this->header = $a_title;
421 }
422
423 public function getHeader(): string
424 {
425 return $this->header;
426 }
427
428 public function setLinkParams(string $l_params = ""): void
429 {
430 $this->link_params = $l_params;
431 }
432
433 public function getLinkParams(): string
434 {
435 return $this->link_params;
436 }
437
438 public function setLinkFrame(string $l_frame = ""): void
439 {
440 $this->link_frame = $l_frame;
441 }
442
443 public function getLinkFrame(): string
444 {
445 return $this->link_frame;
446 }
447
448 public function setPageLinker(\ILIAS\COPage\PageLinker $page_linker): void
449 {
450 $this->page_linker = $page_linker;
451 }
452
453 public function getLinkXML(): string
454 {
455 return $this->link_xml;
456 }
457
458 public function setQuestionHTML(array $question_html): void
459 {
460 $this->getPageConfig()->setQuestionHTML($question_html);
461 }
462
463 public function getQuestionHTML(): array
464 {
465 return $this->getPageConfig()->getQuestionHTML();
466 }
467
468 public function setTemplateTargetVar(string $a_variable): void
469 {
470 $this->target_var = $a_variable;
471 }
472
473 public function getTemplateTargetVar(): string
474 {
475 return $this->target_var;
476 }
477
478 public function getTemplateOutputVar(): string
479 {
480 return $this->template_output_var;
481 }
482
483 public function setSourcecodeDownloadScript(string $script_name): void
484 {
485 $this->sourcecode_download_script = $script_name;
486 }
487
488 public function getSourcecodeDownloadScript(): string
489 {
490 return $this->sourcecode_download_script;
491 }
492
493 public function setTabs(ilTabsGUI $a_tabs): void
494 {
495 $this->tabs_gui = $a_tabs;
496 }
497
498 public function setPageBackTitle(string $a_title): void
499 {
500 $this->page_back_title = $a_title;
501 }
502
503 public function setFileDownloadLink(string $a_download_link): void
504 {
505 $this->file_download_link = $a_download_link;
506 }
507
508 public function getFileDownloadLink(): string
509 {
510 return $this->file_download_link;
511 }
512
513 public function setFullscreenLink(string $a_fullscreen_link): void
514 {
515 $this->fullscreen_link = $a_fullscreen_link;
516 }
517
518 public function getFullscreenLink(): string
519 {
520 return $this->fullscreen_link;
521 }
522
523 public function setIntLinkReturn(string $a_return): void
524 {
525 $this->int_link_return = $a_return;
526 }
527
528 public function enableNotes(bool $a_enabled, int $a_parent_id): void
529 {
530 $this->notes_enabled = $a_enabled;
531 $this->notes_parent_id = $a_parent_id;
532 }
533
534 public function isEnabledNotes(): bool
535 {
536 return $this->notes_enabled;
537 }
538
542 public function setOfflineDirectory(string $offdir): void
543 {
544 $this->offline_directory = $offdir;
545 }
546
547 public function getOfflineDirectory(): string
548 {
549 return $this->offline_directory;
550 }
551
552
556 public function setViewPageLink(string $a_link, string $a_target = ""): void
557 {
558 $this->view_page_link = $a_link;
559 $this->view_page_target = $a_target;
560 }
561
562 public function getViewPageLink(): string
563 {
564 return $this->view_page_link;
565 }
566
567 public function getViewPageTarget(): string
568 {
569 return $this->view_page_target;
570 }
571
572 public function getViewPageText(): string
573 {
574 return $this->lng->txt("cont_presentation_view");
575 }
576
577 public function setActivationListener(
578 object $a_obj,
579 string $a_meth
580 ): void {
581 $this->act_obj = $a_obj;
582 $this->act_meth = $a_meth;
583 }
584
585 public function setEnabledNews(
586 bool $a_enabled,
587 int $a_news_obj_id = 0,
588 string $a_news_obj_type = ""
589 ): void {
590 $this->enabled_news = $a_enabled;
591 $this->news_obj_id = $a_news_obj_id;
592 $this->news_obj_type = $a_news_obj_type;
593 }
594
595 public function getEnabledNews(): bool
596 {
597 return $this->enabled_news;
598 }
599
600 public function setTabHook(
601 object $a_object,
602 string $a_function
603 ): void {
604 $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
605 }
606
610 public function setEditPreview(
611 bool $a_editpreview
612 ): void {
613 $this->editpreview = $a_editpreview;
614 }
615
616 public function getEditPreview(): bool
617 {
618 return $this->editpreview;
619 }
620
621 public function setEnabledTabs(bool $a_enabledtabs): void
622 {
623 $this->tabs_enabled = $a_enabledtabs;
624 }
625
626 public function getEnabledTabs(): bool
627 {
628 return $this->tabs_enabled;
629 }
630
631 public function setEnabledPageFocus(bool $a_enabledpagefocus): void
632 {
633 $this->enabledpagefocus = $a_enabledpagefocus;
634 }
635
636 public function setOpenPlaceHolder(string $a_val): void
637 {
638 $this->open_place_holder = $a_val;
639 }
640
641 public function getOpenPlaceHolder(): string
642 {
643 return $this->open_place_holder;
644 }
645
646 public function getEnabledPageFocus(): bool
647 {
648 return $this->enabledpagefocus;
649 }
650
651 public function setPrependingHtml(string $a_prependinghtml): void
652 {
653 $this->prependinghtml = $a_prependinghtml;
654 }
655
656 public function getPrependingHtml(): string
657 {
658 return $this->prependinghtml;
659 }
660
661 public function setEnableEditing(bool $a_enableediting): void
662 {
663 $this->enableediting = $a_enableediting;
664 }
665
666 public function getEnableEditing(): bool
667 {
668 return $this->enableediting;
669 }
670
674 public function setRawPageContent(bool $a_rawpagecontent): void
675 {
676 $this->rawpagecontent = $a_rawpagecontent;
677 }
678
679 public function getRawPageContent(): bool
680 {
681 return $this->rawpagecontent;
682 }
683
684 public function setStyleId(int $a_styleid): void
685 {
686 $this->styleid = $a_styleid;
687 }
688
689 public function getStyleId(): int
690 {
691 return $this->styleid;
692 }
693
694 public function setCompareMode(bool $a_val): void
695 {
696 $this->compare_mode = $a_val;
697 }
698
699 public function getCompareMode(): bool
700 {
701 return $this->compare_mode;
702 }
703
707 public function setAbstractOnly(
708 bool $a_val,
709 string $pcid = ""
710 ): void {
711 $this->abstract_only = $a_val;
712 $this->abstract_pcid = $pcid;
713 }
714
715 public function getAbstractOnly(): bool
716 {
717 return $this->abstract_only;
718 }
719
720 public function setRenderPageContainer(bool $a_val): void
721 {
722 $this->render_page_container = $a_val;
723 }
724
725 public function getRenderPageContainer(): bool
726 {
727 return $this->render_page_container;
728 }
729
730 public function getDisabledText(): string
731 {
732 return $this->lng->txt("inactive");
733 }
734
735 public function getEnabledHref(): bool
736 {
737 return $this->enabled_href;
738 }
739
740 public function setEnabledHref(bool $enable): void
741 {
742 $this->enabled_href = $enable;
743 }
744
753 public function activateMetaDataEditor(
754 ilObject $a_rep_obj,
755 string $a_type,
756 int $a_sub_obj_id,
757 ?object $a_observer_obj = null,
758 string $a_observer_func = ""
759 ): void {
760 $this->use_meta_data = true;
761 $this->meta_data_rep_obj = $a_rep_obj;
762 $this->meta_data_sub_obj_id = $a_sub_obj_id;
763 $this->meta_data_type = $a_type;
764 $this->meta_data_observer_obj = $a_observer_obj;
765 $this->meta_data_observer_func = $a_observer_func;
766 }
767
768 public function determineFileDownloadLink(): string
769 {
770 $file_download_link = $this->getFileDownloadLink();
771 if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline") {
772 $file_download_link = $this->ctrl->getLinkTarget($this, "downloadFile");
773 }
774 return $file_download_link;
775 }
776
777 public function determineFullscreenLink(): string
778 {
779 $fullscreen_link = $this->getFullscreenLink();
780 if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline") {
781 $fullscreen_link = $this->ctrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
782 }
783 return $fullscreen_link;
784 }
785
786 public function determineSourcecodeDownloadScript(): string
787 {
788 $l = $this->sourcecode_download_script;
789 if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline") {
790 $l = $this->ctrl->getLinkTarget($this, "");
791 }
792 return $l;
793 }
794
798 public function getComponentPluginsXML(): string
799 {
800 $xml = "";
801 if ($this->getOutputMode() == "edit") {
802 foreach ($this->component_factory->getActivePluginsInSlot("pgcp") as $plugin) {
803 if ($plugin->isValidParentType($this->getPageObject()->getParentType())) {
804 $xml .= '<ComponentPlugin Name="' . $plugin->getPluginName() .
805 '" InsertText="' . $plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT) . '" />';
806 }
807 }
808 }
809 if ($xml != "") {
810 $xml = "<ComponentPlugins>" . $xml . "</ComponentPlugins>";
811 }
812 return $xml;
813 }
814
815
819 public function executeCommand(): string
820 {
821 $ret = "";
822 $next_class = $this->ctrl->getNextClass($this);
823 if ($next_class !== "") {
824 $this->ctrl->setReturn($this, "edit");
825 }
826 $this->log->debug("next_class: " . $next_class);
827 if ($next_class == "" && $this->ctrl->getCmd() == "edit") {
828 $this->tabs_gui->clearTargets();
829 } else {
830 $this->getTabs();
831 }
832
833
834 switch ($next_class) {
835 case 'ilobjectmetadatagui':
836 $this->setBackToEditTabs();
837 $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
838 if (is_object($this->meta_data_observer_obj)) {
839 $md_gui->addMDObserver(
840 $this->meta_data_observer_obj,
841 $this->meta_data_observer_func,
842 "General"
843 );
844 }
845 // set adv metadata record dobject
846 if ($this->adv_type != "") {
847 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
848 }
849 $this->ctrl->forwardCommand($md_gui);
850 break;
851
852 case "ileditclipboardgui":
853 $this->setBackToEditTabs();
854 $clip_gui = new ilEditClipboardGUI();
855 $clip_gui->setPageBackTitle($this->page_back_title);
856 $ret = $this->ctrl->forwardCommand($clip_gui);
857 break;
858
859 // notes
860 case "ilnotegui":
861 case "ilcommentgui":
862 $html = $this->edit();
863 $this->tabs_gui->setTabActive("edit");
864 return $html;
865
866 case strtolower(PublicProfileGUI::class):
867 $profile_gui = new PublicProfileGUI($this->requested_user_id);
868 $ret = $this->ctrl->forwardCommand($profile_gui);
869 break;
870
871 case "ilpageeditorgui":
872 $this->setEditorToolContext();
873
874 if (!$this->getEnableEditing()) {
875 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
876 $this->ctrl->redirect($this, "preview");
877 }
878 $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
879 $page_editor->setHeader($this->getHeader());
880 $page_editor->setPageBackTitle($this->page_back_title);
881 $page_editor->setIntLinkReturn($this->int_link_return);
882 //$page_editor->executeCommand();
883 $ret = $this->ctrl->forwardCommand($page_editor);
884 break;
885
886 case 'ilnewsitemgui':
887 $news_item_gui = new ilNewsItemGUI();
888 $news_item_gui->setEnableEdit(true);
889 $news_item_gui->setContextObjId($this->news_obj_id);
890 $news_item_gui->setContextObjType($this->news_obj_type);
891 $news_item_gui->setContextSubObjId($this->obj->getId());
892 $news_item_gui->setContextSubObjType("pg");
893
894 $ret = $this->ctrl->forwardCommand($news_item_gui);
895 break;
896
897 case "ilpropertyformgui":
898 $form = $this->initOpenedContentForm();
899 $this->ctrl->forwardCommand($form);
900 break;
901
902 case "ilinternallinkgui":
903 $this->lng->loadLanguageModule("content");
904 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
905
906 $link_gui->filterLinkType("PageObject_FAQ");
907 $link_gui->filterLinkType("GlossaryItem");
908 $link_gui->filterLinkType("Media_Media");
909 $link_gui->filterLinkType("Media_FAQ");
910
911 $link_gui->setFilterWhiteList(true);
912 $this->ctrl->forwardCommand($link_gui);
913 break;
914
915 case "ilquestioneditgui":
916 $this->setQEditTabs("question");
917 $edit_gui = new ilQuestionEditGUI();
918 $edit_gui->setPageConfig($this->getPageConfig());
919 $edit_gui->setSelfAssessmentEditingMode(true);
920 $ret = $this->ctrl->forwardCommand($edit_gui);
921 $this->tpl->setContent($ret);
922 break;
923
924 case 'ilassquestionfeedbackeditinggui':
925
926 $this->onFeedbackEditingForwarding();
927
928 // set tabs
929 $this->setQEditTabs("feedback");
930
931 // load required lang mods
932 $this->lng->loadLanguageModule("assessment");
933
934 // set context tabs
935 $questionGUI = assQuestionGUI::_getQuestionGUI(
936 $this->questioninfo->getGeneralQuestionProperties(
937 $this->requested_q_id
938 )->getClassName(),
939 $this->requested_q_id
940 );
941 $questionGUI->getObject()->setObjId(0);
942 $questionGUI->getObject()->setSelfAssessmentEditingMode(true);
943 $questionGUI->getObject()->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
944
945 // forward to ilAssQuestionFeedbackGUI
946 (new ilQuestionEditGUI())->forwardToFeedbackEditGUI($questionGUI);
947 break;
948
949
950 case 'ilLearninghistorygui':
951 $user_id = null;
952 if ($this->getPageObject()->getParentType() == "prtf") {
953 $user_id = ilObject::_lookupOwner($this->getPageObject()->getPortfolioId());
954 }
955 $hist_gui = new ilLearningHistoryGUI();
956 $hist_gui->setUserId($user_id);
957 $this->ctrl->forwardCommand($hist_gui);
958 break;
959
960 default:
961 $cmd = $this->ctrl->getCmd("preview");
962 // presentation view
963 if ($this->getViewPageLink() != "" && $cmd != "edit") {
964 $this->tabs_gui->addNonTabbedLink(
965 "pres_view",
966 $this->getViewPageText(),
967 $this->getViewPageLink()
968 );
969 }
970 $ret = $this->$cmd();
971 if ($this->getOutputMode() == self::PREVIEW && $cmd == "preview") {
972 $this->showEditToolbar();
973 }
974 break;
975 }
976 //echo "+$ret+";
977 return (string) $ret;
978 }
979
983 public function setQEditTabs(string $a_active): void
984 {
985 $this->tabs_gui->clearTargets();
986
987 $this->tabs_gui->setBackTarget(
988 $this->lng->txt("back"),
989 $this->ctrl->getLinkTarget($this, "edit")
990 );
991
992 $this->ctrl->setParameterByClass("ilquestioneditgui", "q_id", $this->requested_q_id);
993 $this->tabs_gui->addTab(
994 "question",
995 $this->lng->txt("question"),
996 $this->ctrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion")
997 );
998
999 $this->ctrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $this->requested_q_id);
1000 $this->tabs_gui->addTab(
1001 "feedback",
1002 $this->lng->txt("feedback"),
1003 $this->ctrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
1004 );
1005
1006 $this->tabs_gui->activateTab($a_active);
1007 }
1008
1009 public function onFeedbackEditingForwarding(): void
1010 {
1011 }
1012
1013 public function deactivatePage(): void
1014 {
1015 $this->getPageObject()->setActivationStart(null);
1016 $this->getPageObject()->setActivationEnd(null);
1017 $this->getPageObject()->setActive(false);
1018 $this->getPageObject()->update();
1019 $this->ctrl->redirect($this, "edit");
1020 }
1021
1022 public function activatePage(): void
1023 {
1024 $this->getPageObject()->setActivationStart(null);
1025 $this->getPageObject()->setActivationEnd(null);
1026 $this->getPageObject()->setActive(true);
1027 $this->getPageObject()->update();
1028 $this->ctrl->redirect($this, "edit");
1029 }
1030
1034 protected function showEditToolbar(): void
1035 {
1036 $ui = $this->ui;
1037 $lng = $this->lng;
1038 if ($this->getEnableEditing()) {
1039 $b = $ui->factory()->button()->standard(
1040 $lng->txt("edit_page"),
1041 $this->ctrl->getLinkTarget($this, "edit")
1042 );
1043 $this->toolbar->addComponent($b);
1044 }
1045 }
1046
1050 public function showPage(): string
1051 {
1052 $main_tpl = $this->tpl;
1053 $sn_arr = [];
1054
1055 $sel_js_mode = '';
1056 $paragraph_plugin_string = '';
1057 $disable_auto_margins = '';
1058
1059 // jquery and jquery ui are always provided for components
1061
1062 // $this->initSelfAssessmentRendering();
1064
1065 $debug = false;
1066 if ($debug) {
1067 $main_tpl->addJavaScript("../components/ILIAS/COPage/js/ilCOPagePres.js");
1068 } else {
1069 $main_tpl->addJavaScript("components/ILIAS/COPage/js/ilCOPagePres.js");
1070 }
1071
1072
1073 // init template
1074 if ($this->getOutputMode() == "edit") {
1075 $this->initEditing();
1076 if (!$this->getPageObject()->getEditLock()) {
1077 return "";
1078 }
1079
1080 $this->getPageObject()->buildDom();
1081
1082 $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1083
1084 $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "components/ILIAS/COPage");
1085 // to do: status dependent class
1086 $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1087
1088 if ($this->getPageConfig()->getUsePageContainer()) {
1089 $tpl->setVariable("PAGE_CONTAINER_CLASS", "ilc_page_cont_PageContainer");
1090 }
1091
1092 $tpl->setVariable(
1093 "WYSIWYG_ACTION",
1094 $this->ctrl->getFormActionByClass("ilpageeditorgui", "", "", true)
1095 );
1096
1097 // determine media, html and javascript mode
1098 $sel_js_mode = "enable";
1099
1100 // show prepending html
1101 $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1102
1103
1104 // get js files for JS enabled editing
1105 if ($sel_js_mode == "enable") {
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 $this->editor_gui->init()->initUI($main_tpl);
1120 }
1121 } else {
1122 // presentation or preview here
1123
1124 $tpl = new ilTemplate("tpl.page.html", true, true, "components/ILIAS/COPage");
1125 if ($this->getEnabledPageFocus()) {
1126 $tpl->touchBlock("page_focus");
1127 }
1128 // presentation
1129 if ($this->isPageContainerToBeRendered()) {
1130 $tpl->touchBlock("page_container_1");
1131 $tpl->touchBlock("page_container_2");
1132 $tpl->touchBlock("page_container_3");
1133 }
1134
1135 // history
1136 $c_old_nr = $this->getPageObject()->old_nr;
1137 if ($c_old_nr > 0 || $this->getCompareMode() || ($this->requested_history_mode == 1)) {
1138 $hist_info =
1139 $this->getPageObject()->getHistoryInfo($c_old_nr);
1140
1141 if (!$this->getCompareMode()) {
1142 $this->ctrl->setParameter($this, "history_mode", "1");
1143
1144 // previous revision
1145 if (isset($hist_info["previous"])) {
1146 $tpl->setCurrentBlock("previous_rev");
1147 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1148 $this->ctrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1149 $tpl->setVariable(
1150 "HREF_PREV",
1151 $this->ctrl->getLinkTarget($this, "preview")
1152 );
1153 } else {
1154 $tpl->setCurrentBlock("previous_rev_disabled");
1155 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1156 }
1157 $tpl->parseCurrentBlock();
1158
1159 // next revision
1160 if ($c_old_nr > 0) {
1161 $tpl->setCurrentBlock("next_rev");
1162 $tpl->setVariable("TXT_NEXT_REV", $this->lng->txt("cont_next_rev"));
1163 $this->ctrl->setParameter($this, "old_nr", $hist_info["next"]["nr"] ?? 0);
1164 $tpl->setVariable(
1165 "HREF_NEXT",
1166 $this->ctrl->getLinkTarget($this, "preview")
1167 );
1168 $tpl->parseCurrentBlock();
1169
1170 // latest revision
1171 $tpl->setCurrentBlock("latest_rev");
1172 $tpl->setVariable("TXT_LATEST_REV", $this->lng->txt("cont_latest_rev"));
1173 $this->ctrl->setParameter($this, "old_nr", "");
1174 $tpl->setVariable(
1175 "HREF_LATEST",
1176 $this->ctrl->getLinkTarget($this, "preview")
1177 );
1178 $tpl->parseCurrentBlock();
1179 }
1180
1181 $this->ctrl->setParameter($this, "history_mode", "");
1182
1183 // rollback
1184 if ($c_old_nr > 0 && $this->user->getId() != ANONYMOUS_USER_ID) {
1185 $tpl->setCurrentBlock("rollback");
1186 $this->ctrl->setParameter($this, "old_nr", $c_old_nr);
1187 $tpl->setVariable(
1188 "HREF_ROLLBACK",
1189 $this->ctrl->getLinkTarget($this, "rollbackConfirmation")
1190 );
1191 $this->ctrl->setParameter($this, "old_nr", "");
1192 $tpl->setVariable(
1193 "TXT_ROLLBACK",
1194 $this->lng->txt("cont_rollback")
1195 );
1196 $tpl->parseCurrentBlock();
1197 }
1198 }
1199
1200 $tpl->setCurrentBlock("hist_nav");
1201 $tpl->setVariable("TXT_REVISION", $this->lng->txt("cont_revision"));
1202 $tpl->setVariable(
1203 "VAL_REVISION_DATE",
1204 ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))
1205 );
1206 $tpl->setVariable(
1207 "VAL_REV_USER",
1208 ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])
1209 );
1210 $tpl->parseCurrentBlock();
1211 }
1212 }
1213 if ($this->getOutputMode() != self::PRESENTATION &&
1214 $this->getOutputMode() != self::OFFLINE &&
1215 $this->getOutputMode() != self::PREVIEW &&
1216 $this->getOutputMode() != self::PRINTING) {
1217 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1218 }
1219
1220 // output media object edit list (of media links)
1221 if ($this->getOutputMode() == "edit") {
1223 $this->obj->getParentType() . ":pg",
1224 $this->obj->getId(),
1225 $this->obj->getLanguage()
1226 );
1227 $mob_links = array();
1228 foreach ($links as $link) {
1229 if ($link["type"] == "mob") {
1230 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
1231 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
1232 }
1233 }
1234 }
1235
1236 // linked media objects
1237 if (count($mob_links) > 0) {
1238 $tpl->setCurrentBlock("med_link");
1239 $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1240 $tpl->setVariable(
1241 "SEL_MED_LINKS",
1242 ilLegacyFormElementsUtil::formSelect(0, "mob_id", $mob_links, false, true)
1243 );
1244 $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1245 $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1246 //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1247 $tpl->parseCurrentBlock();
1248 }
1249
1250 // content snippets used
1251 $this->getPageObject()->buildDom();
1253 $this->getPageObject(),
1254 $this->getPageObject()->getDomDoc()
1255 );
1256 if (count($snippets) > 0) {
1257 foreach ($snippets as $s) {
1258 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1259 }
1260 $tpl->setCurrentBlock("med_link");
1261 $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1262 $tpl->setVariable(
1263 "SEL_SNIPPETS",
1264 ilLegacyFormElementsUtil::formSelect(0, "ci_id", $sn_arr, false, true)
1265 );
1266 $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1267 $tpl->parseCurrentBlock();
1268 }
1269
1270 // scheduled activation?
1271 if (!$this->getPageObject()->getActive() &&
1272 $this->getPageObject()->getActivationStart() != "" &&
1273 $this->getPageConfig()->getEnableScheduledActivation()) {
1274 $tpl->setCurrentBlock("activation_txt");
1275 $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $this->lng->txt("cont_scheduled_activation"));
1276 $tpl->setVariable(
1277 "SA_FROM",
1279 new ilDateTime(
1280 $this->getPageObject()->getActivationStart(),
1282 )
1283 )
1284 );
1285 $tpl->setVariable(
1286 "SA_TO",
1288 new ilDateTime(
1289 $this->getPageObject()->getActivationEnd(),
1291 )
1292 )
1293 );
1294 $tpl->parseCurrentBlock();
1295 }
1296 }
1297
1298 // get content
1299 $builded = $this->obj->buildDom();
1300
1301 // manage hierarchical ids
1302 if ($this->getOutputMode() == "edit") {
1303 // add pc ids, if necessary
1304 if (!$this->obj->checkPCIds()) {
1305 $this->obj->insertPCIds();
1306 $this->obj->update(true, true);
1307 }
1308
1309 $this->obj->addFileSizes();
1310 $this->obj->addHierIDs();
1311 } else {
1312 $this->obj->addFileSizes();
1313 }
1314
1315 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; exit;
1316 //echo "<br>-".htmlentities($this->getLinkXML())."-"; exit;
1317
1318 // set default link xml, if nothing was set yet
1319 if (!$this->link_xml_set) {
1320 $this->setDefaultLinkXml();
1321 }
1322
1323 $template_xml = '';
1324
1325 $link_xml = $this->getLinkXML();
1326
1327 // disable/enable auto margins
1328 if ($this->getStyleId() > 0) {
1329 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1330 $style = new ilObjStyleSheet($this->getStyleId());
1331 $template_xml = $style->getTemplateXML();
1332 $disable_auto_margins = "n";
1333 if ($style->lookupStyleSetting("disable_auto_margins")) {
1334 $disable_auto_margins = "y";
1335 }
1336 }
1337 }
1338
1339 $append_footnotes = "y";
1340 if ($this->getAbstractOnly()) {
1341 if (!$this->abstract_pcid) {
1342 $content = "<dummy><PageObject><PageContent><Paragraph>" .
1343 $this->obj->getFirstParagraphText() . $link_xml .
1344 "</Paragraph></PageContent></PageObject></dummy>";
1345 } else {
1346 $append_footnotes = "n";
1347 $par = $this->obj->getParagraphForPCID($this->abstract_pcid);
1348 $content = "<dummy><PageObject><PageContent><Paragraph Characteristic='" . $par->getCharacteristic() . "'>" .
1349 $par->getText() . $link_xml .
1350 "</Paragraph></PageContent></PageObject>" . $this->obj->getMultimediaXML() . "</dummy>";
1351 }
1352 } else {
1353 $content = $this->obj->getXMLFromDom(
1354 false,
1355 true,
1356 true,
1357 $link_xml . $template_xml . $this->getComponentPluginsXML(),
1358 false,
1359 $this->getStyleId(),
1360 $this->getOutputMode() === "offline"
1361 );
1362 }
1363
1364 // check validation errors
1365 if ($builded !== true) {
1366 $this->displayValidationError($builded);
1367 } else {
1368 $this->displayValidationError((string) $this->edit_repo->getPageError());
1369 }
1370 $this->edit_repo->clearPageError();
1371
1372 // get title
1373 $pg_title = $this->getPresentationTitle();
1374 $col_path = '';
1375 $row_path = '';
1376 $cell_path = '';
1377 $item_path = '';
1378 if ($this->getOutputMode() == "edit") {
1379 $col_path = ilUtil::getImagePath("object/col.svg");
1380 $row_path = ilUtil::getImagePath("object/row.svg");
1381 $item_path = ilUtil::getImagePath("page_editor/icon_peadl.svg");
1382 $cell_path = ilUtil::getImagePath("object/cell.svg");
1383 }
1384
1385 if ($this->getOutputMode() != "offline") {
1386 $enlarge_path = ilUtil::getImagePath("media/enlarge.svg");
1387 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
1388 } else {
1389 $enlarge_path = "images/media/enlarge.svg";
1390 $wb_path = "";
1391 }
1392 $pg_title_class = ($this->getOutputMode() == "print")
1393 ? "ilc_PrintPageTitle"
1394 : "";
1395
1396 // page splitting only for learning modules and
1397 // digital books
1398 $enable_split_new = ($this->obj->getParentType() == "lm")
1399 ? "y"
1400 : "n";
1401
1402 // page splitting to next page only for learning modules and
1403 // digital books if next page exists in tree
1404 if (($this->obj->getParentType() == "lm") &&
1406 $this->obj->getParentId(),
1407 $this->obj->getId()
1408 )) {
1409 $enable_split_next = "y";
1410 } else {
1411 $enable_split_next = "n";
1412 }
1413
1414 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1415
1416
1417 if ($this->getPageConfig()->getEnablePCType("Tabs")) {
1420 }
1421
1422 // needed for placeholders
1423 $this->tpl->addCss(ilObjStyleSheet::getBaseContentStylePath());
1424
1425 $file_download_link = $this->determineFileDownloadLink();
1426 $fullscreen_link = $this->determineFullscreenLink();
1427 $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1428
1429 // default values for various parameters (should be used by
1430 // all instances in the future)
1431 $media_mode = ($this->getOutputMode() == "edit")
1432 ? $this->user->getPref("ilPageEditor_MediaMode")
1433 : "enable";
1434
1435 $paste = (ilEditClipboard::getAction() == "copy" &&
1436 $this->getOutputMode() == "edit");
1437
1438 $cfg = $this->getPageConfig();
1439
1440 $current_ts = time();
1441
1442 $enable_href = $this->getEnabledHref();
1443 if ($this->getOutputMode() == self::EDIT) {
1444 $enable_href = false;
1445 }
1446
1447 // added UTF-8 encoding otherwise umlaute are converted too
1448 $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"),
1449 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1450 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1451 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1452 'img_col' => $col_path,
1453 'img_row' => $row_path,
1454 'img_cell' => $cell_path,
1455 'img_item' => $item_path,
1456 'acc_save_url' => "./ilias.php?baseClass=ilaccordionpropertiesstoragegui&cmd=setOpenedTab" .
1457 "&user_id=" . $this->user->getId(),
1458 'append_footnotes' => $append_footnotes,
1459 'compare_mode' => $this->getCompareMode() ? "y" : "n",
1460 'enable_split_new' => $enable_split_new,
1461 'enable_split_next' => $enable_split_next,
1462 'link_params' => $this->link_params,
1463 'file_download_link' => $file_download_link,
1464 'fullscreen_link' => $fullscreen_link,
1465 'img_path' => $img_path,
1466 'parent_id' => $this->obj->getParentId(),
1467 'download_script' => $this->sourcecode_download_script,
1468 'encoded_download_script' => urlencode($this->sourcecode_download_script),
1469 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1470 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1471 'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1472 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1473 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1474 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1475 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1476 'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1477 'paste' => $paste ? "y" : "n",
1478 'media_mode' => $media_mode,
1479 'javascript' => $sel_js_mode,
1480 'paragraph_plugins' => $paragraph_plugin_string,
1481 'disable_auto_margins' => $disable_auto_margins,
1482 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1483 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1484 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1485 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1486 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1487 'enable_learning_history' => $cfg->getEnablePCType("LearningHistory") ? "y" : "n",
1488 'enable_qover' => "n",
1489 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1490 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1491 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1492 'current_ts' => $current_ts,
1493 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1494 'page_perma_link' => $this->getPagePermaLink(),
1495 'activated_protection' =>
1496 ($this->getPageConfig()->getSectionProtection() == \ilPageConfig::SEC_PROTECT_PROTECTED) ? "y" : "n",
1497 'protection_text' => $this->lng->txt("cont_sec_protected_text"),
1498 'enable_href' => $enable_href
1499 );
1500 if ($this->link_frame != "") { // todo other link types
1501 $params["pg_frame"] = $this->link_frame;
1502 }
1503
1504 //$content = str_replace("&nbsp;", "", $content);
1505
1506 // this ensures that cache is emptied with every update
1507 $params["version"] = ILIAS_VERSION;
1508 // ensure no cache hit, if included files/media objects have been changed
1509 $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1510
1511
1512 // should be modularized
1513 $md5_adds = ilPCSection::getCacheTriggerString($this->getPageObject());
1514 // run xslt
1515 $md5 = md5(serialize($params) . $link_xml . $template_xml . $md5_adds);
1516
1517 //$a = microtime();
1518
1519 // check cache (same parameters, non-edit mode and rendered time
1520 // > last change
1521 $is_error = false;
1522 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1523 !$this->getCompareMode() &&
1524 !$this->getAbstractOnly() &&
1525 $md5 == $this->obj->getRenderMd5() &&
1526 ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1527 $this->obj->getRenderedTime() != "" &&
1528 $this->obj->old_nr == 0) {
1529 // cache hit
1530 $output = $this->obj->getRenderedContent();
1531 } else {
1532 $this->log->debug("Calling XSLT, content: " . substr($content, 0, 100));
1533 try {
1534 $output = $this->xsl->process($content, $params);
1535 } catch (Exception $e) {
1536 $output = "";
1537 if ($this->getOutputMode() == "edit") {
1538 $output = "<pre>" . $e->getMessage() . "<br>" . htmlentities($content) . "</pre>";
1539 $is_error = true;
1540 }
1541 }
1542 if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1543 && !$this->getAbstractOnly()
1544 && $this->obj->old_nr == 0) {
1545 $this->obj->writeRenderedContent($output, $md5);
1546 }
1547 }
1548
1549 if (!$is_error) {
1550 // unmask user html
1551 if (($this->getOutputMode() != "edit" ||
1552 $this->user->getPref("ilPageEditor_HTMLMode") != "disable")
1553 && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
1554 $output = str_replace("&lt;", "<", $output);
1555 $output = str_replace("&gt;", ">", $output);
1556 }
1557 $output = str_replace("&amp;", "&", $output);
1558
1559 // insert page snippets
1560 //$output = $this->insertContentIncludes($output);
1561
1562 // insert resource blocks
1563 $output = $this->insertResources($output);
1564
1565 // insert page toc
1566 if ($this->getPageConfig()->getEnablePageToc()) {
1567 $output = $this->insertPageToc($output);
1568 }
1569
1570 // insert advanced output trigger
1571 $output = $this->insertAdvTrigger($output);
1572
1573 // workaround for preventing template engine
1574 // from hiding paragraph text that is enclosed
1575 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1576 $output = $this->replaceCurlyBrackets($output);
1577
1578 // remove all newlines (important for code / pre output)
1579 $output = str_replace("\n", "", $output);
1580
1581 //echo htmlentities($output);
1582 $output = $this->postOutputProcessing($output);
1583 //echo htmlentities($output);
1584 if ($this->getOutputMode() == "edit" &&
1585 !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
1586 $output = '<div class="copg-disabled-page"><div class="ilCopgDisabledText">' . $this->getDisabledText() . '</div>' . $output . '</div>';
1587 }
1588
1589 // for all page components...
1590 $defs = $this->pc_definition->getPCDefinitions();
1591 foreach ($defs as $def) {
1592 $pc_class = $def["pc_class"];
1593 $pc_obj = new $pc_class($this->getPageObject());
1594 $pc_obj->setSourcecodeDownloadScript($this->determineSourcecodeDownloadScript());
1595 $pc_obj->setFileDownloadLink($this->determineFileDownloadLink());
1596 $pc_obj->setFullscreenLink($this->determineFullscreenLink());
1597 $pc_obj->setProfileBackUrl($this->getProfileBackUrl());
1598
1599 // post xsl page content modification by pc elements
1600 $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode(), $this->getAbstractOnly());
1601 }
1602 }
1603
1604 $this->addResourcesToTemplate($main_tpl);
1605
1606 // enable rendering of latex in the whole output
1607 $output = $this->ui->renderer()->render($this->ui->factory()->legacy()->latexContent($output));
1608
1609 // $output = $this->selfAssessmentRendering($output);
1610
1611 // output
1612 if ($this->ctrl->isAsynch() && !$this->getRawPageContent() &&
1613 $this->getOutputMode() == "edit") {
1614 // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1615 $up_pc = $this->request->getString("updated_pc_id_str");
1616 if ($up_pc != "") {
1617 echo $up_pc;
1618 }
1619 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1620 $tpl->setCurrentBlock("edit_page");
1621 $tpl->parseCurrentBlock();
1622 echo $tpl->get("edit_page");
1623 exit;
1624 }
1625 $edit_init = "";
1626 if ($this->getOutputMode() === "edit") {
1627 $edit_init = $this->editor_gui->init()->getInitHtml($this->getOpenPlaceHolder());
1628 }
1629 if ($this->outputToTemplate()) {
1630 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1631 $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get() . $edit_init);
1632 return $output;
1633 } else {
1634 if ($this->getRawPageContent()) { // e.g. needed in glossaries
1635 return $output . $edit_init;
1636 } else {
1637 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1638 return $tpl->get() . $edit_init;
1639 }
1640 }
1641 }
1642
1643 public function replaceCurlyBrackets(string $output): string
1644 {
1645 //echo "<br><br>".htmlentities($output);
1646
1647 while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1648 is_int($end = strpos($output, "<!--ParEnd-->", $start))) {
1649 $output = substr($output, 0, $start) .
1650 str_replace(
1651 array("{","}"),
1652 array("&#123;","&#125;"),
1653 substr($output, $start + 15, $end - ($start + 15))
1654 ) .
1655 substr($output, $end + 13);
1656 }
1657
1658 // $output = str_replace("{", "&#123;", $output);
1659 // $output = str_replace("}", "&#125;", $output);
1660 //echo "<br><br>".htmlentities($output);
1661 return $output;
1662 }
1663
1667 public function getActivationCaptions(): array
1668 {
1669 return array("deactivatePage" => $this->lng->txt("cont_deactivate_page"),
1670 "activatePage" => $this->lng->txt("cont_activate_page"));
1671 }
1672
1676 public function setEditMode(): void
1677 {
1678 $media_mode = $this->request->getString("media_mode");
1679 $html_mode = $this->request->getString("html_mode");
1680 $js_mode = $this->request->getString("js_mode");
1681 if ($media_mode != "") {
1682 if ($media_mode == "disable") {
1683 $this->user->writePref("ilPageEditor_MediaMode", "disable");
1684 } else {
1685 $this->user->writePref("ilPageEditor_MediaMode", "");
1686 }
1687 }
1688 if ($html_mode != "") {
1689 if ($html_mode == "disable") {
1690 $this->user->writePref("ilPageEditor_HTMLMode", "disable");
1691 } else {
1692 $this->user->writePref("ilPageEditor_HTMLMode", "");
1693 }
1694 }
1695 if ($js_mode != "") {
1696 if ($js_mode == "disable") {
1697 $this->user->writePref("ilPageEditor_JavaScript", "disable");
1698 } else {
1699 $this->user->writePref("ilPageEditor_JavaScript", "");
1700 }
1701 }
1702
1703 $this->ctrl->redirect($this, "edit");
1704 }
1705
1706 public function setDefaultLinkXml(): void
1707 {
1708 $this->page_linker->setProfileBackUrl($this->getProfileBackUrl());
1709 $this->page_linker->setOffline($this->getOutputMode() == self::OFFLINE);
1710 $this->setLinkXml($this->page_linker->getLinkXML($this->getPageObject()->getInternalLinks()));
1711 }
1712
1713 public function setLinkXml(string $xml): void
1714 {
1715 $this->link_xml = $xml;
1716 $this->link_xml_set = true;
1717 }
1718
1719
1720 public function getProfileBackUrl(): string
1721 {
1722 if ($this->profile_back_url != "") {
1723 return $this->profile_back_url;
1724 }
1725 if ($this->getOutputMode() === self::OFFLINE ||
1726 $this->getOutputMode() === self::PRINTING) {
1727 return "";
1728 }
1729 return $this->ctrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
1730 }
1731
1732 public function setProfileBackUrl(string $url): void
1733 {
1734 $this->profile_back_url = $url;
1735 }
1736
1737
1738 public function downloadFile(): void
1739 {
1740 $this->getPageObject()->buildDom();
1741 $cm = $this->pm->content($this->getPageObject()->getDomDoc());
1742 $cm->downloadFile(
1743 $this->getPageObject(),
1744 $this->requested_file_id
1745 );
1746 }
1747
1748 public function displayMediaFullscreen(): void
1749 {
1750 $this->displayMedia(true);
1751 }
1752
1753 public function displayMedia(bool $a_fullscreen = false): void
1754 {
1755 $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "components/ILIAS/LearningModule");
1756 $tpl->setCurrentBlock("ilMedia");
1757 //$int_links = $page_object->getInternalLinks();
1758 $med_links = ilMediaItem::_getMapAreasIntLinks($this->request->getMobId());
1759
1760 // @todo
1761 $link_xml = $this->page_linker->getLinkXML($med_links);
1762
1763 $media_obj = new ilObjMediaObject($this->request->getMobId());
1764 if ($this->request->getPageType() === "mep") {
1765 $pg_obj = new ilMediaPoolPage($this->request->getPageId());
1766 } else {
1767 $pg_obj = $this->getPageObject();
1768 }
1769 $pg_obj->buildDom();
1770
1771 $xml = "<dummy>";
1772 if ($this->requested_pg_id > 0) {
1773 $xml .= $pg_obj->getMediaAliasElement($this->request->getMobId());
1774 } else {
1775 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
1776 }
1777 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
1778 $xml .= $link_xml;
1779 $xml .= "</dummy>";
1780
1781 $mode = "media";
1782 if ($a_fullscreen) {
1783 $mode = "fullscreen";
1784 }
1785
1786 //echo "XML:".htmlentities($xml);
1787 // determine target frames for internal links
1788 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
1789 $enlarge_path = ilUtil::getImagePath("media/enlarge.svg");
1790 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
1791 'link_params' => "ref_id=" . $this->requested_ref_id,'fullscreen_link' => "",
1792 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1793 'ref_id' => $this->requested_ref_id, 'webspace_path' => $wb_path);
1794 $output = $this->xsl->process($xml, $params);
1795
1796 // unmask user html
1799 $tpl->setVariable("MEDIA_CONTENT", $output);
1800
1801 // add js
1803 //$tpl->fillJavaScriptFiles();
1804 //$tpl->fillCssFiles();
1805 $this->gui->toolbar()->setItems([]); // clear toolbar, see #45620
1806 $tpl->printToStdout();
1807 exit;
1808 }
1809
1810 public function showPageFullscreen(): void
1811 {
1812 $tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "components/ILIAS/COPage");
1813 $this->setTemplate($tpl);
1814 $this->addResourcesToTemplate($tpl);
1816 $tpl->addCss(ilObjStyleSheet::getContentStylePath($this->getStyleId()));
1817 $this->setTemplateOutput(false);
1818 $this->setHeader("");
1819 $ret = $this->showPage();
1820 $tpl->setVariable("MEDIA_CONTENT", "<div>" . $ret . "</div>");
1821 $tpl->printToStdout();
1822 exit;
1823 }
1824
1825
1829 public function download_paragraph(): void
1830 {
1831 $pg_obj = $this->getPageObject();
1832 $pg_obj->buildDom();
1833 $pg_obj->sendParagraph(
1834 $this->request->getString("par_id"),
1835 $this->request->getString("downloadtitle")
1836 );
1837 }
1838
1839 public function insertPageToc(string $a_output): string
1840 {
1841 // extract all headings
1842 $offsets = [];
1843 $cpos = 0;
1844 while (is_int($pos = strpos($a_output, "ilPageTocH", $cpos))) {
1845 $offsets[] = $pos;
1846 $cpos = $pos + 1;
1847 }
1848
1849 $page_heads = array();
1850 foreach ($offsets as $os) {
1851 $level = (int) substr($a_output, $os + 10, 1);
1852 if (in_array($level, array(1,2,3))) {
1853 $anchor = str_replace(
1854 "TocH",
1855 "TocA",
1856 substr($a_output, $os, strpos($a_output, "-->", $os) - $os)
1857 );
1858
1859 // get heading
1860 $tag_start = stripos($a_output, "<h" . $level . " ", $os);
1861 $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
1862 $head = substr($a_output, $tag_start, $tag_end - $tag_start);
1863
1864 // get headings text
1865 $text_start = stripos($head, ">") + 1;
1866 $text_end = strripos($head, "<!--", $text_start);
1867 $text = substr($head, $text_start, $text_end - $text_start);
1868 $page_heads[] = array("level" => $level, "text" => $text,
1869 "anchor" => $anchor);
1870 }
1871 }
1872 if (count($page_heads) > 1) {
1873 $listing = $this->gui->listing();
1874 // todo: inject?
1875 /*$list->setListClass("ilc_page_toc_PageTOCList");
1876 $list->setItemClass("ilc_page_toc_PageTOCItem");*/
1877 $i = 0;
1878 $c_depth = 1;
1879 $c_par[1] = 0;
1880 $c_par[2] = 0;
1881 $page_toc_ph = "<!--PageTocPH-->";
1882 foreach ($page_heads as $ind => $h) {
1883 $i++;
1884 $par = 0;
1885
1886 // check if we have a parent for one level up
1887 $par = 0;
1888 if ($h["level"] == 2 && $c_par[1] > 0) {
1889 $par = $c_par[1];
1890 }
1891 if ($h["level"] == 3 && $c_par[2] > 0) {
1892 $par = $c_par[2];
1893 }
1894
1895 $h["text"] = str_replace($page_toc_ph, "", $h["text"]);
1896
1897 $listing->node(
1898 $this->ui->factory()->legacy()->content("<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>"),
1899 (string) $i,
1900 (string) ($par)
1901 );
1902
1903 // set the node as current parent of the level
1904 if ($h["level"] == 1) {
1905 $c_par[1] = $i;
1906 $c_par[2] = 0;
1907 }
1908 if ($h["level"] == 2) {
1909 $c_par[2] = $i;
1910 }
1911 }
1912
1913 $tpl = new ilTemplate(
1914 "tpl.page_toc.html",
1915 true,
1916 true,
1917 "components/ILIAS/COPage"
1918 );
1919 $tpl->setVariable("PAGE_TOC", $listing->autoNumbers(true)->render());
1920 $tpl->setVariable("TXT_PAGE_TOC", $this->lng->txt("cont_page_toc"));
1921 $tpl->setVariable("TXT_HIDE", $this->lng->txt("hide"));
1922 $tpl->setVariable("TXT_SHOW", $this->lng->txt("show"));
1923
1924 $a_output = str_replace(
1925 "{{{{{PageTOC}}}}}",
1926 $tpl->get(),
1927 $a_output
1928 );
1929 $numbers = $listing->getNumbers();
1930
1931 if (count($numbers) > 0) {
1932 foreach ($numbers as $n) {
1933 $a_output = (strpos($a_output, $page_toc_ph) !== false)
1934 ? substr_replace($a_output, $n . " ", strpos($a_output, $page_toc_ph), strlen($page_toc_ph))
1935 : $a_output;
1936 }
1937 }
1938 } else {
1939 $a_output = str_replace(
1940 "{{{{{PageTOC}}}}}",
1941 "",
1942 $a_output
1943 );
1944 }
1945
1946 return $a_output;
1947 }
1948
1949 public function insertResources(string $a_output): string
1950 {
1951 // this is edit mode only
1952 if ($this->getEnablePCType("Resources") &&
1953 ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview")) {
1955 }
1956 return $a_output;
1957 }
1958
1959
1960
1964 public function insertAdvTrigger(string $a_output): string
1965 {
1966 if (!$this->getAbstractOnly()) {
1967 $a_output = str_replace(
1968 "{{{{{LV_show_adv}}}}}",
1969 $this->lng->txt("cont_show_adv"),
1970 $a_output
1971 );
1972 $a_output = str_replace(
1973 "{{{{{LV_hide_adv}}}}}",
1974 $this->lng->txt("cont_hide_adv"),
1975 $a_output
1976 );
1977 } else {
1978 $a_output = str_replace(
1979 "{{{{{LV_show_adv}}}}}",
1980 "",
1981 $a_output
1982 );
1983 $a_output = str_replace(
1984 "{{{{{LV_hide_adv}}}}}",
1985 "",
1986 $a_output
1987 );
1988 }
1989
1990 return $a_output;
1991 }
1992
1993
1998 public function postOutputProcessing(string $a_output): string
1999 {
2000 return $a_output;
2001 }
2002
2003
2007 public function previewHistory(): void
2008 {
2009 $this->preview();
2010 }
2011
2012 public function preview(): string
2013 {
2014 if ($this->requested_history_mode) {
2015 $this->setBackToHistoryTabs();
2016 } else {
2017 $this->tabs_gui->activateTab("cont_preview");
2018 }
2019 $this->setOutputMode(self::PREVIEW);
2020 return $this->showPage();
2021 }
2022
2026 protected function setEditorToolContext(): void
2027 {
2028 $collection = $this->tool_context->current()->getAdditionalData();
2029 if ($collection->exists(ilCOPageEditGSToolProvider::SHOW_EDITOR)) {
2030 $collection->replace(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2031 } else {
2032 $collection->add(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2033 }
2034 }
2035
2036 protected function initEditing(): void
2037 {
2038 // editing allowed?
2039 if (!$this->getEnableEditing()) {
2040 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
2041 $this->ctrl->redirect($this, "preview");
2042 }
2043
2044 // not so nive workaround for container pages, bug #0015831
2045 $ptype = $this->getParentType();
2046 if ($ptype == "cont" && $this->requested_ref_id > 0) {
2047 $ptype = ilObject::_lookupType($this->requested_ref_id, true);
2048 }
2049 $this->setScreenIdComponent();
2050 $this->help->setScreenId("edit_" . $ptype);
2051
2052 // edit lock
2053 if (!$this->getPageObject()->getEditLock()) {
2054 $this->showEditLockInfo();
2055 return;
2056 } else {
2057 $this->setEditorToolContext();
2058 }
2059
2060 $this->lng->toJS("paste");
2061 $this->lng->toJS("delete");
2062 $this->lng->toJS("cont_delete_content");
2063 $this->lng->toJS("copg_confirm_el_deletion");
2064 $this->lng->toJS("cont_saving");
2065 $this->lng->toJS("cont_ed_par");
2066 $this->lng->toJS("cont_no_block");
2067 $this->lng->toJS("copg_error");
2068 $this->lng->toJS("cont_ed_click_to_add_pg");
2069 $this->lng->toJS("cont_ed_new_item_after");
2070 $this->lng->toJS("cont_ed_new_item_before");
2071 $this->lng->toJS("cont_ed_item_up");
2072 $this->lng->toJS("cont_ed_item_down");
2073 $this->lng->toJS("cont_ed_delete_item");
2074 $this->lng->toJS("copg_edit_iframe_title");
2075 $this->lng->toJS("copg_par_format_selection");
2077 // ilModalGUI::initJS(); // due to permission repo picker in sections, waits for new tree/repo picker
2078 }
2079
2080 protected function showEditLockInfo(): void
2081 {
2082 $info = $this->lng->txt("content_no_edit_lock");
2083 $lock = $this->getPageObject()->getEditLockInfo();
2084 $info .= "</br>" . $this->lng->txt("content_until") . ": " .
2085 ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2086 $info .= "</br>" . $this->lng->txt("obj_usr") . ": " .
2087 ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2088
2089 $back_link = $this->ui->factory()->link()->standard(
2090 $this->lng->txt("back"),
2091 $this->ctrl->getLinkTarget($this, "finishEditing")
2092 );
2093
2094 $mbox = $this->ui->factory()->messageBox()->info($info)
2095 ->withLinks([$back_link]);
2096 $rendered_mbox = $this->ui->renderer()->render($mbox);
2097
2098 if (!$this->ctrl->isAsynch()) {
2099 $this->tpl->setContent($rendered_mbox);
2100 } else {
2101 echo $rendered_mbox;
2102 exit;
2103 }
2104 }
2105
2106 public function edit(): string
2107 {
2108 $this->setOutputMode(self::EDIT);
2109 $html = $this->showPage();
2110
2111 if ($this->isEnabledNotes()) {
2112 $html .= "<br /><br />" . $this->getNotesHTML();
2113 }
2114
2115 return $html;
2116 }
2117
2118 public function getBlockingInfoMessage(): string
2119 {
2120 $ui = $this->ui;
2121
2122 $lock = $this->getPageObject()->getEditLockInfo();
2123 $info = $this->lng->txt("cont_got_lock_release");
2124 $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)), $info);
2125
2126 $mbox = $ui->factory()->messageBox()->info($info);
2127
2128 return $ui->renderer()->render($mbox);
2129 }
2130
2131 public function insertJSAtPlaceholder(): string
2132 {
2133 $pl_pc_id = $this->request->getPlaceholderPCId();
2134 $this->obj->buildDom();
2135 $this->obj->addHierIDs();
2136 $this->setOpenPlaceHolder($pl_pc_id);
2137 return $this->edit();
2138 }
2139
2140 public function presentation(string $a_mode = self::PRESENTATION): string
2141 {
2142 $this->setOutputMode($a_mode);
2143
2144 return $this->showPage();
2145 }
2146
2147 public function getHTML(): string
2148 {
2149 $this->getTabs("preview");
2150 return $this->showPage();
2151 }
2152
2156 public function showMediaFullscreen(int $a_style_id = 0): void
2157 {
2158 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "components/ILIAS/COPage");
2159 $this->tpl->setCurrentBlock("ContentStyle");
2160 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
2161 $this->tpl->parseCurrentBlock();
2162
2163 $this->tpl->setVariable(
2164 "PAGETITLE",
2165 " - " . ilObject::_lookupTitle($this->request->getMobId())
2166 );
2167 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2168 $this->tpl->setCurrentBlock("ilMedia");
2169
2170 $media_obj = new ilObjMediaObject($this->request->getMobId());
2171 if ($this->requested_pg_id > 0) {
2172 $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $this->requested_pg_id);
2173 $pg_obj->buildDom();
2174
2175 $xml = "<dummy>";
2176 // todo: we get always the first alias now (problem if mob is used multiple
2177 // times in page)
2178 $xml .= $pg_obj->getMediaAliasElement($this->request->getMobId());
2179 } else {
2180 $xml = "<dummy>";
2181 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2182 }
2183 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2184 $xml .= "</dummy>";
2185
2186
2187 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
2188 $mode = "fullscreen";
2189 $params = array('mode' => $mode,
2190 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
2191 'webspace_path' => $wb_path);
2192 $output = $this->xsl->process($xml, $params);
2193
2194 // unmask user html
2195 $this->tpl->setVariable("MEDIA_CONTENT", $output);
2196 }
2197
2203 public function displayValidationError($a_error): void
2204 {
2205 if (is_array($a_error)) {
2206 $error_str = "<strong>Error(s):</strong><br>";
2207 foreach ($a_error as $error) {
2208 $err_mess = implode(" - ", $error);
2209 if (!is_int(strpos($err_mess, ":0:"))) {
2210 $error_str .= htmlentities($err_mess) . "<br />";
2211 }
2212 }
2213 $this->tpl->setVariable("MESSAGE", $error_str);
2214 }
2215 }
2216
2217 protected function setBackToEditTabs(): void
2218 {
2219 $this->tabs_gui->clearTargets();
2220 $this->tabs_gui->setBackTarget(
2221 $this->lng->txt("back"),
2222 $this->ctrl->getLinkTarget($this, "edit")
2223 );
2224 }
2225
2226 protected function setBackToHistoryTabs(): void
2227 {
2228 $this->tabs_gui->clearTargets();
2229 $this->tabs_gui->setBackTarget(
2230 $this->lng->txt("back"),
2231 $this->ctrl->getLinkTarget($this, "history")
2232 );
2233 }
2234
2238 public function history(): string
2239 {
2240 if (!$this->getEnableEditing()) {
2241 return "";
2242 }
2243
2244 $this->setBackToEditTabs();
2245
2246 $this->tpl->addJavaScript("assets/js/page_history.js");
2247
2248 $table_gui = new ilPageHistoryTableGUI($this, "history");
2249 $table_gui->setId("hist_table");
2250 $entries = $this->getPageObject()->getHistoryEntries();
2251 $entries[] = array('page_id' => $this->getPageObject()->getId(),
2252 'parent_type' => $this->getPageObject()->getParentType(),
2253 'hdate' => $this->getPageObject()->getLastChange(),
2254 'parent_id' => $this->getPageObject()->getParentId(),
2255 'nr' => 0,
2256 'sortkey' => 999999,
2257 'user' => $this->getPageObject()->last_change_user);
2258 $table_gui->setData($entries);
2259 return $table_gui->getHTML();
2260 }
2261
2265 public function rollbackConfirmation(): void
2266 {
2267 if (!$this->getEnableEditing()) {
2268 return;
2269 }
2270
2271 $c_gui = new ilConfirmationGUI();
2272
2273 // set confirm/cancel commands
2274 $this->ctrl->setParameter($this, "rollback_nr", $this->requested_old_nr);
2275 $c_gui->setFormAction($this->ctrl->getFormAction($this, "rollback"));
2276 $c_gui->setHeaderText($this->lng->txt("cont_rollback_confirmation"));
2277 $c_gui->setCancel($this->lng->txt("cancel"), "history");
2278 $c_gui->setConfirm($this->lng->txt("confirm"), "rollback");
2279
2280 $hentry = $this->obj->getHistoryEntry($this->requested_old_nr);
2281
2282 $c_gui->addItem(
2283 "id[]",
2284 $this->requested_old_nr,
2286 );
2287
2288 $this->tpl->setContent($c_gui->getHTML());
2289 }
2290
2294 public function rollback(): void
2295 {
2296 if (!$this->getEnableEditing()) {
2297 return;
2298 }
2299
2300 $hentry = $this->obj->getHistoryEntry(
2301 $this->request->getString("rollback_nr")
2302 );
2303
2304 if ($hentry["content"] != "") {
2305 $this->obj->setXMLContent($hentry["content"]);
2306 $this->obj->buildDom(true);
2307 if ($this->obj->update()) {
2308 $this->ctrl->redirect($this, "history");
2309 }
2310 }
2311 $this->ctrl->redirect($this, "history");
2312 }
2313
2314 public function setScreenIdComponent(): void
2315 {
2316 $this->help->setScreenIdComponent("copg");
2317 }
2318
2319 public function getMetaDataLink(): string
2320 {
2321 $mdtab = "";
2322 if ($this->use_meta_data) {
2323 $mdgui = new ilObjectMetaDataGUI(
2324 $this->meta_data_rep_obj,
2325 $this->meta_data_type,
2326 $this->meta_data_sub_obj_id
2327 );
2328 $mdtab = $mdgui->getTab();
2329 if ($mdtab) {
2330 $this->tabs_gui->addTarget(
2331 "meta_data",
2332 $mdtab,
2333 "",
2334 "ilobjectmetadatagui"
2335 );
2336 }
2337 }
2338 return (string) $mdtab;
2339 }
2340
2341 public function getTabs(string $a_activate = ""): void
2342 {
2343 if (in_array($this->getOutputMode(), [self::OFFLINE])) {
2344 return;
2345 }
2346 $this->setScreenIdComponent();
2347
2348 if (!$this->getEnabledTabs()) {
2349 return;
2350 }
2351
2352 // back to upper context
2353 if (!$this->getEditPreview()) {
2354 $this->tabs_gui->addTarget("pg", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
2355 } else {
2356 $this->tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
2357 }
2358
2359 if ($this->use_meta_data) {
2360 $mdgui = new ilObjectMetaDataGUI(
2361 $this->meta_data_rep_obj,
2362 $this->meta_data_type,
2363 $this->meta_data_sub_obj_id
2364 );
2365 $mdtab = $mdgui->getTab();
2366 if ($mdtab) {
2367 $this->tabs_gui->addTarget(
2368 "meta_data",
2369 $mdtab,
2370 "",
2371 "ilobjectmetadatagui"
2372 );
2373 }
2374 }
2375
2376 $lm_set = new ilSetting("lm");
2377
2378 // external hook to add tabs
2379 if (is_array($this->tab_hook)) {
2380 $func = $this->tab_hook["func"];
2381 $this->tab_hook["obj"]->$func();
2382 }
2383 }
2384
2388 public function compareVersion(): string
2389 {
2390 if (!$this->getEnableEditing()) {
2391 return "";
2392 }
2393
2394 $tpl = new ilTemplate("tpl.page_compare.html", true, true, "components/ILIAS/COPage");
2395 $this->setBackToHistoryTabs();
2396
2397 $pg = $this->obj;
2398 $l_page = ilPageObjectFactory::getInstance($pg->getParentType(), $pg->getId(), $this->request->getInt("left"), $pg->getLanguage());
2399 $r_page = ilPageObjectFactory::getInstance($pg->getParentType(), $pg->getId(), $this->request->getInt("right"), $pg->getLanguage());
2400
2401 $compare = $this->compare->compare(
2402 $this->getPageObject(),
2403 $l_page,
2404 $r_page
2405 );
2406
2407 // left page
2408 $lpage = $compare["l_page"];
2409 $cfg = $this->getPageConfig();
2410 $cfg->setPreventHTMLUnmasking(true);
2411
2412 $this->setOutputMode(self::PREVIEW);
2413 $this->setPageObject($lpage);
2414 $this->setPresentationTitle($this->getPresentationTitle());
2415 $this->setCompareMode(true);
2416
2417 $lhtml = $this->showPage();
2418 $lhtml = $this->replaceDiffTags($lhtml);
2419 $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
2420 $tpl->setVariable("LEFT", $lhtml);
2421
2422 // right page
2423 $rpage = $compare["r_page"];
2424 $this->setPageObject($rpage);
2425 $this->setPresentationTitle($this->getPresentationTitle());
2426 $this->setCompareMode(true);
2427 $this->setOutputMode(self::PREVIEW);
2428
2429 $rhtml = $this->showPage();
2430 $rhtml = $this->replaceDiffTags($rhtml);
2431 $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
2432 $tpl->setVariable("RIGHT", $rhtml);
2433
2434 $tpl->setVariable("TXT_NEW", $this->lng->txt("cont_pc_new"));
2435 $tpl->setVariable("TXT_MODIFIED", $this->lng->txt("cont_pc_modified"));
2436 $tpl->setVariable("TXT_DELETED", $this->lng->txt("cont_pc_deleted"));
2437
2438 return $tpl->get();
2439 }
2440
2441 public function replaceDiffTags(string $a_html): string
2442 {
2443 $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
2444 $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
2445 $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
2446 $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
2447
2448 return $a_html;
2449 }
2450
2454 public function editActivation(): void
2455 {
2456 $this->setBackToEditTabs();
2457
2458 $atpl = new ilTemplate("tpl.page_activation.php", true, true, "components/ILIAS/COPage");
2459 $this->initActivationForm();
2460 $this->getActivationFormValues();
2461 $atpl->setVariable("FORM", $this->form->getHTML());
2462 $this->tpl->setContent($atpl->get());
2463 }
2464
2468 public function initActivationForm(): void
2469 {
2470 $this->form = new ilPropertyFormGUI();
2471 $this->form->setFormAction($this->ctrl->getFormAction($this));
2472 $this->form->setTitle($this->lng->txt("cont_page_activation"));
2473
2474 // activation type radio
2475 $rad = new ilRadioGroupInputGUI($this->lng->txt("cont_activation"), "activation");
2476 $rad_op1 = new ilRadioOption($this->lng->txt("cont_activated"), "activated");
2477
2478 $rad->addOption($rad_op1);
2479 $rad_op2 = new ilRadioOption($this->lng->txt("cont_deactivated"), "deactivated");
2480 $rad->addOption($rad_op2);
2481 $rad_op3 = new ilRadioOption($this->lng->txt("cont_scheduled_activation"), "scheduled");
2482
2483 $dt_prop = new ilDateTimeInputGUI($this->lng->txt("cont_start"), "start");
2484 $dt_prop->setRequired(true);
2485 $dt_prop->setShowTime(true);
2486 $rad_op3->addSubItem($dt_prop);
2487 $dt_prop2 = new ilDateTimeInputGUI($this->lng->txt("cont_end"), "end");
2488 $dt_prop2->setRequired(true);
2489 $dt_prop2->setShowTime(true);
2490 $rad_op3->addSubItem($dt_prop2);
2491
2492 // show activation information
2493 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
2494 $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
2495 $rad_op3->addSubItem($cb);
2496
2497
2498 $rad->addOption($rad_op3);
2499
2500 $this->form->addCommandButton("saveActivation", $this->lng->txt("save"));
2501
2502 $this->form->addItem($rad);
2503 }
2504
2508 public function getActivationFormValues(): void
2509 {
2510 $activation = "deactivated";
2511 if ($this->getPageObject()->getActive()) {
2512 $activation = "activated";
2513 }
2514
2515 $dt_prop = $this->form->getItemByPostVar("start");
2516 if ($this->getPageObject()->getActivationStart() != "") {
2517 $activation = "scheduled";
2518 $dt_prop->setDate(new ilDateTime(
2519 $this->getPageObject()->getActivationStart(),
2521 ));
2522 }
2523 $dt_prop = $this->form->getItemByPostVar("end");
2524 if ($this->getPageObject()->getActivationEnd() != "") {
2525 $activation = "scheduled";
2526 $dt_prop->setDate(new ilDateTime(
2527 $this->getPageObject()->getActivationEnd(),
2529 ));
2530 }
2531
2532 $this->form->getItemByPostVar("activation")->setValue($activation);
2533 $this->form->getItemByPostVar("show_activation_info")->setChecked($this->getPageObject()->getShowActivationInfo());
2534 }
2535
2539 public function saveActivation(): void
2540 {
2541 $this->initActivationForm();
2542
2543 if ($this->form->checkInput()) {
2544 $this->getPageObject()->setActive(true);
2545 $this->getPageObject()->setActivationStart(null);
2546 $this->getPageObject()->setActivationEnd(null);
2547 $this->getPageObject()->setShowActivationInfo(
2548 $this->request->getString("show_activation_info")
2549 );
2550 $activation = $this->request->getString("activation");
2551 if ($activation == "deactivated") {
2552 $this->getPageObject()->setActive(false);
2553 }
2554 if ($activation == "scheduled") {
2555 $this->getPageObject()->setActive(false);
2556 $this->getPageObject()->setActivationStart(
2557 $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME)
2558 );
2559 $this->getPageObject()->setActivationEnd(
2560 $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME)
2561 );
2562 }
2563 $this->getPageObject()->update();
2564 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
2565 $this->ctrl->redirect($this, "editActivation");
2566 }
2567 $this->form->setValuesByPost();
2568 $this->tpl->setContent($this->form->getHTML());
2569 }
2570
2574 public function getNotesHTML(
2575 ?object $a_content_object = null,
2576 bool $a_enable_private_notes = true,
2577 bool $a_enable_public_notes = false,
2578 bool $a_enable_notes_deletion = false,
2579 ?callable $a_callback = null,
2580 bool $export = false
2581 ): string {
2582 // scorm 2004 page gui
2583 if (!$a_content_object) {
2584 throw new ilException("No content object given.");
2585 /*
2586 $notes_gui = new ilNoteGUI(
2587 $this->notes_parent_id,
2588 $this->obj->getId(),
2589 "pg"
2590 );
2591
2592 $a_enable_private_notes = true;
2593 $a_enable_public_notes = true;
2594 $a_enable_notes_deletion = false;
2595 $notes_gui->setUseObjectTitleHeader(false);*/
2596 }
2597 // wiki page gui, blog posting gui
2598 else {
2599 /*
2600 $notes_gui = new ilNoteGUI(
2601 $a_content_object->getParentId(),
2602 $a_content_object->getId(),
2603 $a_content_object->getParentType()
2604 );*/
2605 $comments_gui = $this->notes->gui()->getCommentsGUI(
2606 $a_content_object->getParentId(),
2607 $a_content_object->getId(),
2608 $a_content_object->getParentType()
2609 );
2610 $comments_gui->setUseObjectTitleHeader(false);
2611 }
2612
2613 if ($a_enable_private_notes) {
2614 $comments_gui->enablePrivateNotes();
2615 }
2616 if ($a_enable_public_notes) {
2617 $comments_gui->enablePublicNotes();
2618 if ($a_enable_notes_deletion) {
2619 $comments_gui->enablePublicNotesDeletion(true);
2620 }
2621 }
2622 if ($export) {
2623 $comments_gui->setExportMode();
2624 }
2625
2626 if ($a_callback) {
2627 $comments_gui->addObserver($a_callback);
2628 }
2629
2630 $next_class = $this->ctrl->getNextClass($this);
2631 if (in_array($next_class, ["ilnotegui", "ilcommentgui"])) {
2632 $html = $this->ctrl->forwardCommand($comments_gui);
2633 } else {
2634 $html = $comments_gui->getListHTML();
2635 }
2636 return $html;
2637 }
2638
2642 public function processAnswer(): void
2643 {
2645 $this->request->getString("type"),
2646 $this->request->getString("id"),
2647 $this->request->getString("answer")
2648 );
2649 }
2650
2651
2652 //
2653 // Initially opened content (e.g. used in learning modules), that
2654 // is presented in another than the main content area (e.g. a picture in
2655 // the bottom left area)
2656 //
2657
2661 public function initialOpenedContent(): void
2662 {
2663 $this->tabs_gui->activateTab("edit");
2664 $form = $this->initOpenedContentForm();
2665 $this->tpl->setContent($form->getHTML());
2666 }
2667
2669 {
2670 $form = new ilPropertyFormGUI();
2671
2672 // link input
2673 $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
2674 $ac->setAllowedLinkTypes(ilLinkInputGUI::INT);
2675 $ac->setInternalLinkDefault("Media_Media", 0);
2676 $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
2677 $val = $this->obj->getInitialOpenedContent();
2678 if (($val["id"] ?? '') != "" && ($val["type"] ?? '') != "") {
2679 $ac->setValue($val["type"] . "|" . $val["id"] . "|" . $val["target"]);
2680 }
2681
2682 $form->addItem($ac);
2683
2684 $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
2685 $form->addCommandButton("edit", $this->lng->txt("cancel"));
2686 $form->setTitle($this->lng->txt("cont_initial_attached_content"));
2687 $form->setFormAction($this->ctrl->getFormAction($this));
2688
2689 return $form;
2690 }
2691
2692 public function saveInitialOpenedContent(): void
2693 {
2694 $this->obj->saveInitialOpenedContent(
2695 $this->request->getString("opened_content_ajax_type"),
2696 $this->request->getInt("opened_content_ajax_id"),
2697 $this->request->getString("opened_content_ajax_target")
2698 );
2699
2700 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"));
2701 $this->ctrl->redirect($this, "edit");
2702 }
2703
2707
2708
2712 public function switchToLanguage(): void
2713 {
2714 $l = $this->request->getString("totransl");
2715 $p = $this->getPageObject();
2716 if (!$this->checkLangPageAvailable($p->getId(), $l)) {
2717 $this->confirmPageTranslationCreation();
2718 return;
2719 }
2720 $this->ctrl->setParameter($this, "transl", $l);
2721 $this->ctrl->redirect($this, "edit");
2722 }
2723
2724 protected function checkLangPageAvailable(int $id, string $lang): bool
2725 {
2726 $p = $this->getPageObject();
2727 return ilPageObject::_exists($this->getParentType(), $id, $lang);
2728 }
2729
2733 public function confirmPageTranslationCreation(): void
2734 {
2735 $l = $this->request->getString("totransl");
2736 $this->ctrl->setParameter($this, "totransl", $l);
2737 $this->lng->loadLanguageModule("meta");
2738
2739 $cgui = new ilConfirmationGUI();
2740 $cgui->setFormAction($this->ctrl->getFormAction($this));
2741 $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
2742 $this->lng->txt("meta_l_" . $l));
2743 $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
2744 $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");
2745 $this->tpl->setContent($cgui->getHTML());
2746 }
2747
2751 public function editMasterLanguage(): void
2752 {
2753 $this->ctrl->setParameter($this, "transl", "-");
2754 $this->ctrl->redirect($this, "edit");
2755 }
2756
2760 public function createPageTranslation(): void
2761 {
2762 $l = $this->request->getString("totransl");
2763
2765 $this->getPageObject()->getParentType(),
2766 $this->getPageObject()->getId(),
2767 0,
2768 "-"
2769 );
2770
2771 $p->copyPageToTranslation($l);
2772 $this->ctrl->setParameter($this, "transl", $l);
2773 $this->ctrl->redirect($this, "edit");
2774 }
2775
2779 public function releasePageLock(): void
2780 {
2781 $this->getPageObject()->releasePageLock();
2782 $this->tpl->setOnScreenMessage('success', $this->lng->txt("cont_page_lock_released"), true);
2783 $this->finishEditing();
2784 }
2785
2786 public function finishEditing(): void
2787 {
2788 $this->ctrl->redirect($this, "preview");
2789 }
2790
2791 protected function isPageContainerToBeRendered(): bool
2792 {
2793 return (
2794 $this->getRenderPageContainer() || ($this->getOutputMode() == self::PREVIEW && $this->getPageConfig()->getUsePageContainer())
2795 );
2796 }
2797
2798 public function getPagePermaLink(): string
2799 {
2800 return "";
2801 }
2802
2807 {
2808 $collector = new \ILIAS\COPage\ResourcesCollector($this->getOutputMode(), $this->getPageObject());
2809
2810 foreach ($collector->getJavascriptFiles() as $js) {
2811 $tpl->addJavaScript($js);
2812 }
2813
2814 foreach ($collector->getCssFiles() as $css) {
2815 $tpl->addCss($css);
2816 }
2817
2818 foreach ($collector->getOnloadCode() as $code) {
2819 $tpl->addOnLoadCode($code);
2820 }
2821 }
2822
2826 public function getAdditionalPageActions(): array
2827 {
2828 return [];
2829 }
2830
2831 public function afterDeleteContents(): void
2832 {
2833 }
2834
2835}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Page component editing request.
GUI class for public user profile presentation.
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 addCss()
Add required css.
static addJavaScript(?ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
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.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
This class represents a date/time property in a property form.
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Base class for ILIAS Exception handling.
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 _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)
User Interface for NewsItem entities.
static hasSuccessorPage(int $a_cont_obj_id, int $a_page_id)
checks if page has a successor page
static includePresentationJS(?ilGlobalTemplateInterface $a_tpl=null)
Include media object presentation JS.
static isTypeAllowed(string $a_type)
Class ilObjStyleSheet.
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.
Class ilObjectMetaDataGUI.
Class ilObject Basic functions for all objects.
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 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...
Page Editor GUI class.
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="-")
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
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
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="")
ILIAS COPage Link LinkManager $link
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.
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.
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="")
ILIAS COPage PC PCDefinition $pc_definition
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.
ILIAS COPage Compare PageCompare $compare
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)
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)
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.
getAdditionalPageActions()
Get additional page actions.
ilGlobalTemplateInterface $tpl
ILIAS COPage InternalGUIService $gui
history()
Get history table as HTML.
ILIAS COPage Editor GUIService $editor_gui
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.
ILIAS Notes Service $notes
setProfileBackUrl(string $url)
getComponentPluginsXML()
Put information about activated plugins into XML.
ILIAS COPage Xsl XslManager $xsl
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)
checkLangPageAvailable(int $id, string $lang)
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.
ILIAS COPage Page PageManager $pm
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)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
Class ilQuestionEditGUI.
This class represents a property in a property form.
This class represents an option in a radio group.
ILIAS Setting Class.
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 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=null)
Default behaviour is:
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
const ANONYMOUS_USER_ID
Definition: constants.php:27
exit
$info
Definition: entry_point.php:21
const ILIAS_VERSION
setVariable(string $variable, $value='')
Sets the given variable to the given value.
touchBlock(string $block)
overwrites ITX::touchBlock.
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
form(?array $class_path, string $cmd, string $submit_caption="")
link(string $caption, string $href, bool $new_viewport=false)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68
$lm_set
getLanguage()
$text
Definition: xapiexit.php:21