ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPageObjectGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
17{
18 const PRESENTATION = "presentation";
19 const EDIT = "edit";
20 const PREVIEW = "preview";
21 const OFFLINE = "offline";
22 const PRINTING = "print";
23 protected $profile_back_url = "";
24
28 protected $tpl;
29
33 protected $lng;
34
38 protected $ctrl;
39
43 protected $tabs_gui;
44
48 protected $access;
49
53 protected $plugin_admin;
54
58 protected $log;
59
63 protected $user;
64
68 protected $help;
69
73 public $obj;
74
78 protected $output_mode;
79
90 public $activation = false;
91 public $activated = true;
92 public $editpreview = false;
93 public $use_meta_data = false;
94 public $link_xml_set = false;
95 public $enableediting = true;
96 public $rawpagecontent = false;
98 public $compare_mode = false;
99 public $page_config = null;
100 public $tabs_enabled = true;
102 private $abstract_only = false;
103 protected $parent_type = "";
104
108 protected $tool_context;
109
110 //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
111 //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
112 public $pl_start = "{{{{{";
113 public $pl_end = "}}}}}";
114
118 protected $ui;
119
120 protected $page_linker;
121
131 public function __construct(
132 $a_parent_type,
133 $a_id,
134 $a_old_nr = 0,
135 $a_prevent_get_id = false,
136 $a_lang = ""
137 ) {
138 global $DIC;
139
140 $this->log = ilLoggerFactory::getLogger('copg');
141 $this->tpl = $DIC->ui()->mainTemplate();
142 $this->ctrl = $DIC->ctrl();
143 $this->lng = $DIC->language();
144 $this->tabs_gui = $DIC->tabs();
145 $this->plugin_admin = $DIC["ilPluginAdmin"];
146 $this->access = $DIC->access();
147 $this->user = $DIC->user();
148 $this->help = $DIC["ilHelp"];
149 $this->ui = $DIC->ui();
150
151 $this->setParentType($a_parent_type);
152 $this->setId($a_id);
153 if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0) {
154 $a_old_nr = $_GET["old_nr"];
155 }
156 $this->setOldNr($a_old_nr);
157
158 if ($a_lang == "" && $_GET["transl"] != "") {
159 $this->setLanguage($_GET["transl"]);
160 } else {
161 if ($a_lang == "") {
162 $a_lang = "-";
163 }
164 $this->setLanguage($a_lang);
165 }
166
167
168 $this->setOutputMode(self::PRESENTATION);
169 $this->setEnabledPageFocus(true);
170 $this->initPageObject();
171 $this->setPageConfig($this->getPageObject()->getPageConfig());
172
173 $this->page_linker = new ilPageLinker(get_class($this));
174
175 $this->output2template = true;
176 $this->question_xml = "";
177 $this->question_html = "";
178
179 $this->template_output_var = "PAGE_CONTENT";
180 $this->change_comments = false;
181 $this->page_back_title = $this->lng->txt("page");
182 $this->lng->loadLanguageModule("content");
183 $this->lng->loadLanguageModule("copg");
184
185 $this->tool_context = $DIC->globalScreen()->tool()->context();
186
187 $this->setTemplateOutput(false);
188
189 $this->ctrl->saveParameter($this, "transl");
190
191 $this->afterConstructor();
192 }
193
197 public function afterConstructor()
198 {
199 }
200
201
205 final protected function initPageObject()
206 {
207 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
209 $this->getParentType(),
210 $this->getId(),
211 $this->getOldNr(),
212 $this->getLanguage()
213 );
214 $this->setPageObject($page);
215 }
216
222 public function setParentType($a_val)
223 {
224 $this->parent_type = $a_val;
225 }
226
232 public function getParentType()
233 {
234 return $this->parent_type;
235 }
236
242 public function setId($a_val)
243 {
244 $this->id = $a_val;
245 }
246
252 public function getId()
253 {
254 return $this->id;
255 }
256
262 public function setOldNr($a_val)
263 {
264 $this->old_nr = $a_val;
265 }
266
272 public function getOldNr()
273 {
274 return $this->old_nr;
275 }
276
282 public function setLanguage($a_val)
283 {
284 $this->language = $a_val;
285 }
286
292 public function getLanguage()
293 {
294 if ($this->language == "") {
295 return "-";
296 }
297
298 return $this->language;
299 }
300
306 public function setEnablePCType($a_pc_type, $a_val)
307 {
308 $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
309 }
310
316 public function getEnablePCType($a_pc_type)
317 {
318 return $this->getPageConfig()->getEnablePCType($a_pc_type);
319 }
320
326 public function setPageConfig($a_val)
327 {
328 $this->page_config = $a_val;
329 }
330
336 public function getPageConfig()
337 {
338 return $this->page_config;
339 }
340
346 public function setPageObject(ilPageObject $a_pg_obj)
347 {
348 $this->obj = $a_pg_obj;
349 }
350
356 public function getPageObject()
357 {
358 return $this->obj;
359 }
360
366 public function setOutputMode($a_mode = self::PRESENTATION)
367 {
368 $this->output_mode = $a_mode;
369 }
370
371 public function getOutputMode()
372 {
373 return $this->output_mode;
374 }
375
376 public function setTemplateOutput($a_output = true)
377 {
378 $this->output2template = $a_output;
379 }
380
381 public function outputToTemplate()
382 {
384 }
385
386 public function setPresentationTitle($a_title = "")
387 {
388 $this->presentation_title = $a_title;
389 }
390
391 public function getPresentationTitle()
392 {
394 }
395
396 public function setHeader($a_title = "")
397 {
398 $this->header = $a_title;
399 }
400
401 public function getHeader()
402 {
403 return $this->header;
404 }
405
406 public function setLinkParams($l_params = "")
407 {
408 $this->link_params = $l_params;
409 }
410
411 public function getLinkParams()
412 {
413 return $this->link_params;
414 }
415
416 public function setLinkFrame($l_frame = "")
417 {
418 $this->link_frame = $l_frame;
419 }
420
421 public function getLinkFrame()
422 {
423 return $this->link_frame;
424 }
425
427 {
428 $this->page_linker = $page_linker;
429 }
430
431 public function getLinkXML()
432 {
433 return $this->link_xml;
434 }
435
436 public function setQuestionXML($question_xml)
437 {
438 $this->question_xml = $question_xml;
439 }
440
442 {
443 $this->getPageConfig()->setQuestionHTML($question_html);
444 }
445
446 public function getQuestionXML()
447 {
448 return $this->question_xml;
449 }
450
451 public function getQuestionHTML()
452 {
453 return $this->getPageConfig()->getQuestionHTML();
454 }
455
456 public function setTemplateTargetVar($a_variable)
457 {
458 $this->target_var = $a_variable;
459 }
460
461 public function getTemplateTargetVar()
462 {
463 return $this->target_var;
464 }
465
466 public function setTemplateOutputVar($a_value)
467 {
468 $this->template_output_var = $a_value;
469 }
470
471 public function getTemplateOutputVar()
472 {
474 }
475
481 public function setSourcecodeDownloadScript($script_name)
482 {
483 $this->sourcecode_download_script = $script_name;
484 }
485
492 {
494 }
495
496 public function setLocator(&$a_locator)
497 {
498 $this->locator = $a_locator;
499 }
500
501 public function setTabs($a_tabs)
502 {
503 $this->tabs_gui = $a_tabs;
504 }
505
506 public function setPageBackTitle($a_title)
507 {
508 $this->page_back_title = $a_title;
509 }
510
516 public function setFileDownloadLink($a_download_link)
517 {
518 $this->file_download_link = $a_download_link;
519 }
520
526 public function getFileDownloadLink()
527 {
528 return $this->file_download_link;
529 }
530
536 public function setFullscreenLink($a_fullscreen_link)
537 {
538 $this->fullscreen_link = $a_fullscreen_link;
539 }
540
546 public function getFullscreenLink()
547 {
548 return $this->fullscreen_link;
549 }
550
551 public function setIntLinkReturn($a_return)
552 {
553 $this->int_link_return = $a_return;
554 }
555
556 public function enableChangeComments($a_enabled)
557 {
558 $this->change_comments = $a_enabled;
559 }
560
561 public function isEnabledChangeComments()
562 {
564 }
565
566 public function enableNotes($a_enabled, $a_parent_id)
567 {
568 $this->notes_enabled = $a_enabled;
569 $this->notes_parent_id = $a_parent_id;
570 }
571
572 public function isEnabledNotes()
573 {
574 return $this->notes_enabled;
575 }
576
582 public function setOfflineDirectory($offdir)
583 {
584 $this->offline_directory = $offdir;
585 }
586
587
592 public function getOfflineDirectory()
593 {
594 return $this->offline_directory;
595 }
596
597
604 public function setViewPageLink($a_link, $a_target = "")
605 {
606 $this->view_page_link = $a_link;
607 $this->view_page_target = $a_target;
608 }
609
613 public function getViewPageLink()
614 {
615 return $this->view_page_link;
616 }
617
621 public function getViewPageTarget()
622 {
623 return $this->view_page_target;
624 }
625
631 public function getViewPageText()
632 {
633 return $this->lng->txt("cont_presentation_view");
634 }
635
636 public function setActivationListener(&$a_obj, $a_meth)
637 {
638 $this->act_obj = $a_obj;
639 $this->act_meth = $a_meth;
640 }
641
647 public function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
648 {
649 $this->enabled_news = $a_enabled;
650 $this->news_obj_id = $a_news_obj_id;
651 $this->news_obj_type = $a_news_obj_type;
652 }
653
659 public function getEnabledNews()
660 {
661 return $this->enabled_news;
662 }
663
667 public function setTabHook($a_object, $a_function)
668 {
669 $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
670 }
671
677 public function setEditPreview($a_editpreview)
678 {
679 $this->editpreview = $a_editpreview;
680 }
681
687 public function getEditPreview()
688 {
689 return $this->editpreview;
690 }
691
697 public function setEnabledTabs($a_enabledtabs)
698 {
699 $this->tabs_enabled = $a_enabledtabs;
700 }
701
707 public function getEnabledTabs()
708 {
709 return $this->tabs_enabled;
710 }
711
717 public function setEnabledPageFocus($a_enabledpagefocus)
718 {
719 $this->enabledpagefocus = $a_enabledpagefocus;
720 }
721
727 public function getEnabledPageFocus()
728 {
729 return $this->enabledpagefocus;
730 }
731
737 public function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
738 {
739 return;
740 $this->exp_frame = $a_exp_frame;
741 $this->exp_id = $a_exp_id;
742 $this->exp_target_script = $a_exp_target_script;
743 }
744
750 public function setPrependingHtml($a_prependinghtml)
751 {
752 $this->prependinghtml = $a_prependinghtml;
753 }
754
760 public function getPrependingHtml()
761 {
762 return $this->prependinghtml;
763 }
764
770 public function setEnableEditing($a_enableediting)
771 {
772 $this->enableediting = $a_enableediting;
773 }
774
780 public function getEnableEditing()
781 {
783 }
784
790 public function setRawPageContent($a_rawpagecontent)
791 {
792 $this->rawpagecontent = $a_rawpagecontent;
793 }
794
800 public function getRawPageContent()
801 {
803 }
804
810 public function setStyleId($a_styleid)
811 {
812 $this->styleid = $a_styleid;
813 }
814
820 public function getStyleId()
821 {
822 return $this->styleid;
823 }
824
830 public function setCompareMode($a_val)
831 {
832 $this->compare_mode = $a_val;
833 }
834
840 public function getCompareMode()
841 {
842 return $this->compare_mode;
843 }
844
850 public function setAbstractOnly($a_val)
851 {
852 $this->abstract_only = $a_val;
853 }
854
860 public function getAbstractOnly()
861 {
863 }
864
870 public function setRenderPageContainer($a_val)
871 {
872 $this->render_page_container = $a_val;
873 }
874
880 public function getRenderPageContainer()
881 {
883 }
884
891 public function getDisabledText()
892 {
893 return $this->lng->txt("inactive");
894 }
895
896
906 public function activateMetaDataEditor(
907 $a_rep_obj,
908 $a_type,
909 $a_sub_obj_id,
910 $a_observer_obj = null,
911 $a_observer_func = ""
912 ) {
913 $this->use_meta_data = true;
914 $this->meta_data_rep_obj = $a_rep_obj;
915 $this->meta_data_sub_obj_id = $a_sub_obj_id;
916 $this->meta_data_type = $a_type;
917 $this->meta_data_observer_obj = $a_observer_obj;
918 $this->meta_data_observer_func = $a_observer_func;
919 }
920
927 {
928 $file_download_link = $this->getFileDownloadLink();
929 if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline") {
930 $file_download_link = $this->ctrl->getLinkTarget($this, "downloadFile");
931 }
932 return $file_download_link;
933 }
934
940 public function determineFullscreenLink()
941 {
942 $fullscreen_link = $this->getFullscreenLink();
943 if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline") {
944 $fullscreen_link = $this->ctrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
945 }
946 return $fullscreen_link;
947 }
948
955 {
957 if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline") {
958 $l = $this->ctrl->getLinkTarget($this, "");
959 }
960 return $l;
961 }
962
966 public function getComponentPluginsXML()
967 {
968 $xml = "";
969 if ($this->getOutputMode() == "edit") {
970 $pl_names = $this->plugin_admin->getActivePluginsForSlot(
972 "COPage",
973 "pgcp"
974 );
975 foreach ($pl_names as $pl_name) {
976 $plugin = $this->plugin_admin->getPluginObject(
978 "COPage",
979 "pgcp",
980 $pl_name
981 );
982 if ($plugin->isValidParentType($this->getPageObject()->getParentType())) {
983 $xml .= '<ComponentPlugin Name="' . $plugin->getPluginName() .
984 '" InsertText="' . $plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT) . '" />';
985 }
986 }
987 }
988 if ($xml != "") {
989 $xml = "<ComponentPlugins>" . $xml . "</ComponentPlugins>";
990 }
991 return $xml;
992 }
993
994
998 public function executeCommand()
999 {
1000 $this->getTabs();
1001
1002 $this->ctrl->setReturn($this, "edit");
1003
1004 $next_class = $this->ctrl->getNextClass($this);
1005 $this->log->debug("next_class: " . $next_class);
1006 switch ($next_class) {
1007 case 'ilobjectmetadatagui':
1008 $this->tabs_gui->activateTab("meta_data");
1009 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
1010 $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
1011 if (is_object($this->meta_data_observer_obj)) {
1012 $md_gui->addMDObserver(
1013 $this->meta_data_observer_obj,
1014 $this->meta_data_observer_func,
1015 "General"
1016 );
1017 }
1018 $this->ctrl->forwardCommand($md_gui);
1019 break;
1020
1021 case "ileditclipboardgui":
1022 $clip_gui = new ilEditClipboardGUI();
1023 $clip_gui->setPageBackTitle($this->page_back_title);
1024 $ret = $this->ctrl->forwardCommand($clip_gui);
1025 break;
1026
1027 // notes
1028 case "ilnotegui":
1029 switch ($_GET["notes_mode"]) {
1030 default:
1031 $html = $this->edit();
1032 $this->tabs_gui->setTabActive("edit");
1033 return $html;
1034 }
1035 break;
1036
1037 case 'ilpublicuserprofilegui':
1038 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
1039 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1040 $ret = $this->ctrl->forwardCommand($profile_gui);
1041 break;
1042
1043 case "ilpageeditorgui":
1044 if (!$this->getEnableEditing()) {
1045 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
1046 $this->ctrl->redirect($this, "preview");
1047 }
1048 $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
1049 $page_editor->setLocator($this->locator);
1050 $page_editor->setHeader($this->getHeader());
1051 $page_editor->setPageBackTitle($this->page_back_title);
1052 $page_editor->setIntLinkReturn($this->int_link_return);
1053 //$page_editor->executeCommand();
1054 $ret = $this->ctrl->forwardCommand($page_editor);
1055 break;
1056
1057 case 'ilnewsitemgui':
1058 include_once("./Services/News/classes/class.ilNewsItemGUI.php");
1059 $news_item_gui = new ilNewsItemGUI();
1060 $news_item_gui->setEnableEdit(true);
1061 $news_item_gui->setContextObjId($this->news_obj_id);
1062 $news_item_gui->setContextObjType($this->news_obj_type);
1063 $news_item_gui->setContextSubObjId($this->obj->getId());
1064 $news_item_gui->setContextSubObjType("pg");
1065
1066 $ret = $this->ctrl->forwardCommand($news_item_gui);
1067 break;
1068
1069 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1070 $ret = $this->ctrl->forwardCommand($profile_gui);
1071 break;
1072
1073 case "ilpropertyformgui":
1074 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1075 $form = $this->initOpenedContentForm();
1076 $this->ctrl->forwardCommand($form);
1077 break;
1078
1079 case "ilinternallinkgui":
1080 $this->lng->loadLanguageModule("content");
1081 require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1082 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1083
1084 $link_gui->filterLinkType("PageObject_FAQ");
1085 $link_gui->filterLinkType("GlossaryItem");
1086 $link_gui->filterLinkType("Media_Media");
1087 $link_gui->filterLinkType("Media_FAQ");
1088
1089 $link_gui->setFilterWhiteList(true);
1090 $this->ctrl->forwardCommand($link_gui);
1091 break;
1092
1093 case "ilquestioneditgui":
1094 $this->setQEditTabs("question");
1095 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1096 $edit_gui = new ilQuestionEditGUI();
1097 $edit_gui->setPageConfig($this->getPageConfig());
1098// $edit_gui->addNewIdListener($this, "setNewQuestionId");
1099 $edit_gui->setSelfAssessmentEditingMode(true);
1100 $ret = $this->ctrl->forwardCommand($edit_gui);
1101 $this->tpl->setContent($ret);
1102 break;
1103
1104 case 'ilassquestionfeedbackeditinggui':
1105
1107
1108 // set tabs
1109 $this->setQEditTabs("feedback");
1110
1111 // load required lang mods
1112 $this->lng->loadLanguageModule("assessment");
1113
1114 // set context tabs
1115 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
1116 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
1117 $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
1118 $questionGUI->object->setObjId(0);
1119 $questionGUI->object->setSelfAssessmentEditingMode(true);
1120 $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1121
1122 // forward to ilAssQuestionFeedbackGUI
1123 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1124 $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $this->ctrl, $this->access, $this->tpl, $this->tabs_gui, $this->lng);
1125 $this->ctrl->forwardCommand($gui);
1126 break;
1127
1128/* case "ilpagemultilanggui":
1129 $this->ctrl->setReturn($this, "edit");
1130 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1131 $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1132 $this->getPageConfig()->getSinglePageMode());
1133 //$this->setTabs("settings");
1134 //$this->setSubTabs("cont_multilinguality");
1135 $ret = $this->ctrl->forwardCommand($ml_gui);
1136 break;*/
1137
1138
1139 case 'ilLearninghistorygui':
1140 $user_id = null;
1141 if ($this->getPageObject()->getParentType() == "prtf") {
1142 $user_id = ilObject::_lookupOwner($this->getPageObject()->getPortfolioId());
1143 }
1144 $hist_gui = new ilLearningHistoryGUI();
1145 $hist_gui->setUserId($user_id);
1146 $this->ctrl->forwardCommand($hist_gui);
1147 break;
1148
1149 default:
1150 $cmd = $this->ctrl->getCmd("preview");
1151 $ret = $this->$cmd();
1152 break;
1153 }
1154 //echo "+$ret+";
1155 return $ret;
1156 }
1157
1164 public function setQEditTabs($a_active)
1165 {
1166 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1167
1168 $this->tabs_gui->clearTargets();
1169
1170 $this->tabs_gui->setBackTarget(
1171 $this->lng->txt("back"),
1172 $this->ctrl->getLinkTarget($this, "edit")
1173 );
1174
1175 $this->ctrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1176 $this->tabs_gui->addTab(
1177 "question",
1178 $this->lng->txt("question"),
1179 $this->ctrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion")
1180 );
1181
1182 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1183 $this->ctrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1184 $this->tabs_gui->addTab(
1185 "feedback",
1186 $this->lng->txt("feedback"),
1187 $this->ctrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
1188 );
1189
1190 $this->tabs_gui->activateTab($a_active);
1191 }
1192
1197 {
1198 }
1199
1200
1201 public function deactivatePage()
1202 {
1203 $this->getPageObject()->setActivationStart(null);
1204 $this->getPageObject()->setActivationEnd(null);
1205 $this->getPageObject()->setActive(false);
1206 $this->getPageObject()->update();
1207 $this->ctrl->redirect($this, "edit");
1208 }
1209
1210 public function activatePage()
1211 {
1212 $this->getPageObject()->setActivationStart(null);
1213 $this->getPageObject()->setActivationEnd(null);
1214 $this->getPageObject()->setActive(true);
1215 $this->getPageObject()->update();
1216 $this->ctrl->redirect($this, "edit");
1217 }
1218
1222 public function showPage()
1223 {
1224 $main_tpl = $this->tpl;
1225
1226 // jquery and jquery ui are always provided for components
1227 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1230
1231 // $this->initSelfAssessmentRendering();
1232
1233 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1235
1236 $main_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1237
1238 // needed for overlays in iim
1239 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1241
1242 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1244
1245 // init template
1246 //if($this->outputToTemplate())
1247 //{
1248 if ($this->getOutputMode() == "edit") {
1249 $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1250
1251 //echo ":".$this->getTemplateTargetVar().":";
1252 $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1253 //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1254
1255 // to do: status dependent class
1256 $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1257
1258 // user comment
1259 if ($this->isEnabledChangeComments()) {
1260 $tpl->setCurrentBlock("change_comment");
1261 $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1262 $tpl->parseCurrentBlock();
1263 }
1264
1265 $tpl->setVariable(
1266 "WYSIWYG_ACTION",
1267 $this->ctrl->getFormActionByClass("ilpageeditorgui", "", "", true)
1268 );
1269
1270 // determine media, html and javascript mode
1271 $sel_media_mode = ($this->user->getPref("ilPageEditor_MediaMode") == "disable")
1272 ? "disable"
1273 : "enable";
1274 $sel_html_mode = ($this->user->getPref("ilPageEditor_HTMLMode") == "disable")
1275 ? "disable"
1276 : "enable";
1277 $sel_js_mode = "disable";
1278 //if($ilSetting->get("enable_js_edit", 1))
1279 //{
1280 $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1281 ? "enable"
1282 : "disable";
1283 //}
1284
1285 // show prepending html
1286 $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1287 $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1288
1289 // presentation view
1290 if ($this->getViewPageLink() != "") {
1291 $this->tabs_gui->addNonTabbedLink(
1292 "pres_view",
1293 $this->getViewPageText(),
1294 $this->getViewPageLink(),
1295 $this->getViewPageTarget()
1296 );
1297 }
1298
1299 // show actions drop down
1300 $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1301
1302 // get js files for JS enabled editing
1303 if ($sel_js_mode == "enable") {
1304 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1307 ilYuiUtil::initPanel(false);
1308 $main_tpl->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1309 $main_tpl->addJavascript("Services/COPage/js/page_editing.js");
1310
1311 include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1313 $this->lng->toJS("cont_error");
1314 $this->lng->toJS("cont_sel_el_cut_use_paste");
1315 $this->lng->toJS("cont_sel_el_copied_use_paste");
1316
1317 include_once './Services/Style/Content/classes/class.ilObjStyleSheet.php';
1318 $main_tpl->addOnloadCode("var preloader = new Image();
1319 preloader.src = './templates/default/images/loader.svg';
1320 ilCOPage.setUser('" . $this->user->getLogin() . "');
1321 ilCOPage.setContentCss('" .
1322 ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) .
1324 ", ./Services/COPage/css/tiny_extra.css" .
1325 "')");
1326 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
1328 $main_tpl->addOnloadCode("ilCOPage.addTextFormat('" . $c . "');");
1329 }
1330
1331 $main_tpl->addJavascript("./libs/bower/bower_components/tinymce/tinymce.min.js");
1332 $tpl->touchBlock("init_dragging");
1333
1334 $cfg = $this->getPageConfig();
1335 $tpl->setVariable(
1336 "IL_TINY_MENU",
1337 self::getTinyMenu(
1338 $this->getPageObject()->getParentType(),
1339 $cfg->getEnableInternalLinks(),
1340 $cfg->getEnableWikiLinks(),
1341 $cfg->getEnableKeywords(),
1342 $this->getStyleId(),
1343 true,
1344 true,
1345 $cfg->getEnableAnchors(),
1346 true,
1347 $cfg->getEnableUserLinks()
1348 )
1349 );
1350
1351 // add int link parts
1352 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1353 $tpl->setCurrentBlock("int_link_prep");
1354 $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1355 $this->ctrl->getLinkTargetByClass(
1356 array("ilpageeditorgui", "ilinternallinkgui"),
1357 "",
1358 false,
1359 true,
1360 false
1361 )
1362 ));
1363 $tpl->parseCurrentBlock();
1364
1365 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1367 $main_tpl->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1368 }
1369
1370 // multiple actions
1371 $cnt_pcs = $this->getPageObject()->countPageContents();
1372 if ($cnt_pcs > 1 ||
1373 ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0)) {
1374 $tpl->setCurrentBlock("multi_actions");
1375 if ($sel_js_mode == "enable") {
1376 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1377 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1378 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1379 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1380 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1381 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1382 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1383 }
1384 $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1385 $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1386 $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1387 $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1388 $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1389 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1390 $tpl->parseCurrentBlock();
1391 }
1392 } else {
1393 // presentation or preview here
1394
1395 $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1396 if ($this->getEnabledPageFocus()) {
1397 $tpl->touchBlock("page_focus");
1398 }
1399
1400 include_once("./Services/User/classes/class.ilUserUtil.php");
1401
1402 // presentation
1403 if ($this->isPageContainerToBeRendered()) {
1404 $tpl->touchBlock("page_container_1");
1405 $tpl->touchBlock("page_container_2");
1406 $tpl->touchBlock("page_container_3");
1407 }
1408
1409 // history
1410 $c_old_nr = $this->getPageObject()->old_nr;
1411 if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
1412 $hist_info =
1413 $this->getPageObject()->getHistoryInfo($c_old_nr);
1414
1415 if (!$this->getCompareMode()) {
1416 $this->ctrl->setParameter($this, "history_mode", "1");
1417
1418 // previous revision
1419 if (is_array($hist_info["previous"])) {
1420 $tpl->setCurrentBlock("previous_rev");
1421 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1422 $this->ctrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1423 $tpl->setVariable(
1424 "HREF_PREV",
1425 $this->ctrl->getLinkTarget($this, "preview")
1426 );
1427 $tpl->parseCurrentBlock();
1428 } else {
1429 $tpl->setCurrentBlock("previous_rev_disabled");
1430 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1431 $tpl->parseCurrentBlock();
1432 }
1433
1434 // next revision
1435 if ($c_old_nr > 0) {
1436 $tpl->setCurrentBlock("next_rev");
1437 $tpl->setVariable("TXT_NEXT_REV", $this->lng->txt("cont_next_rev"));
1438 $this->ctrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1439 $tpl->setVariable(
1440 "HREF_NEXT",
1441 $this->ctrl->getLinkTarget($this, "preview")
1442 );
1443 $tpl->parseCurrentBlock();
1444
1445 // latest revision
1446 $tpl->setCurrentBlock("latest_rev");
1447 $tpl->setVariable("TXT_LATEST_REV", $this->lng->txt("cont_latest_rev"));
1448 $this->ctrl->setParameter($this, "old_nr", "");
1449 $tpl->setVariable(
1450 "HREF_LATEST",
1451 $this->ctrl->getLinkTarget($this, "preview")
1452 );
1453 $tpl->parseCurrentBlock();
1454 }
1455
1456 $this->ctrl->setParameter($this, "history_mode", "");
1457
1458 // rollback
1459 if ($c_old_nr > 0 && $this->user->getId() != ANONYMOUS_USER_ID) {
1460 $tpl->setCurrentBlock("rollback");
1461 $this->ctrl->setParameter($this, "old_nr", $c_old_nr);
1462 $tpl->setVariable(
1463 "HREF_ROLLBACK",
1464 $this->ctrl->getLinkTarget($this, "rollbackConfirmation")
1465 );
1466 $this->ctrl->setParameter($this, "old_nr", "");
1467 $tpl->setVariable(
1468 "TXT_ROLLBACK",
1469 $this->lng->txt("cont_rollback")
1470 );
1471 $tpl->parseCurrentBlock();
1472 }
1473 }
1474
1475 $tpl->setCurrentBlock("hist_nav");
1476 $tpl->setVariable("TXT_REVISION", $this->lng->txt("cont_revision"));
1477 $tpl->setVariable(
1478 "VAL_REVISION_DATE",
1479 ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))
1480 );
1481 $tpl->setVariable(
1482 "VAL_REV_USER",
1483 ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])
1484 );
1485 $tpl->parseCurrentBlock();
1486 }
1487 }
1488 if ($this->getOutputMode() != self::PRESENTATION &&
1489 $this->getOutputMode() != self::OFFLINE &&
1490 $this->getOutputMode() != self::PREVIEW &&
1491 $this->getOutputMode() != self::PRINTING) {
1492 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1493 }
1494
1495 // output media object edit list (of media links)
1496 if ($this->getOutputMode() == "edit") {
1498 $this->obj->getParentType() . ":pg",
1499 $this->obj->getId(),
1500 $this->obj->getLanguage()
1501 );
1502 $mob_links = array();
1503 foreach ($links as $link) {
1504 if ($link["type"] == "mob") {
1505 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
1506 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
1507 }
1508 }
1509 }
1510
1511 // linked media objects
1512 if (count($mob_links) > 0) {
1513 $tpl->setCurrentBlock("med_link");
1514 $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1515 $tpl->setVariable(
1516 "SEL_MED_LINKS",
1517 ilUtil::formSelect(0, "mob_id", $mob_links, false, true)
1518 );
1519 $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1520 $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1521 //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1522 $tpl->parseCurrentBlock();
1523 }
1524
1525 // content snippets used
1526 include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1528 $this->getPageObject(),
1529 $this->getPageObject()->getDomDoc()
1530 );
1531 if (count($snippets) > 0) {
1532 foreach ($snippets as $s) {
1533 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1534 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1535 }
1536 $tpl->setCurrentBlock("med_link");
1537 $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1538 $tpl->setVariable(
1539 "SEL_SNIPPETS",
1540 ilUtil::formSelect(0, "ci_id", $sn_arr, false, true)
1541 );
1542 $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1543 $tpl->parseCurrentBlock();
1544 }
1545
1546 // scheduled activation?
1547 if (!$this->getPageObject()->getActive() &&
1548 $this->getPageObject()->getActivationStart() != "" &&
1549 $this->getPageConfig()->getEnableScheduledActivation()) {
1550 $tpl->setCurrentBlock("activation_txt");
1551 $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $this->lng->txt("cont_scheduled_activation"));
1552 $tpl->setVariable(
1553 "SA_FROM",
1555 new ilDateTime(
1556 $this->getPageObject()->getActivationStart(),
1558 )
1559 )
1560 );
1561 $tpl->setVariable(
1562 "SA_TO",
1564 new ilDateTime(
1565 $this->getPageObject()->getActivationEnd(),
1567 )
1568 )
1569 );
1570 $tpl->parseCurrentBlock();
1571 }
1572 }
1573
1574 if ($_GET["reloadTree"] == "y") {
1575 $tpl->setCurrentBlock("reload_tree");
1576 $tpl->setVariable(
1577 "LINK_TREE",
1578 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false)
1579 );
1580 $tpl->parseCurrentBlock();
1581 }
1582 // }
1583 // get content
1584 $builded = $this->obj->buildDom();
1585
1586 // manage hierarchical ids
1587 if ($this->getOutputMode() == "edit") {
1588
1589 // add pc ids, if necessary
1590 if (!$this->obj->checkPCIds()) {
1591 $this->obj->insertPCIds();
1592 $this->obj->update(true, true);
1593 }
1594
1595 $this->obj->addFileSizes();
1596 $this->obj->addHierIDs();
1597
1598 $hids = $this->obj->getHierIds();
1599 $row1_ids = $this->obj->getFirstRowIds();
1600 $col1_ids = $this->obj->getFirstColumnIds();
1601 $litem_ids = $this->obj->getListItemIds();
1602 $fitem_ids = $this->obj->getFileItemIds();
1603
1604 // standard menues
1605 $hids = $this->obj->getHierIds();
1606 foreach ($hids as $hid) {
1607 $tpl->setCurrentBlock("add_dhtml");
1608 $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
1609 $tpl->parseCurrentBlock();
1610 }
1611
1612 // column menues for tables
1613 foreach ($col1_ids as $hid) {
1614 $tpl->setCurrentBlock("add_dhtml");
1615 $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
1616 $tpl->parseCurrentBlock();
1617 }
1618
1619 // row menues for tables
1620 foreach ($row1_ids as $hid) {
1621 $tpl->setCurrentBlock("add_dhtml");
1622 $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
1623 $tpl->parseCurrentBlock();
1624 }
1625
1626 // list item menues
1627 foreach ($litem_ids as $hid) {
1628 $tpl->setCurrentBlock("add_dhtml");
1629 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1630 $tpl->parseCurrentBlock();
1631 }
1632
1633 // file item menues
1634 foreach ($fitem_ids as $hid) {
1635 $tpl->setCurrentBlock("add_dhtml");
1636 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1637 $tpl->parseCurrentBlock();
1638 }
1639 } else {
1640 $this->obj->addFileSizes();
1641 }
1642
1643 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; exit;
1644 //echo "<br>-".htmlentities($this->getLinkXML())."-"; exit;
1645
1646 // set default link xml, if nothing was set yet
1647 if (!$this->link_xml_set) {
1648 $this->setDefaultLinkXml();
1649 }
1650
1651 //$content = $this->obj->getXMLFromDom(false, true, true,
1652 // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1653 $link_xml = $this->getLinkXML();
1654 //echo "<br>-".htmlentities($link_xml)."-"; exit;
1655 // disable/enable auto margins
1656 if ($this->getStyleId() > 0) {
1657 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1658 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1659 $style = new ilObjStyleSheet($this->getStyleId());
1660 $template_xml = $style->getTemplateXML();
1661 $disable_auto_margins = "n";
1662 if ($style->lookupStyleSetting("disable_auto_margins")) {
1663 $disable_auto_margins = "y";
1664 }
1665 }
1666 }
1667
1668 if ($this->getAbstractOnly()) {
1669 $content = "<dummy><PageObject><PageContent><Paragraph>" .
1670 $this->obj->getFirstParagraphText() . $link_xml .
1671 "</Paragraph></PageContent></PageObject></dummy>";
1672 } else {
1673 $content = $this->obj->getXMLFromDom(
1674 false,
1675 true,
1676 true,
1677 $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML()
1678 );
1679 }
1680
1681 // check validation errors
1682 if ($builded !== true) {
1683 $this->displayValidationError($builded);
1684 } else {
1685 $this->displayValidationError($_SESSION["il_pg_error"]);
1686 }
1687 unset($_SESSION["il_pg_error"]);
1688
1689 // get title
1690 $pg_title = $this->getPresentationTitle();
1691
1692 if ($this->getOutputMode() == "edit") {
1693 $col_path = ilUtil::getImagePath("col.svg");
1694 $row_path = ilUtil::getImagePath("row.svg");
1695 $item_path = ilUtil::getImagePath("item.svg");
1696 $cell_path = ilUtil::getImagePath("cell.svg");
1697 }
1698
1699 if ($this->getOutputMode() != "offline") {
1700 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1701 $wb_path = ilUtil::getWebspaceDir("output") . "/";
1702 } else {
1703 $enlarge_path = "images/enlarge.svg";
1704 $wb_path = "";
1705 }
1706 $pg_title_class = ($this->getOutputMode() == "print")
1707 ? "ilc_PrintPageTitle"
1708 : "";
1709
1710 // page splitting only for learning modules and
1711 // digital books
1712 $enable_split_new = ($this->obj->getParentType() == "lm")
1713 ? "y"
1714 : "n";
1715
1716 // page splitting to next page only for learning modules and
1717 // digital books if next page exists in tree
1718 if (($this->obj->getParentType() == "lm") &&
1720 $this->obj->getParentId(),
1721 $this->obj->getId()
1722 )) {
1723 $enable_split_next = "y";
1724 } else {
1725 $enable_split_next = "n";
1726 }
1727
1728 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1729
1730
1731 if ($this->getPageConfig()->getEnablePCType("Tabs")) {
1732 //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1733 //ilYuiUtil::initTabView();
1734 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1737 }
1738
1739 // needed for placeholders
1740 $this->tpl->addCss(ilObjStyleSheet::getPlaceHolderStylePath());
1741
1742 $file_download_link = $this->determineFileDownloadLink();
1743 $fullscreen_link = $this->determineFullscreenLink();
1744 $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1745
1746 // default values for various parameters (should be used by
1747 // all instances in the future)
1748 $media_mode = ($this->getOutputMode() == "edit")
1749 ? $this->user->getPref("ilPageEditor_MediaMode")
1750 : "enable";
1751
1752 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1753 $paste = (ilEditClipboard::getAction() == "copy" &&
1754 $this->getOutputMode() == "edit");
1755
1756 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1757
1758 $flv_video_player = ($this->getOutputMode() != "offline")
1761
1762 $cfg = $this->getPageConfig();
1763
1764 $current_ts = time();
1765 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1766
1767 // added UTF-8 encoding otherwise umlaute are converted too
1768 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1769 $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"),
1770 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1771 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1772 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1773 'img_col' => $col_path,
1774 'img_row' => $row_path,
1775 'img_cell' => $cell_path,
1776 'img_item' => $item_path,
1777 'compare_mode' => $this->getCompareMode() ? "y" : "n",
1778 'enable_split_new' => $enable_split_new,
1779 'enable_split_next' => $enable_split_next,
1780 'link_params' => $this->link_params,
1781 'file_download_link' => $file_download_link,
1782 'fullscreen_link' => $fullscreen_link,
1783 'img_path' => $img_path,
1784 'parent_id' => $this->obj->getParentId(),
1785 'download_script' => $this->sourcecode_download_script,
1786 'encoded_download_script' => urlencode($this->sourcecode_download_script),
1787 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1788 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1789 'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1790 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1791 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1792 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1793 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1794 'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1795 'paste' => $paste ? "y" : "n",
1796 'media_mode' => $media_mode,
1797 'javascript' => $sel_js_mode,
1798 'paragraph_plugins' => $paragraph_plugin_string,
1799 'disable_auto_margins' => $disable_auto_margins,
1800 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1801 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1802 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1803 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1804 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1805 'enable_learning_history' => $cfg->getEnablePCType("LearningHistory") ? "y" : "n",
1806 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1807 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1808 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1809 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1810 'current_ts' => $current_ts,
1811 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1812 'flv_video_player' => $flv_video_player,
1813 'page_perma_link' => $this->getPagePermaLink()
1814 );
1815 if ($this->link_frame != "") { // todo other link types
1816 $params["pg_frame"] = $this->link_frame;
1817 }
1818
1819 //$content = str_replace("&nbsp;", "", $content);
1820
1821 // this ensures that cache is emptied with every update
1822 $params["version"] = ILIAS_VERSION;
1823 // ensure no cache hit, if included files/media objects have been changed
1824 $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1825
1826
1827 // should be modularized
1828 include_once("./Services/COPage/classes/class.ilPCSection.php");
1830
1831 // run xslt
1832 $md5 = md5(serialize($params) . $link_xml . $template_xml . $md5_adds);
1833
1834 //$a = microtime();
1835
1836 // check cache (same parameters, non-edit mode and rendered time
1837 // > last change
1838 $is_error = false;
1839 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1840 !$this->getCompareMode() &&
1841 !$this->getAbstractOnly() &&
1842 $md5 == $this->obj->getRenderMd5() &&
1843 ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1844 $this->obj->getRenderedTime() != "" &&
1845 $this->obj->old_nr == 0) {
1846 // cache hit
1847 $output = $this->obj->getRenderedContent();
1848 } else {
1849 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1850 $this->log->debug("Calling XSLT, content: " . substr($content, 0, 100));
1851 try {
1852 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1853 $xh = xslt_create();
1854 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1855 } catch (Exception $e) {
1856 $output = "";
1857 if ($this->getOutputMode() == "edit") {
1858 $output = "<pre>".$e->getMessage()."<br>".htmlentities($content)."</pre>";
1859 $is_error = true;
1860 }
1861 }
1862 if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1863 && !$this->getAbstractOnly()
1864 && $this->obj->old_nr == 0) {
1865 $this->obj->writeRenderedContent($output, $md5);
1866 }
1867 xslt_free($xh);
1868 }
1869
1870 if (!$is_error) {
1871 // unmask user html
1872 if (($this->getOutputMode() != "edit" ||
1873 $this->user->getPref("ilPageEditor_HTMLMode") != "disable")
1874 && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
1875 $output = str_replace("&lt;", "<", $output);
1876 $output = str_replace("&gt;", ">", $output);
1877 }
1878 $output = str_replace("&amp;", "&", $output);
1879
1880 include_once './Services/MathJax/classes/class.ilMathJax.php';
1881 $output = ilMathJax::getInstance()->insertLatexImages($output);
1882
1883 // insert page snippets
1884 //$output = $this->insertContentIncludes($output);
1885
1886 // insert resource blocks
1887 $output = $this->insertResources($output);
1888
1889 // insert page toc
1890 if ($this->getPageConfig()->getEnablePageToc()) {
1891 $output = $this->insertPageToc($output);
1892 }
1893
1894 // insert advanced output trigger
1895 $output = $this->insertAdvTrigger($output);
1896
1897 // workaround for preventing template engine
1898 // from hiding paragraph text that is enclosed
1899 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1900 $output = $this->replaceCurlyBrackets($output);
1901
1902 // remove all newlines (important for code / pre output)
1903 $output = str_replace("\n", "", $output);
1904
1905 //echo htmlentities($output);
1906 $output = $this->postOutputProcessing($output);
1907 //echo htmlentities($output);
1908 if ($this->getOutputMode() == "edit" &&
1909 !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
1910 $output = '<div class="il_editarea_disabled"><div class="ilCopgDisabledText">' . $this->getDisabledText() . '</div>' . $output . '</div>';
1911 }
1912
1913 // for all page components...
1914 include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1916 foreach ($defs as $def) {
1918 $pc_class = $def["pc_class"];
1919 $pc_obj = new $pc_class($this->getPageObject());
1920 $pc_obj->setSourcecodeDownloadScript($this->determineSourcecodeDownloadScript());
1921 $pc_obj->setFileDownloadLink($this->determineFileDownloadLink());
1922 $pc_obj->setFullscreenLink($this->determineFullscreenLink());
1923 $pc_obj->setProfileBackUrl($this->getProfileBackUrl());
1924
1925 // post xsl page content modification by pc elements
1926 $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode(), $this->getAbstractOnly());
1927 }
1928 }
1929
1930 $this->addResourcesToTemplate($main_tpl);
1931
1932 // $output = $this->selfAssessmentRendering($output);
1933
1934 // output
1935 if ($this->ctrl->isAsynch() && !$this->getRawPageContent() &&
1936 $this->getOutputMode() == "edit") {
1937 // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1938 if ($_GET["updated_pc_id_str"] != "") {
1939 echo $_GET["updated_pc_id_str"];
1940 }
1941 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1942 $tpl->setCurrentBlock("edit_page");
1943 $tpl->parseCurrentBlock();
1944 echo $tpl->get("edit_page");
1945 exit;
1946 }
1947 if ($this->outputToTemplate()) {
1948 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1949 $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1950 return $output;
1951 } else {
1952 if ($this->getRawPageContent()) { // e.g. needed in glossaries
1953 return $output;
1954 } else {
1955 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1956 return $tpl->get();
1957 }
1958 }
1959 }
1960
1967 public function replaceCurlyBrackets($output)
1968 {
1969 //echo "<br><br>".htmlentities($output);
1970
1971 while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1972 is_int($end = strpos($output, "<!--ParEnd-->", $start))) {
1973 $output = substr($output, 0, $start) .
1974 str_replace(
1975 array("{","}"),
1976 array("&#123;","&#125;"),
1977 substr($output, $start + 15, $end - ($start + 15))
1978 ) .
1979 substr($output, $end + 13);
1980 }
1981
1982 // $output = str_replace("{", "&#123;", $output);
1983 // $output = str_replace("}", "&#125;", $output);
1984 //echo "<br><br>".htmlentities($output);
1985 return $output;
1986 }
1987
1991 protected function getActivationCaptions()
1992 {
1993 return array("deactivatePage" => $this->lng->txt("cont_deactivate_page"),
1994 "activatePage" => $this->lng->txt("cont_activate_page"));
1995 }
1996
2000 public function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
2001 {
2002 global $DIC;
2003
2004 $ui = $DIC->ui();
2005
2006 // actions
2007 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2008
2009 // activate/deactivate
2010 $list = new ilAdvancedSelectionListGUI();
2011 $list->setListTitle($this->lng->txt("actions"));
2012 $list->setId("copage_act");
2013 $entries = false;
2014 if ($this->getPageConfig()->getEnableActivation()) {
2015 $entries = true;
2016 $captions = $this->getActivationCaptions();
2017
2018 if ($this->getPageObject()->getActive()) {
2019 $list->addItem(
2020 $captions["deactivatePage"],
2021 "",
2022 $this->ctrl->getLinkTarget($this, "deactivatePage")
2023 );
2024 } else {
2025 $list->addItem(
2026 $captions["activatePage"],
2027 "",
2028 $this->ctrl->getLinkTarget($this, "activatePage")
2029 );
2030 }
2031
2032 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2033 }
2034
2035 // initially opened content
2036 if ($this->getPageConfig()->getUseAttachedContent()) {
2037 $entries = true;
2038 $list->addItem(
2039 $this->lng->txt("cont_initial_attached_content"),
2040 "",
2041 $this->ctrl->getLinkTarget($this, "initialOpenedContent")
2042 );
2043 }
2044
2045 // multi-lang actions
2046 if ($this->addMultiLangActionsAndInfo($list, $a_tpl)) {
2047 $entries = true;
2048 }
2049
2050 if ($entries) {
2051 $items = $list->getItems();
2052 if (count($items) > 1) {
2053 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2054 } elseif (count($items) == 1) {
2055 $b = $ui->factory()->button()->standard($items[0]["title"], $items[0]["link"]);
2056 $a_tpl->setVariable("PAGE_ACTIONS", $ui->renderer()->render($b));
2057 }
2058 }
2059
2060 $this->lng->loadLanguageModule("content");
2061 $list = new ilAdvancedSelectionListGUI();
2062 $list->setListTitle($this->lng->txt("cont_edit_mode"));
2063 $list->setId("copage_ed_mode");
2064
2065 // media mode
2066 if ($sel_media_mode == "enable") {
2067 $this->ctrl->setParameter($this, "media_mode", "disable");
2068 $list->addItem(
2069 $this->lng->txt("cont_deactivate_media"),
2070 "",
2071 $this->ctrl->getLinkTarget($this, "setEditMode")
2072 );
2073 } else {
2074 $this->ctrl->setParameter($this, "media_mode", "enable");
2075 $list->addItem(
2076 $this->lng->txt("cont_activate_media"),
2077 "",
2078 $this->ctrl->getLinkTarget($this, "setEditMode")
2079 );
2080 }
2081 $this->ctrl->setParameter($this, "media_mode", "");
2082
2083 // html mode
2084 if (!$this->getPageConfig()->getPreventHTMLUnmasking()) {
2085 if ($sel_html_mode == "enable") {
2086 $this->ctrl->setParameter($this, "html_mode", "disable");
2087 $list->addItem(
2088 $this->lng->txt("cont_deactivate_html"),
2089 "",
2090 $this->ctrl->getLinkTarget($this, "setEditMode")
2091 );
2092 } else {
2093 $this->ctrl->setParameter($this, "html_mode", "enable");
2094 $list->addItem(
2095 $this->lng->txt("cont_activate_html"),
2096 "",
2097 $this->ctrl->getLinkTarget($this, "setEditMode")
2098 );
2099 }
2100 }
2101 $this->ctrl->setParameter($this, "html_mode", "");
2102
2103 // js mode
2104 if ($sel_js_mode == "enable") {
2105 $this->ctrl->setParameter($this, "js_mode", "disable");
2106 $list->addItem(
2107 $this->lng->txt("cont_deactivate_js"),
2108 "",
2109 $this->ctrl->getLinkTarget($this, "setEditMode")
2110 );
2111 } else {
2112 $this->ctrl->setParameter($this, "js_mode", "enable");
2113 $list->addItem(
2114 $this->lng->txt("cont_activate_js"),
2115 "",
2116 $this->ctrl->getLinkTarget($this, "setEditMode")
2117 );
2118 }
2119 $this->ctrl->setParameter($this, "js_mode", "");
2120
2121 $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2122 }
2123
2130 public function addMultiLangActionsAndInfo($a_list, $a_tpl)
2131 {
2132 $any_items = false;
2133
2134 $cfg = $this->getPageConfig();
2135
2136 // general multi lang support and single page mode?
2137 if ($cfg->getMultiLangSupport()) {
2138 //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
2139 //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
2140 // $this->getPageObject()->getParentId());
2141
2142 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2143 $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
2144
2145 if (!$ot->getContentActivated()) {
2146 /* if ($cfg->getSinglePageMode())
2147 {
2148 $a_list->addItem($this->lng->txt("cont_activate_multi_lang"), "",
2149 $this->ctrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
2150
2151 $any_items = true;
2152 }*/
2153 } else {
2154 $this->lng->loadLanguageModule("meta");
2155 //echo $this->getPageObject()->getLanguage();
2156 if ($this->getPageObject()->getLanguage() != "-") {
2157 $l = $ot->getMasterLanguage();
2158 $a_list->addItem(
2159 $this->lng->txt("cont_edit_language_version") . ": " .
2160 $this->lng->txt("meta_l_" . $l),
2161 "",
2162 $this->ctrl->getLinkTarget($this, "editMasterLanguage")
2163 );
2164 }
2165
2166 foreach ($ot->getLanguages() as $al => $lang) {
2167 if ($this->getPageObject()->getLanguage() != $al &&
2168 $al != $ot->getMasterLanguage()) {
2169 $this->ctrl->setParameter($this, "totransl", $al);
2170 $a_list->addItem(
2171 $this->lng->txt("cont_edit_language_version") . ": " .
2172 $this->lng->txt("meta_l_" . $al),
2173 "",
2174 $this->ctrl->getLinkTarget($this, "switchToLanguage")
2175 );
2176 $this->ctrl->setParameter($this, "totransl", $_GET["totransl"]);
2177 }
2178 }
2179
2180 /* if ($cfg->getSinglePageMode())
2181 {
2182 $a_list->addItem($this->lng->txt("cont_manage_multilang"), "",
2183 $this->ctrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
2184 }*/
2185
2186 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
2187 $ml_gui = new ilPageMultiLangGUI(
2188 $this->getPageObject()->getParentType(),
2189 $this->getPageObject()->getParentId()
2190 );
2191 $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
2192
2193 $any_items = true;
2194 }
2195 }
2196
2197 return $any_items;
2198 }
2199
2200
2204 public function setEditMode()
2205 {
2206 if ($_GET["media_mode"] != "") {
2207 if ($_GET["media_mode"] == "disable") {
2208 $this->user->writePref("ilPageEditor_MediaMode", "disable");
2209 } else {
2210 $this->user->writePref("ilPageEditor_MediaMode", "");
2211 }
2212 }
2213 if ($_GET["html_mode"] != "") {
2214 if ($_GET["html_mode"] == "disable") {
2215 $this->user->writePref("ilPageEditor_HTMLMode", "disable");
2216 } else {
2217 $this->user->writePref("ilPageEditor_HTMLMode", "");
2218 }
2219 }
2220 if ($_GET["js_mode"] != "") {
2221 if ($_GET["js_mode"] == "disable") {
2222 $this->user->writePref("ilPageEditor_JavaScript", "disable");
2223 } else {
2224 $this->user->writePref("ilPageEditor_JavaScript", "");
2225 }
2226 }
2227
2228 $this->ctrl->redirect($this, "edit");
2229 }
2230
2231
2235 public static function getTinyMenu(
2236 $a_par_type,
2237 $a_int_links = false,
2238 $a_wiki_links = false,
2239 $a_keywords = false,
2240 $a_style_id = 0,
2241 $a_paragraph_styles = true,
2242 $a_save_return = true,
2243 $a_anchors = false,
2244 $a_save_new = true,
2245 $a_user_links = false
2246 ) {
2247 global $DIC;
2248
2249 $lng = $DIC->language();
2250 $ctrl = $DIC->ctrl();
2251
2252 $mathJaxSetting = new ilSetting("MathJax");
2253
2254 include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2255
2256 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2257
2258 $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2259
2260 // debug ghost element
2261 if (DEVMODE == 1) {
2262// $btpl->touchBlock("debug_ghost");
2263 }
2264
2265 // bullet list
2266 $btpl->touchBlock("blist_button");
2268 "il_edm_blist",
2269 $lng->txt("cont_blist"),
2270 "iltinymenu_bd"
2271 );
2272
2273 // numbered list
2274 $btpl->touchBlock("nlist_button");
2276 "il_edm_nlist",
2277 $lng->txt("cont_nlist"),
2278 "iltinymenu_bd"
2279 );
2280
2281 // list indent
2282 $btpl->touchBlock("list_indent");
2284 "ilIndentBut",
2285 $lng->txt("cont_list_indent"),
2286 "iltinymenu_bd"
2287 );
2288
2289 // list outdent
2290 $btpl->touchBlock("list_outdent");
2292 "ilOutdentBut",
2293 $lng->txt("cont_list_outdent"),
2294 "iltinymenu_bd"
2295 );
2296
2297 if ($a_int_links) {
2298 $btpl->touchBlock("bb_ilink_button");
2300 "iosEditInternalLinkTrigger",
2301 $lng->txt("cont_link_to_internal"),
2302 "iltinymenu_bd"
2303 );
2304 }
2306 "il_edm_xlink",
2307 $lng->txt("cont_link_to_external"),
2308 "iltinymenu_bd"
2309 );
2310
2311 if ($a_user_links) {
2312 $btpl->touchBlock("bb_ulink_button");
2313 }
2314
2315 // remove format
2316 $btpl->touchBlock("rformat_button");
2318 "il_edm_rformat",
2319 $lng->txt("cont_remove_format"),
2320 "iltinymenu_bd"
2321 );
2322
2323 if ($a_paragraph_styles) {
2324 // new paragraph
2325 $btpl->setCurrentBlock("new_par");
2326 $btpl->setVariable("IMG_NEWPAR", "+");
2327 $btpl->parseCurrentBlock();
2329 "il_edm_newpar",
2330 $lng->txt("cont_insert_new_paragraph"),
2331 "iltinymenu_bd"
2332 );
2333
2334 $btpl->setCurrentBlock("par_edit");
2335 $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2336 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2337 $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector(
2338 $a_selected,
2340 true
2341 ));
2342
2344 "ilAdvSelListAnchorText_style_selection",
2345 $lng->txt("cont_paragraph_styles"),
2346 "iltinymenu_bd"
2347 );
2348
2349 $btpl->parseCurrentBlock();
2350 }
2351
2352 if ($a_keywords) {
2353 $btpl->setCurrentBlock("bb_kw_button");
2354 $btpl->setVariable("CC_KW", "kw");
2355 $btpl->parseCurrentBlock();
2357 "il_edm_kw",
2358 $lng->txt("cont_text_keyword"),
2359 "iltinymenu_bd"
2360 );
2361 }
2362
2363 if ($a_wiki_links) {
2364 $btpl->setCurrentBlock("bb_wikilink_button2");
2365 $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
2366 $btpl->setVariable("WIKI_BUTTON2_URL", $ctrl->getLinkTargetByClass("ilwikipagegui", ""));
2367 $btpl->parseCurrentBlock();
2369 "il_edm_wlinkd",
2370 $lng->txt("cont_wiki_link_dialog"),
2371 "iltinymenu_bd"
2372 );
2373
2374 $btpl->setCurrentBlock("bb_wikilink_button");
2375 $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2376 $btpl->parseCurrentBlock();
2378 "il_edm_wlink",
2379 $lng->txt("cont_link_to_wiki"),
2380 "iltinymenu_bd"
2381 );
2382 }
2383
2384 $aset = new ilSetting("adve");
2385
2386 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2387 foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st) {
2388 // these are handled via drop down now...
2389 if (in_array($c, array("com", "quot", "acc", "code"))) {
2390 continue;
2391 }
2393 $a_par_type,
2394 "active_" . $c,
2395 true
2396 )) {
2397 $cc_code = $c;
2398 if ($aset->get("use_physical")) {
2399 $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2400 }
2401
2402 if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
2403 $btpl->setCurrentBlock("bb_" . $c . "_button");
2404 $btpl->setVariable("CC_" . strtoupper($c), $cc_code);
2405 $btpl->parseCurrentBlock();
2407 "il_edm_cc_" . $c,
2408 $lng->txt("cont_cc_" . $c),
2409 "iltinymenu_bd"
2410 );
2411
2412 // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2413 }
2414 }
2415 }
2416
2417 if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
2419 "il_edm_tex",
2420 $lng->txt("cont_tex"),
2421 "iltinymenu_bd"
2422 );
2423 }
2425 "il_edm_fn",
2426 $lng->txt("cont_fn"),
2427 "iltinymenu_bd"
2428 );
2429
2430 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2431
2432 $split_button = ilSplitButtonGUI::getInstance();
2433 $split_button->isPrimary(true);
2434 $split_button_items = [];
2435
2436
2437 $sdd = new ilAdvancedSelectionListGUI();
2438 $sdd->setPullRight(false);
2439 $sdd->setListTitle($lng->txt("save") . "...");
2440
2441 if ($a_save_return) {
2442 //$btpl->setCurrentBlock("save_return");
2443 //$btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2444 //$btpl->parseCurrentBlock();
2445 $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;");
2446
2447 $item = ilLinkButton::getInstance();
2448 $item->setCaption('save_return');
2449 $item->setOnClick("ilCOPage.cmdSaveReturn(false); return false;");
2450 $split_button_items[] = $item;
2451 }
2452
2453 if ($a_save_new) {
2454 //$btpl->setCurrentBlock("save_new");
2455 //$btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
2456 //$btpl->parseCurrentBlock();
2457 $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;");
2458 $item = ilLinkButton::getInstance();
2459 $item->setCaption('save_new');
2460 $item->setOnClick("ilCOPage.cmdSaveReturn(true); return false;");
2461 $split_button_items[] = $item;
2462 }
2463
2464 $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;");
2465 $item = ilLinkButton::getInstance();
2466 $item->setCaption('save');
2467 $item->setOnClick("ilCOPage.cmdSave(null); return false;");
2468 $split_button_items[] = $item;
2469
2470 $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;");
2471 /*
2472 $item = ilLinkButton::getInstance();
2473 $item->setCaption('cancel');
2474 $item->setOnClick("\"ilCOPage.cmdCancel(); return false;");
2475 $split_button_items[] = $item;*/
2476
2477
2478 if ($a_anchors) {
2479 $btpl->setCurrentBlock("bb_anc_button");
2480 $btpl->setVariable("CC_ANC", "anc");
2481 $btpl->parseCurrentBlock();
2483 "il_edm_anc",
2484 $lng->txt("cont_anchor"),
2485 "iltinymenu_bd"
2486 );
2487 }
2488
2489 $first = true;
2490 foreach ($split_button_items as $item) {
2491 if ($first) {
2492 $item->setPrimary(true);
2493 $split_button->setDefaultButton($item);
2494 } else {
2495 $split_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($item));
2496 }
2497 $first = false;
2498 }
2499 $btpl->setVariable("SPLIT_BUTTON", $split_button->render());
2500 //$btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML());
2501
2502 /* // footnote
2503 $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2504 $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2505 $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2506 */
2507 // $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2508
2509 $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2510 $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2511
2512 $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2513 $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2514 $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2515 $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2516 $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2517
2518 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2519
2520 $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type, true, $a_style_id));
2522 "ilAdvSelListAnchorElement_char_style_selection",
2523 $lng->txt("cont_more_character_styles"),
2524 "iltinymenu_bd"
2525 );
2526
2527 return $btpl->get();
2528 }
2529
2533 public function setDefaultLinkXml()
2534 {
2535 $this->page_linker->setProfileBackUrl($this->getProfileBackUrl());
2536 $this->page_linker->setOffline($this->getOutputMode() == self::OFFLINE);
2537 $this->setLinkXML($this->page_linker->getLinkXml($this->getPageObject()->getInternalLinks()));
2538 }
2539
2545 public function setLinkXml($xml)
2546 {
2547 $this->link_xml = $xml;
2548 $this->link_xml_set = true;
2549 }
2550
2551
2555 public function getProfileBackUrl()
2556 {
2557 if ($this->profile_back_url != "") {
2559 }
2560 if ($this->getOutputMode() === self::OFFLINE) {
2561 return "";
2562 }
2563 return $this->ctrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
2564 }
2565
2569 public function setProfileBackUrl($url)
2570 {
2571 $this->profile_back_url = $url;
2572 }
2573
2574
2578 public function downloadFile()
2579 {
2580 $download_ok = false;
2581
2582 require_once("./Modules/File/classes/class.ilObjFile.php");
2583 $pg_obj = $this->getPageObject();
2584 $pg_obj->buildDom();
2585 $int_links = $pg_obj->getInternalLinks();
2586 foreach ($int_links as $il) {
2587 if ($il["Target"] == str_replace("_file_", "_dfile_", $_GET["file_id"])) {
2588 $file = explode("_", $_GET["file_id"]);
2589 $file_id = (int) $file[count($file) - 1];
2590 $download_ok = true;
2591 }
2592 }
2593 if (in_array($_GET["file_id"], $pg_obj->getAllFileObjIds())) {
2594 $file = explode("_", $_GET["file_id"]);
2595 $file_id = (int) $file[count($file) - 1];
2596 $download_ok = true;
2597 }
2598
2599 $pcs = ilPageContentUsage::getUsagesOfPage($pg_obj->getId(), $pg_obj->getParentType() . ":pg", 0, false);
2600 foreach ($pcs as $pc) {
2601 $files = ilObjFile::_getFilesOfObject("mep:pg", $pc["id"], 0);
2602 $file = explode("_", $_GET["file_id"]);
2603 $file_id = (int) $file[count($file) - 1];
2604 if (in_array($file_id, $files)) {
2605 $download_ok = true;
2606 }
2607 }
2608
2609 if ($download_ok) {
2610 $fileObj = new ilObjFile($file_id, false);
2611 $fileObj->sendFile();
2612 exit;
2613 }
2614 }
2615
2619 public function displayMediaFullscreen()
2620 {
2621 $this->displayMedia(true);
2622 }
2623
2627 public function displayMedia($a_fullscreen = false)
2628 {
2629 $tpl = $this->tpl;
2630
2631 $tpl = new ilCOPageGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2632 $tpl->setCurrentBlock("ilMedia");
2633
2634 //$int_links = $page_object->getInternalLinks();
2635 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2636
2637 // @todo
2638 $link_xml = $this->page_linker->getLinkXML($med_links);
2639
2640 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2641 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2642 require_once("./Services/COPage/classes/class.ilPageObject.php");
2643 $pg_obj = $this->getPageObject();
2644 $pg_obj->buildDom();
2645
2646 if (!empty($_GET["pg_id"])) {
2647 $xml = "<dummy>";
2648 $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2649 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2650 $xml .= $link_xml;
2651 $xml .= "</dummy>";
2652 } else {
2653 $xml = "<dummy>";
2654 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2655 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2656 $xml .= $link_xml;
2657 $xml .= "</dummy>";
2658 }
2659
2660 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2661 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2662 $xh = xslt_create();
2663
2664 $mode = "media";
2665 if ($a_fullscreen) {
2666 $mode = "fullscreen";
2667 }
2668
2669 //echo "<b>XML:</b>".htmlentities($xml);
2670 // determine target frames for internal links
2671 $wb_path = ilUtil::getWebspaceDir("output") . "/";
2672 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2673 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
2674 'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
2675 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2676 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2677 //echo "<br><br>".htmlentities($output);
2678 //echo xslt_error($xh);
2679 xslt_free($xh);
2680
2681 // unmask user html
2682 require_once('./Services/Style/Content/classes/class.ilObjStyleSheet.php');
2683 $tpl->setVariable(
2684 "LOCATION_CONTENT_STYLESHEET",
2686 );
2687 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2688 $tpl->setVariable("MEDIA_CONTENT", $output);
2689
2690 // add js
2691 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2693 $tpl->fillJavaScriptFiles();
2694 $tpl->fillCssFiles();
2695
2696 echo $tpl->get();
2697 exit;
2698 }
2699
2703 public function download_paragraph()
2704 {
2705 $pg_obj = $this->getPageObject();
2706 $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2707 }
2708
2715 public function insertPageToc($a_output)
2716 {
2717 include_once("./Services/Utilities/classes/class.ilStr.php");
2718
2719 // extract all headings
2720 $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2721 $page_heads = array();
2722 foreach ($offsets as $os) {
2723 $level = (int) substr($a_output, $os + 10, 1);
2724 if (in_array($level, array(1,2,3))) {
2725 $anchor = str_replace(
2726 "TocH",
2727 "TocA",
2728 substr($a_output, $os, strpos($a_output, "<", $os) - $os - 4)
2729 );
2730
2731 // get heading
2732 $tag_start = stripos($a_output, "<h" . $level . " ", $os);
2733 $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
2734 $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2735
2736 // get headings text
2737 $text_start = stripos($head, ">") + 1;
2738 $text_end = strripos($head, "<!--", $text_start);
2739 $text = substr($head, $text_start, $text_end - $text_start);
2740 $page_heads[] = array("level" => $level, "text" => $text,
2741 "anchor" => $anchor);
2742 }
2743 }
2744
2745 if (count($page_heads) > 1) {
2746 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2747 $list = new ilNestedList();
2748 $list->setAutoNumbering(true);
2749 $list->setListClass("ilc_page_toc_PageTOCList");
2750 $list->setItemClass("ilc_page_toc_PageTOCItem");
2751 $i = 0;
2752 $c_depth = 1;
2753 $c_par[1] = 0;
2754 $c_par[2] = 0;
2755 $nr[1] = 1;
2756 $nr[2] = 1;
2757 $nr[3] = 1;
2758 foreach ($page_heads as $ind => $h) {
2759 $i++;
2760 $par = 0;
2761
2762 // check if we have a parent for one level up
2763 $par = 0;
2764 if ($h["level"] == 2 && $c_par[1] > 0) {
2765 $par = $c_par[1];
2766 }
2767 if ($h["level"] == 3 && $c_par[2] > 0) {
2768 $par = $c_par[2];
2769 }
2770
2771 $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2772
2773 // add the list node
2774 $list->addListNode(
2775 "<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>",
2776 $i,
2777 $par
2778 );
2779
2780 // set the node as current parent of the level
2781 if ($h["level"] == 1) {
2782 $c_par[1] = $i;
2783 $c_par[2] = 0;
2784 }
2785 if ($h["level"] == 2) {
2786 $c_par[2] = $i;
2787 }
2788 }
2789
2790 $tpl = new ilTemplate(
2791 "tpl.page_toc.html",
2792 true,
2793 true,
2794 "Services/COPage"
2795 );
2796 $tpl->setVariable("PAGE_TOC", $list->getHTML());
2797 $tpl->setVariable("TXT_PAGE_TOC", $this->lng->txt("cont_page_toc"));
2798 $tpl->setVariable("TXT_HIDE", $this->lng->txt("hide"));
2799 $tpl->setVariable("TXT_SHOW", $this->lng->txt("show"));
2800
2801 $a_output = str_replace(
2802 "{{{{{PageTOC}}}}}",
2803 $tpl->get(),
2804 $a_output
2805 );
2806 $numbers = $list->getNumbers();
2807
2808 if (count($numbers) > 0) {
2809 include_once("./Services/Utilities/classes/class.ilStr.php");
2810 foreach ($numbers as $n) {
2811 $a_output =
2812 ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n . " ", $a_output);
2813 }
2814 }
2815 } else {
2816 $a_output = str_replace(
2817 "{{{{{PageTOC}}}}}",
2818 "",
2819 $a_output
2820 );
2821 }
2822
2823 return $a_output;
2824 }
2825
2832 public function insertResources($a_output)
2833 {
2834 // this is edit mode only
2835
2836 if ($this->getEnablePCType("Resources") &&
2837 ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview")) {
2838 include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2839 $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2840 }
2841 return $a_output;
2842 }
2843
2844
2845
2852 public function insertAdvTrigger($a_output)
2853 {
2854 if (!$this->getAbstractOnly()) {
2855 $a_output = str_replace(
2856 "{{{{{LV_show_adv}}}}}",
2857 $this->lng->txt("cont_show_adv"),
2858 $a_output
2859 );
2860 $a_output = str_replace(
2861 "{{{{{LV_hide_adv}}}}}",
2862 $this->lng->txt("cont_hide_adv"),
2863 $a_output
2864 );
2865 } else {
2866 $a_output = str_replace(
2867 "{{{{{LV_show_adv}}}}}",
2868 "",
2869 $a_output
2870 );
2871 $a_output = str_replace(
2872 "{{{{{LV_hide_adv}}}}}",
2873 "",
2874 $a_output
2875 );
2876 }
2877
2878 return $a_output;
2879 }
2880
2881
2886 public function postOutputProcessing($a_output)
2887 {
2888 return $a_output;
2889 }
2890
2891
2895 public function previewHistory()
2896 {
2897 $this->preview();
2898 }
2899
2903 public function preview()
2904 {
2905 $this->setOutputMode(self::PREVIEW);
2906 return $this->showPage();
2907 }
2908
2912 public function edit()
2913 {
2914 // editing allowed?
2915 if (!$this->getEnableEditing()) {
2916 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
2917 $this->ctrl->redirect($this, "preview");
2918 }
2919
2920 $this->tool_context->current()->addAdditionalData(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2921
2922 // not so nive workaround for container pages, bug #0015831
2923 $ptype = $this->getParentType();
2924 if ($ptype == "cont" && $_GET["ref_id"] > 0) {
2925 $ptype = ilObject::_lookupType((int) $_GET["ref_id"], true);
2926 }
2927 $this->help->setScreenId("edit_" . $ptype);
2928
2929 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2930 if (
2931 $this->user->isAnonymous() &&
2932 !$this->user->isCaptchaVerified() &&
2933 ilCaptchaUtil::isActiveForWiki()
2934 ) {
2935 $form = $this->initCaptchaForm();
2936 if ($_POST['captcha_code'] && $form->checkInput()) {
2937 $this->user->setCaptchaVerified(true);
2938 } else {
2939 return $form->getHTML();
2940 }
2941 }
2942
2943 // edit lock
2944 if (!$this->getPageObject()->getEditLock()) {
2945 include_once("./Services/User/classes/class.ilUserUtil.php");
2946 $info = $this->lng->txt("content_no_edit_lock");
2947 $lock = $this->getPageObject()->getEditLockInfo();
2948 $info .= "</br>" . $this->lng->txt("content_until") . ": " .
2949 ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2950 $info .= "</br>" . $this->lng->txt("obj_usr") . ": " .
2951 ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2952 if (!$this->ctrl->isAsynch()) {
2953 ilUtil::sendInfo($info);
2954 return "";
2955 } else {
2956 echo ilUtil::getSystemMessageHTML($info);
2957 exit;
2958 }
2959 } else {
2960 if ($this->getPageObject()->getEffectiveEditLockTime() > 0) {
2961 $mess = $this->getBlockingInfoMessage();
2962 }
2963 }
2964
2965 $this->setOutputMode(self::EDIT);
2966
2967 $html = $this->showPage();
2968
2969 if ($this->isEnabledNotes()) {
2970 $html .= "<br /><br />" . $this->getNotesHTML();
2971 }
2972
2973 return $mess . $html;
2974 }
2975
2980 protected function getBlockingInfoMessage() : string
2981 {
2983 $lng = $this->lng;
2984 $ui = $this->ui;
2985
2986 $lock = $this->getPageObject()->getEditLockInfo();
2987 $info = $this->lng->txt("cont_got_lock_release");
2988 $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)), $info);
2989
2990 $mbox = $ui->factory()->messageBox()->info($info)
2991 ->withButtons([$ui->factory()->button()->standard($lng->txt("cont_finish_editing"), $ctrl->getLinkTarget($this, "releasePageLock"))]);
2992
2993 return $ui->renderer()->render($mbox);
2994 }
2995
2996
3003 public function insertJSAtPlaceholder()
3004 {
3005 $tpl = $this->tpl;
3006
3007 if ($_GET["pl_hier_id"] == "") {
3008 $this->obj->buildDom();
3009 $this->obj->addHierIDs();
3010 $hid = $this->obj->getHierIdsForPCIds(array($_GET["pl_pc_id"]));
3011 $_GET["pl_hier_id"] = $hid[$_GET["pl_pc_id"]];
3012 }
3013
3014 // 'pl_hier_id' => string '2_1_1_1' (length=7)
3015 // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
3016 $html = $this->edit();
3017
3018 $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('" .
3019 $_GET["pl_hier_id"] . ":" . $_GET["pl_pc_id"] .
3020 "');", 3);
3021
3022 return $html;
3023 }
3024
3028 public function initCaptchaForm()
3029 {
3030 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3031 $form = new ilPropertyFormGUI();
3032
3033 require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3034 $ci = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
3035 $ci->setRequired(true);
3036 $form->addItem($ci);
3037
3038 $form->addCommandButton('edit', $this->lng->txt('ok'));
3039
3040 $form->setTitle($this->lng->txt('cont_captcha_verification'));
3041 $form->setFormAction($this->ctrl->getFormAction($this));
3042
3043 return $form;
3044 }
3045
3046 /*
3047 * presentation
3048 */
3049 public function presentation($a_mode = self::PRESENTATION)
3050 {
3051 $this->setOutputMode($a_mode);
3052
3053 return $this->showPage();
3054 }
3055
3056 public function getHTML()
3057 {
3058 $this->getTabs("preview");
3059 return $this->showPage();
3060 }
3061
3065 public function showMediaFullscreen($a_style_id = 0)
3066 {
3067 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3068 $this->tpl->setCurrentBlock("ContentStyle");
3069 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3070 $this->tpl->parseCurrentBlock();
3071
3072 $this->tpl->setVariable("PAGETITLE", " - " . ilObject::_lookupTitle($_GET["mob_id"]));
3073 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3074 $this->tpl->setCurrentBlock("ilMedia");
3075
3076 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3077 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
3078 if (!empty($_GET["pg_id"])) {
3079 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3080 $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
3081 $pg_obj->buildDom();
3082
3083 $xml = "<dummy>";
3084 // todo: we get always the first alias now (problem if mob is used multiple
3085 // times in page)
3086 $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3087 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
3088 $xml .= "</dummy>";
3089 } else {
3090 $xml = "<dummy>";
3091 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
3092 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
3093 $xml .= "</dummy>";
3094 }
3095
3096 //echo htmlentities($xml); exit;
3097
3098 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3099 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3100 $xh = xslt_create();
3101
3102 //echo "<b>XML:</b>".htmlentities($xml);
3103 // determine target frames for internal links
3104 //$pg_frame = $_GET["frame"];
3105 $wb_path = ilUtil::getWebspaceDir("output") . "/";
3106 $mode = "fullscreen";
3107 $params = array('mode' => $mode, 'webspace_path' => $wb_path);
3108 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
3109 echo xslt_error($xh);
3110 xslt_free($xh);
3111
3112 // unmask user html
3113 $this->tpl->setVariable("MEDIA_CONTENT", $output);
3114 }
3115
3121 public function displayValidationError($a_error)
3122 {
3123 if (is_array($a_error)) {
3124 $error_str = "<b>Error(s):</b><br>";
3125 foreach ($a_error as $error) {
3126 $err_mess = implode(" - ", $error);
3127 if (!is_int(strpos($err_mess, ":0:"))) {
3128 $error_str .= htmlentities($err_mess) . "<br />";
3129 }
3130 }
3131 $this->tpl->setVariable("MESSAGE", $error_str);
3132 }
3133 }
3134
3138 public function history()
3139 {
3140 if (!$this->getEnableEditing()) {
3141 return;
3142 }
3143
3144 $this->tpl->addJavaScript("./Services/COPage/js/page_history.js");
3145
3146 include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3147 $table_gui = new ilPageHistoryTableGUI($this, "history");
3148 $table_gui->setId("hist_table");
3149 $entries = $this->getPageObject()->getHistoryEntries();
3150 $entries[] = array('page_id' => $this->getPageObject()->getId(),
3151 'parent_type' => $this->getPageObject()->getParentType(),
3152 'hdate' => $this->getPageObject()->getLastChange(),
3153 'parent_id' => $this->getPageObject()->getParentId(),
3154 'nr' => 0,
3155 'sortkey' => 999999,
3156 'user' => $this->getPageObject()->last_change_user);
3157 $table_gui->setData($entries);
3158 return $table_gui->getHTML();
3159 }
3160
3164 public function rollbackConfirmation()
3165 {
3166 if (!$this->getEnableEditing()) {
3167 return;
3168 }
3169
3170 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3171 $c_gui = new ilConfirmationGUI();
3172
3173 // set confirm/cancel commands
3174 $this->ctrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3175 $c_gui->setFormAction($this->ctrl->getFormAction($this, "rollback"));
3176 $c_gui->setHeaderText($this->lng->txt("cont_rollback_confirmation"));
3177 $c_gui->setCancel($this->lng->txt("cancel"), "history");
3178 $c_gui->setConfirm($this->lng->txt("confirm"), "rollback");
3179
3180 $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3181
3182 $c_gui->addItem(
3183 "id[]",
3184 $_GET["old_nr"],
3186 );
3187
3188 $this->tpl->setContent($c_gui->getHTML());
3189 }
3190
3194 public function rollback()
3195 {
3196 if (!$this->getEnableEditing()) {
3197 return;
3198 }
3199
3200 $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3201
3202 if ($hentry["content"] != "") {
3203 $this->obj->setXMLContent($hentry["content"]);
3204 $this->obj->buildDom(true);
3205 if ($this->obj->update()) {
3206 $this->ctrl->redirect($this, "history");
3207 }
3208 }
3209 $this->ctrl->redirect($this, "history");
3210 }
3211
3218 public function setScreenIdComponent()
3219 {
3220 $this->help->setScreenIdComponent("copg");
3221 }
3222
3228 public function getTabs($a_activate = "")
3229 {
3230 $this->setScreenIdComponent();
3231
3232 if (!$this->getEnabledTabs()) {
3233 return;
3234 }
3235 // back to upper context
3236 if (!$this->getEditPreview()) {
3237 $this->tabs_gui->addTarget("pg", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3238
3239 if ($this->getEnableEditing()) {
3240 $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "edit"), array("", "edit"));
3241 }
3242 } else {
3243 if ($this->getEnableEditing()) {
3244 $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "edit"), array("", "edit"));
3245 }
3246
3247 $this->tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3248 }
3249
3250 //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3251 // , "properties", get_class($this));
3252
3253 if ($this->use_meta_data) {
3254 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
3255 $mdgui = new ilObjectMetaDataGUI(
3256 $this->meta_data_rep_obj,
3257 $this->meta_data_type,
3258 $this->meta_data_sub_obj_id
3259 );
3260 $mdtab = $mdgui->getTab();
3261 if ($mdtab) {
3262 $this->tabs_gui->addTarget(
3263 "meta_data",
3264 $mdtab,
3265 "",
3266 "ilobjectmetadatagui"
3267 );
3268 }
3269 }
3270
3271 $lm_set = new ilSetting("lm");
3272
3273 if ($this->getEnableEditing() && $lm_set->get("page_history", 1)) {
3274 $this->tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
3275 if ($_GET["history_mode"] == "1" || $this->ctrl->getCmd() == "compareVersion") {
3276 $this->tabs_gui->activateTab("history");
3277 }
3278 }
3279
3280 /* $tabs = $this->ctrl->getTabs();
3281 foreach ($tabs as $tab)
3282 {
3283 $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3284 , $tab["cmd"], $tab["class"]);
3285 }
3286 */
3287 if ($this->getEnableEditing() && $this->user->getId() != ANONYMOUS_USER_ID) {
3288 $this->tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilEditClipboardGUI"), "view"), "view", "ilEditClipboardGUI");
3289 }
3290
3291 if ($this->getPageConfig()->getEnableScheduledActivation()) {
3292 $this->tabs_gui->addTarget(
3293 "cont_activation",
3294 $this->ctrl->getLinkTarget($this, "editActivation"),
3295 "editActivation",
3296 get_class($this)
3297 );
3298 }
3299
3300 if ($this->getEnabledNews()) {
3301 $this->tabs_gui->addTarget(
3302 "news",
3303 $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3304 "",
3305 "ilnewsitemgui"
3306 );
3307 }
3308
3309 // external hook to add tabs
3310 if (is_array($this->tab_hook)) {
3311 $func = $this->tab_hook["func"];
3312 $this->tab_hook["obj"]->$func();
3313 }
3314 //$this->tabs_gui->setTabActive("pg");
3315 }
3316
3320 public function compareVersion()
3321 {
3322 if (!$this->getEnableEditing()) {
3323 return;
3324 }
3325
3326 $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3327 $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3328
3329 // left page
3330 $lpage = $compare["l_page"];
3331 $cfg = $this->getPageConfig();
3332 $cfg->setPreventHTMLUnmasking(true);
3333
3334 $this->setOutputMode(self::PREVIEW);
3335 $this->setPageObject($lpage);
3337 $this->setCompareMode(true);
3338
3339 $lhtml = $this->showPage();
3340 $lhtml = $this->replaceDiffTags($lhtml);
3341 $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3342 $tpl->setVariable("LEFT", $lhtml);
3343
3344 // right page
3345 $rpage = $compare["r_page"];
3346 $this->setPageObject($rpage);
3348 $this->setCompareMode(true);
3349 $this->setOutputMode(self::PREVIEW);
3350
3351 $rhtml = $this->showPage();
3352 $rhtml = $this->replaceDiffTags($rhtml);
3353 $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3354 $tpl->setVariable("RIGHT", $rhtml);
3355
3356 $tpl->setVariable("TXT_NEW", $this->lng->txt("cont_pc_new"));
3357 $tpl->setVariable("TXT_MODIFIED", $this->lng->txt("cont_pc_modified"));
3358 $tpl->setVariable("TXT_DELETED", $this->lng->txt("cont_pc_deleted"));
3359
3360 //var_dump($left);
3361 //var_dump($right);
3362
3363 return $tpl->get();
3364 }
3365
3366 public function replaceDiffTags($a_html)
3367 {
3368 $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3369 $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3370 $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3371 $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3372
3373 return $a_html;
3374 }
3375
3379 public function editActivation()
3380 {
3381 $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3382 $this->initActivationForm();
3383 $this->getActivationFormValues();
3384 $atpl->setVariable("FORM", $this->form->getHTML());
3385 $atpl->setCurrentBlock("updater");
3386 $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3387 $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3388 $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3389 $atpl->parseCurrentBlock();
3390 $this->tpl->setContent($atpl->get());
3391 }
3392
3396 public function initActivationForm()
3397 {
3398 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3399 $this->form = new ilPropertyFormGUI();
3400 $this->form->setFormAction($this->ctrl->getFormAction($this));
3401 $this->form->setTitle($this->lng->txt("cont_page_activation"));
3402
3403 // activation type radio
3404 $rad = new ilRadioGroupInputGUI($this->lng->txt("cont_activation"), "activation");
3405 $rad_op1 = new ilRadioOption($this->lng->txt("cont_activated"), "activated");
3406
3407 $rad->addOption($rad_op1);
3408 $rad_op2 = new ilRadioOption($this->lng->txt("cont_deactivated"), "deactivated");
3409 $rad->addOption($rad_op2);
3410 $rad_op3 = new ilRadioOption($this->lng->txt("cont_scheduled_activation"), "scheduled");
3411
3412 $dt_prop = new ilDateTimeInputGUI($this->lng->txt("cont_start"), "start");
3413 $dt_prop->setRequired(true);
3414 $dt_prop->setShowTime(true);
3415 $rad_op3->addSubItem($dt_prop);
3416 $dt_prop2 = new ilDateTimeInputGUI($this->lng->txt("cont_end"), "end");
3417 $dt_prop2->setRequired(true);
3418 $dt_prop2->setShowTime(true);
3419 $rad_op3->addSubItem($dt_prop2);
3420
3421 // show activation information
3422 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3423 $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3424 $rad_op3->addSubItem($cb);
3425
3426
3427 $rad->addOption($rad_op3);
3428
3429 $this->form->addCommandButton("saveActivation", $this->lng->txt("save"));
3430
3431 $this->form->addItem($rad);
3432 }
3433
3437 public function getActivationFormValues()
3438 {
3439 $activation = "deactivated";
3440 if ($this->getPageObject()->getActive()) {
3441 $activation = "activated";
3442 }
3443
3444 $dt_prop = $this->form->getItemByPostVar("start");
3445 if ($this->getPageObject()->getActivationStart() != "") {
3446 $activation = "scheduled";
3447 $dt_prop->setDate(new ilDateTime(
3448 $this->getPageObject()->getActivationStart(),
3450 ));
3451 }
3452 $dt_prop = $this->form->getItemByPostVar("end");
3453 if ($this->getPageObject()->getActivationEnd() != "") {
3454 $activation = "scheduled";
3455 $dt_prop->setDate(new ilDateTime(
3456 $this->getPageObject()->getActivationEnd(),
3458 ));
3459 }
3460
3461 $this->form->getItemByPostVar("activation")->setValue($activation);
3462 $this->form->getItemByPostVar("show_activation_info")->setChecked($this->getPageObject()->getShowActivationInfo());
3463 }
3464
3468 public function saveActivation()
3469 {
3470 $this->initActivationForm();
3471
3472 if ($this->form->checkInput()) {
3473 $this->getPageObject()->setActive(true);
3474 $this->getPageObject()->setActivationStart(null);
3475 $this->getPageObject()->setActivationEnd(null);
3476 $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3477 if ($_POST["activation"] == "deactivated") {
3478 $this->getPageObject()->setActive(false);
3479 }
3480 if ($_POST["activation"] == "scheduled") {
3481 $this->getPageObject()->setActive(false);
3482 $this->getPageObject()->setActivationStart(
3483 $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME)
3484 );
3485 $this->getPageObject()->setActivationEnd(
3486 $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME)
3487 );
3488 }
3489 $this->getPageObject()->update();
3490 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3491 $this->ctrl->redirect($this, "editActivation");
3492 }
3493 $this->form->setValuesByPost();
3494 $this->tpl->setContent($this->form->getHTML());
3495 }
3496
3506 public function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
3507 {
3508 include_once("Services/Notes/classes/class.ilNoteGUI.php");
3509
3510 // scorm 2004 page gui
3511 if (!$a_content_object) {
3512 $notes_gui = new ilNoteGUI(
3513 $this->notes_parent_id,
3514 (int) $this->obj->getId(),
3515 "pg"
3516 );
3517
3518 $a_enable_private_notes = true;
3519 $a_enable_public_notes = true;
3520 $a_enable_notes_deletion = false;
3521 }
3522 // wiki page gui, blog posting gui
3523 else {
3524 $notes_gui = new ilNoteGUI(
3525 $a_content_object->getParentId(),
3526 $a_content_object->getId(),
3527 $a_content_object->getParentType()
3528 );
3529 }
3530
3531 if ($a_enable_private_notes) {
3532 $notes_gui->enablePrivateNotes();
3533 }
3534 if ($a_enable_public_notes) {
3535 $notes_gui->enablePublicNotes();
3536 if ((bool) $a_enable_notes_deletion) {
3537 $notes_gui->enablePublicNotesDeletion(true);
3538 }
3539 }
3540
3541 if ($a_callback) {
3542 $notes_gui->addObserver($a_callback);
3543 }
3544
3545 $next_class = $this->ctrl->getNextClass($this);
3546 if ($next_class == "ilnotegui") {
3547 $html = $this->ctrl->forwardCommand($notes_gui);
3548 } else {
3549 $html = $notes_gui->getNotesHTML();
3550 }
3551 return $html;
3552 }
3553
3557 public function processAnswer()
3558 {
3559 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3563 ilUtil::stripSlashes($_POST["answer"])
3564 );
3565 }
3566
3567
3568 //
3569 // Initially opened content (e.g. used in learning modules), that
3570 // is presented in another than the main content area (e.g. a picture in
3571 // the bottom left area)
3572 //
3573
3580 public function initialOpenedContent()
3581 {
3582 $this->tabs_gui->activateTab("edit");
3583 $form = $this->initOpenedContentForm();
3584
3585 $this->tpl->setContent($form->getHTML());
3586 }
3587
3594 public function initOpenedContentForm()
3595 {
3596 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3597 $form = new ilPropertyFormGUI();
3598
3599 // link input
3600 include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3601 $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3602 $ac->setAllowedLinkTypes(ilLinkInputGUI::INT);
3603 $ac->setInternalLinkDefault("Media_Media", 0);
3604 $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3605 $val = $this->obj->getInitialOpenedContent();
3606 if ($val["id"] != "" && $val["type"] != "") {
3607 $ac->setValue($val["type"] . "|" . $val["id"] . "|" . $val["target"]);
3608 }
3609
3610 $form->addItem($ac);
3611
3612 $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3613 $form->addCommandButton("edit", $this->lng->txt("cancel"));
3614 $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3615 $form->setFormAction($this->ctrl->getFormAction($this));
3616
3617 return $form;
3618 }
3619
3627 {
3628 $this->obj->saveInitialOpenedContent(
3629 ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3630 ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3631 ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3632 );
3633
3634 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3635 $this->ctrl->redirect($this, "edit");
3636 }
3637
3641
3642
3646 public function switchToLanguage()
3647 {
3648 $l = ilUtil::stripSlashes($_GET["totransl"]);
3649 $p = $this->getPageObject();
3650 if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l)) {
3652 return;
3653 }
3654 $this->ctrl->setParameter($this, "transl", $_GET["totransl"]);
3655 $this->ctrl->redirect($this, "edit");
3656 }
3657
3662 {
3663 $l = ilUtil::stripSlashes($_GET["totransl"]);
3664 $this->ctrl->setParameter($this, "totransl", $l);
3665 $this->lng->loadLanguageModule("meta");
3666
3667 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3668 $cgui = new ilConfirmationGUI();
3669 $cgui->setFormAction($this->ctrl->getFormAction($this));
3670 $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
3671 $this->lng->txt("meta_l_" . $l));
3672 $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
3673 $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");
3674 $this->tpl->setContent($cgui->getHTML());
3675 }
3676
3680 public function editMasterLanguage()
3681 {
3682 $this->ctrl->setParameter($this, "transl", "");
3683 $this->ctrl->redirect($this, "edit");
3684 }
3685
3689 public function createPageTranslation()
3690 {
3691 $l = ilUtil::stripSlashes($_GET["totransl"]);
3692
3693 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3695 $this->getPageObject()->getParentType(),
3696 $this->getPageObject()->getId(),
3697 0,
3698 "-"
3699 );
3700 $p->copyPageToTranslation($l);
3701 $this->ctrl->setParameter($this, "transl", $l);
3702 $this->ctrl->redirect($this, "edit");
3703 }
3704
3708 public function releasePageLock()
3709 {
3710 $this->getPageObject()->releasePageLock();
3711 ilUtil::sendSuccess($this->lng->txt("cont_page_lock_released"), true);
3712 $this->ctrl->redirect($this, "preview");
3713 }
3714
3715 protected function isPageContainerToBeRendered()
3716 {
3717 return (
3718 $this->getRenderPageContainer() || $this->getOutputMode() == self::PREVIEW
3719 );
3720 }
3721
3728 public function getPagePermaLink()
3729 {
3730 return "";
3731 }
3732
3738 {
3739 $collector = new \ILIAS\COPage\ResourcesCollector($this->getOutputMode(), $this->getPageObject());
3740
3741 foreach ($collector->getJavascriptFiles() as $js) {
3742 $tpl->addJavascript($js);
3743 }
3744
3745 foreach ($collector->getCssFiles() as $css) {
3746 $tpl->addCss($css);
3747 }
3748
3749 foreach ($collector->getOnloadCode() as $code) {
3750 $tpl->addOnloadCode($code);
3751 }
3752 }
3753}
user()
Definition: user.php:4
$n
Definition: RandomTest.php:85
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
static addCss()
Add required css.
User interface class for advanced drop-down selection lists.
special template class to simplify handling of ITX/PEAR
static getPCDefinitions()
Get PC definitions.
static requirePCClassByName($a_name)
Get instance.
This class represents a captcha input in a property form.
This class represents a checkbox property in a property form.
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class ilEditClipboardGUI.
special template class to simplify handling of ITX/PEAR
Class ilInternalLinkGUI.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
Learning history main GUI class.
static getInstance()
Factory.
This class represents a external and/or internal link in a property form.
static getLogger($a_component_id)
Get component logger.
static isActivated()
Checks whether Map feature is activated.
static getInstance()
Singleton: get instance.
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
static lookupTitle($a_page_id)
Lookup title.
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
User Interface for NewsItem entities.
Notes GUI class.
static hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
Class ilObjFile.
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
Class ilObjMediaObject.
static isTypeAllowed($a_type)
Is type allowed.
Class ilObjStyleSheet.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
Class ilObjectMetaDataGUI.
static getInstance($a_obj_id)
Get instance.
static _lookupTitle($a_id)
lookup object title
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupOwner($a_id)
lookup object owner
static _lookupType($a_id, $a_reference=false)
lookup object type
static initJavascript()
Init javascript.
static collectContentIncludes($a_page, $a_domdoc)
get all content includes that are used within the page
static _getCharacteristics($a_style_id)
Get characteristics.
static _getTextCharacteristics($a_style_id, $a_include_core=false)
Get text characteristics.
static getStyleSelector($a_selected, $a_chars, $a_use_callback=false)
Get style selector.
static getCharStyleSelector($a_par_type, $a_use_callback=true, $a_style_id=0)
Get character style selector.
static insertResourcesIntoPageContent($a_content)
Insert resources (see also ilContainerContentGUI::determinePageEmbeddedBlocks for presentation)
static getCacheTriggerString($a_page)
Get page cache update trigger string.
static _getCommonBBButtons()
Get common bb buttons.
static getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr=0, $a_all_hist_nrs=false, $a_lang="-")
Get page content usages for page.
Page Editor GUI class.
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
Page History Table GUI Class.
Page multilinguality GUI class.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
Class ilPageObjectGUI.
afterConstructor()
After constructor.
getRawPageContent()
Get Get raw page content only.
setPrependingHtml($a_prependinghtml)
Set Prepending HTML.
onFeedbackEditingForwarding()
On feedback editing forwarding.
setLinkXml($xml)
Set linkXML.
setPresentationTitle($a_title="")
getEditPreview()
Get Display first Edit tab, then Preview tab, instead of Page and Edit.
rollback()
Rollback to a previous version.
getTabs($a_activate="")
adds tabs to tab gui object
determineSourcecodeDownloadScript()
Determine source code download script.
setOldNr($a_val)
Set old nr (historic page)
showMediaFullscreen($a_style_id=0)
show fullscreen view of media object
processAnswer()
Process answer.
showPage()
display content of page
getEnablePCType($a_pc_type)
Get enable pc type.
getViewPageText()
get view page text
insertPageToc($a_output)
Insert page toc.
getProfileBackUrl()
Get profile back url.
setRawPageContent($a_rawpagecontent)
Set Get raw page content only.
getDisabledText()
Get disabled text.
setQuestionHTML($question_html)
displayValidationError($a_error)
display validation error
addMultiLangActionsAndInfo($a_list, $a_tpl)
Add multi-language actions to menu.
setOutputMode($a_mode=self::PRESENTATION)
Set Output Mode.
setEditMode()
Set edit mode.
saveActivation()
Save Activation.
insertResources($a_output)
Insert resources.
setRenderPageContainer($a_val)
Set render page container.
getEnabledNews()
Get enabled news.
getLanguage()
Get language.
setEnabledTabs($a_enabledtabs)
Set Output tabs.
getNotesHTML($a_content_object=null, $a_enable_private_notes=true, $a_enable_public_notes=false, $a_enable_notes_deletion=false, $a_callback=null)
Get html for public and/or private notes.
setQuestionXML($question_xml)
getCompareMode()
Get compare mode.
releasePageLock()
Release page lock.
getActivationFormValues()
Get values for activation form.
initOpenedContentForm()
Init form for initially opened content.
enableChangeComments($a_enabled)
setParentType($a_val)
Set parent type.
setPageLinker($page_linker)
setPageConfig($a_val)
Set page config object.
initialOpenedContent()
Initially opened content.
addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
Add actions menu.
confirmPageTranslationCreation()
Confirm page translation creation.
editActivation()
Edit activation (only, if scheduled page activation is activated in administration)
getPrependingHtml()
Get Prepending HTML.
determineFullscreenLink()
Determine fullscreen link.
setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
Set Explorer Updater.
setViewPageLink($a_link, $a_target="")
set link for "view page" button
setEnabledNews($a_enabled, $a_news_obj_id=0, $a_news_obj_type=0)
Set enabled news.
addResourcesToTemplate(ilGlobalTemplateInterface $tpl)
Add resources to template.
compareVersion()
Compares two revisions of the page.
getParentType()
Get parent type.
displayMedia($a_fullscreen=false)
Display media.
getAbstractOnly()
Get abstract only.
setTabHook($a_object, $a_function)
Set tab hook.
setAbstractOnly($a_val)
Set abstract only.
determineFileDownloadLink()
Determine file download link.
getViewPageTarget()
get view page target frame
getPagePermaLink()
Get page perma link.
getPageObject()
Get Page Object.
getFullscreenLink()
Get fullscreen link.
setCompareMode($a_val)
Set compare mode.
insertAdvTrigger($a_output)
Insert adv content trigger.
replaceCurlyBrackets($output)
Replace curly brackets.
__construct( $a_parent_type, $a_id, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="")
Constructor.
activateMetaDataEditor( $a_rep_obj, $a_type, $a_sub_obj_id, $a_observer_obj=null, $a_observer_func="")
Activate meda data editor.
setEnableEditing($a_enableediting)
Set Enable Editing.
getEnabledTabs()
Get Output tabs.
editMasterLanguage()
Edit master language.
setScreenIdComponent()
Set screen id component.
previewHistory()
Preview history.
getStyleId()
Get Style Id.
setEditPreview($a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
postOutputProcessing($a_output)
Finalizing output processing.
setTemplateOutput($a_output=true)
getPageConfig()
Get page config object.
createPageTranslation()
Create page translation.
initCaptchaForm()
Init captcha form.
setFileDownloadLink($a_download_link)
Set file download link.
setEnablePCType($a_pc_type, $a_val)
Set enable pc type.
history()
Get history table as HTML.
displayMediaFullscreen()
Show media in fullscreen mode.
setDefaultLinkXml()
Set standard link xml.
saveInitialOpenedContent()
Save initial opened content.
setFullscreenLink($a_fullscreen_link)
Set fullscreen link.
setStyleId($a_styleid)
Set Style Id.
getOfflineDirectory()
get offline directory
rollbackConfirmation()
Rollback confirmation.
static getTinyMenu( $a_par_type, $a_int_links=false, $a_wiki_links=false, $a_keywords=false, $a_style_id=0, $a_paragraph_styles=true, $a_save_return=true, $a_anchors=false, $a_save_new=true, $a_user_links=false)
Get Tiny Menu.
setLanguage($a_val)
Set language.
executeCommand()
execute command
initPageObject()
Init page object.
getEnableEditing()
Get Enable Editing.
setLinkParams($l_params="")
switchToLanguage()
Switch to language.
getEnabledPageFocus()
Get Enable page focus.
getComponentPluginsXML()
Put information about activated plugins into XML.
enableNotes($a_enabled, $a_parent_id)
getFileDownloadLink()
Get file download link.
setSourcecodeDownloadScript($script_name)
Set sourcecode download script.
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
setProfileBackUrl($url)
Get profile back url.
setTemplateTargetVar($a_variable)
getActivationCaptions()
Get captions for activation action menu entries.
presentation($a_mode=self::PRESENTATION)
initActivationForm()
Init activation form.
getBlockingInfoMessage()
Get block info message.
insertJSAtPlaceholder()
InsertJS at placeholder.
downloadFile()
Download file of file lists.
getViewPageLink()
get view page link
download_paragraph()
download source code paragraph
setActivationListener(&$a_obj, $a_meth)
edit()
edit ("view" before)
setQEditTabs($a_active)
Set question editing tabs.
getSourcecodeDownloadScript()
Get sourcecode download script.
setOfflineDirectory($offdir)
set offline directory to offdir
setEnabledPageFocus($a_enabledpagefocus)
Set Enable page focus.
getOldNr()
Get old nr (historic page)
getRenderPageContainer()
Get render page container.
Class ilPageObject.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static saveQuestionAnswer($a_type, $a_id, $a_answer)
Save question answer.
static getFlashVideoPlayerFilename($a_fullpath=false)
Get flash video player file name.
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
This class represents a property form user interface.
GUI class for public user profile presentation.
Class ilQuestionEditGUI.
This class represents a property in a property form.
This class represents an option in a radio group.
ILIAS Setting Class.
static strPosAll($a_haystack, $a_needle)
Get all positions of a string.
static replaceFirsOccurence($a_old, $a_new, $a_str)
Replaces the first occurence of $a_old in $a_str with $a_new.
special template class to simplify handling of ITX/PEAR
static addTooltip( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getWebspaceDir($mode="filesystem")
get webspace directory
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
static initDragDrop(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
help()
Definition: help.php:2
const ILIAS_VERSION
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
language()
Definition: language.php:2
exit
Definition: login.php:29
$i
Definition: metadata.php:24
$xml
Definition: metadata.php:332
$ret
Definition: parser.php:6
$url
$lm_set
if(strpos( $jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:32
ui()
Definition: ui.php:5
$a_type
Definition: workflow.php:92
$lang
Definition: xapiexit.php:8
$DIC
Definition: xapitoken.php:46