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