ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 
64  //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
65  //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
66  var $pl_start = "{{{{{";
67  var $pl_end = "}}}}}";
68 
78  function ilPageObjectGUI($a_parent_type, $a_id, $a_old_nr = 0,
79  $a_prevent_get_id = false, $a_lang = "")
80  {
81  global $tpl, $lng, $ilCtrl,$ilTabs;
82 
83  $this->setParentType($a_parent_type);
84  $this->setId($a_id);
85  if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0)
86  {
87  $a_old_nr = $_GET["old_nr"];
88  }
89  $this->setOldNr($a_old_nr);
90 
91  if ($a_lang == "" && $_GET["transl"] != "")
92  {
93  $this->setLanguage($_GET["transl"]);
94  }
95  else
96  {
97  if ($a_lang == "")
98  {
99  $a_lang = "-";
100  }
101  $this->setLanguage($a_lang);
102  }
103 
104  $this->tpl = $tpl;
105  $this->ctrl = $ilCtrl;
106  $this->lng = $lng;
107 
109  $this->setEnabledPageFocus(true);
110  $this->initPageObject();
111  $this->setPageConfig($this->getPageObject()->getPageConfig());
112 
113  $this->output2template = true;
114  $this->question_xml = "";
115  $this->question_html = "";
116  $this->tabs_gui =& $ilTabs;
117 
118  $this->template_output_var = "PAGE_CONTENT";
119  $this->citation = false;
120  $this->change_comments = false;
121  $this->page_back_title = $this->lng->txt("page");
122  $lng->loadLanguageModule("content");
123 
124  $this->setTemplateOutput(false);
125 
126  $ilCtrl->saveParameter($this, "transl");
127 
128  $this->afterConstructor();
129  }
130 
134  function afterConstructor()
135  {
136  }
137 
138 
142  protected final function initPageObject()
143  {
144  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
145  $page = ilPageObjectFactory::getInstance($this->getParentType(), $this->getId(), $this->getOldNr(),
146  $this->getLanguage());
147  $this->setPageObject($page);
148  }
149 
155  function setParentType($a_val)
156  {
157  $this->parent_type = $a_val;
158  }
159 
165  function getParentType()
166  {
167  return $this->parent_type;
168  }
169 
175  function setId($a_val)
176  {
177  $this->id = $a_val;
178  }
179 
185  function getId()
186  {
187  return $this->id;
188  }
189 
195  function setOldNr($a_val)
196  {
197  $this->old_nr = $a_val;
198  }
199 
205  function getOldNr()
206  {
207  return $this->old_nr;
208  }
209 
215  function setLanguage($a_val)
216  {
217  $this->language = $a_val;
218  }
219 
225  function getLanguage()
226  {
227  if ($this->language == "")
228  {
229  return "-";
230  }
231 
232  return $this->language;
233  }
234 
240  function setEnablePCType($a_pc_type, $a_val)
241  {
242  $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
243  }
244 
250  function getEnablePCType($a_pc_type)
251  {
252  return $this->getPageConfig()->getEnablePCType($a_pc_type);
253  }
254 
260  function setPageConfig($a_val)
261  {
262  $this->page_config = $a_val;
263  }
264 
270  function getPageConfig()
271  {
272  return $this->page_config;
273  }
274 
278  function setBibId($a_id)
279  {
280  // USED FOR SELECTION WHICH PAGE TURNS AND LATER PAGES SHOULD BE SHOWN
281  $this->bib_id = $a_id;
282  }
283 
287  function getBibId()
288  {
289  return $this->bib_id ? $this->bib_id : 0;
290  }
291 
297  function setPageObject($a_pg_obj)
298  {
299  $this->obj = $a_pg_obj;
300  }
301 
307  function getPageObject()
308  {
309  return $this->obj;
310  }
311 
318  {
319  $this->output_mode = $a_mode;
320  }
321 
322  function getOutputMode()
323  {
324  return $this->output_mode;
325  }
326 
327  function setTemplateOutput($a_output = true)
328  {
329  $this->output2template = $a_output;
330  }
331 
332  function outputToTemplate()
333  {
334  return $this->output2template;
335  }
336 
337  function setPresentationTitle($a_title = "")
338  {
339  $this->presentation_title = $a_title;
340  }
341 
343  {
345  }
346 
347  function setHeader($a_title = "")
348  {
349  $this->header = $a_title;
350  }
351 
352  function getHeader()
353  {
354  return $this->header;
355  }
356 
357  function setLinkParams($l_params = "")
358  {
359  $this->link_params = $l_params;
360  }
361 
362  function getLinkParams()
363  {
364  return $this->link_params;
365  }
366 
367  function setLinkFrame($l_frame = "")
368  {
369  $this->link_frame = $l_frame;
370  }
371 
372  function getLinkFrame()
373  {
374  return $this->link_frame;
375  }
376 
377  function setLinkXML($link_xml)
378  {
379  $this->link_xml = $link_xml;
380  $this->link_xml_set = true;
381  }
382 
383  function getLinkXML()
384  {
385  return $this->link_xml;
386  }
387 
388  function setQuestionXML($question_xml)
389  {
390  $this->question_xml = $question_xml;
391  }
392 
393  function setQuestionHTML($question_html)
394  {
395  $this->getPageConfig()->setQuestionHTML($question_html);
396  }
397 
398  function getQuestionXML()
399  {
400  return $this->question_xml;
401  }
402 
403  function getQuestionHTML()
404  {
405  return $this->getPageConfig()->getQuestionHTML();
406  }
407 
408  function setTemplateTargetVar($a_variable)
409  {
410  $this->target_var = $a_variable;
411  }
412 
414  {
415  return $this->target_var;
416  }
417 
418  function setTemplateOutputVar($a_value)
419  {
420  $this->template_output_var = $a_value;
421  }
422 
424  {
426  }
427 
428  // @todo 1: can we get rid of this?
429  function setSourcecodeDownloadScript ($script_name) {
430  $this->sourcecode_download_script = $script_name;
431  }
432 
435  }
436 
437  function enableCitation($a_enabled)
438  {
439  $this->citation = $a_enabled;
440  }
441 
442  function isEnabledCitation()
443  {
444  return $this->citation;
445  }
446 
447  function setLocator(&$a_locator)
448  {
449  $this->locator =& $a_locator;
450  }
451 
452  function setTabs($a_tabs)
453  {
454  $this->tabs_gui = $a_tabs;
455  }
456 
457  function setPageBackTitle($a_title)
458  {
459  $this->page_back_title = $a_title;
460  }
461 
462  // @todo 1: can we get rid of this?
463  function setFileDownloadLink($a_download_link)
464  {
465  $this->file_download_link = $a_download_link;
466  }
467 
469  {
470  return $this->file_download_link;
471  }
472 
473  // @todo 1: can we get rid of this?
474  function setFullscreenLink($a_fullscreen_link)
475  {
476  $this->fullscreen_link = $a_fullscreen_link;
477  }
478 
479  function getFullscreenLink()
480  {
481  return $this->fullscreen_link;
482  }
483 
484  function setIntLinkReturn($a_return)
485  {
486  $this->int_link_return = $a_return;
487  }
488 
489  function enableChangeComments($a_enabled)
490  {
491  $this->change_comments = $a_enabled;
492  }
493 
495  {
496  return $this->change_comments;
497  }
498 
499  function enableNotes($a_enabled, $a_parent_id)
500  {
501  $this->notes_enabled = $a_enabled;
502  $this->notes_parent_id = $a_parent_id;
503  }
504 
505  function isEnabledNotes()
506  {
507  return $this->notes_enabled;
508  }
509 
515  function setOfflineDirectory ($offdir) {
516  $this->offline_directory = $offdir;
517  }
518 
519 
524  function getOfflineDirectory () {
525  return $this->offline_directory;
526  }
527 
528 
535  function setViewPageLink($a_link, $a_target = "")
536  {
537  $this->view_page_link = $a_link;
538  $this->view_page_target = $a_target;
539  }
540 
544  function getViewPageLink()
545  {
546  return $this->view_page_link;
547  }
548 
552  function getViewPageTarget()
553  {
554  return $this->view_page_target;
555  }
556 
557  function setActivationListener(&$a_obj, $a_meth)
558  {
559  $this->act_obj =& $a_obj;
560  $this->act_meth = $a_meth;
561  }
562 
568  function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
569  {
570  $this->enabled_news = $a_enabled;
571  $this->news_obj_id = $a_news_obj_id;
572  $this->news_obj_type = $a_news_obj_type;
573  }
574 
580  function getEnabledNews()
581  {
582  return $this->enabled_news;
583  }
584 
588  function setTabHook($a_object, $a_function)
589  {
590  $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
591  }
592 
598  function setEditPreview($a_editpreview)
599  {
600  $this->editpreview = $a_editpreview;
601  }
602 
608  function getEditPreview()
609  {
610  return $this->editpreview;
611  }
612 
618  function setEnabledTabs($a_enabledtabs)
619  {
620  $this->tabs_enabled = $a_enabledtabs;
621  }
622 
628  function getEnabledTabs()
629  {
630  return $this->tabs_enabled;
631  }
632 
638  function setEnabledPageFocus($a_enabledpagefocus)
639  {
640  $this->enabledpagefocus = $a_enabledpagefocus;
641  }
642 
649  {
650  return $this->enabledpagefocus;
651  }
652 
658  function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
659  {
660 return;
661  $this->exp_frame = $a_exp_frame;
662  $this->exp_id = $a_exp_id;
663  $this->exp_target_script = $a_exp_target_script;
664  }
665 
671  function setPrependingHtml($a_prependinghtml)
672  {
673  $this->prependinghtml = $a_prependinghtml;
674  }
675 
681  function getPrependingHtml()
682  {
683  return $this->prependinghtml;
684  }
685 
691  function setEnableEditing($a_enableediting)
692  {
693  $this->enableediting = $a_enableediting;
694  }
695 
701  function getEnableEditing()
702  {
703  return $this->enableediting;
704  }
705 
711  function setRawPageContent($a_rawpagecontent)
712  {
713  $this->rawpagecontent = $a_rawpagecontent;
714  }
715 
721  function getRawPageContent()
722  {
723  return $this->rawpagecontent;
724  }
725 
731  function setStyleId($a_styleid)
732  {
733  $this->styleid = $a_styleid;
734  }
735 
741  function getStyleId()
742  {
743  return $this->styleid;
744  }
745 
751  function setCompareMode($a_val)
752  {
753  $this->compare_mode = $a_val;
754  }
755 
761  function getCompareMode()
762  {
763  return $this->compare_mode;
764  }
765 
771  function setAbstractOnly($a_val)
772  {
773  $this->abstract_only = $a_val;
774  }
775 
781  function getAbstractOnly()
782  {
783  return $this->abstract_only;
784  }
785 
791  function setRenderPageContainer($a_val)
792  {
793  $this->render_page_container = $a_val;
794  }
795 
802  {
804  }
805 
815  function activateMetaDataEditor($a_rep_obj_id, $a_sub_obj_id, $a_type,
816  $a_observer_obj = NULL, $a_observer_func = "")
817  {
818  $this->use_meta_data = true;
819  $this->meta_data_rep_obj_id = $a_rep_obj_id;
820  $this->meta_data_sub_obj_id = $a_sub_obj_id;
821  $this->meta_data_type = $a_type;
822  $this->meta_data_observer_obj = $a_observer_obj;
823  $this->meta_data_observer_func = $a_observer_func;
824  }
825 
832  {
833  global $ilCtrl;
834 
835  $file_download_link = $this->getFileDownloadLink();
836  if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline")
837  {
838  $file_download_link = $ilCtrl->getLinkTarget($this, "downloadFile");
839  }
840  return $file_download_link;
841  }
842 
849  {
850  global $ilCtrl;
851 
852  $fullscreen_link = $this->getFullscreenLink();
853  if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline")
854  {
855  $fullscreen_link = $ilCtrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
856  }
857  return $fullscreen_link;
858  }
859 
866  {
867  global $ilCtrl;
868 
870  if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline")
871  {
872  $l = $ilCtrl->getLinkTarget($this, "");
873  }
874  return $l;
875  }
876 
881  {
882  $xml = "";
883  if($this->getOutputMode() == "edit")
884  {
885  global $ilPluginAdmin;
886 
887  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
888  "COPage", "pgcp");
889  foreach ($pl_names as $pl_name)
890  {
891  $plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
892  "COPage", "pgcp", $pl_name);
893  if ($plugin->isValidParentType($this->getPageObject()->getParentType()))
894  {
895  $xml.= '<ComponentPlugin Name="'.$plugin->getPluginName().
896  '" InsertText="'.$plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT).'" />';
897  }
898  }
899  }
900  if ($xml != "")
901  {
902  $xml = "<ComponentPlugins>".$xml."</ComponentPlugins>";
903  }
904  return $xml;
905  }
906 
907 
911  function &executeCommand()
912  {
913  global $ilCtrl, $ilTabs, $lng, $ilAccess, $tpl;
914 
915  $next_class = $this->ctrl->getNextClass($this);
916 
917  $cmd = $this->ctrl->getCmd();
918  //$this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
919  // , "view", "ilEditClipboardGUI");
920  $this->getTabs();
921 
922  $ilCtrl->setReturn($this, "edit");
923 //echo "-".$next_class."-";
924  switch($next_class)
925  {
926  case 'ilmdeditorgui':
927  //$this->setTabs();
928  $ilTabs->setTabActive("meta_data");
929  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
930  $md_gui =& new ilMDEditorGUI($this->meta_data_rep_obj_id,
931  $this->meta_data_sub_obj_id, $this->meta_data_type);
932  if (is_object($this->meta_data_observer_obj))
933  {
934  $md_gui->addObserver($this->meta_data_observer_obj,
935  $this->meta_data_observer_func, "General");
936  }
937  $this->ctrl->forwardCommand($md_gui);
938  break;
939 
940  case "ileditclipboardgui":
941  //$this->tabs_gui->clearTargets();
942  //$this->ctrl->setReturn($this, "view");
943  $clip_gui = new ilEditClipboardGUI();
944  $clip_gui->setPageBackTitle($this->page_back_title);
945  //$ret =& $clip_gui->executeCommand();
946  $ret =& $this->ctrl->forwardCommand($clip_gui);
947  break;
948 
949  // notes
950  case "ilnotegui":
951  switch($_GET["notes_mode"])
952  {
953  default:
954  $html = $this->edit();
955  $ilTabs->setTabActive("edit");
956  return $html;
957  }
958  break;
959 
960  case 'ilpublicuserprofilegui':
961  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
962  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
963  $ret = $this->ctrl->forwardCommand($profile_gui);
964  break;
965 
966  case "ilpageeditorgui":
967  if (!$this->getEnableEditing())
968  {
969  ilUtil::sendFailure($lng->txt("permission_denied"), true);
970  $ilCtrl->redirect($this, "preview");
971  }
972  $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
973  $page_editor->setLocator($this->locator);
974  $page_editor->setHeader($this->getHeader());
975  $page_editor->setPageBackTitle($this->page_back_title);
976  $page_editor->setIntLinkReturn($this->int_link_return);
977  //$page_editor->executeCommand();
978  $ret =& $this->ctrl->forwardCommand($page_editor);
979  break;
980 
981  case 'ilnewsitemgui':
982  include_once("./Services/News/classes/class.ilNewsItemGUI.php");
983  $news_item_gui = new ilNewsItemGUI();
984  $news_item_gui->setEnableEdit(true);
985  $news_item_gui->setContextObjId($this->news_obj_id);
986  $news_item_gui->setContextObjType($this->news_obj_type);
987  $news_item_gui->setContextSubObjId($this->obj->getId());
988  $news_item_gui->setContextSubObjType("pg");
989 
990  $ret = $ilCtrl->forwardCommand($news_item_gui);
991  break;
992 
993  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
994  $ret = $this->ctrl->forwardCommand($profile_gui);
995  break;
996 
997  case "ilpropertyformgui":
998  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
999  $form = $this->initOpenedContentForm();
1000  $this->ctrl->forwardCommand($form);
1001  break;
1002 
1003  case "ilinternallinkgui":
1004  $this->lng->loadLanguageModule("content");
1005  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1006  $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1007  //$link_gui->filterLinkType("RepositoryItem");
1008 
1009  $link_gui->filterLinkType("PageObject_FAQ");
1010  $link_gui->filterLinkType("GlossaryItem");
1011  $link_gui->filterLinkType("Media_Media");
1012  $link_gui->filterLinkType("Media_FAQ");
1013 
1014  $link_gui->setFilterWhiteList(true);
1015  $link_gui->setMode("asynch");
1016  $ilCtrl->forwardCommand($link_gui);
1017  break;
1018 
1019  case "ilquestioneditgui":
1020  $this->setQEditTabs("question");
1021  include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1022  $edit_gui = new ilQuestionEditGUI();
1023  $edit_gui->setPageConfig($this->getPageConfig());
1024 // $edit_gui->addNewIdListener($this, "setNewQuestionId");
1025  $edit_gui->setSelfAssessmentEditingMode(true);
1026  $ret = $ilCtrl->forwardCommand($edit_gui);
1027  $this->tpl->setContent($ret);
1028  break;
1029 
1030  case 'ilassquestionfeedbackeditinggui':
1031 
1032  $this->onFeedbackEditingForwarding();
1033 
1034  // set tabs
1035  $this->setQEditTabs("feedback");
1036 
1037  // load required lang mods
1038  $lng->loadLanguageModule("assessment");
1039 
1040  // set context tabs
1041  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
1042  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
1043  $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
1044  $questionGUI->object->setObjId(0);
1045  $questionGUI->object->setSelfAssessmentEditingMode(true);
1046  $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1047 
1048  // forward to ilAssQuestionFeedbackGUI
1049  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1050  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
1051  $ilCtrl->forwardCommand($gui);
1052  break;
1053 
1054 /* case "ilpagemultilanggui":
1055  $ilCtrl->setReturn($this, "edit");
1056  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1057  $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1058  $this->getPageConfig()->getSinglePageMode());
1059  //$this->setTabs("settings");
1060  //$this->setSubTabs("cont_multilinguality");
1061  $ret = $this->ctrl->forwardCommand($ml_gui);
1062  break;*/
1063 
1064  default:
1065  $cmd = $this->ctrl->getCmd("preview");
1066  $ret = $this->$cmd();
1067  break;
1068  }
1069 //echo "+$ret+";
1070  return $ret;
1071  }
1072 
1079  function setQEditTabs($a_active)
1080  {
1081  global $ilTabs, $ilCtrl, $lng;
1082  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1083 
1084  $ilTabs->clearTargets();
1085 
1086  $ilTabs->setBackTarget($lng->txt("back"),
1087  $ilCtrl->getLinkTarget($this, "edit"));
1088 
1089  $ilCtrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1090  $ilTabs->addTab("question", $lng->txt("question"),
1091  $ilCtrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion"));
1092 
1093  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1094  $ilCtrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1095  $ilTabs->addTab("feedback", $lng->txt("feedback"),
1096  $ilCtrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW));
1097 
1098  $ilTabs->activateTab($a_active);
1099  }
1100 
1105  {
1106 
1107  }
1108 
1109 
1110  function deactivatePage()
1111  {
1112  $this->getPageObject()->setActivationStart(null);
1113  $this->getPageObject()->setActivationEnd(null);
1114  $this->getPageObject()->setActive(false);
1115  $this->getPageObject()->update();
1116  $this->ctrl->redirect($this, "edit");
1117  }
1118 
1119  function activatePage()
1120  {
1121  $this->getPageObject()->setActivationStart(null);
1122  $this->getPageObject()->setActivationEnd(null);
1123  $this->getPageObject()->setActive(true);
1124  $this->getPageObject()->update();
1125  $this->ctrl->redirect($this, "edit");
1126  }
1127 
1131  function showPage()
1132  {
1133  global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
1134 
1135  // jquery and jquery ui are always provided for components
1136  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1139 
1140 // $this->initSelfAssessmentRendering();
1141 
1142  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1144 
1145  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1146 
1147  // needed for overlays in iim
1148  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1150 
1151  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1153 
1154  // init template
1155  //if($this->outputToTemplate())
1156  //{
1157  if($this->getOutputMode() == "edit")
1158  {
1159 //echo ":".$this->getTemplateTargetVar().":";
1160  $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1161  //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1162 
1163  // to do: status dependent class
1164  $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1165 
1166  // user comment
1167  if ($this->isEnabledChangeComments())
1168  {
1169  $tpl->setCurrentBlock("change_comment");
1170  $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1171  $tpl->parseCurrentBlock();
1172  }
1173 
1174  $tpl->setVariable("WYSIWYG_ACTION",
1175  $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
1176 
1177  // determine media, html and javascript mode
1178  $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
1179  ? "disable"
1180  : "enable";
1181  $sel_html_mode = ($ilUser->getPref("ilPageEditor_HTMLMode") == "disable")
1182  ? "disable"
1183  : "enable";
1184  $sel_js_mode = "disable";
1185  //if($ilSetting->get("enable_js_edit", 1))
1186  //{
1187  $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1188  ? "enable"
1189  : "disable";
1190  //}
1191 
1192  // show prepending html
1193  $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1194  $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
1195 
1196  // presentation view
1197  if ($this->getViewPageLink() != "")
1198  {
1199  $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"),
1200  $this->getViewPageLink(), $this->getViewPageTarget());
1201  }
1202 
1203  // show actions drop down
1204  $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1205 
1206  // get js files for JS enabled editing
1207  if ($sel_js_mode == "enable")
1208  {
1209  $this->insertHelp($tpl);
1210  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1213  ilYuiUtil::initPanel(false);
1214  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1215  $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
1216 
1217  include_once './Services/Style/classes/class.ilObjStyleSheet.php';
1218  $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
1219  preloader.src = './templates/default/images/loader.svg';
1220  ilCOPage.setContentCss('".
1223  ", ./Services/COPage/css/tiny_extra.css".
1224  "')");
1225 
1226  //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
1227  $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
1228  $tpl->touchBlock("init_dragging");
1229 
1230  $cfg = $this->getPageConfig();
1231  $tpl->setVariable("IL_TINY_MENU",
1232  self::getTinyMenu(
1233  $this->getPageObject()->getParentType(),
1234  $cfg->getEnableInternalLinks(),
1235  $cfg->getEnableWikiLinks(),
1236  $cfg->getEnableKeywords(),
1237  $this->getStyleId(), true, true,
1238  $cfg->getEnableAnchors()
1239  ));
1240 
1241  // add int link parts
1242  include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1243  $tpl->setCurrentBlock("int_link_prep");
1244  $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1245  $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1246  "", false, true, false)));
1247  $tpl->parseCurrentBlock();
1248 
1249  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1251  $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1252 
1253  }
1254 
1255  // multiple actions
1256  $cnt_pcs = $this->getPageObject()->countPageContents();
1257  if ($cnt_pcs > 1 ||
1258  ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0))
1259  {
1260  $tpl->setCurrentBlock("multi_actions");
1261  if ($sel_js_mode == "enable")
1262  {
1263  $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1264  $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1265  $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1266  $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1267  $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1268  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1269  $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1270  }
1271  $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1272  $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1273  $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1274  $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1275  $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1276  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1277  $tpl->parseCurrentBlock();
1278  }
1279  }
1280  else
1281  {
1282  // presentation or preview here
1283 
1284  $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1285  if ($this->getEnabledPageFocus())
1286  {
1287  $tpl->touchBlock("page_focus");
1288  }
1289 
1290  include_once("./Services/User/classes/class.ilUserUtil.php");
1291 
1292  // presentation
1293  if( $this->isPageContainerToBeRendered() )
1294  {
1295  $tpl->touchBlock("page_container_1");
1296  $tpl->touchBlock("page_container_2");
1297  $tpl->touchBlock("page_container_3");
1298  }
1299 
1300  // history
1301  $c_old_nr = $this->getPageObject()->old_nr;
1302  if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1)
1303  {
1304  $hist_info =
1305  $this->getPageObject()->getHistoryInfo($c_old_nr);
1306 
1307  if (!$this->getCompareMode())
1308  {
1309  $ilCtrl->setParameter($this, "history_mode", "1");
1310 
1311  // previous revision
1312  if (is_array($hist_info["previous"]))
1313  {
1314  $tpl->setCurrentBlock("previous_rev");
1315  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1316  $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1317  $tpl->setVariable("HREF_PREV",
1318  $ilCtrl->getLinkTarget($this, "preview"));
1319  $tpl->parseCurrentBlock();
1320  }
1321  else
1322  {
1323  $tpl->setCurrentBlock("previous_rev_disabled");
1324  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1325  $tpl->parseCurrentBlock();
1326  }
1327 
1328  // next revision
1329  if ($c_old_nr > 0)
1330  {
1331  $tpl->setCurrentBlock("next_rev");
1332  $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
1333  $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1334  $tpl->setVariable("HREF_NEXT",
1335  $ilCtrl->getLinkTarget($this, "preview"));
1336  $tpl->parseCurrentBlock();
1337 
1338  // latest revision
1339  $tpl->setCurrentBlock("latest_rev");
1340  $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
1341  $ilCtrl->setParameter($this, "old_nr", "");
1342  $tpl->setVariable("HREF_LATEST",
1343  $ilCtrl->getLinkTarget($this, "preview"));
1344  $tpl->parseCurrentBlock();
1345  }
1346 
1347  $ilCtrl->setParameter($this, "history_mode", "");
1348 
1349  // rollback
1350  if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID)
1351  {
1352  $tpl->setCurrentBlock("rollback");
1353  $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
1354  $tpl->setVariable("HREF_ROLLBACK",
1355  $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
1356  $ilCtrl->setParameter($this, "old_nr", "");
1357  $tpl->setVariable("TXT_ROLLBACK",
1358  $lng->txt("cont_rollback"));
1359  $tpl->parseCurrentBlock();
1360  }
1361  }
1362 
1363  $tpl->setCurrentBlock("hist_nav");
1364  $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
1365  $tpl->setVariable("VAL_REVISION_DATE",
1366  ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
1367  $tpl->setVariable("VAL_REV_USER",
1368  ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
1369  $tpl->parseCurrentBlock();
1370  }
1371  }
1372  if ($this->getOutputMode() != IL_PAGE_PRESENTATION &&
1373  $this->getOutputMode() != IL_PAGE_OFFLINE &&
1374  $this->getOutputMode() != IL_PAGE_PREVIEW &&
1375  $this->getOutputMode() != IL_PAGE_PRINT)
1376  {
1377  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1378  }
1379 
1380  // output media object edit list (of media links)
1381  if($this->getOutputMode() == "edit")
1382  {
1383  $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
1384  $this->obj->getId(), $this->obj->getLanguage());
1385  $mob_links = array();
1386  foreach($links as $link)
1387  {
1388  if ($link["type"] == "mob")
1389  {
1390  if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob")
1391  {
1392  $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
1393  }
1394  }
1395  }
1396 
1397  // linked media objects
1398  if (count($mob_links) > 0)
1399  {
1400  $tpl->setCurrentBlock("med_link");
1401  $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1402  $tpl->setVariable("SEL_MED_LINKS",
1403  ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
1404  $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1405  $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1406  //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1407  $tpl->parseCurrentBlock();
1408  }
1409 
1410  // content snippets used
1411  include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1413  $this->getPageObject()->getDomDoc());
1414  if (count($snippets) > 0)
1415  {
1416  foreach ($snippets as $s)
1417  {
1418  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1419  $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1420  }
1421  $tpl->setCurrentBlock("med_link");
1422  $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1423  $tpl->setVariable("SEL_SNIPPETS",
1424  ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
1425  $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1426  $tpl->parseCurrentBlock();
1427  }
1428 
1429  // scheduled activation?
1430  if (!$this->getPageObject()->getActive() &&
1431  $this->getPageObject()->getActivationStart() != "" &&
1432  $this->getPageConfig()->getEnableScheduledActivation())
1433  {
1434  $tpl->setCurrentBlock("activation_txt");
1435  $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
1436  $tpl->setVariable("SA_FROM",
1438  new ilDateTime($this->getPageObject()->getActivationStart(),
1439  IL_CAL_DATETIME)));
1440  $tpl->setVariable("SA_TO",
1442  new ilDateTime($this->getPageObject()->getActivationEnd(),
1443  IL_CAL_DATETIME)));
1444  $tpl->parseCurrentBlock();
1445  }
1446  }
1447 
1448  if ($_GET["reloadTree"] == "y")
1449  {
1450  $tpl->setCurrentBlock("reload_tree");
1451  if ($this->obj->getParentType() == "dbk")
1452  {
1453  $tpl->setVariable("LINK_TREE",
1454  $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
1455  }
1456  else
1457  {
1458  $tpl->setVariable("LINK_TREE",
1459  $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
1460  }
1461  $tpl->parseCurrentBlock();
1462  }
1463 // }
1464  // get content
1465  $builded = $this->obj->buildDom();
1466 
1467  // manage hierarchical ids
1468  if($this->getOutputMode() == "edit")
1469  {
1470 
1471  // add pc ids, if necessary
1472  if (!$this->obj->checkPCIds())
1473  {
1474  $this->obj->insertPCIds();
1475  $this->obj->update(true, true);
1476  }
1477 
1478  $this->obj->addFileSizes();
1479  $this->obj->addHierIDs();
1480 
1481  $hids = $this->obj->getHierIds();
1482  $row1_ids = $this->obj->getFirstRowIds();
1483  $col1_ids = $this->obj->getFirstColumnIds();
1484  $litem_ids = $this->obj->getListItemIds();
1485  $fitem_ids = $this->obj->getFileItemIds();
1486 
1487  // standard menues
1488  $hids = $this->obj->getHierIds();
1489  foreach($hids as $hid)
1490  {
1491  $tpl->setCurrentBlock("add_dhtml");
1492  $tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
1493  $tpl->parseCurrentBlock();
1494  }
1495 
1496  // column menues for tables
1497  foreach($col1_ids as $hid)
1498  {
1499  $tpl->setCurrentBlock("add_dhtml");
1500  $tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
1501  $tpl->parseCurrentBlock();
1502  }
1503 
1504  // row menues for tables
1505  foreach($row1_ids as $hid)
1506  {
1507  $tpl->setCurrentBlock("add_dhtml");
1508  $tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
1509  $tpl->parseCurrentBlock();
1510  }
1511 
1512  // list item menues
1513  foreach($litem_ids as $hid)
1514  {
1515  $tpl->setCurrentBlock("add_dhtml");
1516  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1517  $tpl->parseCurrentBlock();
1518  }
1519 
1520  // file item menues
1521  foreach($fitem_ids as $hid)
1522  {
1523  $tpl->setCurrentBlock("add_dhtml");
1524  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1525  $tpl->parseCurrentBlock();
1526  }
1527  }
1528  else
1529  {
1530  $this->obj->addFileSizes();
1531  }
1532 
1533 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
1534 //echo "<br>-".htmlentities($this->getLinkXML())."-";
1535 
1536  // set default link xml, if nothing was set yet
1537  if (!$this->link_xml_set)
1538  {
1539  $this->setDefaultLinkXml();
1540  }
1541 
1542  //$content = $this->obj->getXMLFromDom(false, true, true,
1543  // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1544  $link_xml = $this->getLinkXML();
1545 
1546  // disable/enable auto margins
1547  if ($this->getStyleId() > 0)
1548  {
1549  if (ilObject::_lookupType($this->getStyleId()) == "sty")
1550  {
1551  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1552  $style = new ilObjStyleSheet($this->getStyleId());
1553  $template_xml = $style->getTemplateXML();
1554  $disable_auto_margins = "n";
1555  if ($style->lookupStyleSetting("disable_auto_margins"))
1556  {
1557  $disable_auto_margins = "y";
1558  }
1559  }
1560  }
1561 
1562  if ($this->getAbstractOnly())
1563  {
1564  $content = "<dummy><PageObject><PageContent><Paragraph>".
1565  $this->obj->getFirstParagraphText().$link_xml.
1566  "</Paragraph></PageContent></PageObject></dummy>";
1567  }
1568  else
1569  {
1570  $content = $this->obj->getXMLFromDom(false, true, true,
1571  $link_xml.$this->getQuestionXML().$template_xml.$this->getComponentPluginsXML());
1572  }
1573 
1574  // check validation errors
1575  if($builded !== true)
1576  {
1577  $this->displayValidationError($builded);
1578  }
1579  else
1580  {
1581  $this->displayValidationError($_SESSION["il_pg_error"]);
1582  }
1583  unset($_SESSION["il_pg_error"]);
1584 
1585  if(isset($_SESSION["citation_error"]))
1586  {
1587  ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
1588  ilSession::clear("citation_error");
1589  }
1590 
1591  // get title
1592  $pg_title = $this->getPresentationTitle();
1593 
1594  $col_path = ilUtil::getImagePath("col.svg");
1595  $row_path = ilUtil::getImagePath("row.svg");
1596  $item_path = ilUtil::getImagePath("item.svg");
1597 
1598  if ($this->getOutputMode() != "offline")
1599  {
1600  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1601  $wb_path = ilUtil::getWebspaceDir("output")."/";
1602  }
1603  else
1604  {
1605  $enlarge_path = "images/enlarge.svg";
1606  $wb_path = "";
1607  }
1608  $pg_title_class = ($this->getOutputMode() == "print")
1609  ? "ilc_PrintPageTitle"
1610  : "";
1611 
1612  // page splitting only for learning modules and
1613  // digital books
1614  $enable_split_new = ($this->obj->getParentType() == "lm" ||
1615  $this->obj->getParentType() == "dbk")
1616  ? "y"
1617  : "n";
1618 
1619  // page splitting to next page only for learning modules and
1620  // digital books if next page exists in tree
1621  if (($this->obj->getParentType() == "lm" ||
1622  $this->obj->getParentType() == "dbk") &&
1623  ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
1624  $this->obj->getId()))
1625  {
1626  $enable_split_next = "y";
1627  }
1628  else
1629  {
1630  $enable_split_next = "n";
1631  }
1632 
1633  $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1634 
1635 
1636  if ($this->getPageConfig()->getEnablePCType("Tabs"))
1637  {
1638  //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1639  //ilYuiUtil::initTabView();
1640  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1643  }
1644 
1645  $file_download_link = $this->determineFileDownloadLink();
1646  $fullscreen_link = $this->determineFullscreenLink();
1647  $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1648 
1649  // default values for various parameters (should be used by
1650  // all instances in the future)
1651  $media_mode = ($this->getOutputMode() == "edit")
1652  ? $ilUser->getPref("ilPageEditor_MediaMode")
1653  : "enable";
1654 
1655  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1656  $paste = (ilEditClipboard::getAction() == "copy" &&
1657  $this->getOutputMode() == "edit");
1658 
1659  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1660 
1661  $flv_video_player = ($this->getOutputMode() != "offline")
1664 
1665  $cfg = $this->getPageConfig();
1666 
1667  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1668 
1669  // added UTF-8 encoding otherwise umlaute are converted too
1670  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1671  $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
1672  'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1673  'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1674  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1675  'img_col' => $col_path,
1676  'img_row' => $row_path,
1677  'img_item' => $item_path,
1678  'enable_split_new' => $enable_split_new,
1679  'enable_split_next' => $enable_split_next,
1680  'link_params' => $this->link_params,
1681  'file_download_link' => $file_download_link,
1682  'fullscreen_link' => $fullscreen_link,
1683  'img_path' => $img_path,
1684  'parent_id' => $this->obj->getParentId(),
1685  'download_script' => $this->sourcecode_download_script,
1686  'encoded_download_script' => urlencode($this->sourcecode_download_script),
1687  // digilib
1688  'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
1689  'pagebreak' => $this->lng->txt('dgl_pagebreak'),
1690  'page' => $this->lng->txt('page'),
1691  'citate_page' => $this->lng->txt('citate_page'),
1692  'citate_from' => $this->lng->txt('citate_from'),
1693  'citate_to' => $this->lng->txt('citate_to'),
1694  'citate' => $this->lng->txt('citate'),
1695  'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1696  'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1697  'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1698  'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1699  'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1700  'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1701  'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1702  'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1703  'paste' => $paste ? "y" : "n",
1704  'media_mode' => $media_mode,
1705  'javascript' => $sel_js_mode,
1706  'paragraph_plugins' => $paragraph_plugin_string,
1707  'disable_auto_margins' => $disable_auto_margins,
1708  'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1709  'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1710  'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1711  'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1712  'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1713  'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1714  'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1715  'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1716  'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1717  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1718  'flv_video_player' => $flv_video_player
1719  );
1720  if($this->link_frame != "") // todo other link types
1721  $params["pg_frame"] = $this->link_frame;
1722 
1723  //$content = str_replace("&nbsp;", "", $content);
1724 
1725  // this ensures that cache is emptied with every update
1726  $params["version"] = ILIAS_VERSION;
1727  // ensure no cache hit, if included files/media objects have been changed
1728  $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1729 
1730  // run xslt
1731  $md5 = md5(serialize($params).$link_xml.$template_xml);
1732 
1733 //$a = microtime();
1734 
1735  // check cache (same parameters, non-edit mode and rendered time
1736  // > last change
1737  if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1738  !$this->getCompareMode() &&
1739  !$this->getAbstractOnly() &&
1740  $md5 == $this->obj->getRenderMd5() &&
1741  ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1742  $this->obj->getRenderedTime() != "" &&
1743  $this->obj->old_nr == 0)
1744  {
1745  // cache hit
1746  $output = $this->obj->getRenderedContent();
1747  }
1748  else
1749  {
1750  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1751 
1752  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1753  $xh = xslt_create();
1754  // echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
1755  // echo "mode:".$this->getOutputMode().":<br>";
1756  $output = xslt_process($xh, "arg:/_xml","arg:/_xsl", NULL, $args, $params);
1757 
1758  if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1759  && !$this->getAbstractOnly()
1760  && $this->obj->old_nr == 0)
1761  {
1762 //echo "writerenderedcontent";
1763  $this->obj->writeRenderedContent($output, $md5);
1764  }
1765  //echo xslt_error($xh);
1766  xslt_free($xh);
1767  }
1768 
1769 //$b = microtime();
1770 //echo "$a - $b";
1771 //echo "<pre>".htmlentities($output)."</pre>";
1772 
1773  // unmask user html
1774  if (($this->getOutputMode() != "edit" ||
1775  $ilUser->getPref("ilPageEditor_HTMLMode") != "disable")
1776  && !$this->getPageConfig()->getPreventHTMLUnmasking())
1777  {
1778  $output = str_replace("&lt;","<",$output);
1779  $output = str_replace("&gt;",">",$output);
1780  }
1781  $output = str_replace("&amp;", "&", $output);
1782 
1783  $output = ilUtil::insertLatexImages($output);
1784 
1785  // insert page snippets
1786  $output = $this->insertContentIncludes($output);
1787 
1788  // insert resource blocks
1789  $output = $this->insertResources($output);
1790 
1791  // insert page toc
1792  if ($this->getPageConfig()->getEnablePageToc())
1793  {
1794  $output = $this->insertPageToc($output);
1795  }
1796 
1797  // insert advanced output trigger
1798  $output = $this->insertAdvTrigger($output);
1799 
1800  // workaround for preventing template engine
1801  // from hiding paragraph text that is enclosed
1802  // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1803  $output = $this->replaceCurlyBrackets($output);
1804 
1805  // remove all newlines (important for code / pre output)
1806  $output = str_replace("\n", "", $output);
1807 
1808 //echo htmlentities($output);
1809  $output = $this->postOutputProcessing($output);
1810 //echo htmlentities($output);
1811  if($this->getOutputMode() == "edit" &&
1812  !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation()))
1813  {
1814  $output = '<div class="il_editarea_disabled">'.$output.'</div>';
1815  }
1816 
1817  // for all page components...
1818  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1820  foreach ($defs as $def)
1821  {
1823  $pc_class = $def["pc_class"];
1824  $pc_obj = new $pc_class($this->getPageObject());
1825 
1826  // post xsl page content modification by pc elements
1827  $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
1828 
1829  // javascript files
1830  $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
1831  foreach ($js_files as $js)
1832  {
1833  $GLOBALS["tpl"]->addJavascript($js);
1834  }
1835 
1836  // css files
1837  $css_files = $pc_obj->getCssFiles($this->getOutputMode());
1838  foreach ($css_files as $css)
1839  {
1840  $GLOBALS["tpl"]->addCss($css);
1841  }
1842 
1843  // onload code
1844  $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
1845  foreach ($onload_code as $code)
1846  {
1847  $GLOBALS["tpl"]->addOnloadCode($code);
1848  }
1849  }
1850 
1851 // $output = $this->selfAssessmentRendering($output);
1852 
1853  // output
1854  if ($ilCtrl->isAsynch() && !$this->getRawPageContent() &&
1855  $this->getOutputMode() == "edit")
1856  {
1857  // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1858  if ($_GET["updated_pc_id_str"] != "")
1859  {
1860  echo $_GET["updated_pc_id_str"];
1861  }
1862  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1863  $tpl->setCurrentBlock("edit_page");
1864  $tpl->parseCurrentBlock();
1865  echo $tpl->get("edit_page");
1866  exit;
1867  }
1868  if ($this->outputToTemplate())
1869  {
1870  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1871  $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1872  return $output;
1873  }
1874  else
1875  {
1876  if ($this->getRawPageContent()) // e.g. needed in glossaries
1877  {
1878  return $output;
1879  }
1880  else
1881  {
1882  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1883  return $tpl->get();
1884  }
1885  }
1886  }
1887 
1894  function replaceCurlyBrackets($output)
1895  {
1896 //echo "<br><br>".htmlentities($output);
1897 
1898  while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1899  is_int($end = strpos($output, "<!--ParEnd-->", $start)))
1900  {
1901  $output = substr($output, 0, $start).
1902  str_replace(array("{","}"), array("&#123;","&#125;"),
1903  substr($output, $start + 15, $end - ($start + 15))).
1904  substr($output, $end + 13);
1905  }
1906 
1907 // $output = str_replace("{", "&#123;", $output);
1908 // $output = str_replace("}", "&#125;", $output);
1909 //echo "<br><br>".htmlentities($output);
1910  return $output;
1911  }
1912 
1916  protected function getActivationCaptions()
1917  {
1918  global $lng;
1919 
1920  return array("deactivatePage" => $lng->txt("cont_deactivate_page"),
1921  "activatePage" => $lng->txt("cont_activate_page"));
1922  }
1923 
1927  function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
1928  {
1929  global $lng, $ilCtrl;
1930 
1931  // actions
1932  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1933 
1934  // activate/deactivate
1935  $list = new ilAdvancedSelectionListGUI();
1936  $list->setListTitle($lng->txt("actions"));
1937  $list->setId("copage_act");
1938  $entries = false;
1939  if ($this->getPageConfig()->getEnableActivation())
1940  {
1941  $entries = true;
1942  $captions = $this->getActivationCaptions();
1943  if ($this->getPageObject()->getActive())
1944  {
1945  $list->addItem($captions["deactivatePage"], "",
1946  $ilCtrl->getLinkTarget($this, "deactivatePage"));
1947  }
1948  else
1949  {
1950  $list->addItem($captions["activatePage"], "",
1951  $ilCtrl->getLinkTarget($this, "activatePage"));
1952  }
1953 
1954  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
1955  }
1956 
1957  // initially opened content
1958  if ($this->getPageConfig()->getUseAttachedContent())
1959  {
1960  $entries = true;
1961  $list->addItem($lng->txt("cont_initial_attached_content"), "",
1962  $ilCtrl->getLinkTarget($this, "initialOpenedContent"));
1963  }
1964 
1965  // multi-lang actions
1966  if ($this->addMultiLangActionsAndInfo($list, $a_tpl))
1967  {
1968  $entries = true;
1969  }
1970 
1971  if ($entries)
1972  {
1973  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
1974  }
1975 
1976  $lng->loadLanguageModule("content");
1977  $list = new ilAdvancedSelectionListGUI();
1978  $list->setListTitle($lng->txt("cont_edit_mode"));
1979  $list->setId("copage_ed_mode");
1980 
1981  // media mode
1982  if ($sel_media_mode == "enable")
1983  {
1984  $ilCtrl->setParameter($this, "media_mode", "disable");
1985  $list->addItem($lng->txt("cont_deactivate_media"), "",
1986  $ilCtrl->getLinkTarget($this, "setEditMode"));
1987  }
1988  else
1989  {
1990  $ilCtrl->setParameter($this, "media_mode", "enable");
1991  $list->addItem($lng->txt("cont_activate_media"), "",
1992  $ilCtrl->getLinkTarget($this, "setEditMode"));
1993  }
1994  $ilCtrl->setParameter($this, "media_mode", "");
1995 
1996  // html mode
1997  if (!$this->getPageConfig()->getPreventHTMLUnmasking())
1998  {
1999  if ($sel_html_mode == "enable")
2000  {
2001  $ilCtrl->setParameter($this, "html_mode", "disable");
2002  $list->addItem($lng->txt("cont_deactivate_html"), "",
2003  $ilCtrl->getLinkTarget($this, "setEditMode"));
2004  }
2005  else
2006  {
2007  $ilCtrl->setParameter($this, "html_mode", "enable");
2008  $list->addItem($lng->txt("cont_activate_html"), "",
2009  $ilCtrl->getLinkTarget($this, "setEditMode"));
2010  }
2011  }
2012  $ilCtrl->setParameter($this, "html_mode", "");
2013 
2014  // js mode
2015  if ($sel_js_mode == "enable")
2016  {
2017  $ilCtrl->setParameter($this, "js_mode", "disable");
2018  $list->addItem($lng->txt("cont_deactivate_js"), "",
2019  $ilCtrl->getLinkTarget($this, "setEditMode"));
2020  }
2021  else
2022  {
2023  $ilCtrl->setParameter($this, "js_mode", "enable");
2024  $list->addItem($lng->txt("cont_activate_js"), "",
2025  $ilCtrl->getLinkTarget($this, "setEditMode"));
2026  }
2027  $ilCtrl->setParameter($this, "js_mode", "");
2028 
2029  $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2030  }
2031 
2038  function addMultiLangActionsAndInfo($a_list, $a_tpl)
2039  {
2040  global $lng, $ilCtrl;
2041 
2042  $any_items = false;
2043 
2044  $cfg = $this->getPageConfig();
2045 
2046  // general multi lang support and single page mode?
2047  if ($cfg->getMultiLangSupport())
2048  {
2049  //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
2050  //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
2051  // $this->getPageObject()->getParentId());
2052 
2053  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2054  $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
2055 
2056  if (!$ot->getContentActivated())
2057  {
2058 /* if ($cfg->getSinglePageMode())
2059  {
2060  $a_list->addItem($lng->txt("cont_activate_multi_lang"), "",
2061  $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
2062 
2063  $any_items = true;
2064  }*/
2065  }
2066  else
2067  {
2068  $lng->loadLanguageModule("meta");
2069 //echo $this->getPageObject()->getLanguage();
2070  if ($this->getPageObject()->getLanguage() != "-")
2071  {
2072  $l = $ot->getMasterLanguage();
2073  $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2074  $lng->txt("meta_l_".$l), "",
2075  $ilCtrl->getLinkTarget($this, "editMasterLanguage"));
2076  }
2077 
2078  foreach ($ot->getLanguages() as $al => $lang)
2079  {
2080  if ($this->getPageObject()->getLanguage() != $al &&
2081  $al != $ot->getMasterLanguage())
2082  {
2083  $ilCtrl->setParameter($this, "totransl", $al);
2084  $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2085  $lng->txt("meta_l_".$al), "",
2086  $ilCtrl->getLinkTarget($this, "switchToLanguage"));
2087  $ilCtrl->setParameter($this, "totransl", $_GET["totransl"]);
2088  }
2089  }
2090 
2091 /* if ($cfg->getSinglePageMode())
2092  {
2093  $a_list->addItem($lng->txt("cont_manage_multilang"), "",
2094  $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
2095  }*/
2096 
2097  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
2098  $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(),
2099  $this->getPageObject()->getParentId());
2100  $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
2101 
2102  $any_items = true;
2103  }
2104  }
2105 
2106  return $any_items;
2107  }
2108 
2109 
2113  function setEditMode()
2114  {
2115  global $ilCtrl, $ilUser;
2116 
2117  if ($_GET["media_mode"] != "")
2118  {
2119  if ($_GET["media_mode"] == "disable")
2120  {
2121  $ilUser->writePref("ilPageEditor_MediaMode", "disable");
2122  }
2123  else
2124  {
2125  $ilUser->writePref("ilPageEditor_MediaMode", "");
2126  }
2127  }
2128  if ($_GET["html_mode"] != "")
2129  {
2130  if ($_GET["html_mode"] == "disable")
2131  {
2132  $ilUser->writePref("ilPageEditor_HTMLMode", "disable");
2133  }
2134  else
2135  {
2136  $ilUser->writePref("ilPageEditor_HTMLMode", "");
2137  }
2138  }
2139  if ($_GET["js_mode"] != "")
2140  {
2141  if ($_GET["js_mode"] == "disable")
2142  {
2143  $ilUser->writePref("ilPageEditor_JavaScript", "disable");
2144  }
2145  else
2146  {
2147  $ilUser->writePref("ilPageEditor_JavaScript", "");
2148  }
2149  }
2150 
2151  $ilCtrl->redirect($this, "edit");
2152  }
2153 
2154 
2158  static function getTinyMenu($a_par_type,
2159  $a_int_links = false, $a_wiki_links = false, $a_keywords = false,
2160  $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true,
2161  $a_anchors = false, $a_save_new = true)
2162  {
2163  global $lng, $ilCtrl;
2164 
2165  $mathJaxSetting = new ilSetting("MathJax");
2166 
2167  include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2168 
2169  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2170 
2171  $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2172 
2173  // debug ghost element
2174  if (DEVMODE == 1)
2175  {
2176  $btpl->touchBlock("debug_ghost");
2177  }
2178 
2179  // bullet list
2180  $btpl->touchBlock("blist_button");
2181  ilTooltipGUI::addTooltip("il_edm_blist",
2182  $lng->txt("cont_blist"),
2183  "iltinymenu_bd");
2184 
2185  // numbered list
2186  $btpl->touchBlock("nlist_button");
2187  ilTooltipGUI::addTooltip("il_edm_nlist",
2188  $lng->txt("cont_nlist"),
2189  "iltinymenu_bd");
2190 
2191  // list indent
2192  $btpl->touchBlock("list_indent");
2193  ilTooltipGUI::addTooltip("ilIndentBut",
2194  $lng->txt("cont_list_indent"),
2195  "iltinymenu_bd");
2196 
2197  // list outdent
2198  $btpl->touchBlock("list_outdent");
2199  ilTooltipGUI::addTooltip("ilOutdentBut",
2200  $lng->txt("cont_list_outdent"),
2201  "iltinymenu_bd");
2202 
2203  if ($a_int_links)
2204  {
2205  $btpl->touchBlock("bb_ilink_button");
2206  ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"),
2207  "iltinymenu_bd");
2208  }
2209  ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"),
2210  "iltinymenu_bd");
2211 
2212  // remove format
2213  $btpl->touchBlock("rformat_button");
2214  ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"),
2215  "iltinymenu_bd");
2216 
2217  if ($a_paragraph_styles)
2218  {
2219  // new paragraph
2220  $btpl->setCurrentBlock("new_par");
2221  $btpl->setVariable("IMG_NEWPAR", "+");
2222  $btpl->parseCurrentBlock();
2223  ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"),
2224  "iltinymenu_bd");
2225 
2226  $btpl->setCurrentBlock("par_edit");
2227  $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2228  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2229  $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected,
2230  ilPCParagraphGUI::_getCharacteristics($a_style_id), true));
2231 
2232  ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection",
2233  $lng->txt("cont_paragraph_styles"), "iltinymenu_bd");
2234 
2235  $btpl->parseCurrentBlock();
2236  }
2237 
2238  if ($a_keywords)
2239  {
2240  $btpl->setCurrentBlock("bb_kw_button");
2241  $btpl->setVariable("CC_KW", "kw");
2242  $btpl->parseCurrentBlock();
2243  ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"),
2244  "iltinymenu_bd");
2245 
2246  }
2247 
2248  if ($a_wiki_links)
2249  {
2250  $btpl->setCurrentBlock("bb_wikilink_button2");
2251  $btpl->setVariable("TXT_WIKI_BUTTON2", $lng->txt("obj_wiki"));
2252  $btpl->setVariable("WIKI_BUTTON2_URL", $ilCtrl->getLinkTargetByClass("ilwikipagegui", ""));
2253  $btpl->parseCurrentBlock();
2254  ilTooltipGUI::addTooltip("il_edm_wlinkd", $lng->txt("cont_wiki_link_dialog"),
2255  "iltinymenu_bd");
2256 
2257  $btpl->setCurrentBlock("bb_wikilink_button");
2258  $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2259  $btpl->parseCurrentBlock();
2260  ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"),
2261  "iltinymenu_bd");
2262  }
2263 
2264  $aset = new ilSetting("adve");
2265 
2266  include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2267  foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st)
2268  {
2269  // these are handled via drop down now...
2270  if (in_array($c, array("com", "quot", "acc", "code")))
2271  {
2272  continue;
2273  }
2275  $a_par_type, "active_".$c, true))
2276  {
2277  $cc_code = $c;
2278  if ($aset->get("use_physical"))
2279  {
2280  $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2281  }
2282 
2283  if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2284  {
2285  $btpl->setCurrentBlock("bb_".$c."_button");
2286  $btpl->setVariable("CC_".strtoupper($c), $cc_code);
2287  $btpl->parseCurrentBlock();
2288  ilTooltipGUI::addTooltip("il_edm_cc_".$c,
2289  $lng->txt("cont_cc_".$c),
2290  "iltinymenu_bd");
2291 
2292 // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2293  }
2294  }
2295  }
2296 
2297  if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2298  {
2299  ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"),
2300  "iltinymenu_bd");
2301  }
2302  ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"),
2303  "iltinymenu_bd");
2304 
2305  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2306  $sdd = new ilAdvancedSelectionListGUI();
2307  $sdd->setPullRight(false);
2308  $sdd->setListTitle($lng->txt("save")."...");
2309 
2310  if ($a_save_return)
2311  {
2312  $btpl->setCurrentBlock("save_return");
2313  $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2314  $btpl->parseCurrentBlock();
2315  $sdd->addItem($lng->txt("save_return"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(false); return false;");
2316  }
2317 
2318  if ($a_save_new)
2319  {
2320  $btpl->setCurrentBlock("save_new");
2321  $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
2322  $btpl->parseCurrentBlock();
2323  $sdd->addItem($lng->txt("save_new"), "", "#", "", "", "", "", "", "ilCOPage.cmdSaveReturn(true); return false;");
2324  }
2325 
2326  $sdd->addItem($lng->txt("save"), "", "#", "", "", "", "", "", "ilCOPage.cmdSave(null); return false;");
2327  $sdd->addItem($lng->txt("cancel"), "", "#", "", "", "", "", "", "ilCOPage.cmdCancel(); return false;");
2328 
2329  if ($a_anchors)
2330  {
2331  $btpl->setCurrentBlock("bb_anc_button");
2332  $btpl->setVariable("CC_ANC", "anc");
2333  $btpl->parseCurrentBlock();
2334  ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"),
2335  "iltinymenu_bd");
2336  }
2337 
2338  $btpl->setVariable("SAVE_DROPDOWN", $sdd->getHTML());
2339 
2340 /* // footnote
2341  $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2342  $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2343  $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2344 */
2345 // $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2346 
2347  $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2348  $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2349 
2350  $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2351  $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2352  $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2353  $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2354  $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2355 
2356  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2357  $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type));
2358  ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection",
2359  $lng->txt("cont_more_character_styles"), "iltinymenu_bd");
2360 
2361  return $btpl->get();
2362  }
2363 
2368  {
2369  global $ilCtrl;
2370 
2371  $int_links = $this->getPageObject()->getInternalLinks();
2372 //var_dump($int_links);
2373  $link_info = "<IntLinkInfos>";
2374  $targetframe = "None";
2375  foreach ($int_links as $int_link)
2376  {
2377  $target = $int_link["Target"];
2378  if (substr($target, 0, 4) == "il__")
2379  {
2380  $target_arr = explode("_", $target);
2381  $target_id = $target_arr[count($target_arr) - 1];
2382  $type = $int_link["Type"];
2383 
2384  $targetframe = ($int_link["TargetFrame"] != "")
2385  ? $int_link["TargetFrame"]
2386  : "None";
2387 
2388  $ltarget="_top";
2389  if ($targetframe != "None")
2390  {
2391  $ltarget="_blank";
2392  }
2393 
2394  // anchor
2395  $anc = $anc_add = "";
2396  if ($int_link["Anchor"] != "")
2397  {
2398  $anc = $int_link["Anchor"];
2399  $anc_add = "_".rawurlencode($int_link["Anchor"]);
2400  }
2401 
2402  $href = "";
2403  switch($type)
2404  {
2405  case "PageObject":
2406  case "StructureObject":
2408  if ($type == "PageObject")
2409  {
2410  $href = "./goto.php?target=pg_".$target_id.$anc_add;
2411  }
2412  else
2413  {
2414  $href = "./goto.php?target=st_".$target_id;
2415  }
2416  break;
2417 
2418  case "GlossaryItem":
2419  if ($targetframe == "None")
2420  {
2421  $targetframe = "Glossary";
2422  }
2423  $href = "./goto.php?target=git_".$target_id;
2424  break;
2425 
2426  case "MediaObject":
2427  $ilCtrl->setParameter($this, "mob_id", $target_id);
2428  //$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
2429  $href = $ilCtrl->getLinkTarget($this, "displayMedia");
2430  $ilCtrl->setParameter($this, "mob_id", "");
2431  break;
2432 
2433  case "WikiPage":
2434  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
2436  break;
2437 
2438  case "RepositoryItem":
2439  $obj_type = ilObject::_lookupType($target_id, true);
2441  $href = "./goto.php?target=".$obj_type."_".$target_id;
2442  break;
2443 
2444 
2445  }
2446  $anc_par = 'Anchor="'.$anc.'"';
2447  $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".$anc_par." ".
2448  "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
2449  }
2450  }
2451  $link_info.= "</IntLinkInfos>";
2452  $this->setLinkXML($link_info);
2453  }
2454 
2458  function downloadFile()
2459  {
2460  $this->obj->buildDom();
2461 
2462  include_once("./Services/COPage/classes/class.ilPCFileList.php");
2463  $files = ilPCFileList::collectFileItems($this->obj, $this->obj->getDomDoc());
2464 
2465  $file = explode("_", $_GET["file_id"]);
2466  require_once("./Modules/File/classes/class.ilObjFile.php");
2467  $file_id = $file[count($file) - 1];
2468 
2469  // file must be in page
2470  if (!in_array($file_id, $files))
2471  {
2472  exit;
2473  }
2474  $fileObj =& new ilObjFile($file_id, false);
2475  $fileObj->sendFile();
2476  exit;
2477  }
2478 
2483  {
2484  $this->displayMedia(true);
2485  }
2486 
2490  function displayMedia($a_fullscreen = false)
2491  {
2492  global $tpl;
2493 
2494  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2495  $tpl->setCurrentBlock("ilMedia");
2496 
2497  //$int_links = $page_object->getInternalLinks();
2498  $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2499 
2500  // @todo
2501  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2502 
2503  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2504  $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2505  require_once("./Services/COPage/classes/class.ilPageObject.php");
2506  $pg_obj = $this->getPageObject();
2507  $pg_obj->buildDom();
2508 
2509  if (!empty ($_GET["pg_id"]))
2510  {
2511  $xml = "<dummy>";
2512  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2513  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2514  $xml.= $link_xml;
2515  $xml.="</dummy>";
2516  }
2517  else
2518  {
2519  $xml = "<dummy>";
2520  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2521  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2522  $xml.= $link_xml;
2523  $xml.="</dummy>";
2524  }
2525 
2526  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2527  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2528  $xh = xslt_create();
2529 
2530  $mode = "media";
2531  if ($a_fullscreen)
2532  {
2533  $mode = "fullscreen";
2534  }
2535 
2536 //echo "<b>XML:</b>".htmlentities($xml);
2537  // determine target frames for internal links
2538  $wb_path = ilUtil::getWebspaceDir("output")."/";
2539  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2540  $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
2541  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
2542  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2543  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
2544 //echo "<br><br>".htmlentities($output);
2545  //echo xslt_error($xh);
2546  xslt_free($xh);
2547 
2548  // unmask user html
2549  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2551  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2552  $tpl->setVariable("MEDIA_CONTENT", $output);
2553 
2554  // add js
2555  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2557  $tpl->fillJavaScriptFiles();
2558  $tpl->fillCssFiles();
2559 
2560  echo $tpl->get();
2561  exit;
2562  }
2563 
2568  {
2569  $pg_obj = $this->getPageObject();
2570  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2571  }
2572 
2576  function insertContentIncludes($a_html)
2577  {
2578  global $ilCtrl, $lng;
2579 
2580  $c_pos = 0;
2581  $start = strpos($a_html, "{{{{{ContentInclude;");
2582  if (is_int($start))
2583  {
2584  $end = strpos($a_html, "}}}}}", $start);
2585  }
2586  $i = 1;
2587  while ($end > 0)
2588  {
2589  $param = substr($a_html, $start + 20, $end - $start - 20);
2590  $param = explode(";", $param);
2591 
2592  if ($param[0] == "mep" && is_numeric($param[1]) && $param[2] <= 0)
2593  {
2594  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
2595 
2596  if (ilMediaPoolPage::_exists($param[1]))
2597  {
2598  $page_gui = new ilMediaPoolPageGUI($param[1], 0, true, "-");
2599  if ($this->getOutputMode() != "offline")
2600  {
2601  $page_gui->setFileDownloadLink($this->determineFileDownloadLink());
2602  $page_gui->setFullscreenLink($this->determineFullscreenLink());
2603  $page_gui->setSourceCodeDownloadScript($this->determineSourcecodeDownloadScript());
2604  }
2605  else
2606  {
2607  $page_gui->setOutputMode(IL_PAGE_OFFLINE);
2608  }
2609 
2610  $html = $page_gui->getRawContent();
2611  }
2612  else
2613  {
2614  if ($this->getOutputMode() == "edit")
2615  {
2616  $html = "// ".$lng->txt("cont_missing_snippet")." //";
2617  }
2618  }
2619  $h2 = substr($a_html, 0, $start).
2620  $html.
2621  substr($a_html, $end + 5);
2622  $a_html = $h2;
2623  $i++;
2624  }
2625  $start = strpos($a_html, "{{{{{ContentInclude;", $start + 5);
2626  $end = 0;
2627  if (is_int($start))
2628  {
2629  $end = strpos($a_html, "}}}}}", $start);
2630  }
2631  }
2632  return $a_html;
2633  }
2634 
2641  function insertPageToc($a_output)
2642  {
2643  global $lng;
2644 
2645  include_once("./Services/Utilities/classes/class.ilStr.php");
2646 
2647  // extract all headings
2648  $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2649  $page_heads = array();
2650  foreach ($offsets as $os)
2651  {
2652  $level = (int) substr($a_output, $os + 10, 1);
2653  if (in_array($level, array(1,2,3)))
2654  {
2655  $anchor = str_replace("TocH", "TocA",
2656  substr($a_output, $os, strpos($a_output, "<", $os) - $os - 3)
2657  );
2658 
2659  // get heading
2660  $tag_start = stripos($a_output, "<h".$level." ", $os);
2661  $tag_end = stripos($a_output, "</h".$level.">", $tag_start);
2662  $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2663 
2664  // get headings text
2665  $text_start = stripos($head, ">") + 1;
2666  $text_end = strripos($head, "<!--", $text_start);
2667  $text = substr($head, $text_start, $text_end - $text_start);
2668  $page_heads[] = array("level" => $level, "text" => $text,
2669  "anchor" => $anchor);
2670  }
2671  }
2672 
2673  if (count($page_heads) > 1)
2674  {
2675  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2676  $list = new ilNestedList();
2677  $list->setAutoNumbering(true);
2678  $list->setListClass("ilc_page_toc_PageTOCList");
2679  $list->setItemClass("ilc_page_toc_PageTOCItem");
2680  $i = 0;
2681  $c_depth = 1;
2682  $c_par[1] = 0;
2683  $c_par[2] = 0;
2684  $nr[1] = 1;
2685  $nr[2] = 1;
2686  $nr[3] = 1;
2687  foreach ($page_heads as $ind => $h)
2688  {
2689  $i++;
2690  $par = 0;
2691 
2692  // check if we have a parent for one level up
2693  $par = 0;
2694  if ($h["level"] == 2 && $c_par[1] > 0)
2695  {
2696  $par = $c_par[1];
2697  }
2698  if ($h["level"] == 3 && $c_par[2] > 0)
2699  {
2700  $par = $c_par[2];
2701  }
2702 
2703  $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2704 
2705  // add the list node
2706  $list->addListNode(
2707  "<a href='#".$h["anchor"]."' class='ilc_page_toc_PageTOCLink'>".$h["text"]."</a>",
2708  $i, $par);
2709 
2710  // set the node as current parent of the level
2711  if ($h["level"] == 1)
2712  {
2713  $c_par[1] = $i;
2714  $c_par[2] = 0;
2715  }
2716  if ($h["level"] == 2)
2717  {
2718  $c_par[2] = $i;
2719  }
2720  }
2721 
2722  $tpl = new ilTemplate("tpl.page_toc.html", true, true,
2723  "Services/COPage");
2724  $tpl->setVariable("PAGE_TOC", $list->getHTML());
2725  $tpl->setVariable("TXT_PAGE_TOC", $lng->txt("cont_page_toc"));
2726  $tpl->setVariable("TXT_HIDE", $lng->txt("hide"));
2727  $tpl->setVariable("TXT_SHOW", $lng->txt("show"));
2728 
2729  $a_output = str_replace("{{{{{PageTOC}}}}}",
2730  $tpl->get(), $a_output);
2731  $numbers = $list->getNumbers();
2732 
2733  if (count($numbers) > 0)
2734  {
2735  include_once("./Services/Utilities/classes/class.ilStr.php");
2736  foreach ($numbers as $n)
2737  {
2738  $a_output =
2739  ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n." ", $a_output);
2740  }
2741  }
2742  }
2743  else
2744  {
2745  $a_output = str_replace("{{{{{PageTOC}}}}}",
2746  "", $a_output);
2747  }
2748 
2749  return $a_output;
2750  }
2751 
2758  function insertResources($a_output)
2759  {
2760  // this is edit mode only
2761 
2762  if ($this->getEnablePCType("Resources") &&
2763  ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview"))
2764  {
2765  include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2766  $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2767  }
2768  return $a_output;
2769  }
2770 
2771 
2772 
2779  function insertAdvTrigger($a_output)
2780  {
2781  global $lng;
2782 
2783  if (!$this->getAbstractOnly())
2784  {
2785  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2786  $lng->txt("cont_show_adv"), $a_output);
2787  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2788  $lng->txt("cont_hide_adv"), $a_output);
2789  }
2790  else
2791  {
2792  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2793  "", $a_output);
2794  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2795  "", $a_output);
2796  }
2797 
2798  return $a_output;
2799  }
2800 
2801 
2806  function postOutputProcessing($a_output)
2807  {
2808  return $a_output;
2809  }
2810 
2814  function insertHelp($a_tpl)
2815  {
2816  global $lng;
2817 
2818  $a_tpl->setCurrentBlock("help");
2819  $a_tpl->setVariable("TXT_ADD_EL", $lng->txt("cont_add_elements"));
2820  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
2821  $a_tpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD));
2822  $a_tpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG));
2823  $a_tpl->setVariable("TXT_DRAG", $lng->txt("cont_drag_and_drop_elements"));
2824  $a_tpl->setVariable("TXT_SEL", $lng->txt("cont_double_click_to_delete"));
2825  $a_tpl->parseCurrentBlock();
2826  }
2827 
2831  function previewHistory()
2832  {
2833  $this->preview();
2834  }
2835 
2839  function preview()
2840  {
2841  global $tree;
2843  return $this->showPage();
2844  }
2845 
2849  function edit()
2850  {
2851  global $tree, $lng, $ilCtrl, $ilSetting, $ilUser, $ilHelp;
2852 
2853  // editing allowed?
2854  if (!$this->getEnableEditing())
2855  {
2856  ilUtil::sendFailure($lng->txt("permission_denied"), true);
2857  $ilCtrl->redirect($this, "preview");
2858  }
2859 
2860  // not so nive workaround for container pages, bug #0015831
2861  $ptype = $this->getParentType();
2862  if ($ptype == "cont" && $_GET["ref_id"] > 0)
2863  {
2864  $ptype = ilObject::_lookupType((int) $_GET["ref_id"], true);
2865  }
2866  $ilHelp->setScreenId("edit_".$ptype);
2867 
2868  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2869  if(
2870  $ilUser->isAnonymous() &&
2871  !$ilUser->isCaptchaVerified() &&
2872  ilCaptchaUtil::isActiveForWiki()
2873  )
2874  {
2875  $form = $this->initCaptchaForm();
2876  if($_POST['captcha_code'] && $form->checkInput())
2877  {
2878  $ilUser->setCaptchaVerified(true);
2879  }
2880  else
2881  {
2882  return $form->getHTML();
2883  }
2884  }
2885 
2886  // edit lock
2887  if (!$this->getPageObject()->getEditLock())
2888  {
2889  include_once("./Services/User/classes/class.ilUserUtil.php");
2890  $info = $lng->txt("content_no_edit_lock");
2891  $lock = $this->getPageObject()->getEditLockInfo();
2892  $info .= "</br>" . $lng->txt("content_until") . ": " .
2893  ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2894  $info .= "</br>" . $lng->txt("obj_usr") . ": " .
2895  ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2896  if (!$ilCtrl->isAsynch())
2897  {
2898  ilUtil::sendInfo($info);
2899  return "";
2900  }
2901  else
2902  {
2903  echo $this->tpl->getMessageHTML($info);
2904  exit;
2905  }
2906  }
2907  else
2908  {
2909  $aset = new ilSetting("adve");
2910 
2911  $min = (int) $aset->get("block_mode_minutes") ;
2912  if ($min > 0)
2913  {
2914  include_once("./Services/User/classes/class.ilUserUtil.php");
2915  $lock = $this->getPageObject()->getEditLockInfo();
2916  $info = $lng->txt("cont_got_lock_until");
2917  $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX)), $info);
2918  //$info.= "</br>".$lng->txt("content_until").": ".
2919  // ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX));
2920  //$info.= "</br>".$lng->txt("obj_usr").": ".
2921  // ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2922  include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
2923  $but = ilLinkButton::getInstance();
2924  $but->setCaption("cont_finish_editing");
2925  $but->setUrl($ilCtrl->getLinkTarget($this, "releasePageLock"));
2926  $info = str_replace("%2", $but->render(), $info);
2927  ilUtil::sendInfo($info);
2928  }
2929  }
2930 
2931  $this->setOutputMode(IL_PAGE_EDIT);
2932 
2933  $html = $this->showPage();
2934 
2935  if ($this->isEnabledNotes())
2936  {
2937  $html.= "<br /><br />".$this->getNotesHTML();
2938  }
2939 
2940  return $html;
2941  }
2942 
2950  {
2951  global $tpl;
2952 
2953 // 'pl_hier_id' => string '2_1_1_1' (length=7)
2954 // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
2955  $html = $this->edit();
2956 
2957  $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('".
2958  $_GET["pl_hier_id"].":".$_GET["pl_pc_id"].
2959  "');", 3);
2960 
2961  return $html;
2962  }
2963 
2967  public function initCaptchaForm()
2968  {
2973  global $lng, $ilCtrl;
2974 
2975  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2976  $form = new ilPropertyFormGUI();
2977 
2978  require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
2979  $ci = new ilCaptchaInputGUI($lng->txt('cont_captcha_code'), 'captcha_code');
2980  $ci->setRequired(true);
2981  $form->addItem($ci);
2982 
2983  $form->addCommandButton('edit', $lng->txt('ok'));
2984 
2985  $form->setTitle($lng->txt('cont_captcha_verification'));
2986  $form->setFormAction($ilCtrl->getFormAction($this));
2987 
2988  return $form;
2989  }
2990 
2991  /*
2992  * presentation
2993  */
2995  {
2996  global $tree;
2997  $this->setOutputMode($a_mode);
2998 
2999  return $this->showPage();
3000  }
3001 
3002  function getHTML()
3003  {
3004  $this->getTabs("preview");
3005  return $this->showPage();
3006  }
3007 
3011  function showMediaFullscreen($a_style_id = 0)
3012  {
3013  $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3014  $this->tpl->setCurrentBlock("ContentStyle");
3015  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3016  $this->tpl->parseCurrentBlock();
3017 
3018  $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
3019  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3020  $this->tpl->setCurrentBlock("ilMedia");
3021 
3022  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3023  $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
3024  if (!empty ($_GET["pg_id"]))
3025  {
3026  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3027  $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
3028  $pg_obj->buildDom();
3029 
3030  $xml = "<dummy>";
3031  // todo: we get always the first alias now (problem if mob is used multiple
3032  // times in page)
3033  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3034  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3035  $xml.="</dummy>";
3036  }
3037  else
3038  {
3039  $xml = "<dummy>";
3040  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
3041  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3042  $xml.="</dummy>";
3043  }
3044 
3045 //echo htmlentities($xml); exit;
3046 
3047  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3048  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3049  $xh = xslt_create();
3050 
3051 //echo "<b>XML:</b>".htmlentities($xml);
3052  // determine target frames for internal links
3053  //$pg_frame = $_GET["frame"];
3054  $wb_path = ilUtil::getWebspaceDir("output")."/";
3055  $mode = "fullscreen";
3056  $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
3057  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
3058  echo xslt_error($xh);
3059  xslt_free($xh);
3060 
3061  // unmask user html
3062  $this->tpl->setVariable("MEDIA_CONTENT", $output);
3063  }
3064 
3070  function displayValidationError($a_error)
3071  {
3072  if(is_array($a_error))
3073  {
3074  $error_str = "<b>Error(s):</b><br>";
3075  foreach ($a_error as $error)
3076  {
3077  $err_mess = implode($error, " - ");
3078  if (!is_int(strpos($err_mess, ":0:")))
3079  {
3080  $error_str .= htmlentities($err_mess)."<br />";
3081  }
3082  }
3083  $this->tpl->setVariable("MESSAGE", $error_str);
3084  }
3085  }
3086 
3090  function history()
3091  {
3092  global $tpl, $lng, $ilAccess;
3093 
3094  if (!$this->getEnableEditing())
3095  {
3096  return;
3097  }
3098 
3099  $tpl->addJavaScript("./Services/COPage/js/page_history.js");
3100 
3101  include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3102  $table_gui = new ilPageHistoryTableGUI($this, "history");
3103  $table_gui->setId("hist_table");
3104  $entries = $this->getPageObject()->getHistoryEntries();
3105  $entries[] = array('page_id' => $this->getPageObject()->getId(),
3106  'parent_type' => $this->getPageObject()->getParentType(),
3107  'hdate' => $this->getPageObject()->getLastChange(),
3108  'parent_id' => $this->getPageObject()->getParentId(),
3109  'nr' => 0,
3110  'sortkey' => 999999,
3111  'user' => $this->getPageObject()->last_change_user);
3112  $table_gui->setData($entries);
3113  return $table_gui->getHTML();
3114  }
3115 
3120  {
3121  global $tpl, $lng, $ilAccess, $ilCtrl;
3122 
3123  if (!$this->getEnableEditing())
3124  {
3125  return;
3126  }
3127 
3128  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3129  $c_gui = new ilConfirmationGUI();
3130 
3131  // set confirm/cancel commands
3132  $ilCtrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3133  $c_gui->setFormAction($ilCtrl->getFormAction($this, "rollback"));
3134  $c_gui->setHeaderText($lng->txt("cont_rollback_confirmation"));
3135  $c_gui->setCancel($lng->txt("cancel"), "history");
3136  $c_gui->setConfirm($lng->txt("confirm"), "rollback");
3137 
3138  $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3139 
3140  $c_gui->addItem("id[]", $_GET["old_nr"],
3142 
3143  $tpl->setContent($c_gui->getHTML());
3144  }
3145 
3149  function rollback()
3150  {
3151  global $ilCtrl;
3152 
3153  if (!$this->getEnableEditing())
3154  {
3155  return;
3156  }
3157 
3158  $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3159 
3160  if ($hentry["content"] != "")
3161  {
3162  $this->obj->setXMLContent($hentry["content"]);
3163  $this->obj->buildDom(true);
3164  if ($this->obj->update())
3165  {
3166  $ilCtrl->redirect($this, "history");
3167  }
3168  }
3169  $ilCtrl->redirect($this, "history");
3170  }
3171 
3179  {
3180  global $ilHelp;
3181 
3182  $ilHelp->setScreenIdComponent("copg");
3183  }
3184 
3190  function getTabs($a_activate = "")
3191  {
3192  global $ilTabs, $ilCtrl, $ilUser;
3193 
3194  $this->setScreenIdComponent();
3195 
3196  if (!$this->getEnabledTabs())
3197  {
3198  return;
3199  }
3200 
3201 //echo "-".$ilCtrl->getNextClass()."-".$ilCtrl->getCmd()."-";
3202  // back to upper context
3203 
3204  if (!$this->getEditPreview())
3205  {
3206  $ilTabs->addTarget("pg", $ilCtrl->getLinkTarget($this, "preview")
3207  , array("", "preview"));
3208 
3209  if ($this->getEnableEditing())
3210  {
3211  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3212  , array("", "edit"));
3213  }
3214  }
3215  else
3216  {
3217  if ($this->getEnableEditing())
3218  {
3219  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3220  , array("", "edit"));
3221  }
3222 
3223  $ilTabs->addTarget("cont_preview", $ilCtrl->getLinkTarget($this, "preview")
3224  , array("", "preview"));
3225  }
3226 
3227  //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3228  // , "properties", get_class($this));
3229 
3230  if ($this->use_meta_data)
3231  {
3232  $ilTabs->addTarget("meta_data",
3233  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
3234  "", "ilmdeditorgui");
3235  }
3236 
3237  $lm_set = new ilSetting("lm");
3238 
3239  if ($this->getEnableEditing() && $lm_set->get("page_history", 1))
3240  {
3241  $ilTabs->addTarget("history", $this->ctrl->getLinkTarget($this, "history")
3242  , "history", get_class($this));
3243  if ($_GET["history_mode"] == "1" || $this->ctrl->getCmd() == "compareVersion")
3244  {
3245  $ilTabs->activateTab("history");
3246  }
3247  }
3248 
3249 /* $tabs = $this->ctrl->getTabs();
3250  foreach ($tabs as $tab)
3251  {
3252  $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3253  , $tab["cmd"], $tab["class"]);
3254  }
3255 */
3256  if ($this->getEnableEditing() && $ilUser->getId() != ANONYMOUS_USER_ID)
3257  {
3258  $ilTabs->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
3259  , "view", "ilEditClipboardGUI");
3260  }
3261 
3262  if ($this->getPageConfig()->getEnableScheduledActivation())
3263  {
3264  $ilTabs->addTarget("cont_activation", $this->ctrl->getLinkTarget($this, "editActivation"),
3265  "editActivation", get_class($this));
3266  }
3267 
3268  if ($this->getEnabledNews())
3269  {
3270  $ilTabs->addTarget("news",
3271  $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3272  "", "ilnewsitemgui");
3273  }
3274 
3275  // external hook to add tabs
3276  if (is_array($this->tab_hook))
3277  {
3278  $func = $this->tab_hook["func"];
3279  $this->tab_hook["obj"]->$func();
3280  }
3281  //$ilTabs->setTabActive("pg");
3282  }
3283 
3287  function compareVersion()
3288  {
3289  global $lng;
3290 
3291  if (!$this->getEnableEditing())
3292  {
3293  return;
3294  }
3295 
3296  $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3297  $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3298 
3299  // left page
3300  $lpage = $compare["l_page"];
3301  $cfg = $this->getPageConfig();
3302  $cfg->setPreventHTMLUnmasking(true);
3303 
3305  $this->setPageObject($lpage);
3306  $this->setPresentationTitle($this->getPresentationTitle());
3307  $this->setCompareMode(true);
3308 
3309  $lhtml = $this->showPage();
3310  $lhtml = $this->replaceDiffTags($lhtml);
3311  $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3312  $tpl->setVariable("LEFT", $lhtml);
3313 
3314  // right page
3315  $rpage = $compare["r_page"];
3316  $this->setPageObject($rpage);
3317  $this->setPresentationTitle($this->getPresentationTitle());
3318  $this->setCompareMode(true);
3320 
3321  $rhtml = $this->showPage();
3322  $rhtml = $this->replaceDiffTags($rhtml);
3323  $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3324  $tpl->setVariable("RIGHT", $rhtml);
3325 
3326  $tpl->setVariable("TXT_NEW", $lng->txt("cont_pc_new"));
3327  $tpl->setVariable("TXT_MODIFIED", $lng->txt("cont_pc_modified"));
3328  $tpl->setVariable("TXT_DELETED", $lng->txt("cont_pc_deleted"));
3329 
3330 //var_dump($left);
3331 //var_dump($right);
3332 
3333  return $tpl->get();
3334  }
3335 
3336  function replaceDiffTags($a_html)
3337  {
3338  $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3339  $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3340  $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3341  $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3342 
3343  return $a_html;
3344  }
3345 
3349  function editActivation()
3350  {
3351  global $ilCtrl, $lng, $tpl;
3352 
3353  $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3354  $this->initActivationForm();
3355  $this->getActivationFormValues();
3356  $atpl->setVariable("FORM", $this->form->getHTML());
3357  $atpl->setCurrentBlock("updater");
3358  $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3359  $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3360  $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3361  $atpl->parseCurrentBlock();
3362  $tpl->setContent($atpl->get());
3363  }
3364 
3369  {
3370  global $ilCtrl, $lng;
3371 
3372  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3373  $this->form = new ilPropertyFormGUI();
3374  $this->form->setFormAction($ilCtrl->getFormAction($this));
3375  $this->form->setTitle($lng->txt("cont_page_activation"));
3376 
3377  // activation type radio
3378  $rad = new ilRadioGroupInputGUI($lng->txt("cont_activation"), "activation");
3379  $rad_op1 = new ilRadioOption($lng->txt("cont_activated"), "activated");
3380 
3381  $rad->addOption($rad_op1);
3382  $rad_op2 = new ilRadioOption($lng->txt("cont_deactivated"), "deactivated");
3383  $rad->addOption($rad_op2);
3384  $rad_op3 = new ilRadioOption($lng->txt("cont_scheduled_activation"), "scheduled");
3385 
3386  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_start"), "start");
3387  $dt_prop->setShowTime(true);
3388  $rad_op3->addSubItem($dt_prop);
3389  $dt_prop2 = new ilDateTimeInputGUI($lng->txt("cont_end"), "end");
3390  $dt_prop2->setShowTime(true);
3391  $rad_op3->addSubItem($dt_prop2);
3392 
3393  // show activation information
3394  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3395  $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3396  $rad_op3->addSubItem($cb);
3397 
3398 
3399  $rad->addOption($rad_op3);
3400 
3401  $this->form->addCommandButton("saveActivation", $lng->txt("save"));
3402 
3403  $this->form->addItem($rad);
3404  }
3405 
3410  {
3411  $values = array();
3412  $values["activation"] = "deactivated";
3413  if ($this->getPageObject()->getActive())
3414  {
3415  $values["activation"] = "activated";
3416  }
3417 
3418  $dt_prop = $this->form->getItemByPostVar("start");
3419  if ($this->getPageObject()->getActivationStart() != "")
3420  {
3421  $values["activation"] = "scheduled";
3422  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationStart(),
3423  IL_CAL_DATETIME));
3424  }
3425  $dt_prop = $this->form->getItemByPostVar("end");
3426  if ($this->getPageObject()->getActivationEnd() != "")
3427  {
3428  $values["activation"] = "scheduled";
3429  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationEnd(),
3430  IL_CAL_DATETIME));
3431  }
3432 
3433  $values["show_activation_info"] = $this->getPageObject()->getShowActivationInfo();
3434 
3435  $this->form->setValuesByArray($values);
3436  }
3437 
3441  function saveActivation()
3442  {
3443  global $tpl, $lng, $ilCtrl;
3444 
3445  $this->initActivationForm();
3446 
3447  if ($this->form->checkInput())
3448  {
3449  $this->getPageObject()->setActive(true);
3450  $this->getPageObject()->setActivationStart(null);
3451  $this->getPageObject()->setActivationEnd(null);
3452  $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3453  if ($_POST["activation"] == "deactivated")
3454  {
3455  $this->getPageObject()->setActive(false);
3456  }
3457  if ($_POST["activation"] == "scheduled")
3458  {
3459  $this->getPageObject()->setActive(false);
3460  $this->getPageObject()->setActivationStart(
3461  $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME));
3462  $this->getPageObject()->setActivationEnd(
3463  $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME));
3464  }
3465  $this->getPageObject()->update();
3466  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3467  $ilCtrl->redirect($this, "editActivation");
3468  }
3469  $this->form->getValuesByPost();
3470  $tpl->setContent($this->form->getHTML());
3471  }
3472 
3482  function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
3483  {
3484  global $ilCtrl;
3485 
3486  include_once("Services/Notes/classes/class.ilNoteGUI.php");
3487 
3488  // scorm 2004 page gui
3489  if(!$a_content_object)
3490  {
3491  $notes_gui = new ilNoteGUI($this->notes_parent_id,
3492  (int)$this->obj->getId(), "pg");
3493 
3494  $a_enable_private_notes = true;
3495  $a_enable_public_notes = true;
3496  $a_enable_notes_deletion = false;
3497  }
3498  // wiki page gui, blog posting gui
3499  else
3500  {
3501  $notes_gui = new ilNoteGUI($a_content_object->getParentId(),
3502  $a_content_object->getId(), $a_content_object->getParentType());
3503  }
3504 
3505  if($a_enable_private_notes)
3506  {
3507  $notes_gui->enablePrivateNotes();
3508  }
3509  if ($a_enable_public_notes)
3510  {
3511  $notes_gui->enablePublicNotes();
3512  if ((bool)$a_enable_notes_deletion)
3513  {
3514  $notes_gui->enablePublicNotesDeletion(true);
3515  }
3516  }
3517 
3518  if($a_callback)
3519  {
3520  $notes_gui->addObserver($a_callback);
3521  }
3522 
3523  $next_class = $this->ctrl->getNextClass($this);
3524  if ($next_class == "ilnotegui")
3525  {
3526  $html = $this->ctrl->forwardCommand($notes_gui);
3527  }
3528  else
3529  {
3530  $html = $notes_gui->getNotesHTML();
3531  }
3532  return $html;
3533  }
3534 
3538  function processAnswer()
3539  {
3540  global $ilLog;
3541 
3542  /*$ilLog->write($_POST);
3543  $ilLog->write($_POST["id"]);
3544  $ilLog->write($_POST["type"]);
3545  $ilLog->write($_POST["answer"]);
3546  $ilLog->write($_GET);*/
3547 
3548  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3550  ilUtil::stripSlashes($_POST["type"]),
3552  ilUtil::stripSlashes($_POST["answer"]));
3553  }
3554 
3555 
3556  //
3557  // Initially opened content (e.g. used in learning modules), that
3558  // is presented in another than the main content area (e.g. a picture in
3559  // the bottom left area)
3560  //
3561 
3569  {
3570  global $ilTabs, $ilCtrl;
3571 
3572  $ilTabs->activateTab("edit");
3573  $form = $this->initOpenedContentForm();
3574 
3575  $this->tpl->setContent($form->getHTML());
3576  }
3577 
3585  {
3586  global $ilCtrl;
3587 
3588  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3589  $form = new ilPropertyFormGUI();
3590 
3591  // link input
3592  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3593  $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3595  $ac->setInternalLinkDefault("Media_Media", 0);
3596  $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3597  $val = $this->obj->getInitialOpenedContent();
3598  if ($val["id"] != "" && $val["type"] != "")
3599  {
3600  $ac->setValue($val["type"]."|".$val["id"]."|".$val["target"]);
3601  }
3602 
3603  $form->addItem($ac);
3604 
3605  $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3606  $form->addCommandButton("edit", $this->lng->txt("cancel"));
3607  $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3608  $form->setFormAction($ilCtrl->getFormAction($this));
3609 
3610  return $form;
3611  }
3612 
3620  {
3621  global $ilCtrl;
3622 
3623  $this->obj->saveInitialOpenedContent(
3624  ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3625  ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3626  ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3627  );
3628 
3629  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3630  $ilCtrl->redirect($this, "edit");
3631  }
3632 
3636 
3637 
3641  function switchToLanguage()
3642  {
3643  global $ilCtrl;
3644 
3645  $l = ilUtil::stripSlashes($_GET["totransl"]);
3646  $p = $this->getPageObject();
3647  if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l))
3648  {
3650  return;
3651  }
3652  $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
3653  $ilCtrl->redirect($this, "edit");
3654  }
3655 
3660  {
3661  global $ilCtrl, $tpl, $lng;
3662 
3663  $l = ilUtil::stripSlashes($_GET["totransl"]);
3664  $ilCtrl->setParameter($this, "totransl", $l);
3665  $lng->loadLanguageModule("meta");
3666 
3667  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3668  $cgui = new ilConfirmationGUI();
3669  $cgui->setFormAction($ilCtrl->getFormAction($this));
3670  $cgui->setHeaderText($lng->txt("cont_page_translation_does_not_exist").": ".
3671  $lng->txt("meta_l_".$l));
3672  $cgui->setCancel($lng->txt("cancel"), "editMasterLanguage");
3673  $cgui->setConfirm($lng->txt("confirm"), "createPageTranslation");
3674  $tpl->setContent($cgui->getHTML());
3675  }
3676 
3681  {
3682  global $ilCtrl;
3683 
3684  $ilCtrl->setParameter($this, "transl", "");
3685  $ilCtrl->redirect($this, "edit");
3686  }
3687 
3692  {
3693  global $ilCtrl;
3694 
3695  $l = ilUtil::stripSlashes($_GET["totransl"]);
3696  $this->getPageObject()->copyPageToTranslation($l);
3697  $ilCtrl->setParameter($this, "transl", $l);
3698  $ilCtrl->redirect($this, "edit");
3699  }
3700 
3704  function releasePageLock()
3705  {
3706  global $ilCtrl, $lng;
3707 
3708  $this->getPageObject()->releasePageLock();
3709  ilUtil::sendSuccess($lng->txt("cont_page_lock_released"), true);
3710  $ilCtrl->redirect($this, "preview");
3711  }
3712 
3713  protected function isPageContainerToBeRendered()
3714  {
3715  return (
3716  $this->getRenderPageContainer() || $this->getOutputMode() == IL_PAGE_PREVIEW
3717  );
3718  }
3719 }
3720 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
xslt_create()
getPCDefinitions()
Get PC definitions.
history()
Get history table as HTML.
releasePageLock()
Release page lock.
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:86
ILIAS Setting Class.
initOpenedContentForm()
Init form for initially opened content.
print $file
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.
insertAdvTrigger($a_output)
Insert adv content trigger.
const IL_PAGE_PREVIEW
exit
Definition: login.php:54
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.
setEnablePCType($a_pc_type, $a_val)
Set enable pc type.
$_POST['username']
Definition: cron.php:12
getPageObject()
Get Page Object.
const ILIAS_VERSION
const IL_CAL_DATETIME
activateMetaDataEditor($a_rep_obj_id, $a_sub_obj_id, $a_type, $a_observer_obj=NULL, $a_observer_func="")
Activate meda data editor.
Class ilEditClipboardGUI.
editMasterLanguage()
Edit master language.
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"]
setParentType($a_val)
Set parent type.
static insertLatexImages($a_text, $a_start="\ex\, $a_end="\\tex\")
replace [text]...[/tex] tags with formula image code
setQuestionXML($question_xml)
if(strpos($jquery_path, './')===0) else if(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:34
xslt_free(&$proc)
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.
$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 _getCharacteristics($a_style_id)
Get characteristics.
confirmPageTranslationCreation()
Confirm page translation creation.
$target_id
Definition: goto.php:88
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
setEnableEditing($a_enableediting)
Set Enable Editing.
Class ilInternalLinkGUI.
insertJSAtPlaceholder()
InsertJS at placeholder.
static requirePCClassByName($a_name)
Get instance.
setDefaultLinkXml()
Set standard link xml.
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.
hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
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.
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)
Default behaviour is:
_getQuestionType($question_id)
Returns the question type of a question with a given id.
This class represents a date/time property in a property form.
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.
ilPageObjectGUI($a_parent_type, $a_id, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="")
Constructor.
presentation($a_mode=IL_PAGE_PRESENTATION)
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.
GUI class for public user profile presentation.
setFullscreenLink($a_fullscreen_link)
determineFullscreenLink()
Determine fullscreen link.
getEnabledNews()
Get enabled news.
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.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
$GLOBALS['ct_recipient']
addSubItem($a_item)
Add Subitem.
setOfflineDirectory($offdir)
set offline directory to offdir
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.
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.
download_paragraph()
download source code paragraph
_lookupContObjID($a_id)
get learning module / digibook id for lm object
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
static 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="")
setSourcecodeDownloadScript($script_name)
Class ilObjMediaObject.
static clear($a_var)
Unset a value.
setRenderPageContainer($a_val)
Set render page container.
$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
_getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
& executeCommand()
execute command
setFileDownloadLink($a_download_link)
const IL_MODE_ALIAS
static getCharStyleSelector($a_par_type, $a_use_callback=true)
Get character style selector.
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 initPanel($a_resize=false)
Init yui panel.
getActivationCaptions()
Get captions for activation action menu entries.
_doJSEditing()
checks if current user has activated js editing and if browser is js capable
User interface class for advanced drop-down selection lists.
getOfflineDirectory()
get offline directory
static isActivated()
Checks whether Map feature is activated.
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.
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 $ilUser
Definition: imgupload.php:15
getEnabledPageFocus()
Get Enable page focus.
getContentStylePath($a_style_id)
get content style path
global $ilSetting
Definition: privfeed.php:40
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.
insertContentIncludes($a_html)
Insert content includes.
initPageObject()
Init page object.
setTabHook($a_object, $a_function)
Set tab hook.
Class ilObjStyleSheet.
showPage()
display content of page
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)
Get Tiny Menu.
static initjQuery($a_tpl=null)
Init jQuery.
const IL_MODE_OUTPUT
addMultiLangActionsAndInfo($a_list, $a_tpl)
Add multi-language actions to menu.
static _exists($a_id)
Check whether meida pool page exists.
enablePrivateNotes($a_enable=true)
enable private notes
static saveQuestionAnswer($a_type, $a_id, $a_answer)
Save question answer.
insertResources($a_output)
Insert resources.
processAnswer()
Process answer.
getRenderPageContainer()
Get render page container.
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.
Class ilMediaPoolPage GUI class.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
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.
setShowTime($a_showtime)
Set Show Time Information.
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.
includePresentationJS($a_tpl=null)
Include media object presentation JS.
displayValidationError($a_error)
display validation error
static initJavascript()
Init javascript.