ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
394  {
395  $this->question_html = $question_html;
396  }
397 
398  function getQuestionXML()
399  {
400  return $this->question_xml;
401  }
402 
403  function getQuestionHTML()
404  {
405  return $this->question_html;
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("./Modules/LearningModule/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  include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1021  $edit_gui = new ilQuestionEditGUI();
1022  $edit_gui->setPageConfig($this->getPageConfig());
1023  $this->setQEditTabs("question");
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->setDefaultNrOfTries(null);
1047  $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1048 
1049  // forward to ilAssQuestionFeedbackGUI
1050  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1051  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
1052  $ilCtrl->forwardCommand($gui);
1053  break;
1054 
1055 /* case "ilpagemultilanggui":
1056  $ilCtrl->setReturn($this, "edit");
1057  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1058  $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1059  $this->getPageConfig()->getSinglePageMode());
1060  //$this->setTabs("settings");
1061  //$this->setSubTabs("cont_multilinguality");
1062  $ret = $this->ctrl->forwardCommand($ml_gui);
1063  break;*/
1064 
1065  default:
1066  $cmd = $this->ctrl->getCmd("preview");
1067  $ret = $this->$cmd();
1068  break;
1069  }
1070 //echo "+$ret+";
1071  return $ret;
1072  }
1073 
1080  function setQEditTabs($a_active)
1081  {
1082  global $ilTabs, $ilCtrl, $lng;
1083  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1084 
1085  $ilTabs->clearTargets();
1086 
1087  $ilTabs->setBackTarget($lng->txt("back"),
1088  $ilCtrl->getLinkTarget($this, "edit"));
1089 
1090  $ilCtrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1091  $ilTabs->addTab("question", $lng->txt("question"),
1092  $ilCtrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion"));
1093 
1094  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1095  $ilCtrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1096  $ilTabs->addTab("feedback", $lng->txt("feedback"),
1097  $ilCtrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW));
1098 
1099  $ilTabs->activateTab($a_active);
1100  }
1101 
1106  {
1107 
1108  }
1109 
1110 
1111  function deactivatePage()
1112  {
1113  $this->getPageObject()->setActivationStart(null);
1114  $this->getPageObject()->setActivationEnd(null);
1115  $this->getPageObject()->setActive(false);
1116  $this->getPageObject()->update();
1117  $this->ctrl->redirect($this, "edit");
1118  }
1119 
1120  function activatePage()
1121  {
1122  $this->getPageObject()->setActivationStart(null);
1123  $this->getPageObject()->setActivationEnd(null);
1124  $this->getPageObject()->setActive(true);
1125  $this->getPageObject()->update();
1126  $this->ctrl->redirect($this, "edit");
1127  }
1128 
1129  /*
1130  * display content of page
1131  */
1132  function showPage()
1133  {
1134  global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
1135 
1136  $this->initSelfAssessmentRendering();
1137 
1138  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1140 
1141 
1142  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1143 
1144  // needed for overlays in iim
1145  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1147 
1148  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1150 
1151  // init template
1152  //if($this->outputToTemplate())
1153  //{
1154  if($this->getOutputMode() == "edit")
1155  {
1156 //echo ":".$this->getTemplateTargetVar().":";
1157  $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1158  //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1159 
1160  // to do: status dependent class
1161  $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1162 
1163  // user comment
1164  if ($this->isEnabledChangeComments())
1165  {
1166  $tpl->setCurrentBlock("change_comment");
1167  $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1168  $tpl->parseCurrentBlock();
1169 // $tpl->setCurrentBlock("adm_content");
1170  }
1171 
1172  // explorer updater
1173  if ($this->exp_frame != "")
1174  {
1175 /* $tpl->setCurrentBlock("updater");
1176  $tpl->setVariable("UPDATER_FRAME", $this->exp_frame);
1177  $tpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
1178  $tpl->setVariable("HREF_UPDATER", $this->exp_target_script);
1179  $tpl->parseCurrentBlock();*/
1180  }
1181 
1182 /* $tpl->setVariable("TXT_INSERT_BEFORE", $this->lng->txt("cont_set_before"));
1183  $tpl->setVariable("TXT_INSERT_AFTER", $this->lng->txt("cont_set_after"));
1184  $tpl->setVariable("TXT_INSERT_CANCEL", $this->lng->txt("cont_set_cancel"));
1185  $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1186 */
1187  $tpl->setVariable("WYSIWYG_ACTION",
1188  $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
1189 
1190 
1191  // determine media, html and javascript mode
1192  $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
1193  ? "disable"
1194  : "enable";
1195  $sel_html_mode = ($ilUser->getPref("ilPageEditor_HTMLMode") == "disable")
1196  ? "disable"
1197  : "enable";
1198  $sel_js_mode = "disable";
1199  //if($ilSetting->get("enable_js_edit", 1))
1200  //{
1201  $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1202  ? "enable"
1203  : "disable";
1204  //}
1205 
1206  // show prepending html
1207  $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1208  $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
1209 
1210  // presentation view
1211  if ($this->getViewPageLink() != "")
1212  {
1213  $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"),
1214  $this->getViewPageLink(), $this->getViewPageTarget());
1215  }
1216 
1217  // show actions drop down
1218  $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1219 
1220  // get js files for JS enabled editing
1221  if ($sel_js_mode == "enable")
1222  {
1223  $this->insertHelp($tpl);
1224  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1227  ilYuiUtil::initPanel(false);
1228  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1229  //$GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
1230  $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing_4_0_12.js");
1231 
1232  include_once './Services/Style/classes/class.ilObjStyleSheet.php';
1233  $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
1234  preloader.src = './templates/default/images/loader.gif';
1235  ilCOPage.setContentCss('".
1238  ", ./Services/COPage/css/tiny_extra.css".
1239  "')");
1240 
1241  //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
1242  $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_0_12/tinymce.js");
1243  $tpl->touchBlock("init_dragging");
1244 
1245  $cfg = $this->getPageConfig();
1246  $tpl->setVariable("IL_TINY_MENU",
1247  self::getTinyMenu(
1248  $this->getPageObject()->getParentType(),
1249  $cfg->getEnableInternalLinks(),
1250  $cfg->getEnableWikiLinks(),
1251  $cfg->getEnableKeywords(),
1252  $this->getStyleId(), true, true,
1253  $cfg->getEnableAnchors()
1254  ));
1255 
1256  // add int link parts
1257  include_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
1258  $tpl->setCurrentBlock("int_link_prep");
1259  $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1260  $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1261  "", false, true, false)));
1262  $tpl->parseCurrentBlock();
1263 
1264  // internal links per js
1265  //$tpl->setVariable("IL_INT_LINK_URL",
1266  // $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1267  // "showLinkHelp", false, true, false));
1268 
1269  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1271  $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1272 
1273  }
1274 
1275  // multiple actions
1276  $cnt_pcs = $this->getPageObject()->countPageContents();
1277  if ($cnt_pcs > 1 ||
1278  ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0))
1279  {
1280  $tpl->setCurrentBlock("multi_actions");
1281  if ($sel_js_mode == "enable")
1282  {
1283  $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1284  $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1285  $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1286  $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1287  $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1288  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1289  $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1290  }
1291  $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1292  $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1293  $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1294  $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1295  $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1296  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
1297  $tpl->parseCurrentBlock();
1298  }
1299  }
1300  else
1301  {
1302  // presentation or preview here
1303 
1304  $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1305  if ($this->getEnabledPageFocus())
1306  {
1307  $tpl->touchBlock("page_focus");
1308  }
1309 
1310  include_once("./Services/User/classes/class.ilUserUtil.php");
1311 
1312  // presentation
1313  if ($this->getOutputMode() == IL_PAGE_PREVIEW ||
1314  $this->getRenderPageContainer())
1315  {
1316  $tpl->touchBlock("page_container_1");
1317  $tpl->touchBlock("page_container_2");
1318  $tpl->touchBlock("page_container_3");
1319  }
1320 
1321  // history
1322  $c_old_nr = $this->getPageObject()->old_nr;
1323  if ($c_old_nr > 0)
1324  {
1325  $hist_info =
1326  $this->getPageObject()->getHistoryInfo($c_old_nr);
1327 
1328  if (!$this->getCompareMode())
1329  {
1330  // previous revision
1331  if (is_array($hist_info["previous"]))
1332  {
1333  $tpl->setCurrentBlock("previous_rev");
1334  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1335  $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1336  $tpl->setVariable("HREF_PREV",
1337  $ilCtrl->getLinkTarget($this, "preview"));
1338  $tpl->parseCurrentBlock();
1339  }
1340  else
1341  {
1342  $tpl->setCurrentBlock("previous_rev_disabled");
1343  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1344  $tpl->parseCurrentBlock();
1345  }
1346 
1347  // next revision
1348  $tpl->setCurrentBlock("next_rev");
1349  $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
1350  $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1351  $tpl->setVariable("HREF_NEXT",
1352  $ilCtrl->getLinkTarget($this, "preview"));
1353  $tpl->parseCurrentBlock();
1354 
1355  // latest revision
1356  $tpl->setCurrentBlock("latest_rev");
1357  $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
1358  $ilCtrl->setParameter($this, "old_nr", "");
1359  $tpl->setVariable("HREF_LATEST",
1360  $ilCtrl->getLinkTarget($this, "preview"));
1361  $tpl->parseCurrentBlock();
1362 
1363  // rollback
1364  if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID)
1365  {
1366  $tpl->setCurrentBlock("rollback");
1367  $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
1368  $tpl->setVariable("HREF_ROLLBACK",
1369  $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
1370  $ilCtrl->setParameter($this, "old_nr", "");
1371  $tpl->setVariable("TXT_ROLLBACK",
1372  $lng->txt("cont_rollback"));
1373  $tpl->parseCurrentBlock();
1374  }
1375  }
1376 
1377  $tpl->setCurrentBlock("hist_nav");
1378  $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
1379  $tpl->setVariable("VAL_REVISION_DATE",
1380  ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
1381  $tpl->setVariable("VAL_REV_USER",
1382  ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
1383  $tpl->parseCurrentBlock();
1384  }
1385  }
1386  if ($this->getOutputMode() != IL_PAGE_PRESENTATION &&
1387  $this->getOutputMode() != IL_PAGE_OFFLINE &&
1388  $this->getOutputMode() != IL_PAGE_PREVIEW &&
1389  $this->getOutputMode() != IL_PAGE_PRINT)
1390  {
1391  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1392  }
1393 
1394  // output media object edit list (of media links)
1395  if($this->getOutputMode() == "edit")
1396  {
1397  $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
1398  $this->obj->getId(), $this->obj->getLanguage());
1399  $mob_links = array();
1400  foreach($links as $link)
1401  {
1402  if ($link["type"] == "mob")
1403  {
1404  if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob")
1405  {
1406  $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
1407  }
1408  }
1409  }
1410 
1411  // linked media objects
1412  if (count($mob_links) > 0)
1413  {
1414  $tpl->setCurrentBlock("med_link");
1415  $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1416  $tpl->setVariable("SEL_MED_LINKS",
1417  ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
1418  $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1419  $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1420  //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1421  $tpl->parseCurrentBlock();
1422  }
1423 
1424  // content snippets used
1425  include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1427  $this->getPageObject()->getDomDoc());
1428  if (count($snippets) > 0)
1429  {
1430  foreach ($snippets as $s)
1431  {
1432  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1433  $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1434  }
1435  $tpl->setCurrentBlock("med_link");
1436  $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1437  $tpl->setVariable("SEL_SNIPPETS",
1438  ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
1439  $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1440  $tpl->parseCurrentBlock();
1441  }
1442 
1443  // scheduled activation?
1444  if (!$this->getPageObject()->getActive() &&
1445  $this->getPageObject()->getActivationStart() != "" &&
1446  $this->getPageConfig()->getEnableScheduledActivation())
1447  {
1448  $tpl->setCurrentBlock("activation_txt");
1449  $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
1450  $tpl->setVariable("SA_FROM",
1452  new ilDateTime($this->getPageObject()->getActivationStart(),
1453  IL_CAL_DATETIME)));
1454  $tpl->setVariable("SA_TO",
1456  new ilDateTime($this->getPageObject()->getActivationEnd(),
1457  IL_CAL_DATETIME)));
1458  $tpl->parseCurrentBlock();
1459  }
1460  }
1461 
1462  if ($_GET["reloadTree"] == "y")
1463  {
1464  $tpl->setCurrentBlock("reload_tree");
1465  if ($this->obj->getParentType() == "dbk")
1466  {
1467  $tpl->setVariable("LINK_TREE",
1468  $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
1469  }
1470  else
1471  {
1472  $tpl->setVariable("LINK_TREE",
1473  $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
1474  }
1475  $tpl->parseCurrentBlock();
1476  }
1477 // }
1478  // get content
1479  $builded = $this->obj->buildDom();
1480 
1481  // manage hierarchical ids
1482  if($this->getOutputMode() == "edit")
1483  {
1484 
1485  // add pc ids, if necessary
1486  if (!$this->obj->checkPCIds())
1487  {
1488  $this->obj->insertPCIds();
1489  $this->obj->update(true, true);
1490  }
1491 
1492  $this->obj->addFileSizes();
1493  $this->obj->addHierIDs();
1494 
1495  $hids = $this->obj->getHierIds();
1496  $row1_ids = $this->obj->getFirstRowIds();
1497  $col1_ids = $this->obj->getFirstColumnIds();
1498  $litem_ids = $this->obj->getListItemIds();
1499  $fitem_ids = $this->obj->getFileItemIds();
1500 
1501  // standard menues
1502  $hids = $this->obj->getHierIds();
1503  foreach($hids as $hid)
1504  {
1505  $tpl->setCurrentBlock("add_dhtml");
1506  $tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
1507  $tpl->parseCurrentBlock();
1508  }
1509 
1510  // column menues for tables
1511  foreach($col1_ids as $hid)
1512  {
1513  $tpl->setCurrentBlock("add_dhtml");
1514  $tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
1515  $tpl->parseCurrentBlock();
1516  }
1517 
1518  // row menues for tables
1519  foreach($row1_ids as $hid)
1520  {
1521  $tpl->setCurrentBlock("add_dhtml");
1522  $tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
1523  $tpl->parseCurrentBlock();
1524  }
1525 
1526  // list item menues
1527  foreach($litem_ids as $hid)
1528  {
1529  $tpl->setCurrentBlock("add_dhtml");
1530  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1531  $tpl->parseCurrentBlock();
1532  }
1533 
1534  // file item menues
1535  foreach($fitem_ids as $hid)
1536  {
1537  $tpl->setCurrentBlock("add_dhtml");
1538  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1539  $tpl->parseCurrentBlock();
1540  }
1541  }
1542  else
1543  {
1544  $this->obj->addFileSizes();
1545  }
1546 
1547 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
1548 //echo "<br>-".htmlentities($this->getLinkXML())."-";
1549 
1550  // set default link xml, if nothing was set yet
1551  if (!$this->link_xml_set)
1552  {
1553  $this->setDefaultLinkXml();
1554  }
1555 
1556  //$content = $this->obj->getXMLFromDom(false, true, true,
1557  // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1558  $link_xml = $this->getLinkXML();
1559 
1560  // disable/enable auto margins
1561  if ($this->getStyleId() > 0)
1562  {
1563  if (ilObject::_lookupType($this->getStyleId()) == "sty")
1564  {
1565  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1566  $style = new ilObjStyleSheet($this->getStyleId());
1567  $template_xml = $style->getTemplateXML();
1568  $disable_auto_margins = "n";
1569  if ($style->lookupStyleSetting("disable_auto_margins"))
1570  {
1571  $disable_auto_margins = "y";
1572  }
1573  }
1574  }
1575 
1576  if ($this->getAbstractOnly())
1577  {
1578  $content = "<dummy><PageObject><PageContent><Paragraph>".
1579  $this->obj->getFirstParagraphText().$link_xml.
1580  "</Paragraph></PageContent></PageObject></dummy>";
1581  }
1582  else
1583  {
1584  $content = $this->obj->getXMLFromDom(false, true, true,
1585  $link_xml.$this->getQuestionXML().$template_xml.$this->getComponentPluginsXML());
1586  }
1587 
1588  // check validation errors
1589  if($builded !== true)
1590  {
1591  $this->displayValidationError($builded);
1592  }
1593  else
1594  {
1595  $this->displayValidationError($_SESSION["il_pg_error"]);
1596  }
1597  unset($_SESSION["il_pg_error"]);
1598 
1599  if(isset($_SESSION["citation_error"]))
1600  {
1601  ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
1602  ilSession::clear("citation_error");
1603  }
1604 
1605  // get title
1606  $pg_title = $this->getPresentationTitle();
1607 
1608  $add_path = ilUtil::getImagePath("add.png");
1609  $col_path = ilUtil::getImagePath("col.png");
1610  $row_path = ilUtil::getImagePath("row.png");
1611  $item_path = ilUtil::getImagePath("item.png");
1612  $med_disabled_path = ilUtil::getImagePath("media_disabled.png");
1613 
1614  if ($this->getOutputMode() != "offline")
1615  {
1616  $enlarge_path = ilUtil::getImagePath("enlarge.png");
1617  $wb_path = ilUtil::getWebspaceDir("output")."/";
1618  }
1619  else
1620  {
1621  $enlarge_path = "images/enlarge.png";
1622  $wb_path = "";
1623  }
1624  $pg_title_class = ($this->getOutputMode() == "print")
1625  ? "ilc_PrintPageTitle"
1626  : "";
1627 
1628  // page splitting only for learning modules and
1629  // digital books
1630  $enable_split_new = ($this->obj->getParentType() == "lm" ||
1631  $this->obj->getParentType() == "dbk")
1632  ? "y"
1633  : "n";
1634 
1635  // page splitting to next page only for learning modules and
1636  // digital books if next page exists in tree
1637  if (($this->obj->getParentType() == "lm" ||
1638  $this->obj->getParentType() == "dbk") &&
1639  ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
1640  $this->obj->getId()))
1641  {
1642  $enable_split_next = "y";
1643  }
1644  else
1645  {
1646  $enable_split_next = "n";
1647  }
1648 
1649  $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1650 
1651 
1652  if ($this->getPageConfig()->getEnablePCType("Tabs"))
1653  {
1654  //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1655  //ilYuiUtil::initTabView();
1656  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1659  }
1660 
1661  $file_download_link = $this->determineFileDownloadLink();
1662  $fullscreen_link = $this->determineFullscreenLink();
1663  $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1664 
1665  // default values for various parameters (should be used by
1666  // all instances in the future)
1667  $media_mode = ($this->getOutputMode() == "edit")
1668  ? $ilUser->getPref("ilPageEditor_MediaMode")
1669  : "enable";
1670 
1671  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1672  $paste = (ilEditClipboard::getAction() == "copy" &&
1673  $this->getOutputMode() == "edit");
1674 
1675  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1676 
1677  $flv_video_player = ($this->getOutputMode() != "offline")
1680 
1681  $cfg = $this->getPageConfig();
1682 
1683  // added UTF-8 encoding otherwise umlaute are converted too
1684  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
1685  $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
1686  'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1687  'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1688  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1689  'img_add' => $add_path,
1690  'img_col' => $col_path,
1691  'img_row' => $row_path,
1692  'img_item' => $item_path,
1693  'enable_split_new' => $enable_split_new,
1694  'enable_split_next' => $enable_split_next,
1695  'link_params' => $this->link_params,
1696  'file_download_link' => $file_download_link,
1697  'fullscreen_link' => $fullscreen_link,
1698  'med_disabled_path' => $med_disabled_path,
1699  'img_path' => $img_path,
1700  'parent_id' => $this->obj->getParentId(),
1701  'download_script' => $this->sourcecode_download_script,
1702  'encoded_download_script' => urlencode($this->sourcecode_download_script),
1703  // digilib
1704  'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
1705  'pagebreak' => $this->lng->txt('dgl_pagebreak'),
1706  'page' => $this->lng->txt('page'),
1707  'citate_page' => $this->lng->txt('citate_page'),
1708  'citate_from' => $this->lng->txt('citate_from'),
1709  'citate_to' => $this->lng->txt('citate_to'),
1710  'citate' => $this->lng->txt('citate'),
1711  'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1712  'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1713  'enable_map' => ($cfg->getEnablePCType("Map") && ilGoogleMapUtil::isActivated()) ? "y" : "n",
1714  'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1715  'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1716  'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1717  'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1718  'paste' => $paste ? "y" : "n",
1719  'media_mode' => $media_mode,
1720  'javascript' => $sel_js_mode,
1721  'paragraph_plugins' => $paragraph_plugin_string,
1722  'disable_auto_margins' => $disable_auto_margins,
1723  'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1724  'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1725  'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1726  'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1727  'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1728  'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1729  'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1730  'flv_video_player' => $flv_video_player
1731  );
1732  if($this->link_frame != "") // todo other link types
1733  $params["pg_frame"] = $this->link_frame;
1734 
1735  //$content = str_replace("&nbsp;", "", $content);
1736 
1737  // this ensures that cache is emptied with every update
1738  $params["version"] = ILIAS_VERSION;
1739  // ensure no cache hit, if included files/media objects have been changed
1740  $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1741 
1742  // run xslt
1743  $md5 = md5(serialize($params).$link_xml.$template_xml);
1744 
1745 //$a = microtime();
1746 
1747  // check cache (same parameters, non-edit mode and rendered time
1748  // > last change
1749  if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1750  !$this->getCompareMode() &&
1751  !$this->getAbstractOnly() &&
1752  $md5 == $this->obj->getRenderMd5() &&
1753  ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1754  $this->obj->getRenderedTime() != "" &&
1755  $this->obj->old_nr == 0)
1756  {
1757  // cache hit
1758  $output = $this->obj->getRenderedContent();
1759  }
1760  else
1761  {
1762  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1763 
1764  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1765  $xh = xslt_create();
1766  // echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
1767  // echo "mode:".$this->getOutputMode().":<br>";
1768  $output = xslt_process($xh, "arg:/_xml","arg:/_xsl", NULL, $args, $params);
1769 
1770  if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1771  && !$this->getAbstractOnly()
1772  && $this->obj->old_nr == 0)
1773  {
1774 //echo "writerenderedcontent";
1775  $this->obj->writeRenderedContent($output, $md5);
1776  }
1777  //echo xslt_error($xh);
1778  xslt_free($xh);
1779  }
1780 
1781 //$b = microtime();
1782 //echo "$a - $b";
1783 //echo "<pre>".htmlentities($output)."</pre>";
1784 
1785  // unmask user html
1786  if (($this->getOutputMode() != "edit" ||
1787  $ilUser->getPref("ilPageEditor_HTMLMode") != "disable")
1788  && !$this->getPageConfig()->getPreventHTMLUnmasking())
1789  {
1790  $output = str_replace("&lt;","<",$output);
1791  $output = str_replace("&gt;",">",$output);
1792  }
1793  $output = str_replace("&amp;", "&", $output);
1794 
1795  $output = ilUtil::insertLatexImages($output);
1796 
1797  // insert page snippets
1798  $output = $this->insertContentIncludes($output);
1799 
1800  // insert resource blocks
1801  $output = $this->insertResources($output);
1802 
1803  // insert page toc
1804  if ($this->getPageConfig()->getEnablePageToc())
1805  {
1806  $output = $this->insertPageToc($output);
1807  }
1808 
1809  // insert advanced output trigger
1810  $output = $this->insertAdvTrigger($output);
1811 
1812  // workaround for preventing template engine
1813  // from hiding paragraph text that is enclosed
1814  // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1815  $output = $this->replaceCurlyBrackets($output);
1816 
1817  // remove all newlines (important for code / pre output)
1818  $output = str_replace("\n", "", $output);
1819 
1820  // add question HTML (always after the cache!)
1821  $qhtml = $this->getQuestionHTML();
1822  if (is_array($qhtml))
1823  {
1824  foreach ($qhtml as $k => $h)
1825  {
1826  $output = str_replace($this->pl_start."Question;il__qst_$k".$this->pl_end, " ".$h, $output);
1827  }
1828  }
1829 
1830 //echo htmlentities($output);
1831  $output = $this->postOutputProcessing($output);
1832 //echo htmlentities($output);
1833  if($this->getOutputMode() == "edit" &&
1834  !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation()))
1835  {
1836  $output = '<div class="il_editarea_disabled">'.$output.'</div>';
1837  }
1838 
1839  // for all page components...
1840  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1842  foreach ($defs as $def)
1843  {
1845  $pc_class = $def["pc_class"];
1846  $pc_obj = new $pc_class($this->getPageObject());
1847 
1848  // post xsl page content modification by pc elements
1849  $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
1850 
1851  // javascript files
1852  $js_files = $pc_obj->getJavascriptFiles();
1853  foreach ($js_files as $js)
1854  {
1855  $GLOBALS["tpl"]->addJavascript($js);
1856  }
1857 
1858  // css files
1859  $css_files = $pc_obj->getCssFiles();
1860  foreach ($css_files as $css)
1861  {
1862  $GLOBALS["tpl"]->addCss($css);
1863  }
1864  }
1865 
1866  $output = $this->obj->insertSourceCodeParagraphs($output, $this->getOutputMode());
1867 
1868  $output = $this->selfAssessmentRendering($output);
1869 //echo "<pre>".htmlentities($output)."</pre>";
1870  // output
1871  if ($ilCtrl->isAsynch() && !$this->getRawPageContent() &&
1872  $this->getOutputMode() == "edit")
1873  {
1874  // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1875  if ($_GET["updated_pc_id_str"] != "")
1876  {
1877  echo $_GET["updated_pc_id_str"];
1878  }
1879  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1880  $tpl->setCurrentBlock("edit_page");
1881  $tpl->parseCurrentBlock();
1882  echo $tpl->get("edit_page");
1883  exit;
1884  }
1885  if ($this->outputToTemplate())
1886  {
1887  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1888  $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1889  return $output;
1890  }
1891  else
1892  {
1893  if ($this->getRawPageContent()) // e.g. needed in glossaries
1894  {
1895  return $output;
1896  }
1897  else
1898  {
1899  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1900  return $tpl->get();
1901  }
1902  }
1903  }
1904 
1911  function replaceCurlyBrackets($output)
1912  {
1913 //echo "<br><br>".htmlentities($output);
1914 
1915  while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1916  is_int($end = strpos($output, "<!--ParEnd-->", $start)))
1917  {
1918  $output = substr($output, 0, $start).
1919  str_replace(array("{","}"), array("&#123;","&#125;"),
1920  substr($output, $start + 15, $end - ($start + 15))).
1921  substr($output, $end + 13);
1922  }
1923 
1924 // $output = str_replace("{", "&#123;", $output);
1925 // $output = str_replace("}", "&#125;", $output);
1926 //echo "<br><br>".htmlentities($output);
1927  return $output;
1928  }
1929 
1933  protected function getActivationCaptions()
1934  {
1935  global $lng;
1936 
1937  return array("deactivatePage" => $lng->txt("cont_deactivate_page"),
1938  "activatePage" => $lng->txt("cont_activate_page"));
1939  }
1940 
1944  function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
1945  {
1946  global $lng, $ilCtrl;
1947 
1948  // actions
1949  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
1950 
1951  // activate/deactivate
1952  $list = new ilAdvancedSelectionListGUI();
1953  $list->setListTitle($lng->txt("actions"));
1954  $list->setId("copage_act");
1955  $entries = false;
1956  if ($this->getPageConfig()->getEnableActivation())
1957  {
1958  $entries = true;
1959  $captions = $this->getActivationCaptions();
1960  if ($this->getPageObject()->getActive())
1961  {
1962  $list->addItem($captions["deactivatePage"], "",
1963  $ilCtrl->getLinkTarget($this, "deactivatePage"));
1964  }
1965  else
1966  {
1967  $list->addItem($captions["activatePage"], "",
1968  $ilCtrl->getLinkTarget($this, "activatePage"));
1969  }
1970 
1971  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
1972  }
1973 
1974  // initially opened content
1975  if ($this->getPageConfig()->getUseAttachedContent())
1976  {
1977  $entries = true;
1978  $list->addItem($lng->txt("cont_initial_attached_content"), "",
1979  $ilCtrl->getLinkTarget($this, "initialOpenedContent"));
1980  }
1981 
1982  // multi-lang actions
1983  if ($this->addMultiLangActionsAndInfo($list, $a_tpl))
1984  {
1985  $entries = true;
1986  }
1987 
1988  if ($entries)
1989  {
1990  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
1991  }
1992 
1993  $lng->loadLanguageModule("content");
1994  $list = new ilAdvancedSelectionListGUI();
1995  $list->setListTitle($lng->txt("cont_edit_mode"));
1996  $list->setId("copage_ed_mode");
1997 
1998  // media mode
1999  if ($sel_media_mode == "enable")
2000  {
2001  $ilCtrl->setParameter($this, "media_mode", "disable");
2002  $list->addItem($lng->txt("cont_deactivate_media"), "",
2003  $ilCtrl->getLinkTarget($this, "setEditMode"));
2004  }
2005  else
2006  {
2007  $ilCtrl->setParameter($this, "media_mode", "enable");
2008  $list->addItem($lng->txt("cont_activate_media"), "",
2009  $ilCtrl->getLinkTarget($this, "setEditMode"));
2010  }
2011  $ilCtrl->setParameter($this, "media_mode", "");
2012 
2013  // html mode
2014  if (!$this->getPageConfig()->getPreventHTMLUnmasking())
2015  {
2016  if ($sel_html_mode == "enable")
2017  {
2018  $ilCtrl->setParameter($this, "html_mode", "disable");
2019  $list->addItem($lng->txt("cont_deactivate_html"), "",
2020  $ilCtrl->getLinkTarget($this, "setEditMode"));
2021  }
2022  else
2023  {
2024  $ilCtrl->setParameter($this, "html_mode", "enable");
2025  $list->addItem($lng->txt("cont_activate_html"), "",
2026  $ilCtrl->getLinkTarget($this, "setEditMode"));
2027  }
2028  }
2029  $ilCtrl->setParameter($this, "html_mode", "");
2030 
2031  // js mode
2032  if ($sel_js_mode == "enable")
2033  {
2034  $ilCtrl->setParameter($this, "js_mode", "disable");
2035  $list->addItem($lng->txt("cont_deactivate_js"), "",
2036  $ilCtrl->getLinkTarget($this, "setEditMode"));
2037  }
2038  else
2039  {
2040  $ilCtrl->setParameter($this, "js_mode", "enable");
2041  $list->addItem($lng->txt("cont_activate_js"), "",
2042  $ilCtrl->getLinkTarget($this, "setEditMode"));
2043  }
2044  $ilCtrl->setParameter($this, "js_mode", "");
2045 
2046  $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2047  }
2048 
2055  function addMultiLangActionsAndInfo($a_list, $a_tpl)
2056  {
2057  global $lng, $ilCtrl;
2058 
2059  $any_items = false;
2060 
2061  $cfg = $this->getPageConfig();
2062 
2063  // general multi lang support and single page mode?
2064  if ($cfg->getMultiLangSupport())
2065  {
2066  //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
2067  //$ml = new ilPageMultiLang($this->getPageObject()->getParentType(),
2068  // $this->getPageObject()->getParentId());
2069 
2070  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
2071  $ot = ilObjectTranslation::getInstance($this->getPageObject()->getParentId());
2072 
2073  if (!$ot->getContentActivated())
2074  {
2075 /* if ($cfg->getSinglePageMode())
2076  {
2077  $a_list->addItem($lng->txt("cont_activate_multi_lang"), "",
2078  $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality"));
2079 
2080  $any_items = true;
2081  }*/
2082  }
2083  else
2084  {
2085  $lng->loadLanguageModule("meta");
2086 //echo $this->getPageObject()->getLanguage();
2087  if ($this->getPageObject()->getLanguage() != "-")
2088  {
2089  $l = $ot->getMasterLanguage();
2090  $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2091  $lng->txt("meta_l_".$l), "",
2092  $ilCtrl->getLinkTarget($this, "editMasterLanguage"));
2093  }
2094 
2095  foreach ($ot->getLanguages() as $al => $lang)
2096  {
2097  if ($this->getPageObject()->getLanguage() != $al &&
2098  $al != $ot->getMasterLanguage())
2099  {
2100  $ilCtrl->setParameter($this, "totransl", $al);
2101  $a_list->addItem($lng->txt("cont_edit_language_version").": ".
2102  $lng->txt("meta_l_".$al), "",
2103  $ilCtrl->getLinkTarget($this, "switchToLanguage"));
2104  $ilCtrl->setParameter($this, "totransl", $_GET["totransl"]);
2105  }
2106  }
2107 
2108 /* if ($cfg->getSinglePageMode())
2109  {
2110  $a_list->addItem($lng->txt("cont_manage_multilang"), "",
2111  $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "settings"));
2112  }*/
2113 
2114  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
2115  $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(),
2116  $this->getPageObject()->getParentId());
2117  $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage()));
2118 
2119  $any_items = true;
2120  }
2121  }
2122 
2123  return $any_items;
2124  }
2125 
2126 
2130  function setEditMode()
2131  {
2132  global $ilCtrl, $ilUser;
2133 
2134  if ($_GET["media_mode"] != "")
2135  {
2136  if ($_GET["media_mode"] == "disable")
2137  {
2138  $ilUser->writePref("ilPageEditor_MediaMode", "disable");
2139  }
2140  else
2141  {
2142  $ilUser->writePref("ilPageEditor_MediaMode", "");
2143  }
2144  }
2145  if ($_GET["html_mode"] != "")
2146  {
2147  if ($_GET["html_mode"] == "disable")
2148  {
2149  $ilUser->writePref("ilPageEditor_HTMLMode", "disable");
2150  }
2151  else
2152  {
2153  $ilUser->writePref("ilPageEditor_HTMLMode", "");
2154  }
2155  }
2156  if ($_GET["js_mode"] != "")
2157  {
2158  if ($_GET["js_mode"] == "disable")
2159  {
2160  $ilUser->writePref("ilPageEditor_JavaScript", "disable");
2161  }
2162  else
2163  {
2164  $ilUser->writePref("ilPageEditor_JavaScript", "");
2165  }
2166  }
2167 
2168  $ilCtrl->redirect($this, "edit");
2169  }
2170 
2171 
2175  static function getTinyMenu($a_par_type,
2176  $a_int_links = false, $a_wiki_links = false, $a_keywords = false,
2177  $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true,
2178  $a_anchors = false, $a_save_new = true)
2179  {
2180  global $lng;
2181 
2182  $mathJaxSetting = new ilSetting("MathJax");
2183 
2184  include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2185 
2186  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2187 
2188  $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2189 
2190  // debug ghost element
2191  if (DEVMODE == 1)
2192  {
2193  $btpl->touchBlock("debug_ghost");
2194  }
2195 
2196  // paste from word
2197  $btpl->setCurrentBlock("pword_button");
2198  $btpl->setVariable("IMG_PWORD", ilUtil::img(ilUtil::getImagePath("tn_pword.png"),
2199  "", 20, 20));
2200  $btpl->parseCurrentBlock();
2201  ilTooltipGUI::addTooltip("il_edm_pword",
2202  $lng->txt("cont_pword"),
2203  "iltinymenu_bd");
2204 
2205  // bullet list
2206  $btpl->setCurrentBlock("blist_button");
2207  $btpl->setVariable("IMG_BLIST", ilUtil::img(ilUtil::getImagePath("tn_blist.png"),
2208  "", 20, 20));
2209  $btpl->parseCurrentBlock();
2210  ilTooltipGUI::addTooltip("il_edm_blist",
2211  $lng->txt("cont_blist"),
2212  "iltinymenu_bd");
2213 
2214  // numbered list
2215  $btpl->setCurrentBlock("nlist_button");
2216  $btpl->setVariable("IMG_NLIST", ilUtil::img(ilUtil::getImagePath("tn_nlist.png"),
2217  "", 20, 20));
2218  $btpl->parseCurrentBlock();
2219  ilTooltipGUI::addTooltip("il_edm_nlist",
2220  $lng->txt("cont_nlist"),
2221  "iltinymenu_bd");
2222 
2223  // list indent
2224  $btpl->setCurrentBlock("list_indent");
2225  $btpl->setVariable("IMG_LIST_INDENT", ilUtil::img(ilUtil::getImagePath("tn_indent.png"),
2226  "", 20, 20));
2227  $btpl->parseCurrentBlock();
2228  ilTooltipGUI::addTooltip("ilIndentBut",
2229  $lng->txt("cont_list_indent"),
2230  "iltinymenu_bd");
2231 
2232 
2233  // list outdent
2234  $btpl->setCurrentBlock("list_outdent");
2235  $btpl->setVariable("IMG_LIST_OUTDENT", ilUtil::img(ilUtil::getImagePath("tn_outdent.png"),
2236  "", 20, 20));
2237  $btpl->parseCurrentBlock();
2238  ilTooltipGUI::addTooltip("ilOutdentBut",
2239  $lng->txt("cont_list_outdent"),
2240  "iltinymenu_bd");
2241 
2242  if ($a_int_links)
2243  {
2244  $btpl->touchBlock("bb_ilink_button");
2245  ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"),
2246  "iltinymenu_bd");
2247  }
2248  ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"),
2249  "iltinymenu_bd");
2250 
2251  // remove format
2252  $btpl->setCurrentBlock("rformat_button");
2253  $btpl->setVariable("IMG_RFORMAT", ilUtil::img(ilUtil::getImagePath("tn_rformat.png"),
2254  "", 20, 20));
2255  $btpl->parseCurrentBlock();
2256  ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"),
2257  "iltinymenu_bd");
2258 
2259  if ($a_paragraph_styles)
2260  {
2261  // new paragraph
2262  $btpl->setCurrentBlock("new_par");
2263  $btpl->setVariable("IMG_NEWPAR", "+");
2264  $btpl->parseCurrentBlock();
2265  ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"),
2266  "iltinymenu_bd");
2267 
2268  $btpl->setCurrentBlock("par_edit");
2269  $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2270  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2271  $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected,
2272  ilPCParagraphGUI::_getCharacteristics($a_style_id), true));
2273 
2274  ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection",
2275  $lng->txt("cont_paragraph_styles"), "iltinymenu_bd");
2276 
2277  $btpl->parseCurrentBlock();
2278  }
2279 
2280  if ($a_keywords)
2281  {
2282  $btpl->setCurrentBlock("bb_kw_button");
2283  $btpl->setVariable("CC_KW", "kw");
2284  $btpl->parseCurrentBlock();
2285  ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"),
2286  "iltinymenu_bd");
2287 
2288  }
2289 
2290  if ($a_wiki_links)
2291  {
2292  $btpl->setCurrentBlock("bb_wikilink_button");
2293  $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2294  $btpl->parseCurrentBlock();
2295  ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"),
2296  "iltinymenu_bd");
2297  }
2298 
2299  $aset = new ilSetting("adve");
2300 
2301  include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2302  foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st)
2303  {
2304  // these are handled via drop down now...
2305  if (in_array($c, array("com", "quot", "acc", "code")))
2306  {
2307  continue;
2308  }
2310  $a_par_type, "active_".$c, true))
2311  {
2312  $cc_code = $c;
2313  if ($aset->get("use_physical"))
2314  {
2315  $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2316  }
2317 
2318  if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2319  {
2320  $btpl->setCurrentBlock("bb_".$c."_button");
2321  $btpl->setVariable("CC_".strtoupper($c), $cc_code);
2322  $btpl->parseCurrentBlock();
2323  ilTooltipGUI::addTooltip("il_edm_cc_".$c,
2324  $lng->txt("cont_cc_".$c),
2325  "iltinymenu_bd");
2326 
2327 // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2328  }
2329  }
2330  }
2331 
2332  if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2333  {
2334  ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"),
2335  "iltinymenu_bd");
2336  }
2337  ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"),
2338  "iltinymenu_bd");
2339 
2340  if ($a_save_return)
2341  {
2342  $btpl->setCurrentBlock("save_return");
2343  $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2344  $btpl->parseCurrentBlock();
2345  }
2346 
2347  if ($a_save_new)
2348  {
2349  $btpl->setCurrentBlock("save_new");
2350  $btpl->setVariable("TXT_SAVE_NEW", $lng->txt("save_new"));
2351  $btpl->parseCurrentBlock();
2352  }
2353 
2354  if ($a_anchors)
2355  {
2356  $btpl->setCurrentBlock("bb_anc_button");
2357  $btpl->setVariable("CC_ANC", "anc");
2358  $btpl->parseCurrentBlock();
2359  ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"),
2360  "iltinymenu_bd");
2361  }
2362 
2363 /* // footnote
2364  $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2365  $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2366  $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2367 */
2368 // $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2369 
2370  $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2371  $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2372 
2373  $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2374  $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2375  $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2376  $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2377  $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2378 
2379  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2380  $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type));
2381  ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection",
2382  $lng->txt("cont_more_character_styles"), "iltinymenu_bd");
2383 
2384  return $btpl->get();
2385  }
2386 
2391  {
2392  global $ilCtrl;
2393 
2394  $int_links = $this->getPageObject()->getInternalLinks();
2395 //var_dump($int_links);
2396  $link_info = "<IntLinkInfos>";
2397  $targetframe = "None";
2398  foreach ($int_links as $int_link)
2399  {
2400  $target = $int_link["Target"];
2401  if (substr($target, 0, 4) == "il__")
2402  {
2403  $target_arr = explode("_", $target);
2404  $target_id = $target_arr[count($target_arr) - 1];
2405  $type = $int_link["Type"];
2406 
2407  $targetframe = ($int_link["TargetFrame"] != "")
2408  ? $int_link["TargetFrame"]
2409  : "None";
2410 
2411  $ltarget="_top";
2412  if ($targetframe != "None")
2413  {
2414  $ltarget="_blank";
2415  }
2416 
2417  // anchor
2418  $anc = $anc_add = "";
2419  if ($int_link["Anchor"] != "")
2420  {
2421  $anc = $int_link["Anchor"];
2422  $anc_add = "_".rawurlencode($int_link["Anchor"]);
2423  }
2424 
2425  $href = "";
2426  switch($type)
2427  {
2428  case "PageObject":
2429  case "StructureObject":
2431  if ($type == "PageObject")
2432  {
2433  $href = "./goto.php?target=pg_".$target_id.$anc_add;
2434  }
2435  else
2436  {
2437  $href = "./goto.php?target=st_".$target_id;
2438  }
2439  break;
2440 
2441  case "GlossaryItem":
2442  if ($targetframe == "None")
2443  {
2444  $targetframe = "Glossary";
2445  }
2446  $href = "./goto.php?target=git_".$target_id;
2447  break;
2448 
2449  case "MediaObject":
2450  $ilCtrl->setParameter($this, "mob_id", $target_id);
2451  //$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
2452  $href = $ilCtrl->getLinkTarget($this, "displayMedia");
2453  $ilCtrl->setParameter($this, "mob_id", "");
2454  break;
2455 
2456  case "WikiPage":
2457  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
2459  break;
2460 
2461  case "RepositoryItem":
2462  $obj_type = ilObject::_lookupType($target_id, true);
2464  $href = "./goto.php?target=".$obj_type."_".$target_id;
2465  break;
2466 
2467 
2468  }
2469  $anc_par = 'Anchor="'.$anc.'"';
2470  $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".$anc_par." ".
2471  "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
2472  }
2473  }
2474  $link_info.= "</IntLinkInfos>";
2475  $this->setLinkXML($link_info);
2476  }
2477 
2481  function downloadFile()
2482  {
2483  $this->obj->buildDom();
2484 
2485  include_once("./Services/COPage/classes/class.ilPCFileList.php");
2486  $files = ilPCFileList::collectFileItems($this->obj, $this->obj->getDomDoc());
2487 
2488  $file = explode("_", $_GET["file_id"]);
2489  require_once("./Modules/File/classes/class.ilObjFile.php");
2490  $file_id = $file[count($file) - 1];
2491 
2492  // file must be in page
2493  if (!in_array($file_id, $files))
2494  {
2495  exit;
2496  }
2497  $fileObj =& new ilObjFile($file_id, false);
2498  $fileObj->sendFile();
2499  exit;
2500  }
2501 
2506  {
2507  $this->displayMedia(true);
2508  }
2509 
2513  function displayMedia($a_fullscreen = false)
2514  {
2515  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2516  $tpl->setCurrentBlock("ilMedia");
2517 
2518  //$int_links = $page_object->getInternalLinks();
2519  $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2520 
2521  // @todo
2522  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2523 
2524  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2525  $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2526  require_once("./Services/COPage/classes/class.ilPageObject.php");
2527  $pg_obj = $this->getPageObject();
2528  $pg_obj->buildDom();
2529 
2530  if (!empty ($_GET["pg_id"]))
2531  {
2532  $xml = "<dummy>";
2533  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2534  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2535  $xml.= $link_xml;
2536  $xml.="</dummy>";
2537  }
2538  else
2539  {
2540  $xml = "<dummy>";
2541  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2542  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2543  $xml.= $link_xml;
2544  $xml.="</dummy>";
2545  }
2546 
2547  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2548  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2549  $xh = xslt_create();
2550 
2551  $mode = "media";
2552  if ($a_fullscreen)
2553  {
2554  $mode = "fullscreen";
2555  }
2556 
2557 //echo "<b>XML:</b>".htmlentities($xml);
2558  // determine target frames for internal links
2559  $wb_path = ilUtil::getWebspaceDir("output")."/";
2560  $enlarge_path = ilUtil::getImagePath("enlarge.png");
2561  $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
2562  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
2563  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2564  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
2565 //echo "<br><br>".htmlentities($output);
2566  //echo xslt_error($xh);
2567  xslt_free($xh);
2568 
2569  // unmask user html
2570  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2572  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2573  $tpl->setVariable("MEDIA_CONTENT", $output);
2574  echo $tpl->get();
2575  exit;
2576  }
2577 
2582  {
2583  $pg_obj = $this->getPageObject();
2584  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2585  }
2586 
2590  function insertContentIncludes($a_html)
2591  {
2592  global $ilCtrl, $lng;
2593 
2594  $c_pos = 0;
2595  $start = strpos($a_html, "{{{{{ContentInclude;");
2596  if (is_int($start))
2597  {
2598  $end = strpos($a_html, "}}}}}", $start);
2599  }
2600  $i = 1;
2601  while ($end > 0)
2602  {
2603  $param = substr($a_html, $start + 20, $end - $start - 20);
2604  $param = explode(";", $param);
2605 
2606  if ($param[0] == "mep" && is_numeric($param[1]) && $param[2] <= 0)
2607  {
2608  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
2609 
2610  if (ilMediaPoolPage::_exists($param[1]))
2611  {
2612  $page_gui = new ilMediaPoolPageGUI($param[1], 0, true, "-");
2613  if ($this->getOutputMode() != "offline")
2614  {
2615  $page_gui->setFileDownloadLink($this->determineFileDownloadLink());
2616  $page_gui->setFullscreenLink($this->determineFullscreenLink());
2617  $page_gui->setSourceCodeDownloadScript($this->determineSourcecodeDownloadScript());
2618  }
2619  else
2620  {
2621  $page_gui->setOutputMode(IL_PAGE_OFFLINE);
2622  }
2623 
2624  $html = $page_gui->getRawContent();
2625  }
2626  else
2627  {
2628  if ($this->getOutputMode() == "edit")
2629  {
2630  $html = "// ".$lng->txt("cont_missing_snippet")." //";
2631  }
2632  }
2633  $h2 = substr($a_html, 0, $start).
2634  $html.
2635  substr($a_html, $end + 5);
2636  $a_html = $h2;
2637  $i++;
2638  }
2639  $start = strpos($a_html, "{{{{{ContentInclude;", $start + 5);
2640  $end = 0;
2641  if (is_int($start))
2642  {
2643  $end = strpos($a_html, "}}}}}", $start);
2644  }
2645  }
2646  return $a_html;
2647  }
2648 
2655  function insertPageToc($a_output)
2656  {
2657  global $lng;
2658 
2659  include_once("./Services/Utilities/classes/class.ilStr.php");
2660 
2661  // extract all headings
2662  $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2663  $page_heads = array();
2664  foreach ($offsets as $os)
2665  {
2666  $level = (int) substr($a_output, $os + 10, 1);
2667  if (in_array($level, array(1,2,3)))
2668  {
2669  $anchor = str_replace("TocH", "TocA",
2670  substr($a_output, $os, strpos($a_output, "<", $os) - $os - 3)
2671  );
2672 
2673  // get heading
2674  $tag_start = stripos($a_output, "<h".$level." ", $os);
2675  $tag_end = stripos($a_output, "</h".$level.">", $tag_start);
2676  $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2677 
2678  // get headings text
2679  $text_start = stripos($head, ">") + 1;
2680  $text_end = strripos($head, "<!--", $text_start);
2681  $text = substr($head, $text_start, $text_end - $text_start);
2682  $page_heads[] = array("level" => $level, "text" => $text,
2683  "anchor" => $anchor);
2684  }
2685  }
2686 
2687  if (count($page_heads) > 1)
2688  {
2689  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2690  $list = new ilNestedList();
2691  $list->setAutoNumbering(true);
2692  $list->setListClass("ilc_page_toc_PageTOCList");
2693  $list->setItemClass("ilc_page_toc_PageTOCItem");
2694  $i = 0;
2695  $c_depth = 1;
2696  $c_par[1] = 0;
2697  $c_par[2] = 0;
2698  $nr[1] = 1;
2699  $nr[2] = 1;
2700  $nr[3] = 1;
2701  foreach ($page_heads as $ind => $h)
2702  {
2703  $i++;
2704  $par = 0;
2705 
2706  // check if we have a parent for one level up
2707  $par = 0;
2708  if ($h["level"] == 2 && $c_par[1] > 0)
2709  {
2710  $par = $c_par[1];
2711  }
2712  if ($h["level"] == 3 && $c_par[2] > 0)
2713  {
2714  $par = $c_par[2];
2715  }
2716 
2717  $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2718 
2719  // add the list node
2720  $list->addListNode(
2721  "<a href='#".$h["anchor"]."' class='ilc_page_toc_PageTOCLink'>".$h["text"]."</a>",
2722  $i, $par);
2723 
2724  // set the node as current parent of the level
2725  if ($h["level"] == 1)
2726  {
2727  $c_par[1] = $i;
2728  $c_par[2] = 0;
2729  }
2730  if ($h["level"] == 2)
2731  {
2732  $c_par[2] = $i;
2733  }
2734  }
2735 
2736  $tpl = new ilTemplate("tpl.page_toc.html", true, true,
2737  "Services/COPage");
2738  $tpl->setVariable("PAGE_TOC", $list->getHTML());
2739  $tpl->setVariable("TXT_PAGE_TOC", $lng->txt("cont_page_toc"));
2740  $tpl->setVariable("TXT_HIDE", $lng->txt("hide"));
2741  $tpl->setVariable("TXT_SHOW", $lng->txt("show"));
2742 
2743  $a_output = str_replace("{{{{{PageTOC}}}}}",
2744  $tpl->get(), $a_output);
2745  $numbers = $list->getNumbers();
2746 
2747  if (count($numbers) > 0)
2748  {
2749  include_once("./Services/Utilities/classes/class.ilStr.php");
2750  foreach ($numbers as $n)
2751  {
2752  $a_output =
2753  ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n." ", $a_output);
2754  }
2755  }
2756  }
2757  else
2758  {
2759  $a_output = str_replace("{{{{{PageTOC}}}}}",
2760  "", $a_output);
2761  }
2762 
2763  return $a_output;
2764  }
2765 
2772  function insertResources($a_output)
2773  {
2774  // this is edit mode only
2775 
2776  if ($this->getEnablePCType("Resources") &&
2777  ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview"))
2778  {
2779  include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2780  $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2781  }
2782  return $a_output;
2783  }
2784 
2785 
2786 
2793  function insertAdvTrigger($a_output)
2794  {
2795  global $lng;
2796 
2797  if (!$this->getAbstractOnly())
2798  {
2799  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2800  $lng->txt("cont_show_adv"), $a_output);
2801  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2802  $lng->txt("cont_hide_adv"), $a_output);
2803  }
2804  else
2805  {
2806  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
2807  "", $a_output);
2808  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
2809  "", $a_output);
2810  }
2811 
2812  return $a_output;
2813  }
2814 
2815 
2820  function postOutputProcessing($a_output)
2821  {
2822  return $a_output;
2823  }
2824 
2828  function insertHelp($a_tpl)
2829  {
2830  global $lng;
2831 
2832  $a_tpl->setCurrentBlock("help_img");
2833  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.png"));
2834  $a_tpl->parseCurrentBlock();
2835  $a_tpl->setCurrentBlock("help_item");
2836  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_add_elements"));
2837  $a_tpl->parseCurrentBlock();
2838 
2839  $a_tpl->setCurrentBlock("help_img");
2840  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
2841  $a_tpl->parseCurrentBlock();
2842  $a_tpl->setCurrentBlock("help_img");
2843  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("drop_streaked_area.png"));
2844  $a_tpl->parseCurrentBlock();
2845  $a_tpl->setCurrentBlock("help_item");
2846  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_drag_and_drop_elements"));
2847  $a_tpl->parseCurrentBlock();
2848 
2849  $a_tpl->setCurrentBlock("help_img");
2850  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
2851  $a_tpl->parseCurrentBlock();
2852  $a_tpl->setCurrentBlock("help_item");
2853  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_double_click_to_delete"));
2854  $a_tpl->parseCurrentBlock();
2855 
2856  $a_tpl->setCurrentBlock("help");
2857  $a_tpl->parseCurrentBlock();
2858  }
2859 
2863  function preview()
2864  {
2865  global $tree;
2867  return $this->showPage();
2868  }
2869 
2873  function edit()
2874  {
2875  global $tree, $lng, $ilCtrl, $ilSetting, $ilUser, $ilHelp;
2876 
2877  // editing allowed?
2878  if (!$this->getEnableEditing())
2879  {
2880  ilUtil::sendFailure($lng->txt("permission_denied"), true);
2881  $ilCtrl->redirect($this, "preview");
2882  }
2883 
2884  $ilHelp->setScreenId("edit_".$this->getParentType());
2885 
2886  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2887  if(
2888  $ilUser->isAnonymous() &&
2889  !$ilUser->isCaptchaVerified() &&
2890  ilCaptchaUtil::isActiveForWiki()
2891  )
2892  {
2893  $form = $this->initCaptchaForm();
2894  if($_POST['captcha_code'] && $form->checkInput())
2895  {
2896  $ilUser->setCaptchaVerified(true);
2897  }
2898  else
2899  {
2900  return $form->getHTML();
2901  }
2902  }
2903 
2904  // edit lock
2905  if (!$this->getPageObject()->getEditLock())
2906  {
2907  $info = $lng->txt("content_no_edit_lock");
2908 
2909  include_once("./Services/User/classes/class.ilUserUtil.php");
2910 
2911  $lock = $this->getPageObject()->getEditLockInfo();
2912  $info.= "</br>".$lng->txt("content_until").": ".
2913  ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX));
2914  $info.= "</br>".$lng->txt("obj_usr").": ".
2915  ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2916 
2917  ilUtil::sendInfo($info);
2918  return "";
2919  }
2920  else
2921  {
2922  $aset = new ilSetting("adve");
2923 
2924  $min = (int) $aset->get("block_mode_minutes") ;
2925  if ($min > 0)
2926  {
2927  $info = $lng->txt("cont_got_lock");
2928  include_once("./Services/User/classes/class.ilUserUtil.php");
2929  $lock = $this->getPageObject()->getEditLockInfo();
2930  //$info.= "</br>".$lng->txt("content_until").": ".
2931  // ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX));
2932  //$info.= "</br>".$lng->txt("obj_usr").": ".
2933  // ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2934  $info.= " <a class='small submit' href='".$ilCtrl->getLinkTarget($this, "releasePageLock")."'>".
2935  $lng->txt("cont_finish_editing")."</a>";
2936  ilUtil::sendInfo($info);
2937  }
2938  }
2939 
2940  $this->setOutputMode(IL_PAGE_EDIT);
2941 
2942  $html = $this->showPage();
2943 
2944  if ($this->isEnabledNotes())
2945  {
2946  $html.= "<br /><br />".$this->getNotesHTML();
2947  }
2948 
2949  return $html;
2950  }
2951 
2959  {
2960  global $tpl;
2961 
2962 // 'pl_hier_id' => string '2_1_1_1' (length=7)
2963 // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
2964  $html = $this->edit();
2965 
2966  $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('".
2967  $_GET["pl_hier_id"].":".$_GET["pl_pc_id"].
2968  "');", 3);
2969 
2970  return $html;
2971  }
2972 
2976  public function initCaptchaForm()
2977  {
2982  global $lng, $ilCtrl;
2983 
2984  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2985  $form = new ilPropertyFormGUI();
2986 
2987  require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
2988  $ci = new ilCaptchaInputGUI($lng->txt('cont_captcha_code'), 'captcha_code');
2989  $ci->setRequired(true);
2990  $form->addItem($ci);
2991 
2992  $form->addCommandButton('edit', $lng->txt('ok'));
2993 
2994  $form->setTitle($lng->txt('cont_captcha_verification'));
2995  $form->setFormAction($ilCtrl->getFormAction($this));
2996 
2997  return $form;
2998  }
2999 
3000  /*
3001  * presentation
3002  */
3004  {
3005  global $tree;
3006  $this->setOutputMode($a_mode);
3007 
3008  return $this->showPage();
3009  }
3010 
3011  function getHTML()
3012  {
3013  $this->getTabs("preview");
3014  return $this->showPage();
3015  }
3016 
3020  function showMediaFullscreen($a_style_id = 0)
3021  {
3022  $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3023  $this->tpl->setCurrentBlock("ContentStyle");
3024  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3025  $this->tpl->parseCurrentBlock();
3026 
3027  $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
3028  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3029  $this->tpl->setCurrentBlock("ilMedia");
3030 
3031  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3032  $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
3033  if (!empty ($_GET["pg_id"]))
3034  {
3035  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3036  $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
3037  $pg_obj->buildDom();
3038 
3039  $xml = "<dummy>";
3040  // todo: we get always the first alias now (problem if mob is used multiple
3041  // times in page)
3042  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3043  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3044  $xml.="</dummy>";
3045  }
3046  else
3047  {
3048  $xml = "<dummy>";
3049  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
3050  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3051  $xml.="</dummy>";
3052  }
3053 
3054 //echo htmlentities($xml); exit;
3055 
3056  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3057  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3058  $xh = xslt_create();
3059 
3060 //echo "<b>XML:</b>".htmlentities($xml);
3061  // determine target frames for internal links
3062  //$pg_frame = $_GET["frame"];
3063  $wb_path = ilUtil::getWebspaceDir("output")."/";
3064  $mode = "fullscreen";
3065  $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
3066  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
3067  echo xslt_error($xh);
3068  xslt_free($xh);
3069 
3070  // unmask user html
3071  $this->tpl->setVariable("MEDIA_CONTENT", $output);
3072  }
3073 
3079  function displayValidationError($a_error)
3080  {
3081  if(is_array($a_error))
3082  {
3083  $error_str = "<b>Error(s):</b><br>";
3084  foreach ($a_error as $error)
3085  {
3086  $err_mess = implode($error, " - ");
3087  if (!is_int(strpos($err_mess, ":0:")))
3088  {
3089  $error_str .= htmlentities($err_mess)."<br />";
3090  }
3091  }
3092  $this->tpl->setVariable("MESSAGE", $error_str);
3093  }
3094  }
3095 
3099  function history()
3100  {
3101  global $tpl, $lng, $ilAccess;
3102 
3103  if (!$this->getEnableEditing())
3104  {
3105  return;
3106  }
3107 
3108  $tpl->addJavaScript("./Services/COPage/js/page_history.js");
3109 
3110  include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3111  $table_gui = new ilPageHistoryTableGUI($this, "history");
3112  $table_gui->setId("hist_table");
3113  $entries = $this->getPageObject()->getHistoryEntries();
3114  $entries[] = array('page_id' => $this->getPageObject()->getId(),
3115  'parent_type' => $this->getPageObject()->getParentType(),
3116  'hdate' => $this->getPageObject()->getLastChange(),
3117  'parent_id' => $this->getPageObject()->getParentId(),
3118  'nr' => 0,
3119  'sortkey' => 999999,
3120  'user' => $this->getPageObject()->last_change_user);
3121  $table_gui->setData($entries);
3122  return $table_gui->getHTML();
3123  }
3124 
3129  {
3130  global $tpl, $lng, $ilAccess, $ilCtrl;
3131 
3132  if (!$this->getEnableEditing())
3133  {
3134  return;
3135  }
3136 
3137  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3138  $c_gui = new ilConfirmationGUI();
3139 
3140  // set confirm/cancel commands
3141  $ilCtrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3142  $c_gui->setFormAction($ilCtrl->getFormAction($this, "rollback"));
3143  $c_gui->setHeaderText($lng->txt("cont_rollback_confirmation"));
3144  $c_gui->setCancel($lng->txt("cancel"), "history");
3145  $c_gui->setConfirm($lng->txt("confirm"), "rollback");
3146 
3147  $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3148 
3149  $c_gui->addItem("id[]", $_GET["old_nr"],
3151 
3152  $tpl->setContent($c_gui->getHTML());
3153  }
3154 
3158  function rollback()
3159  {
3160  global $ilCtrl;
3161 
3162  if (!$this->getEnableEditing())
3163  {
3164  return;
3165  }
3166 
3167  $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3168 
3169  if ($hentry["content"] != "")
3170  {
3171  $this->obj->setXMLContent($hentry["content"]);
3172  $this->obj->buildDom(true);
3173  if ($this->obj->update())
3174  {
3175  $ilCtrl->redirect($this, "history");
3176  }
3177  }
3178  $ilCtrl->redirect($this, "history");
3179  }
3180 
3188  {
3189  global $ilHelp;
3190 
3191  $ilHelp->setScreenIdComponent("copg");
3192  }
3193 
3199  function getTabs($a_activate = "")
3200  {
3201  global $ilTabs, $ilCtrl, $ilUser;
3202 
3203  $this->setScreenIdComponent();
3204 
3205  if (!$this->getEnabledTabs())
3206  {
3207  return;
3208  }
3209 
3210 //echo "-".$ilCtrl->getNextClass()."-".$ilCtrl->getCmd()."-";
3211  // back to upper context
3212 
3213  if (!$this->getEditPreview())
3214  {
3215  $ilTabs->addTarget("pg", $ilCtrl->getLinkTarget($this, "preview")
3216  , array("", "preview"));
3217 
3218  if ($this->getEnableEditing())
3219  {
3220  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3221  , array("", "edit"));
3222  }
3223  }
3224  else
3225  {
3226  if ($this->getEnableEditing())
3227  {
3228  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3229  , array("", "edit"));
3230  }
3231 
3232  $ilTabs->addTarget("cont_preview", $ilCtrl->getLinkTarget($this, "preview")
3233  , array("", "preview"));
3234  }
3235 
3236  //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3237  // , "properties", get_class($this));
3238 
3239  if ($this->use_meta_data)
3240  {
3241  $ilTabs->addTarget("meta_data",
3242  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
3243  "", "ilmdeditorgui");
3244  }
3245 
3246  $lm_set = new ilSetting("lm");
3247 
3248  if ($this->getEnableEditing() && $lm_set->get("page_history", 1))
3249  {
3250  $ilTabs->addTarget("history", $this->ctrl->getLinkTarget($this, "history")
3251  , "history", get_class($this));
3252  }
3253 
3254 /* $tabs = $this->ctrl->getTabs();
3255  foreach ($tabs as $tab)
3256  {
3257  $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3258  , $tab["cmd"], $tab["class"]);
3259  }
3260 */
3261  if ($this->getEnableEditing() && $ilUser->getId() != ANONYMOUS_USER_ID)
3262  {
3263  $ilTabs->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
3264  , "view", "ilEditClipboardGUI");
3265  }
3266 
3267  if ($this->getPageConfig()->getEnableScheduledActivation())
3268  {
3269  $ilTabs->addTarget("cont_activation", $this->ctrl->getLinkTarget($this, "editActivation"),
3270  "editActivation", get_class($this));
3271  }
3272 
3273  if ($this->getEnabledNews())
3274  {
3275  $ilTabs->addTarget("news",
3276  $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3277  "", "ilnewsitemgui");
3278  }
3279 
3280  // external hook to add tabs
3281  if (is_array($this->tab_hook))
3282  {
3283  $func = $this->tab_hook["func"];
3284  $this->tab_hook["obj"]->$func();
3285  }
3286  //$ilTabs->setTabActive("pg");
3287  }
3288 
3292  function compareVersion()
3293  {
3294  global $lng;
3295 
3296  if (!$this->getEnableEditing())
3297  {
3298  return;
3299  }
3300 
3301  $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3302  $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3303 
3304  // left page
3305  $lpage = $compare["l_page"];
3306  $cfg = $this->getPageConfig();
3307  $cfg->setPreventHTMLUnmasking(true);
3308 
3310  $this->setPageObject($lpage);
3311  $this->setPresentationTitle($this->getPresentationTitle());
3312  $this->setCompareMode(true);
3313 
3314  $lhtml = $this->showPage();
3315  $lhtml = $this->replaceDiffTags($lhtml);
3316  $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3317  $tpl->setVariable("LEFT", $lhtml);
3318 
3319  // right page
3320  $rpage = $compare["r_page"];
3321  $this->setPageObject($rpage);
3322  $this->setPresentationTitle($this->getPresentationTitle());
3323  $this->setCompareMode(true);
3325 
3326  $rhtml = $this->showPage();
3327  $rhtml = $this->replaceDiffTags($rhtml);
3328  $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3329  $tpl->setVariable("RIGHT", $rhtml);
3330 
3331  $tpl->setVariable("TXT_NEW", $lng->txt("cont_pc_new"));
3332  $tpl->setVariable("TXT_MODIFIED", $lng->txt("cont_pc_modified"));
3333  $tpl->setVariable("TXT_DELETED", $lng->txt("cont_pc_deleted"));
3334 
3335 //var_dump($left);
3336 //var_dump($right);
3337 
3338  return $tpl->get();
3339  }
3340 
3341  function replaceDiffTags($a_html)
3342  {
3343  $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3344  $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3345  $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3346  $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3347 
3348  return $a_html;
3349  }
3350 
3354  function editActivation()
3355  {
3356  global $ilCtrl, $lng, $tpl;
3357 
3358  $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3359  $this->initActivationForm();
3360  $this->getActivationFormValues();
3361  $atpl->setVariable("FORM", $this->form->getHTML());
3362  $atpl->setCurrentBlock("updater");
3363  $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3364  $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3365  $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3366  $atpl->parseCurrentBlock();
3367  $tpl->setContent($atpl->get());
3368  }
3369 
3374  {
3375  global $ilCtrl, $lng;
3376 
3377  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3378  $this->form = new ilPropertyFormGUI();
3379  $this->form->setFormAction($ilCtrl->getFormAction($this));
3380  $this->form->setTitle($lng->txt("cont_page_activation"));
3381 
3382  // activation type radio
3383  $rad = new ilRadioGroupInputGUI($lng->txt("cont_activation"), "activation");
3384  $rad_op1 = new ilRadioOption($lng->txt("cont_activated"), "activated");
3385 
3386  $rad->addOption($rad_op1);
3387  $rad_op2 = new ilRadioOption($lng->txt("cont_deactivated"), "deactivated");
3388  $rad->addOption($rad_op2);
3389  $rad_op3 = new ilRadioOption($lng->txt("cont_scheduled_activation"), "scheduled");
3390 
3391  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_start"), "start");
3392  $dt_prop->setShowTime(true);
3393  $rad_op3->addSubItem($dt_prop);
3394  $dt_prop2 = new ilDateTimeInputGUI($lng->txt("cont_end"), "end");
3395  $dt_prop2->setShowTime(true);
3396  $rad_op3->addSubItem($dt_prop2);
3397 
3398  // show activation information
3399  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3400  $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3401  $rad_op3->addSubItem($cb);
3402 
3403 
3404  $rad->addOption($rad_op3);
3405 
3406  $this->form->addCommandButton("saveActivation", $lng->txt("save"));
3407 
3408  $this->form->addItem($rad);
3409  }
3410 
3415  {
3416  $values = array();
3417  $values["activation"] = "deactivated";
3418  if ($this->getPageObject()->getActive())
3419  {
3420  $values["activation"] = "activated";
3421  }
3422 
3423  $dt_prop = $this->form->getItemByPostVar("start");
3424  if ($this->getPageObject()->getActivationStart() != "")
3425  {
3426  $values["activation"] = "scheduled";
3427  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationStart(),
3428  IL_CAL_DATETIME));
3429  }
3430  $dt_prop = $this->form->getItemByPostVar("end");
3431  if ($this->getPageObject()->getActivationEnd() != "")
3432  {
3433  $values["activation"] = "scheduled";
3434  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationEnd(),
3435  IL_CAL_DATETIME));
3436  }
3437 
3438  $values["show_activation_info"] = $this->getPageObject()->getShowActivationInfo();
3439 
3440  $this->form->setValuesByArray($values);
3441  }
3442 
3446  function saveActivation()
3447  {
3448  global $tpl, $lng, $ilCtrl;
3449 
3450  $this->initActivationForm();
3451 
3452  if ($this->form->checkInput())
3453  {
3454  $this->getPageObject()->setActive(true);
3455  $this->getPageObject()->setActivationStart(null);
3456  $this->getPageObject()->setActivationEnd(null);
3457  $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3458  if ($_POST["activation"] == "deactivated")
3459  {
3460  $this->getPageObject()->setActive(false);
3461  }
3462  if ($_POST["activation"] == "scheduled")
3463  {
3464  $this->getPageObject()->setActive(false);
3465  $this->getPageObject()->setActivationStart(
3466  $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME));
3467  $this->getPageObject()->setActivationEnd(
3468  $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME));
3469  }
3470  $this->getPageObject()->update();
3471  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3472  $ilCtrl->redirect($this, "editActivation");
3473  }
3474  $this->form->getValuesByPost();
3475  $tpl->setContent($this->form->getHTML());
3476  }
3477 
3487  function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
3488  {
3489  global $ilCtrl;
3490 
3491  include_once("Services/Notes/classes/class.ilNoteGUI.php");
3492 
3493  // scorm 2004 page gui
3494  if(!$a_content_object)
3495  {
3496  $notes_gui = new ilNoteGUI($this->notes_parent_id,
3497  (int)$this->obj->getId(), "pg");
3498 
3499  $a_enable_private_notes = true;
3500  $a_enable_public_notes = true;
3501  $a_enable_notes_deletion = false;
3502  }
3503  // wiki page gui, blog posting gui
3504  else
3505  {
3506  $notes_gui = new ilNoteGUI($a_content_object->getParentId(),
3507  $a_content_object->getId(), $a_content_object->getParentType());
3508  }
3509 
3510  if($a_enable_private_notes)
3511  {
3512  $notes_gui->enablePrivateNotes();
3513  }
3514  if ($a_enable_public_notes)
3515  {
3516  $notes_gui->enablePublicNotes();
3517  if ((bool)$a_enable_notes_deletion)
3518  {
3519  $notes_gui->enablePublicNotesDeletion(true);
3520  }
3521  }
3522 
3523  if($a_callback)
3524  {
3525  $notes_gui->addObserver($a_callback);
3526  }
3527 
3528  $next_class = $this->ctrl->getNextClass($this);
3529  if ($next_class == "ilnotegui")
3530  {
3531  $html = $this->ctrl->forwardCommand($notes_gui);
3532  }
3533  else
3534  {
3535  $html = $notes_gui->getNotesHTML();
3536  }
3537  return $html;
3538  }
3539 
3543  function getQuestionJsOfPage($a_no_interaction = false)
3544  {
3545  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
3546  $q_ids = $this->getPageObject()->getQuestionIds();
3547  $js = array();
3548  if (count($q_ids) > 0)
3549  {
3550  foreach ($q_ids as $q_id)
3551  {
3552  $q_exporter = new ilQuestionExporter($a_no_interaction);
3553  $image_path = ($this->getOutputMode() == "offline")
3554  ? "./assessment/0/".$q_id."/images/"
3555  : null;
3556  $js[$q_id] = $q_exporter->exportQuestion($q_id, $image_path, $this->getOutputMode());
3557  }
3558  }
3559  return $js;
3560  }
3561 
3565  function initSelfAssessmentRendering($a_force_no_form = false)
3566  {
3567  global $tpl, $ilCtrl, $lng;
3568 
3569  if ($this->getPageConfig()->getEnableSelfAssessment())
3570  {
3571  $qhtml = $this->getQuestionJsOfPage(($this->getOutputMode()=="edit" || $a_force_no_form)
3572  ? true
3573  : false);
3574 // $qhtml = $this->getQuestionJsOfPage(true);
3575  $this->setQuestionHTML($qhtml);
3576  //include JQuery Libraries before Prototpye
3577 // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js");
3578 // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js");
3579  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
3582  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/pure.js");
3583  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/question_handling.js");
3584  $tpl->addCss("./Modules/Scorm2004/templates/default/question_handling.css");
3585  if (!$this->getPageConfig()->getEnableSelfAssessmentScorm() && $this->getOutputMode() != IL_PAGE_PREVIEW
3586  && $this->getOutputMode() != "offline")
3587  {
3588  $tpl->addJavaScript("./Services/COPage/js/ilCOPageQuestionHandler.js");
3589  $url = $ilCtrl->getLinkTarget($this, "processAnswer", "", true, false);
3590  $tpl->addOnloadCode("ilCOPageQuestionHandler.initCallback('".$url."');");
3591  }
3592 
3593  if ($this->getPageConfig()->getDisableDefaultQuestionFeedback())
3594  {
3595  $tpl->addOnloadCode("ilias.questions.default_feedback = false;");
3596  }
3597 
3598  $lk = $this->getPageConfig()->getLocalizationLanguage();
3599  self::addPreparationJavascript($tpl, $lk);
3600  }
3601  }
3602 
3609  static function addPreparationJavascript($a_tpl, $a_lang)
3610  {
3611  global $lng;
3612 
3613  $a_tpl->addOnloadCode(self::getJSTextInitCode($a_lang).
3614  'ilCOPagePres.updateQuestionOverviews();
3615  ');
3616  }
3617 
3624  static function getJSTextInitCode($a_lang)
3625  {
3626  global $lng, $ilUser;
3627 
3628  if ($a_lang == "")
3629  {
3630  $a_lang = $ilUser->getLanguage();
3631  }
3632 
3633  return
3634  '
3635  ilias.questions.txt.wrong_answers = "'.$lng->txtlng("content", "cont_wrong_answers", $a_lang).'";
3636  ilias.questions.txt.wrong_answers_single = "'.$lng->txtlng("content", "cont_wrong_answers_single", $a_lang).'";
3637  ilias.questions.txt.tries_remaining = "'.$lng->txtlng("content", "cont_tries_remaining", $a_lang).'";
3638  ilias.questions.txt.please_try_again = "'.$lng->txtlng("content", "cont_please_try_again", $a_lang).'";
3639  ilias.questions.txt.all_answers_correct = "'.$lng->txtlng("content", "cont_all_answers_correct", $a_lang).'";
3640  ilias.questions.txt.nr_of_tries_exceeded = "'.$lng->txtlng("content", "cont_nr_of_tries_exceeded", $a_lang).'";
3641  ilias.questions.txt.correct_answers_shown = "'.$lng->txtlng("content", "cont_correct_answers_shown", $a_lang).'";
3642  ilias.questions.txt.correct_answers_also = "'.$lng->txtlng("content", "cont_correct_answers_also", $a_lang).'";
3643  ilias.questions.txt.correct_answer_also = "'.$lng->txtlng("content", "cont_correct_answer_also", $a_lang).'";
3644  ilias.questions.txt.ov_all_correct = "'.$lng->txtlng("content", "cont_ov_all_correct", $a_lang).'";
3645  ilias.questions.txt.ov_some_correct = "'.$lng->txtlng("content", "cont_ov_some_correct", $a_lang).'";
3646  ilias.questions.txt.ov_wrong_answered = "'.$lng->txtlng("content", "cont_ov_wrong_answered", $a_lang).'";
3647  ilias.questions.txt.please_select = "'.$lng->txtlng("content", "cont_please_select", $a_lang).'";
3648  ilias.questions.refresh_lang();
3649  ';
3650 
3651  }
3652 
3653 
3657  function processAnswer()
3658  {
3659  global $ilLog;
3660 
3661  /*$ilLog->write($_POST);
3662  $ilLog->write($_POST["id"]);
3663  $ilLog->write($_POST["type"]);
3664  $ilLog->write($_POST["answer"]);
3665  $ilLog->write($_GET);*/
3666 
3667  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3669  ilUtil::stripSlashes($_POST["type"]),
3671  ilUtil::stripSlashes($_POST["answer"]));
3672  }
3673 
3680  function selfAssessmentRendering($a_output)
3681  {
3682  if ($this->getPageConfig()->getEnableSelfAssessment())
3683  {
3684  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
3685  $a_output = "<script>var ScormApi=null;".ilQuestionExporter::questionsJS()."</script>".$a_output;
3686  }
3687  return $a_output;
3688  }
3689 
3690  //
3691  // Initially opened content (e.g. used in learning modules), that
3692  // is presented in another than the main content area (e.g. a picture in
3693  // the bottom left area)
3694  //
3695 
3703  {
3704  global $ilTabs, $ilCtrl;
3705 
3706  $ilTabs->activateTab("edit");
3707  $form = $this->initOpenedContentForm();
3708 
3709  $this->tpl->setContent($form->getHTML());
3710  }
3711 
3719  {
3720  global $ilCtrl;
3721 
3722  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3723  $form = new ilPropertyFormGUI();
3724 
3725  // link input
3726  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3727  $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3729  $ac->setInternalLinkDefault("Media_Media", 0);
3730  $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3731  $val = $this->obj->getInitialOpenedContent();
3732  if ($val["id"] != "" && $val["type"] != "")
3733  {
3734  $ac->setValue($val["type"]."|".$val["id"]."|".$val["target"]);
3735  }
3736 
3737  $form->addItem($ac);
3738 
3739  $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3740  $form->addCommandButton("edit", $this->lng->txt("cancel"));
3741  $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3742  $form->setFormAction($ilCtrl->getFormAction($this));
3743 
3744  return $form;
3745  }
3746 
3754  {
3755  global $ilCtrl;
3756 
3757  $this->obj->saveInitialOpenedContent(
3758  ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3759  ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3760  ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3761  );
3762 
3763  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3764  $ilCtrl->redirect($this, "edit");
3765  }
3766 
3770 
3771 
3775  function switchToLanguage()
3776  {
3777  global $ilCtrl;
3778 
3779  $l = ilUtil::stripSlashes($_GET["totransl"]);
3780  $p = $this->getPageObject();
3781  if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l))
3782  {
3784  return;
3785  }
3786  $ilCtrl->setParameter($this, "transl", $_GET["totransl"]);
3787  $ilCtrl->redirect($this, "edit");
3788  }
3789 
3794  {
3795  global $ilCtrl, $tpl, $lng;
3796 
3797  $l = ilUtil::stripSlashes($_GET["totransl"]);
3798  $ilCtrl->setParameter($this, "totransl", $l);
3799  $lng->loadLanguageModule("meta");
3800 
3801  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3802  $cgui = new ilConfirmationGUI();
3803  $cgui->setFormAction($ilCtrl->getFormAction($this));
3804  $cgui->setHeaderText($lng->txt("cont_page_translation_does_not_exist").": ".
3805  $lng->txt("meta_l_".$l));
3806  $cgui->setCancel($lng->txt("cancel"), "editMasterLanguage");
3807  $cgui->setConfirm($lng->txt("confirm"), "createPageTranslation");
3808  $tpl->setContent($cgui->getHTML());
3809  }
3810 
3815  {
3816  global $ilCtrl;
3817 
3818  $ilCtrl->setParameter($this, "transl", "");
3819  $ilCtrl->redirect($this, "edit");
3820  }
3821 
3826  {
3827  global $ilCtrl;
3828 
3829  $l = ilUtil::stripSlashes($_GET["totransl"]);
3830  $this->getPageObject()->copyPageToTranslation($l);
3831  $ilCtrl->setParameter($this, "transl", $l);
3832  $ilCtrl->redirect($this, "edit");
3833  }
3834 
3838  function releasePageLock()
3839  {
3840  global $ilCtrl, $lng;
3841 
3842  $this->getPageObject()->releasePageLock();
3843  ilUtil::sendSuccess($lng->txt("cont_page_lock_released"), true);
3844  $ilCtrl->redirect($this, "preview");
3845  }
3846 
3847 }
3848 ?>