ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
32 var $tpl;
33 var $lng;
34 var $ctrl;
35 var $obj;
49 var $activation = false;
50 var $activated = true;
51 var $editpreview = false;
52 var $use_meta_data = false;
53 var $link_xml_set = false;
54 var $enableediting = true;
55 var $rawpagecontent = false;
57 var $compare_mode = false;
58 var $page_config = null;
59 var $tabs_enabled = true;
61 private $abstract_only = false;
62 protected $parent_type = "";
63
67 protected $log;
68
69 //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
70 //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
71 var $pl_start = "{{{{{";
72 var $pl_end = "}}}}}";
73
83 function ilPageObjectGUI($a_parent_type, $a_id, $a_old_nr = 0,
84 $a_prevent_get_id = false, $a_lang = "")
85 {
86 global $tpl, $lng, $ilCtrl,$ilTabs;
87
88 $this->log = ilLoggerFactory::getLogger('copg');
89
90 $this->setParentType($a_parent_type);
91 $this->setId($a_id);
92 if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0)
93 {
94 $a_old_nr = $_GET["old_nr"];
95 }
96 $this->setOldNr($a_old_nr);
97
98 if ($a_lang == "" && $_GET["transl"] != "")
99 {
100 $this->setLanguage($_GET["transl"]);
101 }
102 else
103 {
104 if ($a_lang == "")
105 {
106 $a_lang = "-";
107 }
108 $this->setLanguage($a_lang);
109 }
110
111 $this->tpl = $tpl;
112 $this->ctrl = $ilCtrl;
113 $this->lng = $lng;
114
116 $this->setEnabledPageFocus(true);
117 $this->initPageObject();
118 $this->setPageConfig($this->getPageObject()->getPageConfig());
119
120 $this->output2template = true;
121 $this->question_xml = "";
122 $this->question_html = "";
123 $this->tabs_gui =& $ilTabs;
124
125 $this->template_output_var = "PAGE_CONTENT";
126 $this->citation = false;
127 $this->change_comments = false;
128 $this->page_back_title = $this->lng->txt("page");
129 $lng->loadLanguageModule("content");
130
131 $this->setTemplateOutput(false);
132
133 $ilCtrl->saveParameter($this, "transl");
134
135 $this->afterConstructor();
136 }
137
142 {
143 }
144
145
149 protected final function initPageObject()
150 {
151 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
152 $page = ilPageObjectFactory::getInstance($this->getParentType(), $this->getId(), $this->getOldNr(),
153 $this->getLanguage());
154 $this->setPageObject($page);
155 }
156
162 function setParentType($a_val)
163 {
164 $this->parent_type = $a_val;
165 }
166
172 function getParentType()
173 {
174 return $this->parent_type;
175 }
176
182 function setId($a_val)
183 {
184 $this->id = $a_val;
185 }
186
192 function getId()
193 {
194 return $this->id;
195 }
196
202 function setOldNr($a_val)
203 {
204 $this->old_nr = $a_val;
205 }
206
212 function getOldNr()
213 {
214 return $this->old_nr;
215 }
216
222 function setLanguage($a_val)
223 {
224 $this->language = $a_val;
225 }
226
232 function getLanguage()
233 {
234 if ($this->language == "")
235 {
236 return "-";
237 }
238
239 return $this->language;
240 }
241
247 function setEnablePCType($a_pc_type, $a_val)
248 {
249 $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
250 }
251
257 function getEnablePCType($a_pc_type)
258 {
259 return $this->getPageConfig()->getEnablePCType($a_pc_type);
260 }
261
267 function setPageConfig($a_val)
268 {
269 $this->page_config = $a_val;
270 }
271
277 function getPageConfig()
278 {
279 return $this->page_config;
280 }
281
285 function setBibId($a_id)
286 {
287 // USED FOR SELECTION WHICH PAGE TURNS AND LATER PAGES SHOULD BE SHOWN
288 $this->bib_id = $a_id;
289 }
290
294 function getBibId()
295 {
296 return $this->bib_id ? $this->bib_id : 0;
297 }
298
304 function setPageObject($a_pg_obj)
305 {
306 $this->obj = $a_pg_obj;
307 }
308
314 function getPageObject()
315 {
316 return $this->obj;
317 }
318
325 {
326 $this->output_mode = $a_mode;
327 }
328
329 function getOutputMode()
330 {
331 return $this->output_mode;
332 }
333
334 function setTemplateOutput($a_output = true)
335 {
336 $this->output2template = $a_output;
337 }
338
340 {
342 }
343
344 function setPresentationTitle($a_title = "")
345 {
346 $this->presentation_title = $a_title;
347 }
348
350 {
352 }
353
354 function setHeader($a_title = "")
355 {
356 $this->header = $a_title;
357 }
358
359 function getHeader()
360 {
361 return $this->header;
362 }
363
364 function setLinkParams($l_params = "")
365 {
366 $this->link_params = $l_params;
367 }
368
369 function getLinkParams()
370 {
371 return $this->link_params;
372 }
373
374 function setLinkFrame($l_frame = "")
375 {
376 $this->link_frame = $l_frame;
377 }
378
379 function getLinkFrame()
380 {
381 return $this->link_frame;
382 }
383
384 function setLinkXML($link_xml)
385 {
386 $this->link_xml = $link_xml;
387 $this->link_xml_set = true;
388 }
389
390 function getLinkXML()
391 {
392 return $this->link_xml;
393 }
394
395 function setQuestionXML($question_xml)
396 {
397 $this->question_xml = $question_xml;
398 }
399
401 {
402 $this->getPageConfig()->setQuestionHTML($question_html);
403 }
404
405 function getQuestionXML()
406 {
407 return $this->question_xml;
408 }
409
411 {
412 return $this->getPageConfig()->getQuestionHTML();
413 }
414
415 function setTemplateTargetVar($a_variable)
416 {
417 $this->target_var = $a_variable;
418 }
419
421 {
422 return $this->target_var;
423 }
424
425 function setTemplateOutputVar($a_value)
426 {
427 $this->template_output_var = $a_value;
428 }
429
431 {
433 }
434
435 // @todo 1: can we get rid of this?
436 function setSourcecodeDownloadScript ($script_name) {
437 $this->sourcecode_download_script = $script_name;
438 }
439
442 }
443
444 function enableCitation($a_enabled)
445 {
446 $this->citation = $a_enabled;
447 }
448
450 {
451 return $this->citation;
452 }
453
454 function setLocator(&$a_locator)
455 {
456 $this->locator =& $a_locator;
457 }
458
459 function setTabs($a_tabs)
460 {
461 $this->tabs_gui = $a_tabs;
462 }
463
464 function setPageBackTitle($a_title)
465 {
466 $this->page_back_title = $a_title;
467 }
468
469 // @todo 1: can we get rid of this?
470 function setFileDownloadLink($a_download_link)
471 {
472 $this->file_download_link = $a_download_link;
473 }
474
476 {
477 return $this->file_download_link;
478 }
479
480 // @todo 1: can we get rid of this?
481 function setFullscreenLink($a_fullscreen_link)
482 {
483 $this->fullscreen_link = $a_fullscreen_link;
484 }
485
487 {
488 return $this->fullscreen_link;
489 }
490
491 function setIntLinkReturn($a_return)
492 {
493 $this->int_link_return = $a_return;
494 }
495
496 function enableChangeComments($a_enabled)
497 {
498 $this->change_comments = $a_enabled;
499 }
500
502 {
504 }
505
506 function enableNotes($a_enabled, $a_parent_id)
507 {
508 $this->notes_enabled = $a_enabled;
509 $this->notes_parent_id = $a_parent_id;
510 }
511
512 function isEnabledNotes()
513 {
514 return $this->notes_enabled;
515 }
516
522 function setOfflineDirectory ($offdir) {
523 $this->offline_directory = $offdir;
524 }
525
526
532 return $this->offline_directory;
533 }
534
535
542 function setViewPageLink($a_link, $a_target = "")
543 {
544 $this->view_page_link = $a_link;
545 $this->view_page_target = $a_target;
546 }
547
552 {
553 return $this->view_page_link;
554 }
555
560 {
561 return $this->view_page_target;
562 }
563
564 function setActivationListener(&$a_obj, $a_meth)
565 {
566 $this->act_obj =& $a_obj;
567 $this->act_meth = $a_meth;
568 }
569
575 function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
576 {
577 $this->enabled_news = $a_enabled;
578 $this->news_obj_id = $a_news_obj_id;
579 $this->news_obj_type = $a_news_obj_type;
580 }
581
587 function getEnabledNews()
588 {
589 return $this->enabled_news;
590 }
591
595 function setTabHook($a_object, $a_function)
596 {
597 $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
598 }
599
605 function setEditPreview($a_editpreview)
606 {
607 $this->editpreview = $a_editpreview;
608 }
609
615 function getEditPreview()
616 {
617 return $this->editpreview;
618 }
619
625 function setEnabledTabs($a_enabledtabs)
626 {
627 $this->tabs_enabled = $a_enabledtabs;
628 }
629
635 function getEnabledTabs()
636 {
637 return $this->tabs_enabled;
638 }
639
645 function setEnabledPageFocus($a_enabledpagefocus)
646 {
647 $this->enabledpagefocus = $a_enabledpagefocus;
648 }
649
656 {
657 return $this->enabledpagefocus;
658 }
659
665 function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
666 {
667return;
668 $this->exp_frame = $a_exp_frame;
669 $this->exp_id = $a_exp_id;
670 $this->exp_target_script = $a_exp_target_script;
671 }
672
678 function setPrependingHtml($a_prependinghtml)
679 {
680 $this->prependinghtml = $a_prependinghtml;
681 }
682
689 {
690 return $this->prependinghtml;
691 }
692
698 function setEnableEditing($a_enableediting)
699 {
700 $this->enableediting = $a_enableediting;
701 }
702
709 {
711 }
712
718 function setRawPageContent($a_rawpagecontent)
719 {
720 $this->rawpagecontent = $a_rawpagecontent;
721 }
722
729 {
731 }
732
738 function setStyleId($a_styleid)
739 {
740 $this->styleid = $a_styleid;
741 }
742
748 function getStyleId()
749 {
750 return $this->styleid;
751 }
752
758 function setCompareMode($a_val)
759 {
760 $this->compare_mode = $a_val;
761 }
762
768 function getCompareMode()
769 {
770 return $this->compare_mode;
771 }
772
778 function setAbstractOnly($a_val)
779 {
780 $this->abstract_only = $a_val;
781 }
782
789 {
791 }
792
798 function setRenderPageContainer($a_val)
799 {
800 $this->render_page_container = $a_val;
801 }
802
809 {
811 }
812
822 function activateMetaDataEditor($a_rep_obj, $a_type, $a_sub_obj_id,
823 $a_observer_obj = NULL, $a_observer_func = "")
824 {
825 $this->use_meta_data = true;
826 $this->meta_data_rep_obj = $a_rep_obj;
827 $this->meta_data_sub_obj_id = $a_sub_obj_id;
828 $this->meta_data_type = $a_type;
829 $this->meta_data_observer_obj = $a_observer_obj;
830 $this->meta_data_observer_func = $a_observer_func;
831 }
832
839 {
840 global $ilCtrl;
841
842 $file_download_link = $this->getFileDownloadLink();
843 if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline")
844 {
845 $file_download_link = $ilCtrl->getLinkTarget($this, "downloadFile");
846 }
847 return $file_download_link;
848 }
849
856 {
857 global $ilCtrl;
858
859 $fullscreen_link = $this->getFullscreenLink();
860 if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline")
861 {
862 $fullscreen_link = $ilCtrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
863 }
864 return $fullscreen_link;
865 }
866
873 {
874 global $ilCtrl;
875
877 if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline")
878 {
879 $l = $ilCtrl->getLinkTarget($this, "");
880 }
881 return $l;
882 }
883
888 {
889 $xml = "";
890 if($this->getOutputMode() == "edit")
891 {
892 global $ilPluginAdmin;
893
894 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
895 "COPage", "pgcp");
896 foreach ($pl_names as $pl_name)
897 {
898 $plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
899 "COPage", "pgcp", $pl_name);
900 if ($plugin->isValidParentType($this->getPageObject()->getParentType()))
901 {
902 $xml.= '<ComponentPlugin Name="'.$plugin->getPluginName().
903 '" InsertText="'.$plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT).'" />';
904 }
905 }
906 }
907 if ($xml != "")
908 {
909 $xml = "<ComponentPlugins>".$xml."</ComponentPlugins>";
910 }
911 return $xml;
912 }
913
914
918 function &executeCommand()
919 {
920 global $ilCtrl, $ilTabs, $lng, $ilAccess, $tpl;
921
922 $next_class = $this->ctrl->getNextClass($this);
923
924 $this->log->debug("next_class: ".$next_class);
925
926 $cmd = $this->ctrl->getCmd();
927 //$this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
928 // , "view", "ilEditClipboardGUI");
929 $this->getTabs();
930
931 $ilCtrl->setReturn($this, "edit");
932//echo "-".$next_class."-";
933 switch($next_class)
934 {
935 case 'ilobjectmetadatagui':
936 //$this->setTabs();
937 $ilTabs->setTabActive("meta_data");
938 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
939 $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
940 if (is_object($this->meta_data_observer_obj))
941 {
942 $md_gui->addMDObserver($this->meta_data_observer_obj,
943 $this->meta_data_observer_func, "General");
944 }
945 $this->ctrl->forwardCommand($md_gui);
946 break;
947
948 case "ileditclipboardgui":
949 //$this->tabs_gui->clearTargets();
950 //$this->ctrl->setReturn($this, "view");
951 $clip_gui = new ilEditClipboardGUI();
952 $clip_gui->setPageBackTitle($this->page_back_title);
953 //$ret =& $clip_gui->executeCommand();
954 $ret =& $this->ctrl->forwardCommand($clip_gui);
955 break;
956
957 // notes
958 case "ilnotegui":
959 switch($_GET["notes_mode"])
960 {
961 default:
962 $html = $this->edit();
963 $ilTabs->setTabActive("edit");
964 return $html;
965 }
966 break;
967
968 case 'ilpublicuserprofilegui':
969 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
970 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
971 $ret = $this->ctrl->forwardCommand($profile_gui);
972 break;
973
974 case "ilpageeditorgui":
975 if (!$this->getEnableEditing())
976 {
977 ilUtil::sendFailure($lng->txt("permission_denied"), true);
978 $ilCtrl->redirect($this, "preview");
979 }
980 $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
981 $page_editor->setLocator($this->locator);
982 $page_editor->setHeader($this->getHeader());
983 $page_editor->setPageBackTitle($this->page_back_title);
984 $page_editor->setIntLinkReturn($this->int_link_return);
985 //$page_editor->executeCommand();
986 $ret =& $this->ctrl->forwardCommand($page_editor);
987 break;
988
989 case 'ilnewsitemgui':
990 include_once("./Services/News/classes/class.ilNewsItemGUI.php");
991 $news_item_gui = new ilNewsItemGUI();
992 $news_item_gui->setEnableEdit(true);
993 $news_item_gui->setContextObjId($this->news_obj_id);
994 $news_item_gui->setContextObjType($this->news_obj_type);
995 $news_item_gui->setContextSubObjId($this->obj->getId());
996 $news_item_gui->setContextSubObjType("pg");
997
998 $ret = $ilCtrl->forwardCommand($news_item_gui);
999 break;
1000
1001 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1002 $ret = $this->ctrl->forwardCommand($profile_gui);
1003 break;
1004
1005 case "ilpropertyformgui":
1006 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1007 $form = $this->initOpenedContentForm();
1008 $this->ctrl->forwardCommand($form);
1009 break;
1010
1011 case "ilinternallinkgui":
1012 $this->lng->loadLanguageModule("content");
1013 require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1014 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1015 //$link_gui->filterLinkType("RepositoryItem");
1016
1017 $link_gui->filterLinkType("PageObject_FAQ");
1018 $link_gui->filterLinkType("GlossaryItem");
1019 $link_gui->filterLinkType("Media_Media");
1020 $link_gui->filterLinkType("Media_FAQ");
1021
1022 $link_gui->setFilterWhiteList(true);
1023 $link_gui->setMode("asynch");
1024 $ilCtrl->forwardCommand($link_gui);
1025 break;
1026
1027 case "ilquestioneditgui":
1028 $this->setQEditTabs("question");
1029 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1030 $edit_gui = new ilQuestionEditGUI();
1031 $edit_gui->setPageConfig($this->getPageConfig());
1032// $edit_gui->addNewIdListener($this, "setNewQuestionId");
1033 $edit_gui->setSelfAssessmentEditingMode(true);
1034 $ret = $ilCtrl->forwardCommand($edit_gui);
1035 $this->tpl->setContent($ret);
1036 break;
1037
1038 case 'ilassquestionfeedbackeditinggui':
1039
1041
1042 // set tabs
1043 $this->setQEditTabs("feedback");
1044
1045 // load required lang mods
1046 $lng->loadLanguageModule("assessment");
1047
1048 // set context tabs
1049 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
1050 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
1051 $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
1052 $questionGUI->object->setObjId(0);
1053 $questionGUI->object->setSelfAssessmentEditingMode(true);
1054 $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1055
1056 // forward to ilAssQuestionFeedbackGUI
1057 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1058 $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
1059 $ilCtrl->forwardCommand($gui);
1060 break;
1061
1062/* case "ilpagemultilanggui":
1063 $ilCtrl->setReturn($this, "edit");
1064 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1065 $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1066 $this->getPageConfig()->getSinglePageMode());
1067 //$this->setTabs("settings");
1068 //$this->setSubTabs("cont_multilinguality");
1069 $ret = $this->ctrl->forwardCommand($ml_gui);
1070 break;*/
1071
1072 default:
1073 $cmd = $this->ctrl->getCmd("preview");
1074 $ret = $this->$cmd();
1075 break;
1076 }
1077//echo "+$ret+";
1078 return $ret;
1079 }
1080
1087 function setQEditTabs($a_active)
1088 {
1089 global $ilTabs, $ilCtrl, $lng;
1090 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1091
1092 $ilTabs->clearTargets();
1093
1094 $ilTabs->setBackTarget($lng->txt("back"),
1095 $ilCtrl->getLinkTarget($this, "edit"));
1096
1097 $ilCtrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1098 $ilTabs->addTab("question", $lng->txt("question"),
1099 $ilCtrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion"));
1100
1101 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1102 $ilCtrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1103 $ilTabs->addTab("feedback", $lng->txt("feedback"),
1104 $ilCtrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW));
1105
1106 $ilTabs->activateTab($a_active);
1107 }
1108
1113 {
1114
1115 }
1116
1117
1119 {
1120 $this->getPageObject()->setActivationStart(null);
1121 $this->getPageObject()->setActivationEnd(null);
1122 $this->getPageObject()->setActive(false);
1123 $this->getPageObject()->update();
1124 $this->ctrl->redirect($this, "edit");
1125 }
1126
1127 function activatePage()
1128 {
1129 $this->getPageObject()->setActivationStart(null);
1130 $this->getPageObject()->setActivationEnd(null);
1131 $this->getPageObject()->setActive(true);
1132 $this->getPageObject()->update();
1133 $this->ctrl->redirect($this, "edit");
1134 }
1135
1139 function showPage()
1140 {
1141 global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
1142
1143 // jquery and jquery ui are always provided for components
1144 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1147
1148// $this->initSelfAssessmentRendering();
1149
1150 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1152
1153 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1154
1155 // needed for overlays in iim
1156 include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1158
1159 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1161
1162 // init template
1163 //if($this->outputToTemplate())
1164 //{
1165 if($this->getOutputMode() == "edit")
1166 {
1167 $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1168
1169//echo ":".$this->getTemplateTargetVar().":";
1170 $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1171 //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1172
1173 // to do: status dependent class
1174 $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1175
1176 // user comment
1177 if ($this->isEnabledChangeComments())
1178 {
1179 $tpl->setCurrentBlock("change_comment");
1180 $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1181 $tpl->parseCurrentBlock();
1182 }
1183
1184 $tpl->setVariable("WYSIWYG_ACTION",
1185 $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
1186
1187 // determine media, html and javascript mode
1188 $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
1189 ? "disable"
1190 : "enable";
1191 $sel_html_mode = ($ilUser->getPref("ilPageEditor_HTMLMode") == "disable")
1192 ? "disable"
1193 : "enable";
1194 $sel_js_mode = "disable";
1195 //if($ilSetting->get("enable_js_edit", 1))
1196 //{
1197 $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1198 ? "enable"
1199 : "disable";
1200 //}
1201
1202 // show prepending html
1203 $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1204 $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
1205
1206 // presentation view
1207 if ($this->getViewPageLink() != "")
1208 {
1209 $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"),
1210 $this->getViewPageLink(), $this->getViewPageTarget());
1211 }
1212
1213 // show actions drop down
1214 $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1215
1216 // get js files for JS enabled editing
1217 if ($sel_js_mode == "enable")
1218 {
1219 $this->insertHelp($tpl);
1220 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1223 ilYuiUtil::initPanel(false);
1224 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1225 $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
1226
1227 include_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1229 $lng->toJS("cont_error");
1230
1231 include_once './Services/Style/classes/class.ilObjStyleSheet.php';
1232 $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
1233 preloader.src = './templates/default/images/loader.svg';
1234 ilCOPage.setUser('".$ilUser->getLogin()."');
1235 ilCOPage.setContentCss('".
1236 ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()).
1237 ", ".ilUtil::getStyleSheetLocation().
1238 ", ./Services/COPage/css/tiny_extra.css".
1239 "')");
1240
1241 //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
1242 $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_2_4/tinymce.js");
1243 $tpl->touchBlock("init_dragging");
1244
1245 $cfg = $this->getPageConfig();
1246 $tpl->setVariable("IL_TINY_MENU",
1247 self::getTinyMenu(
1248 $this->getPageObject()->getParentType(),
1249 $cfg->getEnableInternalLinks(),
1250 $cfg->getEnableWikiLinks(),
1251 $cfg->getEnableKeywords(),
1252 $this->getStyleId(), true, true,
1253 $cfg->getEnableAnchors(), true,
1254 $cfg->getEnableUserLinks()
1255 ));
1256
1257 // add int link parts
1258 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1259 $tpl->setCurrentBlock("int_link_prep");
1260 $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1261 $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1262 "", false, true, false)));
1263 $tpl->parseCurrentBlock();
1264
1265 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1267 $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1268
1269 }
1270
1271 // multiple actions
1272 $cnt_pcs = $this->getPageObject()->countPageContents();
1273 if ($cnt_pcs > 1 ||
1274 ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0))
1275 {
1276 $tpl->setCurrentBlock("multi_actions");
1277 if ($sel_js_mode == "enable")
1278 {
1279 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1280 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1281 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1282 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1283 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1284 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1285 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1286 }
1287 $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1288 $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1289 $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1290 $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1291 $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1292 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1293 $tpl->parseCurrentBlock();
1294 }
1295 }
1296 else
1297 {
1298 // presentation or preview here
1299
1300 $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1301 if ($this->getEnabledPageFocus())
1302 {
1303 $tpl->touchBlock("page_focus");
1304 }
1305
1306 include_once("./Services/User/classes/class.ilUserUtil.php");
1307
1308 // presentation
1309 if( $this->isPageContainerToBeRendered() )
1310 {
1311 $tpl->touchBlock("page_container_1");
1312 $tpl->touchBlock("page_container_2");
1313 $tpl->touchBlock("page_container_3");
1314 }
1315
1316 // history
1317 $c_old_nr = $this->getPageObject()->old_nr;
1318 if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1)
1319 {
1320 $hist_info =
1321 $this->getPageObject()->getHistoryInfo($c_old_nr);
1322
1323 if (!$this->getCompareMode())
1324 {
1325 $ilCtrl->setParameter($this, "history_mode", "1");
1326
1327 // previous revision
1328 if (is_array($hist_info["previous"]))
1329 {
1330 $tpl->setCurrentBlock("previous_rev");
1331 $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1332 $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1333 $tpl->setVariable("HREF_PREV",
1334 $ilCtrl->getLinkTarget($this, "preview"));
1335 $tpl->parseCurrentBlock();
1336 }
1337 else
1338 {
1339 $tpl->setCurrentBlock("previous_rev_disabled");
1340 $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1341 $tpl->parseCurrentBlock();
1342 }
1343
1344 // next revision
1345 if ($c_old_nr > 0)
1346 {
1347 $tpl->setCurrentBlock("next_rev");
1348 $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
1349 $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1350 $tpl->setVariable("HREF_NEXT",
1351 $ilCtrl->getLinkTarget($this, "preview"));
1352 $tpl->parseCurrentBlock();
1353
1354 // latest revision
1355 $tpl->setCurrentBlock("latest_rev");
1356 $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
1357 $ilCtrl->setParameter($this, "old_nr", "");
1358 $tpl->setVariable("HREF_LATEST",
1359 $ilCtrl->getLinkTarget($this, "preview"));
1360 $tpl->parseCurrentBlock();
1361 }
1362
1363 $ilCtrl->setParameter($this, "history_mode", "");
1364
1365 // rollback
1366 if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID)
1367 {
1368 $tpl->setCurrentBlock("rollback");
1369 $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
1370 $tpl->setVariable("HREF_ROLLBACK",
1371 $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
1372 $ilCtrl->setParameter($this, "old_nr", "");
1373 $tpl->setVariable("TXT_ROLLBACK",
1374 $lng->txt("cont_rollback"));
1375 $tpl->parseCurrentBlock();
1376 }
1377 }
1378
1379 $tpl->setCurrentBlock("hist_nav");
1380 $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
1381 $tpl->setVariable("VAL_REVISION_DATE",
1382 ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
1383 $tpl->setVariable("VAL_REV_USER",
1384 ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
1385 $tpl->parseCurrentBlock();
1386 }
1387 }
1388 if ($this->getOutputMode() != IL_PAGE_PRESENTATION &&
1389 $this->getOutputMode() != IL_PAGE_OFFLINE &&
1390 $this->getOutputMode() != IL_PAGE_PREVIEW &&
1391 $this->getOutputMode() != IL_PAGE_PRINT)
1392 {
1393 $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1394 }
1395
1396 // output media object edit list (of media links)
1397 if($this->getOutputMode() == "edit")
1398 {
1399 $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
1400 $this->obj->getId(), $this->obj->getLanguage());
1401 $mob_links = array();
1402 foreach($links as $link)
1403 {
1404 if ($link["type"] == "mob")
1405 {
1406 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob")
1407 {
1408 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
1409 }
1410 }
1411 }
1412
1413 // linked media objects
1414 if (count($mob_links) > 0)
1415 {
1416 $tpl->setCurrentBlock("med_link");
1417 $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1418 $tpl->setVariable("SEL_MED_LINKS",
1419 ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
1420 $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1421 $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1422 //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1423 $tpl->parseCurrentBlock();
1424 }
1425
1426 // content snippets used
1427 include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1429 $this->getPageObject()->getDomDoc());
1430 if (count($snippets) > 0)
1431 {
1432 foreach ($snippets as $s)
1433 {
1434 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1435 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1436 }
1437 $tpl->setCurrentBlock("med_link");
1438 $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1439 $tpl->setVariable("SEL_SNIPPETS",
1440 ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
1441 $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1442 $tpl->parseCurrentBlock();
1443 }
1444
1445 // scheduled activation?
1446 if (!$this->getPageObject()->getActive() &&
1447 $this->getPageObject()->getActivationStart() != "" &&
1448 $this->getPageConfig()->getEnableScheduledActivation())
1449 {
1450 $tpl->setCurrentBlock("activation_txt");
1451 $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
1452 $tpl->setVariable("SA_FROM",
1454 new ilDateTime($this->getPageObject()->getActivationStart(),
1455 IL_CAL_DATETIME)));
1456 $tpl->setVariable("SA_TO",
1458 new ilDateTime($this->getPageObject()->getActivationEnd(),
1459 IL_CAL_DATETIME)));
1460 $tpl->parseCurrentBlock();
1461 }
1462 }
1463
1464 if ($_GET["reloadTree"] == "y")
1465 {
1466 $tpl->setCurrentBlock("reload_tree");
1467 if ($this->obj->getParentType() == "dbk")
1468 {
1469 $tpl->setVariable("LINK_TREE",
1470 $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
1471 }
1472 else
1473 {
1474 $tpl->setVariable("LINK_TREE",
1475 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
1476 }
1477 $tpl->parseCurrentBlock();
1478 }
1479// }
1480 // get content
1481 $builded = $this->obj->buildDom();
1482
1483 // manage hierarchical ids
1484 if($this->getOutputMode() == "edit")
1485 {
1486
1487 // add pc ids, if necessary
1488 if (!$this->obj->checkPCIds())
1489 {
1490 $this->obj->insertPCIds();
1491 $this->obj->update(true, true);
1492 }
1493
1494 $this->obj->addFileSizes();
1495 $this->obj->addHierIDs();
1496
1497 $hids = $this->obj->getHierIds();
1498 $row1_ids = $this->obj->getFirstRowIds();
1499 $col1_ids = $this->obj->getFirstColumnIds();
1500 $litem_ids = $this->obj->getListItemIds();
1501 $fitem_ids = $this->obj->getFileItemIds();
1502
1503 // standard menues
1504 $hids = $this->obj->getHierIds();
1505 foreach($hids as $hid)
1506 {
1507 $tpl->setCurrentBlock("add_dhtml");
1508 $tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
1509 $tpl->parseCurrentBlock();
1510 }
1511
1512 // column menues for tables
1513 foreach($col1_ids as $hid)
1514 {
1515 $tpl->setCurrentBlock("add_dhtml");
1516 $tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
1517 $tpl->parseCurrentBlock();
1518 }
1519
1520 // row menues for tables
1521 foreach($row1_ids as $hid)
1522 {
1523 $tpl->setCurrentBlock("add_dhtml");
1524 $tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
1525 $tpl->parseCurrentBlock();
1526 }
1527
1528 // list item menues
1529 foreach($litem_ids as $hid)
1530 {
1531 $tpl->setCurrentBlock("add_dhtml");
1532 $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1533 $tpl->parseCurrentBlock();
1534 }
1535
1536 // file item menues
1537 foreach($fitem_ids as $hid)
1538 {
1539 $tpl->setCurrentBlock("add_dhtml");
1540 $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1541 $tpl->parseCurrentBlock();
1542 }
1543 }
1544 else
1545 {
1546 $this->obj->addFileSizes();
1547 }
1548
1549//echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
1550//echo "<br>-".htmlentities($this->getLinkXML())."-";
1551
1552 // set default link xml, if nothing was set yet
1553 if (!$this->link_xml_set)
1554 {
1555 $this->setDefaultLinkXml();
1556 }
1557
1558 //$content = $this->obj->getXMLFromDom(false, true, true,
1559 // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1560 $link_xml = $this->getLinkXML();
1561
1562 // disable/enable auto margins
1563 if ($this->getStyleId() > 0)
1564 {
1565 if (ilObject::_lookupType($this->getStyleId()) == "sty")
1566 {
1567 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1568 $style = new ilObjStyleSheet($this->getStyleId());
1569 $template_xml = $style->getTemplateXML();
1570 $disable_auto_margins = "n";
1571 if ($style->lookupStyleSetting("disable_auto_margins"))
1572 {
1573 $disable_auto_margins = "y";
1574 }
1575 }
1576 }
1577
1578 if ($this->getAbstractOnly())
1579 {
1580 $content = "<dummy><PageObject><PageContent><Paragraph>".
1581 $this->obj->getFirstParagraphText().$link_xml.
1582 "</Paragraph></PageContent></PageObject></dummy>";
1583 }
1584 else
1585 {
1586 $content = $this->obj->getXMLFromDom(false, true, true,
1587 $link_xml.$this->getQuestionXML().$template_xml.$this->getComponentPluginsXML());
1588 }
1589
1590 // check validation errors
1591 if($builded !== true)
1592 {
1593 $this->displayValidationError($builded);
1594 }
1595 else
1596 {
1597 $this->displayValidationError($_SESSION["il_pg_error"]);
1598 }
1599 unset($_SESSION["il_pg_error"]);
1600
1601 if(isset($_SESSION["citation_error"]))
1602 {
1603 ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
1604 ilSession::clear("citation_error");
1605 }
1606
1607 // get title
1608 $pg_title = $this->getPresentationTitle();
1609
1610 $col_path = ilUtil::getImagePath("col.svg");
1611 $row_path = ilUtil::getImagePath("row.svg");
1612 $item_path = ilUtil::getImagePath("item.svg");
1613
1614 if ($this->getOutputMode() != "offline")
1615 {
1616 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1617 $wb_path = ilUtil::getWebspaceDir("output")."/";
1618 }
1619 else
1620 {
1621 $enlarge_path = "images/enlarge.svg";
1622 $wb_path = "";
1623 }
1624 $pg_title_class = ($this->getOutputMode() == "print")
1625 ? "ilc_PrintPageTitle"
1626 : "";
1627
1628 // page splitting only for learning modules and
1629 // digital books
1630 $enable_split_new = ($this->obj->getParentType() == "lm" ||
1631 $this->obj->getParentType() == "dbk")
1632 ? "y"
1633 : "n";
1634
1635 // page splitting to next page only for learning modules and
1636 // digital books if next page exists in tree
1637 if (($this->obj->getParentType() == "lm" ||
1638 $this->obj->getParentType() == "dbk") &&
1639 ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
1640 $this->obj->getId()))
1641 {
1642 $enable_split_next = "y";
1643 }
1644 else
1645 {
1646 $enable_split_next = "n";
1647 }
1648
1649 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1650
1651
1652 if ($this->getPageConfig()->getEnablePCType("Tabs"))
1653 {
1654 //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1655 //ilYuiUtil::initTabView();
1656 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1659 }
1660
1661 $file_download_link = $this->determineFileDownloadLink();
1662 $fullscreen_link = $this->determineFullscreenLink();
1663 $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1664
1665 // default values for various parameters (should be used by
1666 // all instances in the future)
1667 $media_mode = ($this->getOutputMode() == "edit")
1668 ? $ilUser->getPref("ilPageEditor_MediaMode")
1669 : "enable";
1670
1671 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1672 $paste = (ilEditClipboard::getAction() == "copy" &&
1673 $this->getOutputMode() == "edit");
1674
1675 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1676
1677 $flv_video_player = ($this->getOutputMode() != "offline")
1680
1681 $cfg = $this->getPageConfig();
1682
1683 $current_ts = time();
1684 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1685
1686 // added UTF-8 encoding otherwise umlaute are converted too
1687 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1688 $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
1689 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1690 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1691 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1692 'img_col' => $col_path,
1693 'img_row' => $row_path,
1694 'img_item' => $item_path,
1695 'enable_split_new' => $enable_split_new,
1696 'enable_split_next' => $enable_split_next,
1697 'link_params' => $this->link_params,
1698 'file_download_link' => $file_download_link,
1699 'fullscreen_link' => $fullscreen_link,
1700 'img_path' => $img_path,
1701 'parent_id' => $this->obj->getParentId(),
1702 'download_script' => $this->sourcecode_download_script,
1703 'encoded_download_script' => urlencode($this->sourcecode_download_script),
1704 // digilib
1705 'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
1706 'pagebreak' => $this->lng->txt('dgl_pagebreak'),
1707 'page' => $this->lng->txt('page'),
1708 'citate_page' => $this->lng->txt('citate_page'),
1709 'citate_from' => $this->lng->txt('citate_from'),
1710 'citate_to' => $this->lng->txt('citate_to'),
1711 'citate' => $this->lng->txt('citate'),
1712 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1713 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1714 'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1715 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1716 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1717 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1718 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1719 'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1720 'paste' => $paste ? "y" : "n",
1721 'media_mode' => $media_mode,
1722 'javascript' => $sel_js_mode,
1723 'paragraph_plugins' => $paragraph_plugin_string,
1724 'disable_auto_margins' => $disable_auto_margins,
1725 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1726 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1727 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1728 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1729 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1730 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1731 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1732 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1733 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1734 'current_ts' => $current_ts,
1735 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1736 'flv_video_player' => $flv_video_player
1737 );
1738 if($this->link_frame != "") // todo other link types
1739 $params["pg_frame"] = $this->link_frame;
1740
1741 //$content = str_replace("&nbsp;", "", $content);
1742
1743 // this ensures that cache is emptied with every update
1744 $params["version"] = ILIAS_VERSION;
1745 // ensure no cache hit, if included files/media objects have been changed
1746 $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1747
1748
1749 // should be modularized
1750 include_once("./Services/COPage/classes/class.ilPCSection.php");
1752
1753 // run xslt
1754 $md5 = md5(serialize($params).$link_xml.$template_xml.$md5_adds);
1755
1756//$a = microtime();
1757
1758 // check cache (same parameters, non-edit mode and rendered time
1759 // > last change
1760 if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1761 !$this->getCompareMode() &&
1762 !$this->getAbstractOnly() &&
1763 $md5 == $this->obj->getRenderMd5() &&
1764 ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1765 $this->obj->getRenderedTime() != "" &&
1766 $this->obj->old_nr == 0)
1767 {
1768 // cache hit
1769 $output = $this->obj->getRenderedContent();
1770 }
1771 else
1772 {
1773 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1774
1775 $this->log->debug("Calling XSLT, content: ".$content);
1776 //echo $content; exit;
1777 //$content = '<dummy><PageObject></PageObject><MediaObject Id="il__mob_350071"><MediaItem Purpose="Standard"><Location Type="LocalFile">01_Course_Kick_off500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /><MapArea Shape="WholePicture" Coords="" ><ExtLink Href="" Title="">https://lms.skyguide.corp/goto.php?target=fold_323629&client_id=skyguide</ExtLink></MapArea></MediaItem></MediaObject><MediaObject Id="il__mob_350072"><MediaItem Purpose="Standard"><Location Type="LocalFile">02_Feasibility500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350073"><MediaItem Purpose="Standard"><Location Type="LocalFile">03_Preparation500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350074"><MediaItem Purpose="Standard"><Location Type="LocalFile">05_Planning500pix.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350076"><MediaItem Purpose="Standard"><Location Type="LocalFile">06_SIM_Kick_off500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350077"><MediaItem Purpose="Standard"><Location Type="LocalFile">07_TVAL500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="70" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350078"><MediaItem Purpose="Standard"><Location Type="LocalFile">08_PVAL500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="70" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350079"><MediaItem Purpose="Standard"><Location Type="LocalFile">09_OVAL500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350080"><MediaItem Purpose="Standard"><Location Type="LocalFile">10_Course500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350081"><MediaItem Purpose="Standard"><Location Type="LocalFile">11_Evaluation500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="71" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350082"><MediaItem Purpose="Standard"><Location Type="LocalFile">100_Accountable500pix_100_0.png</Location><Format>image/png</Format><Layout Width="100" Height="69" HorizontalAlign="Left" /></MediaItem></MediaObject><MediaObject Id="il__mob_350241"><MediaItem Purpose="Standard"><Location Type="LocalFile">Picture30LINK_450_0.PNG</Location><Format>image/png</Format><Layout Width="450" Height="24" HorizontalAlign="Left" /><MapArea Shape="WholePicture" Coords="" ><ExtLink Href="http://lms.skyguide.corp/goto.php?target=file_323721_download&amp;client_id=skyguide" Title=""></ExtLink></MapArea></MediaItem></MediaObject></dummy>';
1778
1779
1780 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1781 $xh = xslt_create();
1782 // echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
1783 // echo "mode:".$this->getOutputMode().":<br>";
1784 $output = xslt_process($xh, "arg:/_xml","arg:/_xsl", NULL, $args, $params);
1785
1786 if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1787 && !$this->getAbstractOnly()
1788 && $this->obj->old_nr == 0)
1789 {
1790//echo "writerenderedcontent";
1791 $this->obj->writeRenderedContent($output, $md5);
1792 }
1793 //echo xslt_error($xh);
1794 xslt_free($xh);
1795 }
1796
1797//$b = microtime();
1798//echo "$a - $b";
1799//echo "<pre>".htmlentities($output)."</pre>";
1800
1801 // unmask user html
1802 if (($this->getOutputMode() != "edit" ||
1803 $ilUser->getPref("ilPageEditor_HTMLMode") != "disable")
1804 && !$this->getPageConfig()->getPreventHTMLUnmasking())
1805 {
1806 $output = str_replace("&lt;","<",$output);
1807 $output = str_replace("&gt;",">",$output);
1808 }
1809 $output = str_replace("&amp;", "&", $output);
1810
1811 $output = ilUtil::insertLatexImages($output);
1812
1813 // insert page snippets
1814 $output = $this->insertContentIncludes($output);
1815
1816 // insert resource blocks
1817 $output = $this->insertResources($output);
1818
1819 // insert page toc
1820 if ($this->getPageConfig()->getEnablePageToc())
1821 {
1822 $output = $this->insertPageToc($output);
1823 }
1824
1825 // insert advanced output trigger
1826 $output = $this->insertAdvTrigger($output);
1827
1828 // workaround for preventing template engine
1829 // from hiding paragraph text that is enclosed
1830 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1831 $output = $this->replaceCurlyBrackets($output);
1832
1833 // remove all newlines (important for code / pre output)
1834 $output = str_replace("\n", "", $output);
1835
1836//echo htmlentities($output);
1837 $output = $this->postOutputProcessing($output);
1838//echo htmlentities($output);
1839 if($this->getOutputMode() == "edit" &&
1840 !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation()))
1841 {
1842 $output = '<div class="il_editarea_disabled">'.$output.'</div>';
1843 }
1844
1845 // for all page components...
1846 include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1848 foreach ($defs as $def)
1849 {
1851 $pc_class = $def["pc_class"];
1852 $pc_obj = new $pc_class($this->getPageObject());
1853
1854 // post xsl page content modification by pc elements
1855 $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
1856
1857 // javascript files
1858 $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
1859 foreach ($js_files as $js)
1860 {
1861 $GLOBALS["tpl"]->addJavascript($js);
1862 }
1863
1864 // css files
1865 $css_files = $pc_obj->getCssFiles($this->getOutputMode());
1866 foreach ($css_files as $css)
1867 {
1868 $GLOBALS["tpl"]->addCss($css);
1869 }
1870
1871 // onload code
1872 $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
1873 foreach ($onload_code as $code)
1874 {
1875 $GLOBALS["tpl"]->addOnloadCode($code);
1876 }
1877 }
1878
1879// $output = $this->selfAssessmentRendering($output);
1880
1881 // output
1882 if ($ilCtrl->isAsynch() && !$this->getRawPageContent() &&
1883 $this->getOutputMode() == "edit")
1884 {
1885 // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1886 if ($_GET["updated_pc_id_str"] != "")
1887 {
1888 echo $_GET["updated_pc_id_str"];
1889 }
1890 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1891 $tpl->setCurrentBlock("edit_page");
1892 $tpl->parseCurrentBlock();
1893 echo $tpl->get("edit_page");
1894 exit;
1895 }
1896 if ($this->outputToTemplate())
1897 {
1898 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1899 $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1900 return $output;
1901 }
1902 else
1903 {
1904 if ($this->getRawPageContent()) // e.g. needed in glossaries
1905 {
1906 return $output;
1907 }
1908 else
1909 {
1910 $tpl->setVariable($this->getTemplateOutputVar(), $output);
1911 return $tpl->get();
1912 }
1913 }
1914 }
1915
1922 function replaceCurlyBrackets($output)
1923 {
1924//echo "<br><br>".htmlentities($output);
1925
1926 while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1927 is_int($end = strpos($output, "<!--ParEnd-->", $start)))
1928 {
1929 $output = substr($output, 0, $start).
1930 str_replace(array("{","}"), array("&#123;","&#125;"),
1931 substr($output, $start + 15, $end - ($start + 15))).
1932 substr($output, $end + 13);
1933 }
1934
1935// $output = str_replace("{", "&#123;", $output);
1936// $output = str_replace("}", "&#125;", $output);
1937//echo "<br><br>".htmlentities($output);
1938 return $output;
1939 }
1940
1944 protected function getActivationCaptions()
1945 {
1946 global $lng;
1947
1948 return array("deactivatePage" => $lng->txt("cont_deactivate_page"),
1949 "activatePage" => $lng->txt("cont_activate_page"));
1950 }
1951
1955 function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
1956 {
1957 global $lng, $ilCtrl;
1958
1959 // actions
1960 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1961
1962 // activate/deactivate
1963 $list = new ilAdvancedSelectionListGUI();
1964 $list->setListTitle($lng->txt("actions"));
1965 $list->setId("copage_act");
1966 $entries = false;
1967 if ($this->getPageConfig()->getEnableActivation())
1968 {
1969 $entries = true;
1970 $captions = $this->getActivationCaptions();
1971 if ($this->getPageObject()->getActive())
1972 {
1973 $list->addItem($captions["deactivatePage"], "",
1974 $ilCtrl->getLinkTarget($this, "deactivatePage"));
1975 }
1976 else
1977 {
1978 $list->addItem($captions["activatePage"], "",
1979 $ilCtrl->getLinkTarget($this, "activatePage"));
1980 }
1981
1982 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
1983 }
1984
1985 // initially opened content
1986 if ($this->getPageConfig()->getUseAttachedContent())
1987 {
1988 $entries = true;
1989 $list->addItem($lng->txt("cont_initial_attached_content"), "",
1990 $ilCtrl->getLinkTarget($this, "initialOpenedContent"));
1991 }
1992
1993 // multi-lang actions
1994 if ($this->addMultiLangActionsAndInfo($list, $a_tpl))
1995 {
1996 $entries = true;
1997 }
1998
1999 if ($entries)
2000 {
2001 $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2002 }
2003
2004 $lng->loadLanguageModule("content");
2005 $list = new ilAdvancedSelectionListGUI();
2006 $list->setListTitle($lng->txt("cont_edit_mode"));
2007 $list->setId("copage_ed_mode");
2008
2009 // media mode
2010 if ($sel_media_mode == "enable")
2011 {
2012 $ilCtrl->setParameter($this, "media_mode", "disable");
2013 $list->addItem($lng->txt("cont_deactivate_media"), "",
2014 $ilCtrl->getLinkTarget($this, "setEditMode"));
2015 }
2016 else
2017 {
2018 $ilCtrl->setParameter($this, "media_mode", "enable");
2019 $list->addItem($lng->txt("cont_activate_media"), "",
2020 $ilCtrl->getLinkTarget($this, "setEditMode"));
2021 }
2022 $ilCtrl->setParameter($this, "media_mode", "");
2023
2024 // html mode
2025 if (!$this->getPageConfig()->getPreventHTMLUnmasking())
2026 {
2027 if ($sel_html_mode == "enable")
2028 {
2029 $ilCtrl->setParameter($this, "html_mode", "disable");
2030 $list->addItem($lng->txt("cont_deactivate_html"), "",
2031 $ilCtrl->getLinkTarget($this, "setEditMode"));
2032 }
2033 else
2034 {
2035 $ilCtrl->setParameter($this, "html_mode", "enable");
2036 $list->addItem($lng->txt("cont_activate_html"), "",
2037 $ilCtrl->getLinkTarget($this, "setEditMode"));
2038 }
2039 }
2040 $ilCtrl->setParameter($this, "html_mode", "");
2041
2042 // js mode
2043 if ($sel_js_mode == "enable")
2044 {
2045 $ilCtrl->setParameter($this, "js_mode", "disable");
2046 $list->addItem($lng->txt("cont_deactivate_js"), "",
2047 $ilCtrl->getLinkTarget($this, "setEditMode"));
2048 }
2049 else
2050 {
2051 $ilCtrl->setParameter($this, "js_mode", "enable");
2052 $list->addItem($lng->txt("cont_activate_js"), "",
2053 $ilCtrl->getLinkTarget($this, "setEditMode"));
2054 }
2055 $ilCtrl->setParameter($this, "js_mode", "");
2056
2057 $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2058 }
2059
2066 function addMultiLangActionsAndInfo($a_list, $a_tpl)
2067 {
2068 global $lng, $ilCtrl;
2069
2070 $any_items = false;
2071
2072 $cfg = $this->getPageConfig();
2073
2074 // general multi lang support and single page mode?
2075 if ($cfg->getMultiLangSupport())
2076 {
2077 //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
2078 //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
2079 // $this->getPageObject()->getParentId());
2080
2081 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2082 $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
2083
2084 if (!$ot->getContentActivated())
2085 {
2086/* if ($cfg->getSinglePageMode())
2087 {
2088 $a_list->addItem($lng->txt("cont_activate_multi_lang"), "",
2089 $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
2090
2091 $any_items = true;
2092 }*/
2093 }
2094 else
2095 {
2096 $lng->loadLanguageModule("meta");
2097//echo $this->getPageObject()->getLanguage();
2098 if ($this->getPageObject()->getLanguage() != "-")
2099 {
2100 $l = $ot->getMasterLanguage();
2101 $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2102 $lng->txt("meta_l_".$l), "",
2103 $ilCtrl->getLinkTarget($this, "editMasterLanguage"));
2104 }
2105
2106 foreach ($ot->getLanguages() as $al => $lang)
2107 {
2108 if ($this->getPageObject()->getLanguage() != $al &&
2109 $al != $ot->getMasterLanguage())
2110 {
2111 $ilCtrl->setParameter($this, "totransl", $al);
2112 $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2113 $lng->txt("meta_l_".$al), "",
2114 $ilCtrl->getLinkTarget($this, "switchToLanguage"));
2115 $ilCtrl->setParameter($this, "totransl", $_GET["totransl"]);
2116 }
2117 }
2118
2119/* if ($cfg->getSinglePageMode())
2120 {
2121 $a_list->addItem($lng->txt("cont_manage_multilang"), "",
2122 $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
2123 }*/
2124
2125 include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
2126 $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(),
2127 $this->getPageObject()->getParentId());
2128 $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
2129
2130 $any_items = true;
2131 }
2132 }
2133
2134 return $any_items;
2135 }
2136
2137
2141 function setEditMode()
2142 {
2143 global $ilCtrl, $ilUser;
2144
2145 if ($_GET["media_mode"] != "")
2146 {
2147 if ($_GET["media_mode"] == "disable")
2148 {
2149 $ilUser->writePref("ilPageEditor_MediaMode", "disable");
2150 }
2151 else
2152 {
2153 $ilUser->writePref("ilPageEditor_MediaMode", "");
2154 }
2155 }
2156 if ($_GET["html_mode"] != "")
2157 {
2158 if ($_GET["html_mode"] == "disable")
2159 {
2160 $ilUser->writePref("ilPageEditor_HTMLMode", "disable");
2161 }
2162 else
2163 {
2164 $ilUser->writePref("ilPageEditor_HTMLMode", "");
2165 }
2166 }
2167 if ($_GET["js_mode"] != "")
2168 {
2169 if ($_GET["js_mode"] == "disable")
2170 {
2171 $ilUser->writePref("ilPageEditor_JavaScript", "disable");
2172 }
2173 else
2174 {
2175 $ilUser->writePref("ilPageEditor_JavaScript", "");
2176 }
2177 }
2178
2179 $ilCtrl->redirect($this, "edit");
2180 }
2181
2182
2186 static function getTinyMenu($a_par_type,
2187 $a_int_links = false, $a_wiki_links = false, $a_keywords = false,
2188 $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true,
2189 $a_anchors = false, $a_save_new = true, $a_user_links = false)
2190 {
2191 global $lng, $ilCtrl;
2192
2193 $mathJaxSetting = new ilSetting("MathJax");
2194
2195 include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2196
2197 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2198
2199 $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2200
2201 // debug ghost element
2202 if (DEVMODE == 1)
2203 {
2204 $btpl->touchBlock("debug_ghost");
2205 }
2206
2207 // bullet list
2208 $btpl->touchBlock("blist_button");
2209 ilTooltipGUI::addTooltip("il_edm_blist",
2210 $lng->txt("cont_blist"),
2211 "iltinymenu_bd");
2212
2213 // numbered list
2214 $btpl->touchBlock("nlist_button");
2215 ilTooltipGUI::addTooltip("il_edm_nlist",
2216 $lng->txt("cont_nlist"),
2217 "iltinymenu_bd");
2218
2219 // list indent
2220 $btpl->touchBlock("list_indent");
2221 ilTooltipGUI::addTooltip("ilIndentBut",
2222 $lng->txt("cont_list_indent"),
2223 "iltinymenu_bd");
2224
2225 // list outdent
2226 $btpl->touchBlock("list_outdent");
2227 ilTooltipGUI::addTooltip("ilOutdentBut",
2228 $lng->txt("cont_list_outdent"),
2229 "iltinymenu_bd");
2230
2231 if ($a_int_links)
2232 {
2233 $btpl->touchBlock("bb_ilink_button");
2234 ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"),
2235 "iltinymenu_bd");
2236 }
2237 ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"),
2238 "iltinymenu_bd");
2239
2240 if ($a_user_links)
2241 {
2242 $btpl->touchBlock("bb_ulink_button");
2243 }
2244
2245 // remove format
2246 $btpl->touchBlock("rformat_button");
2247 ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"),
2248 "iltinymenu_bd");
2249
2250 if ($a_paragraph_styles)
2251 {
2252 // new paragraph
2253 $btpl->setCurrentBlock("new_par");
2254 $btpl->setVariable("IMG_NEWPAR", "+");
2255 $btpl->parseCurrentBlock();
2256 ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"),
2257 "iltinymenu_bd");
2258
2259 $btpl->setCurrentBlock("par_edit");
2260 $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2261 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2262 $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected,
2263 ilPCParagraphGUI::_getCharacteristics($a_style_id), true));
2264
2265 ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection",
2266 $lng->txt("cont_paragraph_styles"), "iltinymenu_bd");
2267
2268 $btpl->parseCurrentBlock();
2269 }
2270
2271 if ($a_keywords)
2272 {
2273 $btpl->setCurrentBlock("bb_kw_button");
2274 $btpl->setVariable("CC_KW", "kw");
2275 $btpl->parseCurrentBlock();
2276 ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"),
2277 "iltinymenu_bd");
2278
2279 }
2280
2281 if ($a_wiki_links)
2282 {
2283 $btpl->setCurrentBlock("bb_wikilink_button2");
2284 $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
2285 $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", ""));
2286 $btpl->parseCurrentBlock();
2287 ilTooltipGUI::addTooltip("il_edm_wlinkd", $lng->txt("cont_wiki_link_dialog"),
2288 "iltinymenu_bd");
2289
2290 $btpl->setCurrentBlock("bb_wikilink_button");
2291 $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2292 $btpl->parseCurrentBlock();
2293 ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"),
2294 "iltinymenu_bd");
2295 }
2296
2297 $aset = new ilSetting("adve");
2298
2299 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2300 foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st)
2301 {
2302 // these are handled via drop down now...
2303 if (in_array($c, array("com", "quot", "acc", "code")))
2304 {
2305 continue;
2306 }
2308 $a_par_type, "active_".$c, true))
2309 {
2310 $cc_code = $c;
2311 if ($aset->get("use_physical"))
2312 {
2313 $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2314 }
2315
2316 if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2317 {
2318 $btpl->setCurrentBlock("bb_".$c."_button");
2319 $btpl->setVariable("CC_".strtoupper($c), $cc_code);
2320 $btpl->parseCurrentBlock();
2321 ilTooltipGUI::addTooltip("il_edm_cc_".$c,
2322 $lng->txt("cont_cc_".$c),
2323 "iltinymenu_bd");
2324
2325// $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2326 }
2327 }
2328 }
2329
2330 if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2331 {
2332 ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"),
2333 "iltinymenu_bd");
2334 }
2335 ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"),
2336 "iltinymenu_bd");
2337
2338 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2339 $sdd = new ilAdvancedSelectionListGUI();
2340 $sdd->setPullRight(false);
2341 $sdd->setListTitle($lng->txt("save")."...");
2342
2343 if ($a_save_return)
2344 {
2345 $btpl->setCurrentBlock("save_return");
2346 $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2347 $btpl->parseCurrentBlock();
2348 $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;");
2349 }
2350
2351 if ($a_save_new)
2352 {
2353 $btpl->setCurrentBlock("save_new");
2354 $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
2355 $btpl->parseCurrentBlock();
2356 $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;");
2357 }
2358
2359 $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;");
2360 $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;");
2361
2362 if ($a_anchors)
2363 {
2364 $btpl->setCurrentBlock("bb_anc_button");
2365 $btpl->setVariable("CC_ANC", "anc");
2366 $btpl->parseCurrentBlock();
2367 ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"),
2368 "iltinymenu_bd");
2369 }
2370
2371 $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML());
2372
2373/* // footnote
2374 $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2375 $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2376 $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2377*/
2378// $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2379
2380 $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2381 $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2382
2383 $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2384 $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2385 $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2386 $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2387 $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2388
2389 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2390 $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type));
2391 ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection",
2392 $lng->txt("cont_more_character_styles"), "iltinymenu_bd");
2393
2394 return $btpl->get();
2395 }
2396
2401 {
2402 global $ilCtrl;
2403
2404 $int_links = $this->getPageObject()->getInternalLinks();
2405//var_dump($int_links);
2406 $link_info = "<IntLinkInfos>";
2407 $targetframe = "None";
2408 foreach ($int_links as $int_link)
2409 {
2410 $target = $int_link["Target"];
2411 if (substr($target, 0, 4) == "il__")
2412 {
2413 $target_arr = explode("_", $target);
2414 $target_id = $target_arr[count($target_arr) - 1];
2415 $type = $int_link["Type"];
2416
2417 $targetframe = ($int_link["TargetFrame"] != "")
2418 ? $int_link["TargetFrame"]
2419 : "None";
2420
2421 $ltarget="_top";
2422 if ($targetframe != "None")
2423 {
2424 $ltarget="_blank";
2425 }
2426
2427 // anchor
2428 $anc = $anc_add = "";
2429 if ($int_link["Anchor"] != "")
2430 {
2431 $anc = $int_link["Anchor"];
2432 $anc_add = "_".rawurlencode($int_link["Anchor"]);
2433 }
2434
2435 $href = "";
2436 $lcontent = "";
2437 switch($type)
2438 {
2439 case "PageObject":
2440 case "StructureObject":
2442 if ($type == "PageObject")
2443 {
2444 $href = "./goto.php?target=pg_".$target_id.$anc_add;
2445 }
2446 else
2447 {
2448 $href = "./goto.php?target=st_".$target_id;
2449 }
2450 break;
2451
2452 case "GlossaryItem":
2453 if ($targetframe == "None")
2454 {
2455 $targetframe = "Glossary";
2456 }
2457 $href = "./goto.php?target=git_".$target_id;
2458 break;
2459
2460 case "MediaObject":
2461 $ilCtrl->setParameter($this, "mob_id", $target_id);
2462 //$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
2463 $href = $ilCtrl->getLinkTarget($this, "displayMedia");
2464 $ilCtrl->setParameter($this, "mob_id", "");
2465 break;
2466
2467 case "WikiPage":
2468 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
2470 break;
2471
2472 case "RepositoryItem":
2473 $obj_type = ilObject::_lookupType($target_id, true);
2475 $href = "./goto.php?target=".$obj_type."_".$target_id;
2476 break;
2477
2478 case "User":
2479 $obj_type = ilObject::_lookupType($target_id);
2480 if ($obj_type == "usr")
2481 {
2482 include_once("./Services/User/classes/class.ilUserUtil.php");
2483 $back = $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
2484 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $target_id);
2485 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
2486 rawurlencode($back));
2487 $href = "";
2488 include_once("./Services/User/classes/class.ilUserUtil.php");
2490 {
2491 $href = $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML");
2492 }
2493 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", "");
2494 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
2495 }
2496 break;
2497
2498 }
2499 $anc_par = 'Anchor="'.$anc.'"';
2500 $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".$anc_par." ".
2501 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" />";
2502 }
2503 }
2504 $link_info.= "</IntLinkInfos>";
2505 $this->setLinkXML($link_info);
2506 }
2507
2511 function downloadFile()
2512 {
2513 $this->obj->buildDom();
2514
2515 include_once("./Services/COPage/classes/class.ilPCFileList.php");
2516 $files = ilPCFileList::collectFileItems($this->obj, $this->obj->getDomDoc());
2517
2518 $file = explode("_", $_GET["file_id"]);
2519 require_once("./Modules/File/classes/class.ilObjFile.php");
2520 $file_id = $file[count($file) - 1];
2521
2522 // file must be in page
2523 if (!in_array($file_id, $files))
2524 {
2525 exit;
2526 }
2527 $fileObj =& new ilObjFile($file_id, false);
2528 $fileObj->sendFile();
2529 exit;
2530 }
2531
2536 {
2537 $this->displayMedia(true);
2538 }
2539
2543 function displayMedia($a_fullscreen = false)
2544 {
2545 global $tpl;
2546
2547 $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2548 $tpl->setCurrentBlock("ilMedia");
2549
2550 //$int_links = $page_object->getInternalLinks();
2551 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2552
2553 // @todo
2554 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2555
2556 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2557 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2558 require_once("./Services/COPage/classes/class.ilPageObject.php");
2559 $pg_obj = $this->getPageObject();
2560 $pg_obj->buildDom();
2561
2562 if (!empty ($_GET["pg_id"]))
2563 {
2564 $xml = "<dummy>";
2565 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2566 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2567 $xml.= $link_xml;
2568 $xml.="</dummy>";
2569 }
2570 else
2571 {
2572 $xml = "<dummy>";
2573 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2574 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2575 $xml.= $link_xml;
2576 $xml.="</dummy>";
2577 }
2578
2579 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2580 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2581 $xh = xslt_create();
2582
2583 $mode = "media";
2584 if ($a_fullscreen)
2585 {
2586 $mode = "fullscreen";
2587 }
2588
2589//echo "<b>XML:</b>".htmlentities($xml);
2590 // determine target frames for internal links
2591 $wb_path = ilUtil::getWebspaceDir("output")."/";
2592 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2593 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
2594 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
2595 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2596 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
2597//echo "<br><br>".htmlentities($output);
2598 //echo xslt_error($xh);
2599 xslt_free($xh);
2600
2601 // unmask user html
2602 require_once('./Services/Style/classes/class.ilObjStyleSheet.php');
2603 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2605 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2606 $tpl->setVariable("MEDIA_CONTENT", $output);
2607
2608 // add js
2609 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2611 $tpl->fillJavaScriptFiles();
2612 $tpl->fillCssFiles();
2613
2614 echo $tpl->get();
2615 exit;
2616 }
2617
2622 {
2623 $pg_obj = $this->getPageObject();
2624 $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2625 }
2626
2630 function insertContentIncludes($a_html)
2631 {
2632 global $ilCtrl, $lng;
2633
2634 $c_pos = 0;
2635 $start = strpos($a_html, "{{{{{ContentInclude;");
2636 if (is_int($start))
2637 {
2638 $end = strpos($a_html, "}}}}}", $start);
2639 }
2640 $i = 1;
2641 while ($end > 0)
2642 {
2643 $param = substr($a_html, $start + 20, $end - $start - 20);
2644 $param = explode(";", $param);
2645
2646 if ($param[0] == "mep" && is_numeric($param[1]))
2647 {
2648 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
2649
2650 $snippet_lang = $this->getLanguage();
2651 if (!ilPageObject::_exists("mep", $param[1], $snippet_lang))
2652 {
2653 $snippet_lang = "-";
2654 }
2655 if (($param[2] <= 0 || $param[2] == IL_INST_ID) && ilMediaPoolPage::_exists($param[1]))
2656 {
2657 $page_gui = new ilMediaPoolPageGUI($param[1], 0, true, $snippet_lang);
2658 if ($this->getOutputMode() != "offline")
2659 {
2660 $page_gui->setFileDownloadLink($this->determineFileDownloadLink());
2661 $page_gui->setFullscreenLink($this->determineFullscreenLink());
2662 $page_gui->setSourceCodeDownloadScript($this->determineSourcecodeDownloadScript());
2663 }
2664 else
2665 {
2666 $page_gui->setOutputMode(IL_PAGE_OFFLINE);
2667 }
2668
2669 $html = $page_gui->getRawContent();
2670 }
2671 else
2672 {
2673 if ($this->getOutputMode() == "edit")
2674 {
2675 if ($param[2] <= 0)
2676 {
2677 $html = "// ".$lng->txt("cont_missing_snippet")." //";
2678 }
2679 else
2680 {
2681 $html = "// ".$lng->txt("cont_snippet_from_another_installation")." //";
2682 }
2683 }
2684 }
2685 $h2 = substr($a_html, 0, $start).
2686 $html.
2687 substr($a_html, $end + 5);
2688 $a_html = $h2;
2689 $i++;
2690 }
2691
2692 $start = strpos($a_html, "{{{{{ContentInclude;", $start + 5);
2693 $end = 0;
2694 if (is_int($start))
2695 {
2696 $end = strpos($a_html, "}}}}}", $start);
2697 }
2698 }
2699 return $a_html;
2700 }
2701
2708 function insertPageToc($a_output)
2709 {
2710 global $lng;
2711
2712 include_once("./Services/Utilities/classes/class.ilStr.php");
2713
2714 // extract all headings
2715 $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2716 $page_heads = array();
2717 foreach ($offsets as $os)
2718 {
2719 $level = (int) substr($a_output, $os + 10, 1);
2720 if (in_array($level, array(1,2,3)))
2721 {
2722 $anchor = str_replace("TocH", "TocA",
2723 substr($a_output, $os, strpos($a_output, "<", $os) - $os - 3)
2724 );
2725
2726 // get heading
2727 $tag_start = stripos($a_output, "<h".$level." ", $os);
2728 $tag_end = stripos($a_output, "</h".$level.">", $tag_start);
2729 $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2730
2731 // get headings text
2732 $text_start = stripos($head, ">") + 1;
2733 $text_end = strripos($head, "<!--", $text_start);
2734 $text = substr($head, $text_start, $text_end - $text_start);
2735 $page_heads[] = array("level" => $level, "text" => $text,
2736 "anchor" => $anchor);
2737 }
2738 }
2739
2740 if (count($page_heads) > 1)
2741 {
2742 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2743 $list = new ilNestedList();
2744 $list->setAutoNumbering(true);
2745 $list->setListClass("ilc_page_toc_PageTOCList");
2746 $list->setItemClass("ilc_page_toc_PageTOCItem");
2747 $i = 0;
2748 $c_depth = 1;
2749 $c_par[1] = 0;
2750 $c_par[2] = 0;
2751 $nr[1] = 1;
2752 $nr[2] = 1;
2753 $nr[3] = 1;
2754 foreach ($page_heads as $ind => $h)
2755 {
2756 $i++;
2757 $par = 0;
2758
2759 // check if we have a parent for one level up
2760 $par = 0;
2761 if ($h["level"] == 2 && $c_par[1] > 0)
2762 {
2763 $par = $c_par[1];
2764 }
2765 if ($h["level"] == 3 && $c_par[2] > 0)
2766 {
2767 $par = $c_par[2];
2768 }
2769
2770 $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2771
2772 // add the list node
2773 $list->addListNode(
2774 "<a href='#".$h["anchor"]."' class='ilc_page_toc_PageTOCLink'>".$h["text"]."</a>",
2775 $i, $par);
2776
2777 // set the node as current parent of the level
2778 if ($h["level"] == 1)
2779 {
2780 $c_par[1] = $i;
2781 $c_par[2] = 0;
2782 }
2783 if ($h["level"] == 2)
2784 {
2785 $c_par[2] = $i;
2786 }
2787 }
2788
2789 $tpl = new ilTemplate("tpl.page_toc.html", true, true,
2790 "Services/COPage");
2791 $tpl->setVariable("PAGE_TOC", $list->getHTML());
2792 $tpl->setVariable("TXT_PAGE_TOC", $lng->txt("cont_page_toc"));
2793 $tpl->setVariable("TXT_HIDE", $lng->txt("hide"));
2794 $tpl->setVariable("TXT_SHOW", $lng->txt("show"));
2795
2796 $a_output = str_replace("{{{{{PageTOC}}}}}",
2797 $tpl->get(), $a_output);
2798 $numbers = $list->getNumbers();
2799
2800 if (count($numbers) > 0)
2801 {
2802 include_once("./Services/Utilities/classes/class.ilStr.php");
2803 foreach ($numbers as $n)
2804 {
2805 $a_output =
2806 ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n." ", $a_output);
2807 }
2808 }
2809 }
2810 else
2811 {
2812 $a_output = str_replace("{{{{{PageTOC}}}}}",
2813 "", $a_output);
2814 }
2815
2816 return $a_output;
2817 }
2818
2825 function insertResources($a_output)
2826 {
2827 // this is edit mode only
2828
2829 if ($this->getEnablePCType("Resources") &&
2830 ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview"))
2831 {
2832 include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2833 $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2834 }
2835 return $a_output;
2836 }
2837
2838
2839
2846 function insertAdvTrigger($a_output)
2847 {
2848 global $lng;
2849
2850 if (!$this->getAbstractOnly())
2851 {
2852 $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2853 $lng->txt("cont_show_adv"), $a_output);
2854 $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2855 $lng->txt("cont_hide_adv"), $a_output);
2856 }
2857 else
2858 {
2859 $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2860 "", $a_output);
2861 $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2862 "", $a_output);
2863 }
2864
2865 return $a_output;
2866 }
2867
2868
2873 function postOutputProcessing($a_output)
2874 {
2875 return $a_output;
2876 }
2877
2881 function insertHelp($a_tpl)
2882 {
2883 global $lng;
2884
2885 $a_tpl->setCurrentBlock("help");
2886 $a_tpl->setVariable("TXT_ADD_EL", $lng->txt("cont_add_elements"));
2887 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
2888 $a_tpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD));
2889 $a_tpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG));
2890 $a_tpl->setVariable("TXT_DRAG", $lng->txt("cont_drag_and_drop_elements"));
2891 $a_tpl->setVariable("TXT_SEL", $lng->txt("cont_double_click_to_delete"));
2892 $a_tpl->parseCurrentBlock();
2893 }
2894
2899 {
2900 $this->preview();
2901 }
2902
2906 function preview()
2907 {
2908 global $tree;
2910 return $this->showPage();
2911 }
2912
2916 function edit()
2917 {
2918 global $tree, $lng, $ilCtrl, $ilSetting, $ilUser, $ilHelp;
2919
2920 // editing allowed?
2921 if (!$this->getEnableEditing())
2922 {
2923 ilUtil::sendFailure($lng->txt("permission_denied"), true);
2924 $ilCtrl->redirect($this, "preview");
2925 }
2926
2927 // not so nive workaround for container pages, bug #0015831
2928 $ptype = $this->getParentType();
2929 if ($ptype == "cont" && $_GET["ref_id"] > 0)
2930 {
2931 $ptype = ilObject::_lookupType((int) $_GET["ref_id"], true);
2932 }
2933 $ilHelp->setScreenId("edit_".$ptype);
2934
2935 require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2936 if(
2937 $ilUser->isAnonymous() &&
2938 !$ilUser->isCaptchaVerified() &&
2939 ilCaptchaUtil::isActiveForWiki()
2940 )
2941 {
2942 $form = $this->initCaptchaForm();
2943 if($_POST['captcha_code'] && $form->checkInput())
2944 {
2945 $ilUser->setCaptchaVerified(true);
2946 }
2947 else
2948 {
2949 return $form->getHTML();
2950 }
2951 }
2952
2953 // edit lock
2954 if (!$this->getPageObject()->getEditLock())
2955 {
2956 include_once("./Services/User/classes/class.ilUserUtil.php");
2957 $info = $lng->txt("content_no_edit_lock");
2958 $lock = $this->getPageObject()->getEditLockInfo();
2959 $info .= "</br>" . $lng->txt("content_until") . ": " .
2960 ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2961 $info .= "</br>" . $lng->txt("obj_usr") . ": " .
2962 ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2963 if (!$ilCtrl->isAsynch())
2964 {
2966 return "";
2967 }
2968 else
2969 {
2970 echo $this->tpl->getMessageHTML($info);
2971 exit;
2972 }
2973 }
2974 else
2975 {
2976 $aset = new ilSetting("adve");
2977
2978 $min = (int) $aset->get("block_mode_minutes") ;
2979 if ($min > 0)
2980 {
2981 include_once("./Services/User/classes/class.ilUserUtil.php");
2982 $lock = $this->getPageObject()->getEditLockInfo();
2983 $info = $lng->txt("cont_got_lock_until");
2984 $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX)), $info);
2985 //$info.= "</br>".$lng->txt("content_until").": ".
2986 // ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX));
2987 //$info.= "</br>".$lng->txt("obj_usr").": ".
2988 // ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2989 include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
2991 $but->setCaption("cont_finish_editing");
2992 $but->setUrl($ilCtrl->getLinkTarget($this, "releasePageLock"));
2993 $info = str_replace("%2", $but->render(), $info);
2995 }
2996 }
2997
2999
3000 $html = $this->showPage();
3001
3002 if ($this->isEnabledNotes())
3003 {
3004 $html.= "<br /><br />".$this->getNotesHTML();
3005 }
3006
3007 return $html;
3008 }
3009
3017 {
3018 global $tpl;
3019
3020// 'pl_hier_id' => string '2_1_1_1' (length=7)
3021// 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
3022 $html = $this->edit();
3023
3024 $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('".
3025 $_GET["pl_hier_id"].":".$_GET["pl_pc_id"].
3026 "');", 3);
3027
3028 return $html;
3029 }
3030
3034 public function initCaptchaForm()
3035 {
3040 global $lng, $ilCtrl;
3041
3042 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
3043 $form = new ilPropertyFormGUI();
3044
3045 require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
3046 $ci = new ilCaptchaInputGUI($lng->txt('cont_captcha_code'), 'captcha_code');
3047 $ci->setRequired(true);
3048 $form->addItem($ci);
3049
3050 $form->addCommandButton('edit', $lng->txt('ok'));
3051
3052 $form->setTitle($lng->txt('cont_captcha_verification'));
3053 $form->setFormAction($ilCtrl->getFormAction($this));
3054
3055 return $form;
3056 }
3057
3058 /*
3059 * presentation
3060 */
3062 {
3063 global $tree;
3064 $this->setOutputMode($a_mode);
3065
3066 return $this->showPage();
3067 }
3068
3069 function getHTML()
3070 {
3071 $this->getTabs("preview");
3072 return $this->showPage();
3073 }
3074
3078 function showMediaFullscreen($a_style_id = 0)
3079 {
3080 $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3081 $this->tpl->setCurrentBlock("ContentStyle");
3082 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3083 $this->tpl->parseCurrentBlock();
3084
3085 $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
3086 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3087 $this->tpl->setCurrentBlock("ilMedia");
3088
3089 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3090 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
3091 if (!empty ($_GET["pg_id"]))
3092 {
3093 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3094 $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
3095 $pg_obj->buildDom();
3096
3097 $xml = "<dummy>";
3098 // todo: we get always the first alias now (problem if mob is used multiple
3099 // times in page)
3100 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3101 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3102 $xml.="</dummy>";
3103 }
3104 else
3105 {
3106 $xml = "<dummy>";
3107 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
3108 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3109 $xml.="</dummy>";
3110 }
3111
3112//echo htmlentities($xml); exit;
3113
3114 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3115 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3116 $xh = xslt_create();
3117
3118//echo "<b>XML:</b>".htmlentities($xml);
3119 // determine target frames for internal links
3120 //$pg_frame = $_GET["frame"];
3121 $wb_path = ilUtil::getWebspaceDir("output")."/";
3122 $mode = "fullscreen";
3123 $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
3124 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
3125 echo xslt_error($xh);
3126 xslt_free($xh);
3127
3128 // unmask user html
3129 $this->tpl->setVariable("MEDIA_CONTENT", $output);
3130 }
3131
3137 function displayValidationError($a_error)
3138 {
3139 if(is_array($a_error))
3140 {
3141 $error_str = "<b>Error(s):</b><br>";
3142 foreach ($a_error as $error)
3143 {
3144 $err_mess = implode($error, " - ");
3145 if (!is_int(strpos($err_mess, ":0:")))
3146 {
3147 $error_str .= htmlentities($err_mess)."<br />";
3148 }
3149 }
3150 $this->tpl->setVariable("MESSAGE", $error_str);
3151 }
3152 }
3153
3157 function history()
3158 {
3159 global $tpl, $lng, $ilAccess;
3160
3161 if (!$this->getEnableEditing())
3162 {
3163 return;
3164 }
3165
3166 $tpl->addJavaScript("./Services/COPage/js/page_history.js");
3167
3168 include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3169 $table_gui = new ilPageHistoryTableGUI($this, "history");
3170 $table_gui->setId("hist_table");
3171 $entries = $this->getPageObject()->getHistoryEntries();
3172 $entries[] = array('page_id' => $this->getPageObject()->getId(),
3173 'parent_type' => $this->getPageObject()->getParentType(),
3174 'hdate' => $this->getPageObject()->getLastChange(),
3175 'parent_id' => $this->getPageObject()->getParentId(),
3176 'nr' => 0,
3177 'sortkey' => 999999,
3178 'user' => $this->getPageObject()->last_change_user);
3179 $table_gui->setData($entries);
3180 return $table_gui->getHTML();
3181 }
3182
3187 {
3188 global $tpl, $lng, $ilAccess, $ilCtrl;
3189
3190 if (!$this->getEnableEditing())
3191 {
3192 return;
3193 }
3194
3195 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3196 $c_gui = new ilConfirmationGUI();
3197
3198 // set confirm/cancel commands
3199 $ilCtrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3200 $c_gui->setFormAction($ilCtrl->getFormAction($this, "rollback"));
3201 $c_gui->setHeaderText($lng->txt("cont_rollback_confirmation"));
3202 $c_gui->setCancel($lng->txt("cancel"), "history");
3203 $c_gui->setConfirm($lng->txt("confirm"), "rollback");
3204
3205 $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3206
3207 $c_gui->addItem("id[]", $_GET["old_nr"],
3209
3210 $tpl->setContent($c_gui->getHTML());
3211 }
3212
3216 function rollback()
3217 {
3218 global $ilCtrl;
3219
3220 if (!$this->getEnableEditing())
3221 {
3222 return;
3223 }
3224
3225 $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3226
3227 if ($hentry["content"] != "")
3228 {
3229 $this->obj->setXMLContent($hentry["content"]);
3230 $this->obj->buildDom(true);
3231 if ($this->obj->update())
3232 {
3233 $ilCtrl->redirect($this, "history");
3234 }
3235 }
3236 $ilCtrl->redirect($this, "history");
3237 }
3238
3246 {
3247 global $ilHelp;
3248
3249 $ilHelp->setScreenIdComponent("copg");
3250 }
3251
3257 function getTabs($a_activate = "")
3258 {
3259 global $ilTabs, $ilCtrl, $ilUser;
3260
3261 $this->setScreenIdComponent();
3262
3263 if (!$this->getEnabledTabs())
3264 {
3265 return;
3266 }
3267
3268//echo "-".$ilCtrl->getNextClass()."-".$ilCtrl->getCmd()."-";
3269 // back to upper context
3270
3271 if (!$this->getEditPreview())
3272 {
3273 $ilTabs->addTarget("pg", $ilCtrl->getLinkTarget($this, "preview")
3274 , array("", "preview"));
3275
3276 if ($this->getEnableEditing())
3277 {
3278 $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3279 , array("", "edit"));
3280 }
3281 }
3282 else
3283 {
3284 if ($this->getEnableEditing())
3285 {
3286 $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3287 , array("", "edit"));
3288 }
3289
3290 $ilTabs->addTarget("cont_preview", $ilCtrl->getLinkTarget($this, "preview")
3291 , array("", "preview"));
3292 }
3293
3294 //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3295 // , "properties", get_class($this));
3296
3297 if ($this->use_meta_data)
3298 {
3299 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
3300 $mdgui = new ilObjectMetaDataGUI($this->meta_data_rep_obj,
3301 $this->meta_data_type, $this->meta_data_sub_obj_id);
3302 $mdtab = $mdgui->getTab();
3303 if($mdtab)
3304 {
3305 $ilTabs->addTarget("meta_data",
3306 $mdtab, "", "ilobjectmetadatagui");
3307 }
3308 }
3309
3310 $lm_set = new ilSetting("lm");
3311
3312 if ($this->getEnableEditing() && $lm_set->get("page_history", 1))
3313 {
3314 $ilTabs->addTarget("history", $this->ctrl->getLinkTarget($this, "history")
3315 , "history", get_class($this));
3316 if ($_GET["history_mode"] == "1" || $this->ctrl->getCmd() == "compareVersion")
3317 {
3318 $ilTabs->activateTab("history");
3319 }
3320 }
3321
3322/* $tabs = $this->ctrl->getTabs();
3323 foreach ($tabs as $tab)
3324 {
3325 $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3326 , $tab["cmd"], $tab["class"]);
3327 }
3328*/
3329 if ($this->getEnableEditing() && $ilUser->getId() != ANONYMOUS_USER_ID)
3330 {
3331 $ilTabs->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
3332 , "view", "ilEditClipboardGUI");
3333 }
3334
3335 if ($this->getPageConfig()->getEnableScheduledActivation())
3336 {
3337 $ilTabs->addTarget("cont_activation", $this->ctrl->getLinkTarget($this, "editActivation"),
3338 "editActivation", get_class($this));
3339 }
3340
3341 if ($this->getEnabledNews())
3342 {
3343 $ilTabs->addTarget("news",
3344 $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3345 "", "ilnewsitemgui");
3346 }
3347
3348 // external hook to add tabs
3349 if (is_array($this->tab_hook))
3350 {
3351 $func = $this->tab_hook["func"];
3352 $this->tab_hook["obj"]->$func();
3353 }
3354 //$ilTabs->setTabActive("pg");
3355 }
3356
3361 {
3362 global $lng;
3363
3364 if (!$this->getEnableEditing())
3365 {
3366 return;
3367 }
3368
3369 $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3370 $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3371
3372 // left page
3373 $lpage = $compare["l_page"];
3374 $cfg = $this->getPageConfig();
3375 $cfg->setPreventHTMLUnmasking(true);
3376
3378 $this->setPageObject($lpage);
3380 $this->setCompareMode(true);
3381
3382 $lhtml = $this->showPage();
3383 $lhtml = $this->replaceDiffTags($lhtml);
3384 $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3385 $tpl->setVariable("LEFT", $lhtml);
3386
3387 // right page
3388 $rpage = $compare["r_page"];
3389 $this->setPageObject($rpage);
3391 $this->setCompareMode(true);
3393
3394 $rhtml = $this->showPage();
3395 $rhtml = $this->replaceDiffTags($rhtml);
3396 $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3397 $tpl->setVariable("RIGHT", $rhtml);
3398
3399 $tpl->setVariable("TXT_NEW", $lng->txt("cont_pc_new"));
3400 $tpl->setVariable("TXT_MODIFIED", $lng->txt("cont_pc_modified"));
3401 $tpl->setVariable("TXT_DELETED", $lng->txt("cont_pc_deleted"));
3402
3403//var_dump($left);
3404//var_dump($right);
3405
3406 return $tpl->get();
3407 }
3408
3409 function replaceDiffTags($a_html)
3410 {
3411 $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3412 $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3413 $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3414 $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3415
3416 return $a_html;
3417 }
3418
3423 {
3424 global $ilCtrl, $lng, $tpl;
3425
3426 $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3427 $this->initActivationForm();
3428 $this->getActivationFormValues();
3429 $atpl->setVariable("FORM", $this->form->getHTML());
3430 $atpl->setCurrentBlock("updater");
3431 $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3432 $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3433 $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3434 $atpl->parseCurrentBlock();
3435 $tpl->setContent($atpl->get());
3436 }
3437
3442 {
3443 global $ilCtrl, $lng;
3444
3445 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3446 $this->form = new ilPropertyFormGUI();
3447 $this->form->setFormAction($ilCtrl->getFormAction($this));
3448 $this->form->setTitle($lng->txt("cont_page_activation"));
3449
3450 // activation type radio
3451 $rad = new ilRadioGroupInputGUI($lng->txt("cont_activation"), "activation");
3452 $rad_op1 = new ilRadioOption($lng->txt("cont_activated"), "activated");
3453
3454 $rad->addOption($rad_op1);
3455 $rad_op2 = new ilRadioOption($lng->txt("cont_deactivated"), "deactivated");
3456 $rad->addOption($rad_op2);
3457 $rad_op3 = new ilRadioOption($lng->txt("cont_scheduled_activation"), "scheduled");
3458
3459 $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_start"), "start");
3460 $dt_prop->setShowTime(true);
3461 $rad_op3->addSubItem($dt_prop);
3462 $dt_prop2 = new ilDateTimeInputGUI($lng->txt("cont_end"), "end");
3463 $dt_prop2->setShowTime(true);
3464 $rad_op3->addSubItem($dt_prop2);
3465
3466 // show activation information
3467 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3468 $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3469 $rad_op3->addSubItem($cb);
3470
3471
3472 $rad->addOption($rad_op3);
3473
3474 $this->form->addCommandButton("saveActivation", $lng->txt("save"));
3475
3476 $this->form->addItem($rad);
3477 }
3478
3483 {
3484 $values = array();
3485 $values["activation"] = "deactivated";
3486 if ($this->getPageObject()->getActive())
3487 {
3488 $values["activation"] = "activated";
3489 }
3490
3491 $dt_prop = $this->form->getItemByPostVar("start");
3492 if ($this->getPageObject()->getActivationStart() != "")
3493 {
3494 $values["activation"] = "scheduled";
3495 $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationStart(),
3497 }
3498 $dt_prop = $this->form->getItemByPostVar("end");
3499 if ($this->getPageObject()->getActivationEnd() != "")
3500 {
3501 $values["activation"] = "scheduled";
3502 $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationEnd(),
3504 }
3505
3506 $values["show_activation_info"] = $this->getPageObject()->getShowActivationInfo();
3507
3508 $this->form->setValuesByArray($values);
3509 }
3510
3515 {
3516 global $tpl, $lng, $ilCtrl;
3517
3518 $this->initActivationForm();
3519
3520 if ($this->form->checkInput())
3521 {
3522 $this->getPageObject()->setActive(true);
3523 $this->getPageObject()->setActivationStart(null);
3524 $this->getPageObject()->setActivationEnd(null);
3525 $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3526 if ($_POST["activation"] == "deactivated")
3527 {
3528 $this->getPageObject()->setActive(false);
3529 }
3530 if ($_POST["activation"] == "scheduled")
3531 {
3532 $this->getPageObject()->setActive(false);
3533 $this->getPageObject()->setActivationStart(
3534 $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME));
3535 $this->getPageObject()->setActivationEnd(
3536 $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME));
3537 }
3538 $this->getPageObject()->update();
3539 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3540 $ilCtrl->redirect($this, "editActivation");
3541 }
3542 $this->form->getValuesByPost();
3543 $tpl->setContent($this->form->getHTML());
3544 }
3545
3555 function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
3556 {
3557 global $ilCtrl;
3558
3559 include_once("Services/Notes/classes/class.ilNoteGUI.php");
3560
3561 // scorm 2004 page gui
3562 if(!$a_content_object)
3563 {
3564 $notes_gui = new ilNoteGUI($this->notes_parent_id,
3565 (int)$this->obj->getId(), "pg");
3566
3567 $a_enable_private_notes = true;
3568 $a_enable_public_notes = true;
3569 $a_enable_notes_deletion = false;
3570 }
3571 // wiki page gui, blog posting gui
3572 else
3573 {
3574 $notes_gui = new ilNoteGUI($a_content_object->getParentId(),
3575 $a_content_object->getId(), $a_content_object->getParentType());
3576 }
3577
3578 if($a_enable_private_notes)
3579 {
3580 $notes_gui->enablePrivateNotes();
3581 }
3582 if ($a_enable_public_notes)
3583 {
3584 $notes_gui->enablePublicNotes();
3585 if ((bool)$a_enable_notes_deletion)
3586 {
3587 $notes_gui->enablePublicNotesDeletion(true);
3588 }
3589 }
3590
3591 if($a_callback)
3592 {
3593 $notes_gui->addObserver($a_callback);
3594 }
3595
3596 $next_class = $this->ctrl->getNextClass($this);
3597 if ($next_class == "ilnotegui")
3598 {
3599 $html = $this->ctrl->forwardCommand($notes_gui);
3600 }
3601 else
3602 {
3603 $html = $notes_gui->getNotesHTML();
3604 }
3605 return $html;
3606 }
3607
3611 function processAnswer()
3612 {
3613 global $ilLog;
3614
3615 /*$ilLog->write($_POST);
3616 $ilLog->write($_POST["id"]);
3617 $ilLog->write($_POST["type"]);
3618 $ilLog->write($_POST["answer"]);
3619 $ilLog->write($_GET);*/
3620
3621 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3625 ilUtil::stripSlashes($_POST["answer"]));
3626 }
3627
3628
3629 //
3630 // Initially opened content (e.g. used in learning modules), that
3631 // is presented in another than the main content area (e.g. a picture in
3632 // the bottom left area)
3633 //
3634
3642 {
3643 global $ilTabs, $ilCtrl;
3644
3645 $ilTabs->activateTab("edit");
3646 $form = $this->initOpenedContentForm();
3647
3648 $this->tpl->setContent($form->getHTML());
3649 }
3650
3658 {
3659 global $ilCtrl;
3660
3661 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3662 $form = new ilPropertyFormGUI();
3663
3664 // link input
3665 include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3666 $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3667 $ac->setAllowedLinkTypes(ilLinkInputGUI::INT);
3668 $ac->setInternalLinkDefault("Media_Media", 0);
3669 $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3670 $val = $this->obj->getInitialOpenedContent();
3671 if ($val["id"] != "" && $val["type"] != "")
3672 {
3673 $ac->setValue($val["type"]."|".$val["id"]."|".$val["target"]);
3674 }
3675
3676 $form->addItem($ac);
3677
3678 $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3679 $form->addCommandButton("edit", $this->lng->txt("cancel"));
3680 $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3681 $form->setFormAction($ilCtrl->getFormAction($this));
3682
3683 return $form;
3684 }
3685
3693 {
3694 global $ilCtrl;
3695
3696 $this->obj->saveInitialOpenedContent(
3697 ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3698 ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3699 ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3700 );
3701
3702 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3703 $ilCtrl->redirect($this, "edit");
3704 }
3705
3709
3710
3715 {
3716 global $ilCtrl;
3717
3718 $l = ilUtil::stripSlashes($_GET["totransl"]);
3719 $p = $this->getPageObject();
3720 if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l))
3721 {
3723 return;
3724 }
3725 $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
3726 $ilCtrl->redirect($this, "edit");
3727 }
3728
3733 {
3734 global $ilCtrl, $tpl, $lng;
3735
3736 $l = ilUtil::stripSlashes($_GET["totransl"]);
3737 $ilCtrl->setParameter($this, "totransl", $l);
3738 $lng->loadLanguageModule("meta");
3739
3740 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3741 $cgui = new ilConfirmationGUI();
3742 $cgui->setFormAction($ilCtrl->getFormAction($this));
3743 $cgui->setHeaderText($lng->txt("cont_page_translation_does_not_exist").": ".
3744 $lng->txt("meta_l_".$l));
3745 $cgui->setCancel($lng->txt("cancel"), "editMasterLanguage");
3746 $cgui->setConfirm($lng->txt("confirm"), "createPageTranslation");
3747 $tpl->setContent($cgui->getHTML());
3748 }
3749
3754 {
3755 global $ilCtrl;
3756
3757 $ilCtrl->setParameter($this, "transl", "");
3758 $ilCtrl->redirect($this, "edit");
3759 }
3760
3765 {
3766 global $ilCtrl;
3767
3768 $l = ilUtil::stripSlashes($_GET["totransl"]);
3769
3770 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3772 $this->getPageObject()->getId(), 0, "-");
3773 $p->copyPageToTranslation($l);
3774 $ilCtrl->setParameter($this, "transl", $l);
3775 $ilCtrl->redirect($this, "edit");
3776 }
3777
3782 {
3783 global $ilCtrl, $lng;
3784
3785 $this->getPageObject()->releasePageLock();
3786 ilUtil::sendSuccess($lng->txt("cont_page_lock_released"), true);
3787 $ilCtrl->redirect($this, "preview");
3788 }
3789
3790 protected function isPageContainerToBeRendered()
3791 {
3792 return (
3794 );
3795 }
3796}
3797?>
print $file
$n
Definition: RandomTest.php:80
global $l
Definition: afr.php:30
$_GET["client_id"]
$_SESSION["AccountId"]
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
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
_getQuestionType($question_id)
Returns the question type of a question with a given id.
static addJavaScript()
Add javascript files that are necessary to run accordion.
static addCss()
Add required css.
User interface class for advanced drop-down selection lists.
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)
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.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
_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.
_getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
Class ilMediaPoolPage GUI class.
static lookupTitle($a_page_id)
Lookup title.
static _exists($a_id)
Check whether meida pool page exists.
static initJS()
Init javascript.
User Interface for NewsItem entities.
Notes GUI class.
hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
Class ilObjFile.
includePresentationJS($a_tpl=null)
Include media object presentation JS.
Class ilObjMediaObject.
static isTypeAllowed($a_type)
Is type allowed.
Class ilObjStyleSheet.
getContentStylePath($a_style_id)
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 collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static _getCharacteristics($a_style_id)
Get characteristics.
static getCharStyleSelector($a_par_type, $a_use_callback=true)
Get character style selector.
static getStyleSelector($a_selected, $a_chars, $a_use_callback=false)
Get style selector.
static insertResourcesIntoPageContent($a_content)
Insert resources.
static getCacheTriggerString($a_page)
Get page cache update trigger string.
static _getCommonBBButtons()
Get common bb buttons.
Page Editor GUI class.
_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
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.
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.
insertPageToc($a_output)
Insert page toc.
setRawPageContent($a_rawpagecontent)
Set Get raw page content only.
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.
setPageObject($a_pg_obj)
Set Page Object.
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.
setBibId($a_id)
Set Bib Id.
setAbstractOnly($a_val)
Set abstract only.
activateMetaDataEditor($a_rep_obj, $a_type, $a_sub_obj_id, $a_observer_obj=NULL, $a_observer_func="")
Activate meda data editor.
determineFileDownloadLink()
Determine file download link.
getViewPageTarget()
get view page target frame
getPageObject()
Get Page Object.
setCompareMode($a_val)
Set compare mode.
insertAdvTrigger($a_output)
Insert adv content trigger.
replaceCurlyBrackets($output)
Replace curly brackets.
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.
setFileDownloadLink($a_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.
ilPageObjectGUI($a_parent_type, $a_id, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="")
Constructor.
setFullscreenLink($a_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)
& executeCommand()
execute command
setLanguage($a_val)
Set language.
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)
setSourcecodeDownloadScript($script_name)
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.
setOfflineDirectory($offdir)
set offline directory to offdir
insertContentIncludes($a_html)
Insert content includes.
setEnabledPageFocus($a_enabledpagefocus)
Set Enable page focus.
getOldNr()
Get old nr (historic page)
getRenderPageContainer()
Get render page container.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static saveQuestionAnswer($a_type, $a_id, $a_answer)
Save question answer.
static getFlashVideoPlayerFilename($a_fullpath=false)
Get flash video player file name.
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
This class represents a property form user interface.
GUI class for public user profile presentation.
Class ilQuestionEditGUI.
This class represents a property in a property form.
This class represents an option in a radio group.
static clear($a_var)
Unset a value.
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)
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 insertLatexImages($a_text, $a_start="\[tex\]", $a_end="\[\/tex\]")
replace [text]...[/tex] tags with formula image code
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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 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 initPanel($a_resize=false)
Init yui panel.
static initConnection()
Init YUI Connection module.
static initjQueryUI()
Init jQuery UI (see included_components.txt for included components)
static initjQuery($a_tpl=null)
Init jQuery.
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
$h
$header
$style
Definition: example_012.php:70
$js
$text
$params
Definition: example_049.php:96
$code
Definition: example_050.php:99
$info
Definition: example_052.php:80
$target_id
Definition: goto.php:88
$target_arr
Definition: goto.php:86
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
const ILIAS_VERSION
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
exit
Definition: login.php:54
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
$lm_set
global $ilUser
Definition: imgupload.php:15
if(strpos( $jquery_path, './')===0) else if(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:34