ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPageObjectGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4define("IL_PAGE_PRESENTATION", "presentation");
5define("IL_PAGE_EDIT", "edit");
6define("IL_PAGE_PREVIEW", "preview");
7define("IL_PAGE_OFFLINE", "offline");
8define("IL_PAGE_PRINT", "print");
9
10include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
11include_once("./Services/COPage/classes/class.ilPageObject.php");
12include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
13include_once("./Services/Utilities/classes/class.ilDOMUtil.php");
14
31{
35 protected $tpl;
36
40 protected $lng;
41
45 protected $ctrl;
46
50 protected $tabs_gui;
51
55 protected $access;
56
60 protected $plugin_admin;
61
65 protected $log;
66
70 protected $user;
71
75 protected $help;
76
80 public $obj;
81
85 protected $output_mode;
86
97 public $activation = false;
98 public $activated = true;
99 public $editpreview = false;
100 public $use_meta_data = false;
101 public $link_xml_set = false;
102 public $enableediting = true;
103 public $rawpagecontent = false;
105 public $compare_mode = false;
106 public $page_config = null;
107 public $tabs_enabled = true;
109 private $abstract_only = false;
110 protected $parent_type = "";
111
112
113 //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
114 //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
115 public $pl_start = "{{{{{";
116 public $pl_end = "}}}}}";
117
127 public function __construct(
128 $a_parent_type,
129 $a_id,
130 $a_old_nr = 0,
131 $a_prevent_get_id = false,
132 $a_lang = ""
133 ) {
134 global $DIC;
135
136 $this->log = ilLoggerFactory::getLogger('copg');
137 $this->tpl = $DIC["tpl"];
138 $this->ctrl = $DIC->ctrl();
139 $this->lng = $DIC->language();
140 $this->tabs_gui = $DIC->tabs();
141 $this->plugin_admin = $DIC["ilPluginAdmin"];
142 $this->access = $DIC->access();
143 $this->user = $DIC->user();
144 $this->help = $DIC["ilHelp"];
145
146 $this->setParentType($a_parent_type);
147 $this->setId($a_id);
148 if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0) {
149 $a_old_nr = $_GET["old_nr"];
150 }
151 $this->setOldNr($a_old_nr);
152
153 if ($a_lang == "" && $_GET["transl"] != "") {
154 $this->setLanguage($_GET["transl"]);
155 } else {
156 if ($a_lang == "") {
157 $a_lang = "-";
158 }
159 $this->setLanguage($a_lang);
160 }
161
162
164 $this->setEnabledPageFocus(true);
165 $this->initPageObject();
166 $this->setPageConfig($this->getPageObject()->getPageConfig());
167
168 $this->output2template = true;
169 $this->question_xml = "";
170 $this->question_html = "";
171
172 $this->template_output_var = "PAGE_CONTENT";
173 $this->change_comments = false;
174 $this->page_back_title = $this->lng->txt("page");
175 $this->lng->loadLanguageModule("content");
176 $this->lng->loadLanguageModule("copg");
177
178 $this->setTemplateOutput(false);
179
180 $this->ctrl->saveParameter($this, "transl");
181
182 $this->afterConstructor();
183 }
184
188 public function afterConstructor()
189 {
190 }
191
192
196 final protected function initPageObject()
197 {
198 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
200 $this->getParentType(),
201 $this->getId(),
202 $this->getOldNr(),
203 $this->getLanguage()
204 );
205 $this->setPageObject($page);
206 }
207
213 public function setParentType($a_val)
214 {
215 $this->parent_type = $a_val;
216 }
217
223 public function getParentType()
224 {
225 return $this->parent_type;
226 }
227
233 public function setId($a_val)
234 {
235 $this->id = $a_val;
236 }
237
243 public function getId()
244 {
245 return $this->id;
246 }
247
253 public function setOldNr($a_val)
254 {
255 $this->old_nr = $a_val;
256 }
257
263 public function getOldNr()
264 {
265 return $this->old_nr;
266 }
267
273 public function setLanguage($a_val)
274 {
275 $this->language = $a_val;
276 }
277
283 public function getLanguage()
284 {
285 if ($this->language == "") {
286 return "-";
287 }
288
289 return $this->language;
290 }
291
297 public function setEnablePCType($a_pc_type, $a_val)
298 {
299 $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
300 }
301
307 public function getEnablePCType($a_pc_type)
308 {
309 return $this->getPageConfig()->getEnablePCType($a_pc_type);
310 }
311
317 public function setPageConfig($a_val)
318 {
319 $this->page_config = $a_val;
320 }
321
327 public function getPageConfig()
328 {
329 return $this->page_config;
330 }
331
337 public function setPageObject(ilPageObject $a_pg_obj)
338 {
339 $this->obj = $a_pg_obj;
340 }
341
347 public function getPageObject()
348 {
349 return $this->obj;
350 }
351
357 public function setOutputMode($a_mode = IL_PAGE_PRESENTATION)
358 {
359 $this->output_mode = $a_mode;
360 }
361
362 public function getOutputMode()
363 {
364 return $this->output_mode;
365 }
366
367 public function setTemplateOutput($a_output = true)
368 {
369 $this->output2template = $a_output;
370 }
371
372 public function outputToTemplate()
373 {
375 }
376
377 public function setPresentationTitle($a_title = "")
378 {
379 $this->presentation_title = $a_title;
380 }
381
382 public function getPresentationTitle()
383 {
385 }
386
387 public function setHeader($a_title = "")
388 {
389 $this->header = $a_title;
390 }
391
392 public function getHeader()
393 {
394 return $this->header;
395 }
396
397 public function setLinkParams($l_params = "")
398 {
399 $this->link_params = $l_params;
400 }
401
402 public function getLinkParams()
403 {
404 return $this->link_params;
405 }
406
407 public function setLinkFrame($l_frame = "")
408 {
409 $this->link_frame = $l_frame;
410 }
411
412 public function getLinkFrame()
413 {
414 return $this->link_frame;
415 }
416
417 public function setLinkXML($link_xml)
418 {
419 $this->link_xml = $link_xml;
420 $this->link_xml_set = true;
421 }
422
423 public function getLinkXML()
424 {
425 return $this->link_xml;
426 }
427
428 public function setQuestionXML($question_xml)
429 {
430 $this->question_xml = $question_xml;
431 }
432
434 {
435 $this->getPageConfig()->setQuestionHTML($question_html);
436 }
437
438 public function getQuestionXML()
439 {
440 return $this->question_xml;
441 }
442
443 public function getQuestionHTML()
444 {
445 return $this->getPageConfig()->getQuestionHTML();
446 }
447
448 public function setTemplateTargetVar($a_variable)
449 {
450 $this->target_var = $a_variable;
451 }
452
453 public function getTemplateTargetVar()
454 {
455 return $this->target_var;
456 }
457
458 public function setTemplateOutputVar($a_value)
459 {
460 $this->template_output_var = $a_value;
461 }
462
463 public function getTemplateOutputVar()
464 {
466 }
467
473 public function setSourcecodeDownloadScript($script_name)
474 {
475 $this->sourcecode_download_script = $script_name;
476 }
477
484 {
486 }
487
488 public function setLocator(&$a_locator)
489 {
490 $this->locator = $a_locator;
491 }
492
493 public function setTabs($a_tabs)
494 {
495 $this->tabs_gui = $a_tabs;
496 }
497
498 public function setPageBackTitle($a_title)
499 {
500 $this->page_back_title = $a_title;
501 }
502
508 public function setFileDownloadLink($a_download_link)
509 {
510 $this->file_download_link = $a_download_link;
511 }
512
518 public function getFileDownloadLink()
519 {
520 return $this->file_download_link;
521 }
522
528 public function setFullscreenLink($a_fullscreen_link)
529 {
530 $this->fullscreen_link = $a_fullscreen_link;
531 }
532
538 public function getFullscreenLink()
539 {
540 return $this->fullscreen_link;
541 }
542
543 public function setIntLinkReturn($a_return)
544 {
545 $this->int_link_return = $a_return;
546 }
547
548 public function enableChangeComments($a_enabled)
549 {
550 $this->change_comments = $a_enabled;
551 }
552
553 public function isEnabledChangeComments()
554 {
556 }
557
558 public function enableNotes($a_enabled, $a_parent_id)
559 {
560 $this->notes_enabled = $a_enabled;
561 $this->notes_parent_id = $a_parent_id;
562 }
563
564 public function isEnabledNotes()
565 {
566 return $this->notes_enabled;
567 }
568
574 public function setOfflineDirectory($offdir)
575 {
576 $this->offline_directory = $offdir;
577 }
578
579
584 public function getOfflineDirectory()
585 {
586 return $this->offline_directory;
587 }
588
589
596 public function setViewPageLink($a_link, $a_target = "")
597 {
598 $this->view_page_link = $a_link;
599 $this->view_page_target = $a_target;
600 }
601
605 public function getViewPageLink()
606 {
607 return $this->view_page_link;
608 }
609
613 public function getViewPageTarget()
614 {
615 return $this->view_page_target;
616 }
617
623 public function getViewPageText()
624 {
625 return $this->lng->txt("cont_presentation_view");
626 }
627
628 public function setActivationListener(&$a_obj, $a_meth)
629 {
630 $this->act_obj = $a_obj;
631 $this->act_meth = $a_meth;
632 }
633
639 public function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
640 {
641 $this->enabled_news = $a_enabled;
642 $this->news_obj_id = $a_news_obj_id;
643 $this->news_obj_type = $a_news_obj_type;
644 }
645
651 public function getEnabledNews()
652 {
653 return $this->enabled_news;
654 }
655
659 public function setTabHook($a_object, $a_function)
660 {
661 $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
662 }
663
669 public function setEditPreview($a_editpreview)
670 {
671 $this->editpreview = $a_editpreview;
672 }
673
679 public function getEditPreview()
680 {
681 return $this->editpreview;
682 }
683
689 public function setEnabledTabs($a_enabledtabs)
690 {
691 $this->tabs_enabled = $a_enabledtabs;
692 }
693
699 public function getEnabledTabs()
700 {
701 return $this->tabs_enabled;
702 }
703
709 public function setEnabledPageFocus($a_enabledpagefocus)
710 {
711 $this->enabledpagefocus = $a_enabledpagefocus;
712 }
713
719 public function getEnabledPageFocus()
720 {
721 return $this->enabledpagefocus;
722 }
723
729 public function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
730 {
731 return;
732 $this->exp_frame = $a_exp_frame;
733 $this->exp_id = $a_exp_id;
734 $this->exp_target_script = $a_exp_target_script;
735 }
736
742 public function setPrependingHtml($a_prependinghtml)
743 {
744 $this->prependinghtml = $a_prependinghtml;
745 }
746
752 public function getPrependingHtml()
753 {
754 return $this->prependinghtml;
755 }
756
762 public function setEnableEditing($a_enableediting)
763 {
764 $this->enableediting = $a_enableediting;
765 }
766
772 public function getEnableEditing()
773 {
775 }
776
782 public function setRawPageContent($a_rawpagecontent)
783 {
784 $this->rawpagecontent = $a_rawpagecontent;
785 }
786
792 public function getRawPageContent()
793 {
795 }
796
802 public function setStyleId($a_styleid)
803 {
804 $this->styleid = $a_styleid;
805 }
806
812 public function getStyleId()
813 {
814 return $this->styleid;
815 }
816
822 public function setCompareMode($a_val)
823 {
824 $this->compare_mode = $a_val;
825 }
826
832 public function getCompareMode()
833 {
834 return $this->compare_mode;
835 }
836
842 public function setAbstractOnly($a_val)
843 {
844 $this->abstract_only = $a_val;
845 }
846
852 public function getAbstractOnly()
853 {
855 }
856
862 public function setRenderPageContainer($a_val)
863 {
864 $this->render_page_container = $a_val;
865 }
866
872 public function getRenderPageContainer()
873 {
875 }
876
883 public function getDisabledText()
884 {
885 return $this->lng->txt("inactive");
886 }
887
888
898 public function activateMetaDataEditor(
899 $a_rep_obj,
900 $a_type,
901 $a_sub_obj_id,
902 $a_observer_obj = null,
903 $a_observer_func = ""
904 ) {
905 $this->use_meta_data = true;
906 $this->meta_data_rep_obj = $a_rep_obj;
907 $this->meta_data_sub_obj_id = $a_sub_obj_id;
908 $this->meta_data_type = $a_type;
909 $this->meta_data_observer_obj = $a_observer_obj;
910 $this->meta_data_observer_func = $a_observer_func;
911 }
912
919 {
920 $file_download_link = $this->getFileDownloadLink();
921 if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline") {
922 $file_download_link = $this->ctrl->getLinkTarget($this, "downloadFile");
923 }
924 return $file_download_link;
925 }
926
932 public function determineFullscreenLink()
933 {
934 $fullscreen_link = $this->getFullscreenLink();
935 if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline") {
936 $fullscreen_link = $this->ctrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
937 }
938 return $fullscreen_link;
939 }
940
947 {
949 if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline") {
950 $l = $this->ctrl->getLinkTarget($this, "");
951 }
952 return $l;
953 }
954
958 public function getComponentPluginsXML()
959 {
960 $xml = "";
961 if ($this->getOutputMode() == "edit") {
962 $pl_names = $this->plugin_admin->getActivePluginsForSlot(
964 "COPage",
965 "pgcp"
966 );
967 foreach ($pl_names as $pl_name) {
968 $plugin = $this->plugin_admin->getPluginObject(
970 "COPage",
971 "pgcp",
972 $pl_name
973 );
974 if ($plugin->isValidParentType($this->getPageObject()->getParentType())) {
975 $xml.= '<ComponentPlugin Name="' . $plugin->getPluginName() .
976 '" InsertText="' . $plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT) . '" />';
977 }
978 }
979 }
980 if ($xml != "") {
981 $xml = "<ComponentPlugins>" . $xml . "</ComponentPlugins>";
982 }
983 return $xml;
984 }
985
986
990 public function executeCommand()
991 {
992 $this->getTabs();
993
994 $this->ctrl->setReturn($this, "edit");
995
996 $next_class = $this->ctrl->getNextClass($this);
997 $this->log->debug("next_class: " . $next_class);
998 switch ($next_class) {
999 case 'ilobjectmetadatagui':
1000 $this->tabs_gui->activateTab("meta_data");
1001 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
1002 $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
1003 if (is_object($this->meta_data_observer_obj)) {
1004 $md_gui->addMDObserver(
1005 $this->meta_data_observer_obj,
1006 $this->meta_data_observer_func,
1007 "General"
1008 );
1009 }
1010 $this->ctrl->forwardCommand($md_gui);
1011 break;
1012
1013 case "ileditclipboardgui":
1014 $clip_gui = new ilEditClipboardGUI();
1015 $clip_gui->setPageBackTitle($this->page_back_title);
1016 $ret = $this->ctrl->forwardCommand($clip_gui);
1017 break;
1018
1019 // notes
1020 case "ilnotegui":
1021 switch ($_GET["notes_mode"]) {
1022 default:
1023 $html = $this->edit();
1024 $this->tabs_gui->setTabActive("edit");
1025 return $html;
1026 }
1027 break;
1028
1029 case 'ilpublicuserprofilegui':
1030 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
1031 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1032 $ret = $this->ctrl->forwardCommand($profile_gui);
1033 break;
1034
1035 case "ilpageeditorgui":
1036 if (!$this->getEnableEditing()) {
1037 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
1038 $this->ctrl->redirect($this, "preview");
1039 }
1040 $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
1041 $page_editor->setLocator($this->locator);
1042 $page_editor->setHeader($this->getHeader());
1043 $page_editor->setPageBackTitle($this->page_back_title);
1044 $page_editor->setIntLinkReturn($this->int_link_return);
1045 //$page_editor->executeCommand();
1046 $ret = $this->ctrl->forwardCommand($page_editor);
1047 break;
1048
1049 case 'ilnewsitemgui':
1050 include_once("./Services/News/classes/class.ilNewsItemGUI.php");
1051 $news_item_gui = new ilNewsItemGUI();
1052 $news_item_gui->setEnableEdit(true);
1053 $news_item_gui->setContextObjId($this->news_obj_id);
1054 $news_item_gui->setContextObjType($this->news_obj_type);
1055 $news_item_gui->setContextSubObjId($this->obj->getId());
1056 $news_item_gui->setContextSubObjType("pg");
1057
1058 $ret = $this->ctrl->forwardCommand($news_item_gui);
1059 break;
1060
1061 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1062 $ret = $this->ctrl->forwardCommand($profile_gui);
1063 break;
1064
1065 case "ilpropertyformgui":
1066 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1067 $form = $this->initOpenedContentForm();
1068 $this->ctrl->forwardCommand($form);
1069 break;
1070
1071 case "ilinternallinkgui":
1072 $this->lng->loadLanguageModule("content");
1073 require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1074 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1075
1076 $link_gui->filterLinkType("PageObject_FAQ");
1077 $link_gui->filterLinkType("GlossaryItem");
1078 $link_gui->filterLinkType("Media_Media");
1079 $link_gui->filterLinkType("Media_FAQ");
1080
1081 $link_gui->setFilterWhiteList(true);
1082 $this->ctrl->forwardCommand($link_gui);
1083 break;
1084
1085 case "ilquestioneditgui":
1086 $this->setQEditTabs("question");
1087 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1088 $edit_gui = new ilQuestionEditGUI();
1089 $edit_gui->setPageConfig($this->getPageConfig());
1090// $edit_gui->addNewIdListener($this, "setNewQuestionId");
1091 $edit_gui->setSelfAssessmentEditingMode(true);
1092 $ret = $this->ctrl->forwardCommand($edit_gui);
1093 $this->tpl->setContent($ret);
1094 break;
1095
1096 case 'ilassquestionfeedbackeditinggui':
1097
1099
1100 // set tabs
1101 $this->setQEditTabs("feedback");
1102
1103 // load required lang mods
1104 $this->lng->loadLanguageModule("assessment");
1105
1106 // set context tabs
1107 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
1108 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
1109 $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
1110 $questionGUI->object->setObjId(0);
1111 $questionGUI->object->setSelfAssessmentEditingMode(true);
1112 $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1113
1114 // forward to ilAssQuestionFeedbackGUI
1115 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1116 $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $this->ctrl, $this->access, $this->tpl, $this->tabs_gui, $this->lng);
1117 $this->ctrl->forwardCommand($gui);
1118 break;
1119
1120/* case "ilpagemultilanggui":
1121 $this->ctrl->setReturn($this, "edit");
1122 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1123 $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1124 $this->getPageConfig()->getSinglePageMode());
1125 //$this->setTabs("settings");
1126 //$this->setSubTabs("cont_multilinguality");
1127 $ret = $this->ctrl->forwardCommand($ml_gui);
1128 break;*/
1129
1130 default:
1131 $cmd = $this->ctrl->getCmd("preview");
1132 $ret = $this->$cmd();
1133 break;
1134 }
1135 //echo "+$ret+";
1136 return $ret;
1137 }
1138
1145 public function setQEditTabs($a_active)
1146 {
1147 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1148
1149 $this->tabs_gui->clearTargets();
1150
1151 $this->tabs_gui->setBackTarget(
1152 $this->lng->txt("back"),
1153 $this->ctrl->getLinkTarget($this, "edit")
1154 );
1155
1156 $this->ctrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1157 $this->tabs_gui->addTab(
1158 "question",
1159 $this->lng->txt("question"),
1160 $this->ctrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion")
1161 );
1162
1163 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1164 $this->ctrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1165 $this->tabs_gui->addTab(
1166 "feedback",
1167 $this->lng->txt("feedback"),
1168 $this->ctrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
1169 );
1170
1171 $this->tabs_gui->activateTab($a_active);
1172 }
1173
1178 {
1179 }
1180
1181
1182 public function deactivatePage()
1183 {
1184 $this->getPageObject()->setActivationStart(null);
1185 $this->getPageObject()->setActivationEnd(null);
1186 $this->getPageObject()->setActive(false);
1187 $this->getPageObject()->update();
1188 $this->ctrl->redirect($this, "edit");
1189 }
1190
1191 public function activatePage()
1192 {
1193 $this->getPageObject()->setActivationStart(null);
1194 $this->getPageObject()->setActivationEnd(null);
1195 $this->getPageObject()->setActive(true);
1196 $this->getPageObject()->update();
1197 $this->ctrl->redirect($this, "edit");
1198 }
1199
1203 public function showPage()
1204 {
1205 // jquery and jquery ui are always provided for components
1206 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1209
1210 // $this->initSelfAssessmentRendering();
1211
1212 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1214
1215 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1216
1217 // needed for overlays in iim
1218 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1220
1221 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1223
1224 // init template
1225 //if($this->outputToTemplate())
1226 //{
1227 if ($this->getOutputMode() == "edit") {
1228 $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1229
1230 //echo ":".$this->getTemplateTargetVar().":";
1231 $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1232 //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1233
1234 // to do: status dependent class
1235 $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1236
1237 // user comment
1238 if ($this->isEnabledChangeComments()) {
1239 $tpl->setCurrentBlock("change_comment");
1240 $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1241 $tpl->parseCurrentBlock();
1242 }
1243
1244 $tpl->setVariable(
1245 "WYSIWYG_ACTION",
1246 $this->ctrl->getFormActionByClass("ilpageeditorgui", "", "", true)
1247 );
1248
1249 // determine media, html and javascript mode
1250 $sel_media_mode = ($this->user->getPref("ilPageEditor_MediaMode") == "disable")
1251 ? "disable"
1252 : "enable";
1253 $sel_html_mode = ($this->user->getPref("ilPageEditor_HTMLMode") == "disable")
1254 ? "disable"
1255 : "enable";
1256 $sel_js_mode = "disable";
1257 //if($ilSetting->get("enable_js_edit", 1))
1258 //{
1259 $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1260 ? "enable"
1261 : "disable";
1262 //}
1263
1264 // show prepending html
1265 $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1266 $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1267
1268 // presentation view
1269 if ($this->getViewPageLink() != "") {
1270 $this->tabs_gui->addNonTabbedLink(
1271 "pres_view",
1272 $this->getViewPageText(),
1273 $this->getViewPageLink(),
1274 $this->getViewPageTarget()
1275 );
1276 }
1277
1278 // show actions drop down
1279 $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1280
1281 // get js files for JS enabled editing
1282 if ($sel_js_mode == "enable") {
1283 $this->insertHelp($tpl);
1284 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1287 ilYuiUtil::initPanel(false);
1288 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1289 $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
1290
1291 include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1293 $this->lng->toJS("cont_error");
1294 $this->lng->toJS("cont_sel_el_cut_use_paste");
1295 $this->lng->toJS("cont_sel_el_copied_use_paste");
1296
1297 include_once './Services/Style/Content/classes/class.ilObjStyleSheet.php';
1298 $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
1299 preloader.src = './templates/default/images/loader.svg';
1300 ilCOPage.setUser('" . $this->user->getLogin() . "');
1301 ilCOPage.setContentCss('" .
1302 ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) .
1304 ", ./Services/COPage/css/tiny_extra.css" .
1305 "')");
1306 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
1307 foreach (ilPCParagraphGUI::_getTextCharacteristics($this->getStyleId()) as $c) {
1308 $GLOBALS["tpl"]->addOnloadCode("ilCOPage.addTextFormat('" . $c . "');");
1309 }
1310
1311 $GLOBALS["tpl"]->addJavascript("./libs/bower/bower_components/tinymce/tinymce.min.js");
1312 $tpl->touchBlock("init_dragging");
1313
1314 $cfg = $this->getPageConfig();
1315 $tpl->setVariable(
1316 "IL_TINY_MENU",
1317 self::getTinyMenu(
1318 $this->getPageObject()->getParentType(),
1319 $cfg->getEnableInternalLinks(),
1320 $cfg->getEnableWikiLinks(),
1321 $cfg->getEnableKeywords(),
1322 $this->getStyleId(),
1323 true,
1324 true,
1325 $cfg->getEnableAnchors(),
1326 true,
1327 $cfg->getEnableUserLinks()
1328 )
1329 );
1330
1331 // add int link parts
1332 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1333 $tpl->setCurrentBlock("int_link_prep");
1334 $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1335 $this->ctrl->getLinkTargetByClass(
1336 array("ilpageeditorgui", "ilinternallinkgui"),
1337 "",
1338 false,
1339 true,
1340 false
1341 )
1342 ));
1343 $tpl->parseCurrentBlock();
1344
1345 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1347 $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1348 }
1349
1350 // multiple actions
1351 $cnt_pcs = $this->getPageObject()->countPageContents();
1352 if ($cnt_pcs > 1 ||
1353 ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0)) {
1354 $tpl->setCurrentBlock("multi_actions");
1355 if ($sel_js_mode == "enable") {
1356 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1357 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1358 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1359 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1360 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1361 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1362 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1363 }
1364 $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1365 $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1366 $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1367 $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1368 $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1369 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1370 $tpl->parseCurrentBlock();
1371 }
1372 } else {
1373 // presentation or preview here
1374
1375 $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1376 if ($this->getEnabledPageFocus()) {
1377 $tpl->touchBlock("page_focus");
1378 }
1379
1380 include_once("./Services/User/classes/class.ilUserUtil.php");
1381
1382 // presentation
1383 if ($this->isPageContainerToBeRendered()) {
1384 $tpl->touchBlock("page_container_1");
1385 $tpl->touchBlock("page_container_2");
1386 $tpl->touchBlock("page_container_3");
1387 }
1388
1389 // history
1390 $c_old_nr = $this->getPageObject()->old_nr;
1391 if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
1392 $hist_info =
1393 $this->getPageObject()->getHistoryInfo($c_old_nr);
1394
1395 if (!$this->getCompareMode()) {
1396 $this->ctrl->setParameter($this, "history_mode", "1");
1397
1398 // previous revision
1399 if (is_array($hist_info["previous"])) {
1400 $tpl->setCurrentBlock("previous_rev");
1401 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1402 $this->ctrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1403 $tpl->setVariable(
1404 "HREF_PREV",
1405 $this->ctrl->getLinkTarget($this, "preview")
1406 );
1407 $tpl->parseCurrentBlock();
1408 } else {
1409 $tpl->setCurrentBlock("previous_rev_disabled");
1410 $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1411 $tpl->parseCurrentBlock();
1412 }
1413
1414 // next revision
1415 if ($c_old_nr > 0) {
1416 $tpl->setCurrentBlock("next_rev");
1417 $tpl->setVariable("TXT_NEXT_REV", $this->lng->txt("cont_next_rev"));
1418 $this->ctrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1419 $tpl->setVariable(
1420 "HREF_NEXT",
1421 $this->ctrl->getLinkTarget($this, "preview")
1422 );
1423 $tpl->parseCurrentBlock();
1424
1425 // latest revision
1426 $tpl->setCurrentBlock("latest_rev");
1427 $tpl->setVariable("TXT_LATEST_REV", $this->lng->txt("cont_latest_rev"));
1428 $this->ctrl->setParameter($this, "old_nr", "");
1429 $tpl->setVariable(
1430 "HREF_LATEST",
1431 $this->ctrl->getLinkTarget($this, "preview")
1432 );
1433 $tpl->parseCurrentBlock();
1434 }
1435
1436 $this->ctrl->setParameter($this, "history_mode", "");
1437
1438 // rollback
1439 if ($c_old_nr > 0 && $this->user->getId() != ANONYMOUS_USER_ID) {
1440 $tpl->setCurrentBlock("rollback");
1441 $this->ctrl->setParameter($this, "old_nr", $c_old_nr);
1442 $tpl->setVariable(
1443 "HREF_ROLLBACK",
1444 $this->ctrl->getLinkTarget($this, "rollbackConfirmation")
1445 );
1446 $this->ctrl->setParameter($this, "old_nr", "");
1447 $tpl->setVariable(
1448 "TXT_ROLLBACK",
1449 $this->lng->txt("cont_rollback")
1450 );
1451 $tpl->parseCurrentBlock();
1452 }
1453 }
1454
1455 $tpl->setCurrentBlock("hist_nav");
1456 $tpl->setVariable("TXT_REVISION", $this->lng->txt("cont_revision"));
1457 $tpl->setVariable(
1458 "VAL_REVISION_DATE",
1459 ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))
1460 );
1461 $tpl->setVariable(
1462 "VAL_REV_USER",
1463 ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])
1464 );
1465 $tpl->parseCurrentBlock();
1466 }
1467 }
1468 if ($this->getOutputMode() != IL_PAGE_PRESENTATION &&
1469 $this->getOutputMode() != IL_PAGE_OFFLINE &&
1470 $this->getOutputMode() != IL_PAGE_PREVIEW &&
1471 $this->getOutputMode() != IL_PAGE_PRINT) {
1472 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1473 }
1474
1475 // output media object edit list (of media links)
1476 if ($this->getOutputMode() == "edit") {
1478 $this->obj->getParentType() . ":pg",
1479 $this->obj->getId(),
1480 $this->obj->getLanguage()
1481 );
1482 $mob_links = array();
1483 foreach ($links as $link) {
1484 if ($link["type"] == "mob") {
1485 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
1486 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
1487 }
1488 }
1489 }
1490
1491 // linked media objects
1492 if (count($mob_links) > 0) {
1493 $tpl->setCurrentBlock("med_link");
1494 $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1495 $tpl->setVariable(
1496 "SEL_MED_LINKS",
1497 ilUtil::formSelect(0, "mob_id", $mob_links, false, true)
1498 );
1499 $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1500 $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1501 //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1502 $tpl->parseCurrentBlock();
1503 }
1504
1505 // content snippets used
1506 include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1508 $this->getPageObject(),
1509 $this->getPageObject()->getDomDoc()
1510 );
1511 if (count($snippets) > 0) {
1512 foreach ($snippets as $s) {
1513 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1514 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1515 }
1516 $tpl->setCurrentBlock("med_link");
1517 $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1518 $tpl->setVariable(
1519 "SEL_SNIPPETS",
1520 ilUtil::formSelect(0, "ci_id", $sn_arr, false, true)
1521 );
1522 $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1523 $tpl->parseCurrentBlock();
1524 }
1525
1526 // scheduled activation?
1527 if (!$this->getPageObject()->getActive() &&
1528 $this->getPageObject()->getActivationStart() != "" &&
1529 $this->getPageConfig()->getEnableScheduledActivation()) {
1530 $tpl->setCurrentBlock("activation_txt");
1531 $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $this->lng->txt("cont_scheduled_activation"));
1532 $tpl->setVariable(
1533 "SA_FROM",
1535 new ilDateTime(
1536 $this->getPageObject()->getActivationStart(),
1538 )
1539 )
1540 );
1541 $tpl->setVariable(
1542 "SA_TO",
1544 new ilDateTime(
1545 $this->getPageObject()->getActivationEnd(),
1547 )
1548 )
1549 );
1550 $tpl->parseCurrentBlock();
1551 }
1552 }
1553
1554 if ($_GET["reloadTree"] == "y") {
1555 $tpl->setCurrentBlock("reload_tree");
1556 $tpl->setVariable(
1557 "LINK_TREE",
1558 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false)
1559 );
1560 $tpl->parseCurrentBlock();
1561 }
1562 // }
1563 // get content
1564 $builded = $this->obj->buildDom();
1565
1566 // manage hierarchical ids
1567 if ($this->getOutputMode() == "edit") {
1568
1569 // add pc ids, if necessary
1570 if (!$this->obj->checkPCIds()) {
1571 $this->obj->insertPCIds();
1572 $this->obj->update(true, true);
1573 }
1574
1575 $this->obj->addFileSizes();
1576 $this->obj->addHierIDs();
1577
1578 $hids = $this->obj->getHierIds();
1579 $row1_ids = $this->obj->getFirstRowIds();
1580 $col1_ids = $this->obj->getFirstColumnIds();
1581 $litem_ids = $this->obj->getListItemIds();
1582 $fitem_ids = $this->obj->getFileItemIds();
1583
1584 // standard menues
1585 $hids = $this->obj->getHierIds();
1586 foreach ($hids as $hid) {
1587 $tpl->setCurrentBlock("add_dhtml");
1588 $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
1589 $tpl->parseCurrentBlock();
1590 }
1591
1592 // column menues for tables
1593 foreach ($col1_ids as $hid) {
1594 $tpl->setCurrentBlock("add_dhtml");
1595 $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
1596 $tpl->parseCurrentBlock();
1597 }
1598
1599 // row menues for tables
1600 foreach ($row1_ids as $hid) {
1601 $tpl->setCurrentBlock("add_dhtml");
1602 $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
1603 $tpl->parseCurrentBlock();
1604 }
1605
1606 // list item menues
1607 foreach ($litem_ids as $hid) {
1608 $tpl->setCurrentBlock("add_dhtml");
1609 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1610 $tpl->parseCurrentBlock();
1611 }
1612
1613 // file item menues
1614 foreach ($fitem_ids as $hid) {
1615 $tpl->setCurrentBlock("add_dhtml");
1616 $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1617 $tpl->parseCurrentBlock();
1618 }
1619 } else {
1620 $this->obj->addFileSizes();
1621 }
1622
1623 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; exit;
1624 //echo "<br>-".htmlentities($this->getLinkXML())."-"; exit;
1625
1626 // set default link xml, if nothing was set yet
1627 if (!$this->link_xml_set) {
1628 $this->setDefaultLinkXml();
1629 }
1630
1631 //$content = $this->obj->getXMLFromDom(false, true, true,
1632 // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1633 $link_xml = $this->getLinkXML();
1634 //echo "<br>-".htmlentities($link_xml)."-"; exit;
1635 // disable/enable auto margins
1636 if ($this->getStyleId() > 0) {
1637 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1638 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1639 $style = new ilObjStyleSheet($this->getStyleId());
1640 $template_xml = $style->getTemplateXML();
1641 $disable_auto_margins = "n";
1642 if ($style->lookupStyleSetting("disable_auto_margins")) {
1643 $disable_auto_margins = "y";
1644 }
1645 }
1646 }
1647
1648 if ($this->getAbstractOnly()) {
1649 $content = "<dummy><PageObject><PageContent><Paragraph>" .
1650 $this->obj->getFirstParagraphText() . $link_xml .
1651 "</Paragraph></PageContent></PageObject></dummy>";
1652 } else {
1653 $content = $this->obj->getXMLFromDom(
1654 false,
1655 true,
1656 true,
1657 $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML()
1658 );
1659 }
1660
1661 // check validation errors
1662 if ($builded !== true) {
1663 $this->displayValidationError($builded);
1664 } else {
1665 $this->displayValidationError($_SESSION["il_pg_error"]);
1666 }
1667 unset($_SESSION["il_pg_error"]);
1668
1669 // get title
1670 $pg_title = $this->getPresentationTitle();
1671
1672 if ($this->getOutputMode() == "edit") {
1673 $col_path = ilUtil::getImagePath("col.svg");
1674 $row_path = ilUtil::getImagePath("row.svg");
1675 $item_path = ilUtil::getImagePath("item.svg");
1676 $cell_path = ilUtil::getImagePath("cell.svg");
1677 }
1678
1679 if ($this->getOutputMode() != "offline") {
1680 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1681 $wb_path = ilUtil::getWebspaceDir("output") . "/";
1682 } else {
1683 $enlarge_path = "images/enlarge.svg";
1684 $wb_path = "";
1685 }
1686 $pg_title_class = ($this->getOutputMode() == "print")
1687 ? "ilc_PrintPageTitle"
1688 : "";
1689
1690 // page splitting only for learning modules and
1691 // digital books
1692 $enable_split_new = ($this->obj->getParentType() == "lm")
1693 ? "y"
1694 : "n";
1695
1696 // page splitting to next page only for learning modules and
1697 // digital books if next page exists in tree
1698 if (($this->obj->getParentType() == "lm") &&
1700 $this->obj->getParentId(),
1701 $this->obj->getId()
1702 )) {
1703 $enable_split_next = "y";
1704 } else {
1705 $enable_split_next = "n";
1706 }
1707
1708 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1709
1710
1711 if ($this->getPageConfig()->getEnablePCType("Tabs")) {
1712 //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1713 //ilYuiUtil::initTabView();
1714 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1717 }
1718
1719 $file_download_link = $this->determineFileDownloadLink();
1720 $fullscreen_link = $this->determineFullscreenLink();
1721 $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1722
1723 // default values for various parameters (should be used by
1724 // all instances in the future)
1725 $media_mode = ($this->getOutputMode() == "edit")
1726 ? $this->user->getPref("ilPageEditor_MediaMode")
1727 : "enable";
1728
1729 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1730 $paste = (ilEditClipboard::getAction() == "copy" &&
1731 $this->getOutputMode() == "edit");
1732
1733 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1734
1735 $flv_video_player = ($this->getOutputMode() != "offline")
1738
1739 $cfg = $this->getPageConfig();
1740
1741 $current_ts = time();
1742 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1743
1744 // added UTF-8 encoding otherwise umlaute are converted too
1745 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1746 $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"),
1747 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1748 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1749 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1750 'img_col' => $col_path,
1751 'img_row' => $row_path,
1752 'img_cell' => $cell_path,
1753 'img_item' => $item_path,
1754 'compare_mode' => $this->getCompareMode() ? "y" : "n",
1755 'enable_split_new' => $enable_split_new,
1756 'enable_split_next' => $enable_split_next,
1757 'link_params' => $this->link_params,
1758 'file_download_link' => $file_download_link,
1759 'fullscreen_link' => $fullscreen_link,
1760 'img_path' => $img_path,
1761 'parent_id' => $this->obj->getParentId(),
1762 'download_script' => $this->sourcecode_download_script,
1763 'encoded_download_script' => urlencode($this->sourcecode_download_script),
1764 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1765 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1766 'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1767 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1768 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1769 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1770 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1771 'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1772 'paste' => $paste ? "y" : "n",
1773 'media_mode' => $media_mode,
1774 'javascript' => $sel_js_mode,
1775 'paragraph_plugins' => $paragraph_plugin_string,
1776 'disable_auto_margins' => $disable_auto_margins,
1777 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1778 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1779 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1780 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1781 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1782 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1783 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1784 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1785 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1786 'current_ts' => $current_ts,
1787 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1788 'flv_video_player' => $flv_video_player,
1789 'page_perma_link' => $this->getPagePermaLink()
1790 );
1791 if ($this->link_frame != "") { // todo other link types
1792 $params["pg_frame"] = $this->link_frame;
1793 }
1794
1795 //$content = str_replace("&nbsp;", "", $content);
1796
1797 // this ensures that cache is emptied with every update
1798 $params["version"] = ILIAS_VERSION;
1799 // ensure no cache hit, if included files/media objects have been changed
1800 $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1801
1802
1803 // should be modularized
1804 include_once("./Services/COPage/classes/class.ilPCSection.php");
1806
1807 // run xslt
1808 $md5 = md5(serialize($params) . $link_xml . $template_xml . $md5_adds);
1809
1810 //$a = microtime();
1811
1812 // check cache (same parameters, non-edit mode and rendered time
1813 // > last change
1814 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1815 !$this->getCompareMode() &&
1816 !$this->getAbstractOnly() &&
1817 $md5 == $this->obj->getRenderMd5() &&
1818 ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1819 $this->obj->getRenderedTime() != "" &&
1820 $this->obj->old_nr == 0) {
1821 // cache hit
1822 $output = $this->obj->getRenderedContent();
1823 } else {
1824 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1825
1826 $this->log->debug("Calling XSLT, content: " . substr($content, 0, 100));
1827 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1828 $xh = xslt_create();
1829 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1830
1831 if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1832 && !$this->getAbstractOnly()
1833 && $this->obj->old_nr == 0) {
1834 $this->obj->writeRenderedContent($output, $md5);
1835 }
1836 xslt_free($xh);
1837 }
1838
1839 // unmask user html
1840 if (($this->getOutputMode() != "edit" ||
1841 $this->user->getPref("ilPageEditor_HTMLMode") != "disable")
1842 && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
1843 $output = str_replace("&lt;", "<", $output);
1844 $output = str_replace("&gt;", ">", $output);
1845 }
1846 $output = str_replace("&amp;", "&", $output);
1847
1848 include_once './Services/MathJax/classes/class.ilMathJax.php';
1849 $output = ilMathJax::getInstance()->insertLatexImages($output);
1850
1851 // insert page snippets
1852 //$output = $this->insertContentIncludes($output);
1853
1854 // insert resource blocks
1856
1857 // insert page toc
1858 if ($this->getPageConfig()->getEnablePageToc()) {
1859 $output = $this->insertPageToc($output);
1860 }
1861
1862 // insert advanced output trigger
1864
1865 // workaround for preventing template engine
1866 // from hiding paragraph text that is enclosed
1867 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1869
1870 // remove all newlines (important for code / pre output)
1871 $output = str_replace("\n", "", $output);
1872
1873 //echo htmlentities($output);
1875 //echo htmlentities($output);
1876 if ($this->getOutputMode() == "edit" &&
1877 !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
1878 $output = '<div class="il_editarea_disabled"><div class="ilCopgDisabledText">' . $this->getDisabledText() . '</div>' . $output . '</div>';
1879 }
1880
1881 // for all page components...
1882 include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1884 foreach ($defs as $def) {
1886 $pc_class = $def["pc_class"];
1887 $pc_obj = new $pc_class($this->getPageObject());
1888 $pc_obj->setSourcecodeDownloadScript($this->determineSourcecodeDownloadScript());
1889 $pc_obj->setFileDownloadLink($this->determineFileDownloadLink());
1890 $pc_obj->setFullscreenLink($this->determineFullscreenLink());
1891
1892 // post xsl page content modification by pc elements
1893 $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
1894
1895 // javascript files
1896 $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
1897 foreach ($js_files as $js) {
1898 $GLOBALS["tpl"]->addJavascript($js);
1899 }
1900
1901 // css files
1902 $css_files = $pc_obj->getCssFiles($this->getOutputMode());
1903 foreach ($css_files as $css) {
1904 $GLOBALS["tpl"]->addCss($css);
1905 }
1906
1907 // onload code
1908 $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
1909 foreach ($onload_code as $code) {
1910 $GLOBALS["tpl"]->addOnloadCode($code);
1911 }
1912 }
1913
1914 // $output = $this->selfAssessmentRendering($output);
1915
1916 // output
1917 if ($this->ctrl->isAsynch() && !$this->getRawPageContent() &&
1918 $this->getOutputMode() == "edit") {
1919 // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1920 if ($_GET["updated_pc_id_str"] != "") {
1921 echo $_GET["updated_pc_id_str"];
1922 }
1923 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1924 $tpl->setCurrentBlock("edit_page");
1925 $tpl->parseCurrentBlock();
1926 echo $tpl->get("edit_page");
1927 exit;
1928 }
1929 if ($this->outputToTemplate()) {
1930 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1931 $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1932 return $output;
1933 } else {
1934 if ($this->getRawPageContent()) { // e.g. needed in glossaries
1935 return $output;
1936 } else {
1937 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1938 return $tpl->get();
1939 }
1940 }
1941 }
1942
1950 {
1951 //echo "<br><br>".htmlentities($output);
1952
1953 while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1954 is_int($end = strpos($output, "<!--ParEnd-->", $start))) {
1955 $output = substr($output, 0, $start) .
1956 str_replace(
1957 array("{","}"),
1958 array("&#123;","&#125;"),
1959 substr($output, $start + 15, $end - ($start + 15))
1960 ) .
1961 substr($output, $end + 13);
1962 }
1963
1964 // $output = str_replace("{", "&#123;", $output);
1965 // $output = str_replace("}", "&#125;", $output);
1966 //echo "<br><br>".htmlentities($output);
1967 return $output;
1968 }
1969
1973 protected function getActivationCaptions()
1974 {
1975 return array("deactivatePage" => $this->lng->txt("cont_deactivate_page"),
1976 "activatePage" => $this->lng->txt("cont_activate_page"));
1977 }
1978
1982 public function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
1983 {
1984 global $DIC;
1985
1986 $ui = $DIC->ui();
1987
1988 // actions
1989 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1990
1991 // activate/deactivate
1993 $list->setListTitle($this->lng->txt("actions"));
1994 $list->setId("copage_act");
1995 $entries = false;
1996 if ($this->getPageConfig()->getEnableActivation()) {
1997 $entries = true;
1998 $captions = $this->getActivationCaptions();
1999
2000 if ($this->getPageObject()->getActive()) {
2001 $list->addItem(
2002 $captions["deactivatePage"],
2003 "",
2004 $this->ctrl->getLinkTarget($this, "deactivatePage")
2005 );
2006 } else {
2007 $list->addItem(
2008 $captions["activatePage"],
2009 "",
2010 $this->ctrl->getLinkTarget($this, "activatePage")
2011 );
2012 }
2013
2014 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2015 }
2016
2017 // initially opened content
2018 if ($this->getPageConfig()->getUseAttachedContent()) {
2019 $entries = true;
2020 $list->addItem(
2021 $this->lng->txt("cont_initial_attached_content"),
2022 "",
2023 $this->ctrl->getLinkTarget($this, "initialOpenedContent")
2024 );
2025 }
2026
2027 // multi-lang actions
2028 if ($this->addMultiLangActionsAndInfo($list, $a_tpl)) {
2029 $entries = true;
2030 }
2031
2032 if ($entries) {
2033 $items = $list->getItems();
2034 if (count($items) > 1) {
2035 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2036 } elseif (count($items) == 1) {
2037 $b = $ui->factory()->button()->standard($items[0]["title"], $items[0]["link"]);
2038 $a_tpl->setVariable("PAGE_ACTIONS", $ui->renderer()->render($b));
2039 }
2040 }
2041
2042 $this->lng->loadLanguageModule("content");
2044 $list->setListTitle($this->lng->txt("cont_edit_mode"));
2045 $list->setId("copage_ed_mode");
2046
2047 // media mode
2048 if ($sel_media_mode == "enable") {
2049 $this->ctrl->setParameter($this, "media_mode", "disable");
2050 $list->addItem(
2051 $this->lng->txt("cont_deactivate_media"),
2052 "",
2053 $this->ctrl->getLinkTarget($this, "setEditMode")
2054 );
2055 } else {
2056 $this->ctrl->setParameter($this, "media_mode", "enable");
2057 $list->addItem(
2058 $this->lng->txt("cont_activate_media"),
2059 "",
2060 $this->ctrl->getLinkTarget($this, "setEditMode")
2061 );
2062 }
2063 $this->ctrl->setParameter($this, "media_mode", "");
2064
2065 // html mode
2066 if (!$this->getPageConfig()->getPreventHTMLUnmasking()) {
2067 if ($sel_html_mode == "enable") {
2068 $this->ctrl->setParameter($this, "html_mode", "disable");
2069 $list->addItem(
2070 $this->lng->txt("cont_deactivate_html"),
2071 "",
2072 $this->ctrl->getLinkTarget($this, "setEditMode")
2073 );
2074 } else {
2075 $this->ctrl->setParameter($this, "html_mode", "enable");
2076 $list->addItem(
2077 $this->lng->txt("cont_activate_html"),
2078 "",
2079 $this->ctrl->getLinkTarget($this, "setEditMode")
2080 );
2081 }
2082 }
2083 $this->ctrl->setParameter($this, "html_mode", "");
2084
2085 // js mode
2086 if ($sel_js_mode == "enable") {
2087 $this->ctrl->setParameter($this, "js_mode", "disable");
2088 $list->addItem(
2089 $this->lng->txt("cont_deactivate_js"),
2090 "",
2091 $this->ctrl->getLinkTarget($this, "setEditMode")
2092 );
2093 } else {
2094 $this->ctrl->setParameter($this, "js_mode", "enable");
2095 $list->addItem(
2096 $this->lng->txt("cont_activate_js"),
2097 "",
2098 $this->ctrl->getLinkTarget($this, "setEditMode")
2099 );
2100 }
2101 $this->ctrl->setParameter($this, "js_mode", "");
2102
2103 $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2104 }
2105
2112 public function addMultiLangActionsAndInfo($a_list, $a_tpl)
2113 {
2114 $any_items = false;
2115
2116 $cfg = $this->getPageConfig();
2117
2118 // general multi lang support and single page mode?
2119 if ($cfg->getMultiLangSupport()) {
2120 //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
2121 //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
2122 // $this->getPageObject()->getParentId());
2123
2124 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2125 $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
2126
2127 if (!$ot->getContentActivated()) {
2128 /* if ($cfg->getSinglePageMode())
2129 {
2130 $a_list->addItem($this->lng->txt("cont_activate_multi_lang"), "",
2131 $this->ctrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
2132
2133 $any_items = true;
2134 }*/
2135 } else {
2136 $this->lng->loadLanguageModule("meta");
2137 //echo $this->getPageObject()->getLanguage();
2138 if ($this->getPageObject()->getLanguage() != "-") {
2139 $l = $ot->getMasterLanguage();
2140 $a_list->addItem(
2141 $this->lng->txt("cont_edit_language_version") . ": " .
2142 $this->lng->txt("meta_l_" . $l),
2143 "",
2144 $this->ctrl->getLinkTarget($this, "editMasterLanguage")
2145 );
2146 }
2147
2148 foreach ($ot->getLanguages() as $al => $lang) {
2149 if ($this->getPageObject()->getLanguage() != $al &&
2150 $al != $ot->getMasterLanguage()) {
2151 $this->ctrl->setParameter($this, "totransl", $al);
2152 $a_list->addItem(
2153 $this->lng->txt("cont_edit_language_version") . ": " .
2154 $this->lng->txt("meta_l_" . $al),
2155 "",
2156 $this->ctrl->getLinkTarget($this, "switchToLanguage")
2157 );
2158 $this->ctrl->setParameter($this, "totransl", $_GET["totransl"]);
2159 }
2160 }
2161
2162 /* if ($cfg->getSinglePageMode())
2163 {
2164 $a_list->addItem($this->lng->txt("cont_manage_multilang"), "",
2165 $this->ctrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
2166 }*/
2167
2168 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
2169 $ml_gui = new ilPageMultiLangGUI(
2170 $this->getPageObject()->getParentType(),
2171 $this->getPageObject()->getParentId()
2172 );
2173 $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
2174
2175 $any_items = true;
2176 }
2177 }
2178
2179 return $any_items;
2180 }
2181
2182
2186 public function setEditMode()
2187 {
2188 if ($_GET["media_mode"] != "") {
2189 if ($_GET["media_mode"] == "disable") {
2190 $this->user->writePref("ilPageEditor_MediaMode", "disable");
2191 } else {
2192 $this->user->writePref("ilPageEditor_MediaMode", "");
2193 }
2194 }
2195 if ($_GET["html_mode"] != "") {
2196 if ($_GET["html_mode"] == "disable") {
2197 $this->user->writePref("ilPageEditor_HTMLMode", "disable");
2198 } else {
2199 $this->user->writePref("ilPageEditor_HTMLMode", "");
2200 }
2201 }
2202 if ($_GET["js_mode"] != "") {
2203 if ($_GET["js_mode"] == "disable") {
2204 $this->user->writePref("ilPageEditor_JavaScript", "disable");
2205 } else {
2206 $this->user->writePref("ilPageEditor_JavaScript", "");
2207 }
2208 }
2209
2210 $this->ctrl->redirect($this, "edit");
2211 }
2212
2213
2217 public static function getTinyMenu(
2218 $a_par_type,
2219 $a_int_links = false,
2220 $a_wiki_links = false,
2221 $a_keywords = false,
2222 $a_style_id = 0,
2223 $a_paragraph_styles = true,
2224 $a_save_return = true,
2225 $a_anchors = false,
2226 $a_save_new = true,
2227 $a_user_links = false
2228 ) {
2229 global $DIC;
2230
2231 $lng = $DIC->language();
2232 $ctrl = $DIC->ctrl();
2233
2234 $mathJaxSetting = new ilSetting("MathJax");
2235
2236 include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2237
2238 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2239
2240 $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2241
2242 // debug ghost element
2243 if (DEVMODE == 1) {
2244 $btpl->touchBlock("debug_ghost");
2245 }
2246
2247 // bullet list
2248 $btpl->touchBlock("blist_button");
2250 "il_edm_blist",
2251 $lng->txt("cont_blist"),
2252 "iltinymenu_bd"
2253 );
2254
2255 // numbered list
2256 $btpl->touchBlock("nlist_button");
2258 "il_edm_nlist",
2259 $lng->txt("cont_nlist"),
2260 "iltinymenu_bd"
2261 );
2262
2263 // list indent
2264 $btpl->touchBlock("list_indent");
2266 "ilIndentBut",
2267 $lng->txt("cont_list_indent"),
2268 "iltinymenu_bd"
2269 );
2270
2271 // list outdent
2272 $btpl->touchBlock("list_outdent");
2274 "ilOutdentBut",
2275 $lng->txt("cont_list_outdent"),
2276 "iltinymenu_bd"
2277 );
2278
2279 if ($a_int_links) {
2280 $btpl->touchBlock("bb_ilink_button");
2282 "iosEditInternalLinkTrigger",
2283 $lng->txt("cont_link_to_internal"),
2284 "iltinymenu_bd"
2285 );
2286 }
2288 "il_edm_xlink",
2289 $lng->txt("cont_link_to_external"),
2290 "iltinymenu_bd"
2291 );
2292
2293 if ($a_user_links) {
2294 $btpl->touchBlock("bb_ulink_button");
2295 }
2296
2297 // remove format
2298 $btpl->touchBlock("rformat_button");
2300 "il_edm_rformat",
2301 $lng->txt("cont_remove_format"),
2302 "iltinymenu_bd"
2303 );
2304
2305 if ($a_paragraph_styles) {
2306 // new paragraph
2307 $btpl->setCurrentBlock("new_par");
2308 $btpl->setVariable("IMG_NEWPAR", "+");
2309 $btpl->parseCurrentBlock();
2311 "il_edm_newpar",
2312 $lng->txt("cont_insert_new_paragraph"),
2313 "iltinymenu_bd"
2314 );
2315
2316 $btpl->setCurrentBlock("par_edit");
2317 $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2318 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2319 $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector(
2320 $a_selected,
2322 true
2323 ));
2324
2326 "ilAdvSelListAnchorText_style_selection",
2327 $lng->txt("cont_paragraph_styles"),
2328 "iltinymenu_bd"
2329 );
2330
2331 $btpl->parseCurrentBlock();
2332 }
2333
2334 if ($a_keywords) {
2335 $btpl->setCurrentBlock("bb_kw_button");
2336 $btpl->setVariable("CC_KW", "kw");
2337 $btpl->parseCurrentBlock();
2339 "il_edm_kw",
2340 $lng->txt("cont_text_keyword"),
2341 "iltinymenu_bd"
2342 );
2343 }
2344
2345 if ($a_wiki_links) {
2346 $btpl->setCurrentBlock("bb_wikilink_button2");
2347 $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
2348 $btpl->setVariable("WIKI_BUTTON2_URL", $ctrl->getLinkTargetByClass("ilwikipagegui", ""));
2349 $btpl->parseCurrentBlock();
2351 "il_edm_wlinkd",
2352 $lng->txt("cont_wiki_link_dialog"),
2353 "iltinymenu_bd"
2354 );
2355
2356 $btpl->setCurrentBlock("bb_wikilink_button");
2357 $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2358 $btpl->parseCurrentBlock();
2360 "il_edm_wlink",
2361 $lng->txt("cont_link_to_wiki"),
2362 "iltinymenu_bd"
2363 );
2364 }
2365
2366 $aset = new ilSetting("adve");
2367
2368 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2369 foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st) {
2370 // these are handled via drop down now...
2371 if (in_array($c, array("com", "quot", "acc", "code"))) {
2372 continue;
2373 }
2375 $a_par_type,
2376 "active_" . $c,
2377 true
2378 )) {
2379 $cc_code = $c;
2380 if ($aset->get("use_physical")) {
2381 $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2382 }
2383
2384 if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
2385 $btpl->setCurrentBlock("bb_" . $c . "_button");
2386 $btpl->setVariable("CC_" . strtoupper($c), $cc_code);
2387 $btpl->parseCurrentBlock();
2389 "il_edm_cc_" . $c,
2390 $lng->txt("cont_cc_" . $c),
2391 "iltinymenu_bd"
2392 );
2393
2394 // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2395 }
2396 }
2397 }
2398
2399 if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
2401 "il_edm_tex",
2402 $lng->txt("cont_tex"),
2403 "iltinymenu_bd"
2404 );
2405 }
2407 "il_edm_fn",
2408 $lng->txt("cont_fn"),
2409 "iltinymenu_bd"
2410 );
2411
2412 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2413 $sdd = new ilAdvancedSelectionListGUI();
2414 $sdd->setPullRight(false);
2415 $sdd->setListTitle($lng->txt("save") . "...");
2416
2417 if ($a_save_return) {
2418 $btpl->setCurrentBlock("save_return");
2419 $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2420 $btpl->parseCurrentBlock();
2421 $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;");
2422 }
2423
2424 if ($a_save_new) {
2425 $btpl->setCurrentBlock("save_new");
2426 $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
2427 $btpl->parseCurrentBlock();
2428 $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;");
2429 }
2430
2431 $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;");
2432 $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;");
2433
2434 if ($a_anchors) {
2435 $btpl->setCurrentBlock("bb_anc_button");
2436 $btpl->setVariable("CC_ANC", "anc");
2437 $btpl->parseCurrentBlock();
2439 "il_edm_anc",
2440 $lng->txt("cont_anchor"),
2441 "iltinymenu_bd"
2442 );
2443 }
2444
2445 $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML());
2446
2447 /* // footnote
2448 $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2449 $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2450 $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2451 */
2452 // $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2453
2454 $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2455 $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2456
2457 $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2458 $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2459 $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2460 $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2461 $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2462
2463 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2464
2465 $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type, true, $a_style_id));
2467 "ilAdvSelListAnchorElement_char_style_selection",
2468 $lng->txt("cont_more_character_styles"),
2469 "iltinymenu_bd"
2470 );
2471
2472 return $btpl->get();
2473 }
2474
2478 public function setDefaultLinkXml()
2479 {
2480 $int_links = $this->getPageObject()->getInternalLinks();
2481 //var_dump($int_links);
2482 $link_info = "<IntLinkInfos>";
2483 $targetframe = "None";
2484 foreach ($int_links as $int_link) {
2485 $target = $int_link["Target"];
2486 if (substr($target, 0, 4) == "il__") {
2487 $target_arr = explode("_", $target);
2488 $target_id = $target_arr[count($target_arr) - 1];
2489 $type = $int_link["Type"];
2490
2491 $targetframe = ($int_link["TargetFrame"] != "")
2492 ? $int_link["TargetFrame"]
2493 : "None";
2494
2495 $ltarget="_top";
2496 if ($targetframe != "None") {
2497 $ltarget="_blank";
2498 }
2499
2500 // anchor
2501 $anc = $anc_add = "";
2502 if ($int_link["Anchor"] != "") {
2503 $anc = $int_link["Anchor"];
2504 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
2505 }
2506
2507 $href = "";
2508 $lcontent = "";
2509 switch ($type) {
2510 case "PageObject":
2511 case "StructureObject":
2513 if ($type == "PageObject") {
2514 $href = "./goto.php?target=pg_" . $target_id . $anc_add;
2515 } else {
2516 $href = "./goto.php?target=st_" . $target_id;
2517 }
2518 if ($lm_id == "") {
2519 $href = "";
2520 }
2521 break;
2522
2523 case "GlossaryItem":
2524 if ($targetframe == "None") {
2525 $targetframe = "Glossary";
2526 }
2527 $href = "./goto.php?target=git_" . $target_id;
2528 break;
2529
2530 case "MediaObject":
2531 $this->ctrl->setParameter($this, "mob_id", $target_id);
2532 //$this->ctrl->setParameter($this, "pg_id", $this->obj->getId());
2533 $href = $this->ctrl->getLinkTarget($this, "displayMedia");
2534 $this->ctrl->setParameter($this, "mob_id", "");
2535 break;
2536
2537 case "WikiPage":
2538 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
2540 break;
2541
2542 case "PortfolioPage":
2543 include_once("./Modules/Portfolio/classes/class.ilPortfolioPage.php");
2545 break;
2546
2547 case "RepositoryItem":
2548 $obj_type = ilObject::_lookupType($target_id, true);
2550 $href = "./goto.php?target=" . $obj_type . "_" . $target_id;
2551 break;
2552
2553 case "User":
2554 $obj_type = ilObject::_lookupType($target_id);
2555 if ($obj_type == "usr") {
2556 include_once("./Services/User/classes/class.ilUserUtil.php");
2557 $back = $this->getProfileBackUrl();
2558 //var_dump($back); exit;
2559 $this->ctrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $target_id);
2560 $this->ctrl->setParameterByClass(
2561 "ilpublicuserprofilegui",
2562 "back_url",
2563 rawurlencode($back)
2564 );
2565 $href = "";
2566 include_once("./Services/User/classes/class.ilUserUtil.php");
2568 $href = $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML");
2569 }
2570 $this->ctrl->setParameterByClass("ilpublicuserprofilegui", "user_id", "");
2571 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
2572 $lcontent = str_replace("&", "&amp;" ,htmlentities($lcontent));
2573 }
2574 break;
2575
2576 }
2577 if ($href != "") {
2578 $anc_par = 'Anchor="' . $anc . '"';
2579 $link_info .= "<IntLinkInfo Target=\"$target\" Type=\"$type\" " . $anc_par . " " .
2580 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" />";
2581 }
2582 }
2583 }
2584 $link_info.= "</IntLinkInfos>";
2585 $this->setLinkXML($link_info);
2586 }
2587
2591 public function getProfileBackUrl()
2592 {
2593 return $this->ctrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
2594 }
2595
2596
2600 public function downloadFile()
2601 {
2602 $download_ok = false;
2603
2604 require_once("./Modules/File/classes/class.ilObjFile.php");
2605 $pg_obj = $this->getPageObject();
2606 $pg_obj->buildDom();
2607 $int_links = $pg_obj->getInternalLinks();
2608 foreach ($int_links as $il) {
2609 if ($il["Target"] == str_replace("_file_", "_dfile_", $_GET["file_id"])) {
2610 $file = explode("_", $_GET["file_id"]);
2611 $file_id = (int) $file[count($file) - 1];
2612 $download_ok = true;
2613 }
2614 }
2615 if (in_array($_GET["file_id"], $pg_obj->getAllFileObjIds())) {
2616 $file = explode("_", $_GET["file_id"]);
2617 $file_id = (int) $file[count($file) - 1];
2618 $download_ok = true;
2619 }
2620
2621 $pcs = ilPageContentUsage::getUsagesOfPage($pg_obj->getId(), $pg_obj->getParentType().":pg", 0, false);
2622 foreach ($pcs as $pc) {
2623 $files = ilObjFile::_getFilesOfObject("mep:pg", $pc["id"], 0);
2624 $file = explode("_", $_GET["file_id"]);
2625 $file_id = (int) $file[count($file) - 1];
2626 if (in_array($file_id, $files)) {
2627 $download_ok = true;
2628 }
2629 }
2630
2631 if ($download_ok) {
2632 $fileObj = new ilObjFile($file_id, false);
2633 $fileObj->sendFile();
2634 exit;
2635 }
2636 }
2637
2641 public function displayMediaFullscreen()
2642 {
2643 $this->displayMedia(true);
2644 }
2645
2649 public function displayMedia($a_fullscreen = false)
2650 {
2651 $tpl = $this->tpl;
2652
2653 $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2654 $tpl->setCurrentBlock("ilMedia");
2655
2656 //$int_links = $page_object->getInternalLinks();
2657 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2658
2659 // @todo
2660 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2661
2662 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2663 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2664 require_once("./Services/COPage/classes/class.ilPageObject.php");
2665 $pg_obj = $this->getPageObject();
2666 $pg_obj->buildDom();
2667
2668 if (!empty($_GET["pg_id"])) {
2669 $xml = "<dummy>";
2670 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2671 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2672 $xml.= $link_xml;
2673 $xml.="</dummy>";
2674 } else {
2675 $xml = "<dummy>";
2676 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2677 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2678 $xml.= $link_xml;
2679 $xml.="</dummy>";
2680 }
2681
2682 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2683 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2684 $xh = xslt_create();
2685
2686 $mode = "media";
2687 if ($a_fullscreen) {
2688 $mode = "fullscreen";
2689 }
2690
2691 //echo "<b>XML:</b>".htmlentities($xml);
2692 // determine target frames for internal links
2693 $wb_path = ilUtil::getWebspaceDir("output") . "/";
2694 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2695 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
2696 'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
2697 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2698 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2699 //echo "<br><br>".htmlentities($output);
2700 //echo xslt_error($xh);
2701 xslt_free($xh);
2702
2703 // unmask user html
2704 require_once('./Services/Style/Content/classes/class.ilObjStyleSheet.php');
2705 $tpl->setVariable(
2706 "LOCATION_CONTENT_STYLESHEET",
2708 );
2709 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2710 $tpl->setVariable("MEDIA_CONTENT", $output);
2711
2712 // add js
2713 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2715 $tpl->fillJavaScriptFiles();
2716 $tpl->fillCssFiles();
2717
2718 echo $tpl->get();
2719 exit;
2720 }
2721
2725 public function download_paragraph()
2726 {
2727 $pg_obj = $this->getPageObject();
2728 $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2729 }
2730
2737 public function insertPageToc($a_output)
2738 {
2739 include_once("./Services/Utilities/classes/class.ilStr.php");
2740
2741 // extract all headings
2742 $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2743 $page_heads = array();
2744 foreach ($offsets as $os) {
2745 $level = (int) substr($a_output, $os + 10, 1);
2746 if (in_array($level, array(1,2,3))) {
2747 $anchor = str_replace(
2748 "TocH",
2749 "TocA",
2750 substr($a_output, $os, strpos($a_output, "<", $os) - $os - 4)
2751 );
2752
2753 // get heading
2754 $tag_start = stripos($a_output, "<h" . $level . " ", $os);
2755 $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
2756 $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2757
2758 // get headings text
2759 $text_start = stripos($head, ">") + 1;
2760 $text_end = strripos($head, "<!--", $text_start);
2761 $text = substr($head, $text_start, $text_end - $text_start);
2762 $page_heads[] = array("level" => $level, "text" => $text,
2763 "anchor" => $anchor);
2764 }
2765 }
2766
2767 if (count($page_heads) > 1) {
2768 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2769 $list = new ilNestedList();
2770 $list->setAutoNumbering(true);
2771 $list->setListClass("ilc_page_toc_PageTOCList");
2772 $list->setItemClass("ilc_page_toc_PageTOCItem");
2773 $i = 0;
2774 $c_depth = 1;
2775 $c_par[1] = 0;
2776 $c_par[2] = 0;
2777 $nr[1] = 1;
2778 $nr[2] = 1;
2779 $nr[3] = 1;
2780 foreach ($page_heads as $ind => $h) {
2781 $i++;
2782 $par = 0;
2783
2784 // check if we have a parent for one level up
2785 $par = 0;
2786 if ($h["level"] == 2 && $c_par[1] > 0) {
2787 $par = $c_par[1];
2788 }
2789 if ($h["level"] == 3 && $c_par[2] > 0) {
2790 $par = $c_par[2];
2791 }
2792
2793 $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2794
2795 // add the list node
2796 $list->addListNode(
2797 "<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>",
2798 $i,
2799 $par
2800 );
2801
2802 // set the node as current parent of the level
2803 if ($h["level"] == 1) {
2804 $c_par[1] = $i;
2805 $c_par[2] = 0;
2806 }
2807 if ($h["level"] == 2) {
2808 $c_par[2] = $i;
2809 }
2810 }
2811
2812 $tpl = new ilTemplate(
2813 "tpl.page_toc.html",
2814 true,
2815 true,
2816 "Services/COPage"
2817 );
2818 $tpl->setVariable("PAGE_TOC", $list->getHTML());
2819 $tpl->setVariable("TXT_PAGE_TOC", $this->lng->txt("cont_page_toc"));
2820 $tpl->setVariable("TXT_HIDE", $this->lng->txt("hide"));
2821 $tpl->setVariable("TXT_SHOW", $this->lng->txt("show"));
2822
2823 $a_output = str_replace(
2824 "{{{{{PageTOC}}}}}",
2825 $tpl->get(),
2826 $a_output
2827 );
2828 $numbers = $list->getNumbers();
2829
2830 if (count($numbers) > 0) {
2831 include_once("./Services/Utilities/classes/class.ilStr.php");
2832 foreach ($numbers as $n) {
2833 $a_output =
2834 ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n . " ", $a_output);
2835 }
2836 }
2837 } else {
2838 $a_output = str_replace(
2839 "{{{{{PageTOC}}}}}",
2840 "",
2841 $a_output
2842 );
2843 }
2844
2845 return $a_output;
2846 }
2847
2854 public function insertResources($a_output)
2855 {
2856 // this is edit mode only
2857
2858 if ($this->getEnablePCType("Resources") &&
2859 ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview")) {
2860 include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2861 $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2862 }
2863 return $a_output;
2864 }
2865
2866
2867
2874 public function insertAdvTrigger($a_output)
2875 {
2876 if (!$this->getAbstractOnly()) {
2877 $a_output = str_replace(
2878 "{{{{{LV_show_adv}}}}}",
2879 $this->lng->txt("cont_show_adv"),
2880 $a_output
2881 );
2882 $a_output = str_replace(
2883 "{{{{{LV_hide_adv}}}}}",
2884 $this->lng->txt("cont_hide_adv"),
2885 $a_output
2886 );
2887 } else {
2888 $a_output = str_replace(
2889 "{{{{{LV_show_adv}}}}}",
2890 "",
2891 $a_output
2892 );
2893 $a_output = str_replace(
2894 "{{{{{LV_hide_adv}}}}}",
2895 "",
2896 $a_output
2897 );
2898 }
2899
2900 return $a_output;
2901 }
2902
2903
2908 public function postOutputProcessing($a_output)
2909 {
2910 return $a_output;
2911 }
2912
2916 public function insertHelp($a_tpl)
2917 {
2918 $a_tpl->setCurrentBlock("help");
2919 $a_tpl->setVariable("TXT_ADD_EL", $this->lng->txt("cont_add_elements"));
2920 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
2921 $a_tpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD));
2922 $a_tpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG));
2923 $a_tpl->setVariable("TXT_DRAG", $this->lng->txt("cont_drag_and_drop_elements"));
2924 $a_tpl->setVariable("TXT_SEL", $this->lng->txt("cont_double_click_to_delete"));
2925 $a_tpl->parseCurrentBlock();
2926 }
2927
2931 public function previewHistory()
2932 {
2933 $this->preview();
2934 }
2935
2939 public function preview()
2940 {
2942 return $this->showPage();
2943 }
2944
2948 public function edit()
2949 {
2950 // editing allowed?
2951 if (!$this->getEnableEditing()) {
2952 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
2953 $this->ctrl->redirect($this, "preview");
2954 }
2955
2956 // not so nive workaround for container pages, bug #0015831
2957 $ptype = $this->getParentType();
2958 if ($ptype == "cont" && $_GET["ref_id"] > 0) {
2959 $ptype = ilObject::_lookupType((int) $_GET["ref_id"], true);
2960 }
2961 $this->help->setScreenId("edit_" . $ptype);
2962
2963 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2964 if (
2965 $this->user->isAnonymous() &&
2966 !$this->user->isCaptchaVerified() &&
2967 ilCaptchaUtil::isActiveForWiki()
2968 ) {
2969 $form = $this->initCaptchaForm();
2970 if ($_POST['captcha_code'] && $form->checkInput()) {
2971 $this->user->setCaptchaVerified(true);
2972 } else {
2973 return $form->getHTML();
2974 }
2975 }
2976
2977 // edit lock
2978 if (!$this->getPageObject()->getEditLock()) {
2979 include_once("./Services/User/classes/class.ilUserUtil.php");
2980 $info = $this->lng->txt("content_no_edit_lock");
2981 $lock = $this->getPageObject()->getEditLockInfo();
2982 $info .= "</br>" . $this->lng->txt("content_until") . ": " .
2983 ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2984 $info .= "</br>" . $this->lng->txt("obj_usr") . ": " .
2985 ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2986 if (!$this->ctrl->isAsynch()) {
2988 return "";
2989 } else {
2990 echo $this->tpl->getMessageHTML($info);
2991 exit;
2992 }
2993 } else {
2994 if ($this->getPageObject()->getEffectiveEditLockTime() > 0) {
2995 include_once("./Services/User/classes/class.ilUserUtil.php");
2996 $lock = $this->getPageObject()->getEditLockInfo();
2997 $info = $this->lng->txt("cont_got_lock_until");
2998 $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)), $info);
2999 //$info.= "</br>".$this->lng->txt("content_until").": ".
3000 // ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX));
3001 //$info.= "</br>".$this->lng->txt("obj_usr").": ".
3002 // ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
3003 include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
3005 $but->setCaption("cont_finish_editing");
3006 $but->setUrl($this->ctrl->getLinkTarget($this, "releasePageLock"));
3007 $info = str_replace("%2", $but->render(), $info);
3009 }
3010 }
3011
3013
3014 $html = $this->showPage();
3015
3016 if ($this->isEnabledNotes()) {
3017 $html.= "<br /><br />" . $this->getNotesHTML();
3018 }
3019
3020 return $html;
3021 }
3022
3029 public function insertJSAtPlaceholder()
3030 {
3031 $tpl = $this->tpl;
3032
3033 if ($_GET["pl_hier_id"] == "") {
3034 $this->obj->buildDom();
3035 $this->obj->addHierIDs();
3036 $hid = $this->obj->getHierIdsForPCIds(array($_GET["pl_pc_id"]));
3037 $_GET["pl_hier_id"] = $hid[$_GET["pl_pc_id"]];
3038 }
3039
3040 // 'pl_hier_id' => string '2_1_1_1' (length=7)
3041 // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
3042 $html = $this->edit();
3043
3044 $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('" .
3045 $_GET["pl_hier_id"] . ":" . $_GET["pl_pc_id"] .
3046 "');", 3);
3047
3048 return $html;
3049 }
3050
3054 public function initCaptchaForm()
3055 {
3056 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3057 $form = new ilPropertyFormGUI();
3058
3059 require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3060 $ci = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
3061 $ci->setRequired(true);
3062 $form->addItem($ci);
3063
3064 $form->addCommandButton('edit', $this->lng->txt('ok'));
3065
3066 $form->setTitle($this->lng->txt('cont_captcha_verification'));
3067 $form->setFormAction($this->ctrl->getFormAction($this));
3068
3069 return $form;
3070 }
3071
3072 /*
3073 * presentation
3074 */
3075 public function presentation($a_mode = IL_PAGE_PRESENTATION)
3076 {
3077 $this->setOutputMode($a_mode);
3078
3079 return $this->showPage();
3080 }
3081
3082 public function getHTML()
3083 {
3084 $this->getTabs("preview");
3085 return $this->showPage();
3086 }
3087
3091 public function showMediaFullscreen($a_style_id = 0)
3092 {
3093 $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3094 $this->tpl->setCurrentBlock("ContentStyle");
3095 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3096 $this->tpl->parseCurrentBlock();
3097
3098 $this->tpl->setVariable("PAGETITLE", " - " . ilObject::_lookupTitle($_GET["mob_id"]));
3099 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3100 $this->tpl->setCurrentBlock("ilMedia");
3101
3102 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3103 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
3104 if (!empty($_GET["pg_id"])) {
3105 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3106 $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
3107 $pg_obj->buildDom();
3108
3109 $xml = "<dummy>";
3110 // todo: we get always the first alias now (problem if mob is used multiple
3111 // times in page)
3112 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3113 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3114 $xml.="</dummy>";
3115 } else {
3116 $xml = "<dummy>";
3117 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
3118 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3119 $xml.="</dummy>";
3120 }
3121
3122 //echo htmlentities($xml); exit;
3123
3124 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3125 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3126 $xh = xslt_create();
3127
3128 //echo "<b>XML:</b>".htmlentities($xml);
3129 // determine target frames for internal links
3130 //$pg_frame = $_GET["frame"];
3131 $wb_path = ilUtil::getWebspaceDir("output") . "/";
3132 $mode = "fullscreen";
3133 $params = array('mode' => $mode, 'webspace_path' => $wb_path);
3134 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
3135 echo xslt_error($xh);
3136 xslt_free($xh);
3137
3138 // unmask user html
3139 $this->tpl->setVariable("MEDIA_CONTENT", $output);
3140 }
3141
3147 public function displayValidationError($a_error)
3148 {
3149 if (is_array($a_error)) {
3150 $error_str = "<b>Error(s):</b><br>";
3151 foreach ($a_error as $error) {
3152 $err_mess = implode($error, " - ");
3153 if (!is_int(strpos($err_mess, ":0:"))) {
3154 $error_str .= htmlentities($err_mess) . "<br />";
3155 }
3156 }
3157 $this->tpl->setVariable("MESSAGE", $error_str);
3158 }
3159 }
3160
3164 public function history()
3165 {
3166 if (!$this->getEnableEditing()) {
3167 return;
3168 }
3169
3170 $this->tpl->addJavaScript("./Services/COPage/js/page_history.js");
3171
3172 include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3173 $table_gui = new ilPageHistoryTableGUI($this, "history");
3174 $table_gui->setId("hist_table");
3175 $entries = $this->getPageObject()->getHistoryEntries();
3176 $entries[] = array('page_id' => $this->getPageObject()->getId(),
3177 'parent_type' => $this->getPageObject()->getParentType(),
3178 'hdate' => $this->getPageObject()->getLastChange(),
3179 'parent_id' => $this->getPageObject()->getParentId(),
3180 'nr' => 0,
3181 'sortkey' => 999999,
3182 'user' => $this->getPageObject()->last_change_user);
3183 $table_gui->setData($entries);
3184 return $table_gui->getHTML();
3185 }
3186
3190 public function rollbackConfirmation()
3191 {
3192 if (!$this->getEnableEditing()) {
3193 return;
3194 }
3195
3196 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3197 $c_gui = new ilConfirmationGUI();
3198
3199 // set confirm/cancel commands
3200 $this->ctrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3201 $c_gui->setFormAction($this->ctrl->getFormAction($this, "rollback"));
3202 $c_gui->setHeaderText($this->lng->txt("cont_rollback_confirmation"));
3203 $c_gui->setCancel($this->lng->txt("cancel"), "history");
3204 $c_gui->setConfirm($this->lng->txt("confirm"), "rollback");
3205
3206 $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3207
3208 $c_gui->addItem(
3209 "id[]",
3210 $_GET["old_nr"],
3212 );
3213
3214 $this->tpl->setContent($c_gui->getHTML());
3215 }
3216
3220 public function rollback()
3221 {
3222 if (!$this->getEnableEditing()) {
3223 return;
3224 }
3225
3226 $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3227
3228 if ($hentry["content"] != "") {
3229 $this->obj->setXMLContent($hentry["content"]);
3230 $this->obj->buildDom(true);
3231 if ($this->obj->update()) {
3232 $this->ctrl->redirect($this, "history");
3233 }
3234 }
3235 $this->ctrl->redirect($this, "history");
3236 }
3237
3244 public function setScreenIdComponent()
3245 {
3246 $this->help->setScreenIdComponent("copg");
3247 }
3248
3254 public function getTabs($a_activate = "")
3255 {
3256 $this->setScreenIdComponent();
3257
3258 if (!$this->getEnabledTabs()) {
3259 return;
3260 }
3261
3262 // back to upper context
3263 if (!$this->getEditPreview()) {
3264 $this->tabs_gui->addTarget("pg", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3265
3266 if ($this->getEnableEditing()) {
3267 $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "edit"), array("", "edit"));
3268 }
3269 } else {
3270 if ($this->getEnableEditing()) {
3271 $this->tabs_gui->addTarget("edit", $this->ctrl->getLinkTarget($this, "edit"), array("", "edit"));
3272 }
3273
3274 $this->tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3275 }
3276
3277 //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3278 // , "properties", get_class($this));
3279
3280 if ($this->use_meta_data) {
3281 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
3282 $mdgui = new ilObjectMetaDataGUI(
3283 $this->meta_data_rep_obj,
3284 $this->meta_data_type,
3285 $this->meta_data_sub_obj_id
3286 );
3287 $mdtab = $mdgui->getTab();
3288 if ($mdtab) {
3289 $this->tabs_gui->addTarget(
3290 "meta_data",
3291 $mdtab,
3292 "",
3293 "ilobjectmetadatagui"
3294 );
3295 }
3296 }
3297
3298 $lm_set = new ilSetting("lm");
3299
3300 if ($this->getEnableEditing() && $lm_set->get("page_history", 1)) {
3301 $this->tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
3302 if ($_GET["history_mode"] == "1" || $this->ctrl->getCmd() == "compareVersion") {
3303 $this->tabs_gui->activateTab("history");
3304 }
3305 }
3306
3307 /* $tabs = $this->ctrl->getTabs();
3308 foreach ($tabs as $tab)
3309 {
3310 $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3311 , $tab["cmd"], $tab["class"]);
3312 }
3313 */
3314 if ($this->getEnableEditing() && $this->user->getId() != ANONYMOUS_USER_ID) {
3315 $this->tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilEditClipboardGUI"), "view"), "view", "ilEditClipboardGUI");
3316 }
3317
3318 if ($this->getPageConfig()->getEnableScheduledActivation()) {
3319 $this->tabs_gui->addTarget(
3320 "cont_activation",
3321 $this->ctrl->getLinkTarget($this, "editActivation"),
3322 "editActivation",
3323 get_class($this)
3324 );
3325 }
3326
3327 if ($this->getEnabledNews()) {
3328 $this->tabs_gui->addTarget(
3329 "news",
3330 $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3331 "",
3332 "ilnewsitemgui"
3333 );
3334 }
3335
3336 // external hook to add tabs
3337 if (is_array($this->tab_hook)) {
3338 $func = $this->tab_hook["func"];
3339 $this->tab_hook["obj"]->$func();
3340 }
3341 //$this->tabs_gui->setTabActive("pg");
3342 }
3343
3347 public function compareVersion()
3348 {
3349 if (!$this->getEnableEditing()) {
3350 return;
3351 }
3352
3353 $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3354 $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3355
3356 // left page
3357 $lpage = $compare["l_page"];
3358 $cfg = $this->getPageConfig();
3359 $cfg->setPreventHTMLUnmasking(true);
3360
3362 $this->setPageObject($lpage);
3364 $this->setCompareMode(true);
3365
3366 $lhtml = $this->showPage();
3367 $lhtml = $this->replaceDiffTags($lhtml);
3368 $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3369 $tpl->setVariable("LEFT", $lhtml);
3370
3371 // right page
3372 $rpage = $compare["r_page"];
3373 $this->setPageObject($rpage);
3375 $this->setCompareMode(true);
3377
3378 $rhtml = $this->showPage();
3379 $rhtml = $this->replaceDiffTags($rhtml);
3380 $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3381 $tpl->setVariable("RIGHT", $rhtml);
3382
3383 $tpl->setVariable("TXT_NEW", $this->lng->txt("cont_pc_new"));
3384 $tpl->setVariable("TXT_MODIFIED", $this->lng->txt("cont_pc_modified"));
3385 $tpl->setVariable("TXT_DELETED", $this->lng->txt("cont_pc_deleted"));
3386
3387 //var_dump($left);
3388 //var_dump($right);
3389
3390 return $tpl->get();
3391 }
3392
3393 public function replaceDiffTags($a_html)
3394 {
3395 $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3396 $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3397 $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3398 $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3399
3400 return $a_html;
3401 }
3402
3406 public function editActivation()
3407 {
3408 $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3409 $this->initActivationForm();
3410 $this->getActivationFormValues();
3411 $atpl->setVariable("FORM", $this->form->getHTML());
3412 $atpl->setCurrentBlock("updater");
3413 $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3414 $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3415 $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3416 $atpl->parseCurrentBlock();
3417 $this->tpl->setContent($atpl->get());
3418 }
3419
3423 public function initActivationForm()
3424 {
3425 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3426 $this->form = new ilPropertyFormGUI();
3427 $this->form->setFormAction($this->ctrl->getFormAction($this));
3428 $this->form->setTitle($this->lng->txt("cont_page_activation"));
3429
3430 // activation type radio
3431 $rad = new ilRadioGroupInputGUI($this->lng->txt("cont_activation"), "activation");
3432 $rad_op1 = new ilRadioOption($this->lng->txt("cont_activated"), "activated");
3433
3434 $rad->addOption($rad_op1);
3435 $rad_op2 = new ilRadioOption($this->lng->txt("cont_deactivated"), "deactivated");
3436 $rad->addOption($rad_op2);
3437 $rad_op3 = new ilRadioOption($this->lng->txt("cont_scheduled_activation"), "scheduled");
3438
3439 $dt_prop = new ilDateTimeInputGUI($this->lng->txt("cont_start"), "start");
3440 $dt_prop->setRequired(true);
3441 $dt_prop->setShowTime(true);
3442 $rad_op3->addSubItem($dt_prop);
3443 $dt_prop2 = new ilDateTimeInputGUI($this->lng->txt("cont_end"), "end");
3444 $dt_prop2->setRequired(true);
3445 $dt_prop2->setShowTime(true);
3446 $rad_op3->addSubItem($dt_prop2);
3447
3448 // show activation information
3449 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3450 $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3451 $rad_op3->addSubItem($cb);
3452
3453
3454 $rad->addOption($rad_op3);
3455
3456 $this->form->addCommandButton("saveActivation", $this->lng->txt("save"));
3457
3458 $this->form->addItem($rad);
3459 }
3460
3464 public function getActivationFormValues()
3465 {
3466 $activation = "deactivated";
3467 if ($this->getPageObject()->getActive()) {
3468 $activation = "activated";
3469 }
3470
3471 $dt_prop = $this->form->getItemByPostVar("start");
3472 if ($this->getPageObject()->getActivationStart() != "") {
3473 $activation = "scheduled";
3474 $dt_prop->setDate(new ilDateTime(
3475 $this->getPageObject()->getActivationStart(),
3477 ));
3478 }
3479 $dt_prop = $this->form->getItemByPostVar("end");
3480 if ($this->getPageObject()->getActivationEnd() != "") {
3481 $activation = "scheduled";
3482 $dt_prop->setDate(new ilDateTime(
3483 $this->getPageObject()->getActivationEnd(),
3485 ));
3486 }
3487
3488 $this->form->getItemByPostVar("activation")->setValue($activation);
3489 $this->form->getItemByPostVar("show_activation_info")->setChecked($this->getPageObject()->getShowActivationInfo());
3490 }
3491
3495 public function saveActivation()
3496 {
3497 $this->initActivationForm();
3498
3499 if ($this->form->checkInput()) {
3500 $this->getPageObject()->setActive(true);
3501 $this->getPageObject()->setActivationStart(null);
3502 $this->getPageObject()->setActivationEnd(null);
3503 $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3504 if ($_POST["activation"] == "deactivated") {
3505 $this->getPageObject()->setActive(false);
3506 }
3507 if ($_POST["activation"] == "scheduled") {
3508 $this->getPageObject()->setActive(false);
3509 $this->getPageObject()->setActivationStart(
3510 $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME)
3511 );
3512 $this->getPageObject()->setActivationEnd(
3513 $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME)
3514 );
3515 }
3516 $this->getPageObject()->update();
3517 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3518 $this->ctrl->redirect($this, "editActivation");
3519 }
3520 $this->form->setValuesByPost();
3521 $this->tpl->setContent($this->form->getHTML());
3522 }
3523
3533 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)
3534 {
3535 include_once("Services/Notes/classes/class.ilNoteGUI.php");
3536
3537 // scorm 2004 page gui
3538 if (!$a_content_object) {
3539 $notes_gui = new ilNoteGUI(
3540 $this->notes_parent_id,
3541 (int) $this->obj->getId(),
3542 "pg"
3543 );
3544
3545 $a_enable_private_notes = true;
3546 $a_enable_public_notes = true;
3547 $a_enable_notes_deletion = false;
3548 }
3549 // wiki page gui, blog posting gui
3550 else {
3551 $notes_gui = new ilNoteGUI(
3552 $a_content_object->getParentId(),
3553 $a_content_object->getId(),
3554 $a_content_object->getParentType()
3555 );
3556 }
3557
3558 if ($a_enable_private_notes) {
3559 $notes_gui->enablePrivateNotes();
3560 }
3561 if ($a_enable_public_notes) {
3562 $notes_gui->enablePublicNotes();
3563 if ((bool) $a_enable_notes_deletion) {
3564 $notes_gui->enablePublicNotesDeletion(true);
3565 }
3566 }
3567
3568 if ($a_callback) {
3569 $notes_gui->addObserver($a_callback);
3570 }
3571
3572 $next_class = $this->ctrl->getNextClass($this);
3573 if ($next_class == "ilnotegui") {
3574 $html = $this->ctrl->forwardCommand($notes_gui);
3575 } else {
3576 $html = $notes_gui->getNotesHTML();
3577 }
3578 return $html;
3579 }
3580
3584 public function processAnswer()
3585 {
3586 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3590 ilUtil::stripSlashes($_POST["answer"])
3591 );
3592 }
3593
3594
3595 //
3596 // Initially opened content (e.g. used in learning modules), that
3597 // is presented in another than the main content area (e.g. a picture in
3598 // the bottom left area)
3599 //
3600
3607 public function initialOpenedContent()
3608 {
3609 $this->tabs_gui->activateTab("edit");
3610 $form = $this->initOpenedContentForm();
3611
3612 $this->tpl->setContent($form->getHTML());
3613 }
3614
3621 public function initOpenedContentForm()
3622 {
3623 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3624 $form = new ilPropertyFormGUI();
3625
3626 // link input
3627 include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3628 $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3629 $ac->setAllowedLinkTypes(ilLinkInputGUI::INT);
3630 $ac->setInternalLinkDefault("Media_Media", 0);
3631 $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3632 $val = $this->obj->getInitialOpenedContent();
3633 if ($val["id"] != "" && $val["type"] != "") {
3634 $ac->setValue($val["type"] . "|" . $val["id"] . "|" . $val["target"]);
3635 }
3636
3637 $form->addItem($ac);
3638
3639 $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3640 $form->addCommandButton("edit", $this->lng->txt("cancel"));
3641 $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3642 $form->setFormAction($this->ctrl->getFormAction($this));
3643
3644 return $form;
3645 }
3646
3654 {
3655 $this->obj->saveInitialOpenedContent(
3656 ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3657 ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3658 ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3659 );
3660
3661 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3662 $this->ctrl->redirect($this, "edit");
3663 }
3664
3668
3669
3673 public function switchToLanguage()
3674 {
3675 $l = ilUtil::stripSlashes($_GET["totransl"]);
3676 $p = $this->getPageObject();
3677 if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l)) {
3679 return;
3680 }
3681 $this->ctrl->setParameter($this, "transl", $_GET["totransl"]);
3682 $this->ctrl->redirect($this, "edit");
3683 }
3684
3689 {
3690 $l = ilUtil::stripSlashes($_GET["totransl"]);
3691 $this->ctrl->setParameter($this, "totransl", $l);
3692 $this->lng->loadLanguageModule("meta");
3693
3694 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3695 $cgui = new ilConfirmationGUI();
3696 $cgui->setFormAction($this->ctrl->getFormAction($this));
3697 $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
3698 $this->lng->txt("meta_l_" . $l));
3699 $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
3700 $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");
3701 $this->tpl->setContent($cgui->getHTML());
3702 }
3703
3707 public function editMasterLanguage()
3708 {
3709 $this->ctrl->setParameter($this, "transl", "");
3710 $this->ctrl->redirect($this, "edit");
3711 }
3712
3716 public function createPageTranslation()
3717 {
3718 $l = ilUtil::stripSlashes($_GET["totransl"]);
3719
3720 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3722 $this->getPageObject()->getParentType(),
3723 $this->getPageObject()->getId(),
3724 0,
3725 "-"
3726 );
3727 $p->copyPageToTranslation($l);
3728 $this->ctrl->setParameter($this, "transl", $l);
3729 $this->ctrl->redirect($this, "edit");
3730 }
3731
3735 public function releasePageLock()
3736 {
3737 $this->getPageObject()->releasePageLock();
3738 ilUtil::sendSuccess($this->lng->txt("cont_page_lock_released"), true);
3739 $this->ctrl->redirect($this, "preview");
3740 }
3741
3742 protected function isPageContainerToBeRendered()
3743 {
3744 return (
3746 );
3747 }
3748
3755 public function getPagePermaLink()
3756 {
3757 return "";
3758 }
3759}
user()
Definition: user.php:4
$n
Definition: RandomTest.php:85
if(strpos( $jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:32
$files
Definition: add-vimline.php:18
global $l
Definition: afr.php:30
$_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
const IL_PAGE_PRINT
const IL_PAGE_OFFLINE
const IL_PAGE_PRESENTATION
const IL_PAGE_EDIT
const IL_PAGE_PREVIEW
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 addCss()
Add required css.
static addJavaScript(ilTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
User interface class for advanced drop-down selection lists.
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)
Format a date @access public.
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class ilEditClipboardGUI.
static get($a_glyph, $a_text="")
Get glyph html.
Class ilInternalLinkGUI.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
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(ilTemplate $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)
get content style path
Class ilObjectMetaDataGUI.
static getInstance($a_obj_id)
Get instance.
static _lookupObjId($a_id)
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 _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.
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.
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.
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.
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.
insertHelp($a_tpl)
Insert help texts.
setStyleId($a_styleid)
Set Style Id.
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.
getOfflineDirectory()
get offline directory
rollbackConfirmation()
Rollback confirmation.
presentation($a_mode=IL_PAGE_PRESENTATION)
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.
setTemplateTargetVar($a_variable)
getActivationCaptions()
Get captions for activation action menu entries.
initActivationForm()
Init activation form.
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.
static getGotoForPortfolioPageTarget($a_target, $a_offline=false)
Get goto href for internal wiki page link target.
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 hasPublicProfile($a_user_id)
Has public profile.
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getGotoForWikiPageTarget($a_target, $a_offline=false)
Get goto href for internal wiki page link target.
static initDragDrop()
Init YUI Drag and Drop.
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$lang
Definition: consent.php:3
$def
Definition: croninfo.php:21
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
$h
$style
Definition: example_012.php:70
$js
$code
Definition: example_050.php:99
if(!array_key_exists('StateId', $_REQUEST)) $id
$links
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$target_id
Definition: goto.php:49
$target_arr
Definition: goto.php:47
const ILIAS_VERSION
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
$error
Definition: Error.php:17
$xml
Definition: metadata.php:240
$end
Definition: saml1-acs.php:18
$info
Definition: index.php:5
$ret
Definition: parser.php:6
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$type
$s
Definition: pwgen.php:45
if(isset($_POST['submit'])) $form
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7
$lm_set
$a_type
Definition: workflow.php:92
$params
Definition: disable.php:11
$text
Definition: errorreport.php:18
catch(Exception $e) if(isset( $_POST[ 'cancel'])) if(isset($_POST['continue'])) $cfg