ILIAS  release_4-3 Revision
 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-2009 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/COPage/classes/class.ilParagraphPlugins.php");
14 include_once("./Services/COPage/classes/class.ilParagraphPlugin.php");
15 include_once("./Services/Utilities/classes/class.ilDOMUtil.php");
16 
17 
34 {
35  var $ilias;
36  var $tpl;
37  var $lng;
38  var $ctrl;
39  var $obj;
49  var $bib_id;
50  var $citation;
54  var $activation = false;
55  var $activated = true;
56  var $enabledinternallinks = false;
57  var $editpreview = false;
58  var $use_meta_data = false;
59  var $enabledpctabs = false;
60  var $link_xml_set = false;
61  var $enableediting = true;
62  var $rawpagecontent = false;
63  var $layoutmode = false;
65  var $compare_mode = false;
66  var $page_config = null;
67  var $enable_keywords = false;
68  var $enable_anchors = false;
69  var $tabs_enabled = true;
70  private $abstract_only = false;
71  private $enabledloginpage = false;
72 
73  //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
74  //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
75  var $pl_start = "{{{{{";
76  var $pl_end = "}}}}}";
77 
78  // name keys like pc class names!
79  var $pc_types = array(
80  "ContentInclude" => array(
81  "enabled" => false),
82  "DataTable" => array(
83  "enabled" => true),
84  "FileList" => array(
85  "enabled" => true),
86  "InteractiveImage" => array(
87  "enabled" => true),
88  "List" => array(
89  "enabled" => true),
90  "LoginPageElement" => array(
91  "enabled" => false),
92  "Map" => array(
93  "enabled" => false),
94  "MediaObject" => array(
95  "enabled" => true),
96  "Paragraph" => array(
97  "enabled" => true),
98  "PlaceHolder" => array(
99  "enabled" => false),
100  "Question" => array(
101  "enabled" => false),
102  "Resources" => array(
103  "enabled" => false),
104  "Section" => array(
105  "enabled" => true),
106  "SourceCode" => array(
107  "enabled" => true),
108  "Table" => array(
109  "enabled" => true),
110  "Tabs" => array(
111  "enabled" => true),
112  "Profile" => array(
113  "enabled" => false),
114  "Verification" => array(
115  "enabled" => false),
116  "Blog" => array(
117  "enabled" => false),
118  "QuestionOverview" => array(
119  "enabled" => false),
120  "Skills" => array(
121  "enabled" => false)
122  );
123 
124 
125 
130  function ilPageObjectGUI($a_parent_type, $a_id = 0, $a_old_nr = 0,
131  $a_prevent_get_id = false)
132  {
133  global $ilias, $tpl, $lng, $ilCtrl,$ilTabs;
134  $this->ctrl =& $ilCtrl;
135 
136  if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0)
137  {
138  $a_old_nr = $_GET["old_nr"];
139  }
140 
141  $this->ilias =& $ilias;
142  $this->tpl =& $tpl;
143  $this->ctrl =& $ilCtrl;
144  $this->lng =& $lng;
146 
147  // defaults (as in learning modules)
148  $this->setEnabledMaps(false);
149  $this->setEnabledFileLists(true);
150  $this->setEnabledRepositoryObjects(false);
151  $this->setEnabledLoginPage(false);
152  $this->setEnabledSelfAssessment(false);
153  $this->setEnabledPageFocus(true);
154  $this->setLayoutMode(false);
155 
156  include_once("./Services/COPage/classes/class.ilPageConfig.php");
157  $this->setPageConfig(new ilPageConfig());
158 
159 
160  if ($a_id > 0)
161  {
162  $this->initPageObject($a_parent_type, $a_id, $a_old_nr);
163  }
164 
165  $this->output2template = true;
166  $this->question_xml = "";
167  $this->question_html = "";
168  $this->tabs_gui =& $ilTabs;
169 
170  // USED FOR TRANSLATIONS
171  $this->template_output_var = "PAGE_CONTENT";
172  $this->citation = false;
173  $this->change_comments = false;
174  $this->page_back_title = $this->lng->txt("page");
175  $lng->loadLanguageModule("content");
176  $this->setPreventHTMLUnmasking(false);
177  $this->setEnabledWikiLinks(false);
178 
179  $this->setTemplateOutput(false);
180  }
181 
187  function setEnablePCType($a_pc_type, $a_val)
188  {
189  if (isset($a_pc_type))
190  {
191  $this->pc_types[$a_pc_type]["enabled"] = $a_val;
192  }
193  }
194 
200  function getEnablePCType($a_pc_type)
201  {
202  return $this->pc_types[$a_pc_type]["enabled"];
203  }
204 
210  function setPageConfig($a_val)
211  {
212  $this->page_config = $a_val;
213  }
214 
220  function getPageConfig()
221  {
222  return $this->page_config;
223  }
224 
225  function initPageObject($a_parent_type, $a_id, $a_old_nr)
226  {
227  $page = new ilPageObject($a_parent_type, $a_id, $a_old_nr);
228  $this->setPageObject($page);
229  }
230 
234  function setBibId($a_id)
235  {
236  // USED FOR SELECTION WHICH PAGE TURNS AND LATER PAGES SHOULD BE SHOWN
237  $this->bib_id = $a_id;
238  }
239 
243  function getBibId()
244  {
245  return $this->bib_id ? $this->bib_id : 0;
246  }
247 
253  function setPageObject($a_pg_obj)
254  {
255  $this->obj = $a_pg_obj;
256  }
257 
263  function getPageObject()
264  {
265  return $this->obj;
266  }
267 
274  {
275  $this->output_mode = $a_mode;
276  }
277 
278  function getOutputMode()
279  {
280  return $this->output_mode;
281  }
282 
283  function setTemplateOutput($a_output = true)
284  {
285  $this->output2template = $a_output;
286  }
287 
288  function outputToTemplate()
289  {
290  return $this->output2template;
291  }
292 
293  function setPresentationTitle($a_title = "")
294  {
295  $this->presentation_title = $a_title;
296  }
297 
299  {
301  }
302 
303  function setHeader($a_title = "")
304  {
305  $this->header = $a_title;
306  }
307 
308  function getHeader()
309  {
310  return $this->header;
311  }
312 
313  function setLinkParams($l_params = "")
314  {
315  $this->link_params = $l_params;
316  }
317 
318  function getLinkParams()
319  {
320  return $this->link_params;
321  }
322 
323  function setLinkFrame($l_frame = "")
324  {
325  $this->link_frame = $l_frame;
326  }
327 
328  function getLinkFrame()
329  {
330  return $this->link_frame;
331  }
332 
333  function setLinkXML($link_xml)
334  {
335  $this->link_xml = $link_xml;
336  $this->link_xml_set = true;
337  }
338 
339  function getLinkXML()
340  {
341  return $this->link_xml;
342  }
343 
344  function setQuestionXML($question_xml)
345  {
346  $this->question_xml = $question_xml;
347  }
348 
350  {
351  $this->question_html = $question_html;
352  }
353 
354  function getQuestionXML()
355  {
356  return $this->question_xml;
357  }
358 
359  function getQuestionHTML()
360  {
361  return $this->question_html;
362  }
363 
364  function setTemplateTargetVar($a_variable)
365  {
366  $this->target_var = $a_variable;
367  }
368 
370  {
371  return $this->target_var;
372  }
373 
374  function setTemplateOutputVar($a_value)
375  {
376  // USED FOR TRANSLATION PRESENTATION OF dbk OBJECTS
377  $this->template_output_var = $a_value;
378  }
379 
381  {
383  }
384 
385  function setOutputSubmode($a_mode)
386  {
387  // USED FOR TRANSLATION PRESENTATION OF dbk OBJECTS
388  $this->output_submode = $a_mode;
389  }
390 
391  function getOutputSubmode()
392  {
393  return $this->output_submode;
394  }
395 
396 
397  function setSourcecodeDownloadScript ($script_name) {
398  $this->sourcecode_download_script = $script_name;
399  }
400 
403  }
404 
405  function enableCitation($a_enabled)
406  {
407  $this->citation = $a_enabled;
408  }
409 
410  function isEnabledCitation()
411  {
412  return $this->citation;
413  }
414 
415  function setLocator(&$a_locator)
416  {
417  $this->locator =& $a_locator;
418  }
419 
420  function setTabs($a_tabs)
421  {
422  $this->tabs_gui = $a_tabs;
423  }
424 
425  function setPageBackTitle($a_title)
426  {
427  $this->page_back_title = $a_title;
428  }
429 
430  function setFileDownloadLink($a_download_link)
431  {
432  $this->file_download_link = $a_download_link;
433  }
434 
436  {
437  return $this->file_download_link;
438  }
439 
440  function setFullscreenLink($a_fullscreen_link)
441  {
442  $this->fullscreen_link = $a_fullscreen_link;
443  }
444 
445  function getFullscreenLink()
446  {
447  return $this->fullscreen_link;
448  }
449 
455  function setEnableKeywords($a_val)
456  {
457  $this->enable_keywords = $a_val;
458  }
459 
465  function getEnableKeywords()
466  {
467  return $this->enable_keywords;
468  }
469 
475  function setEnableAnchors($a_val)
476  {
477  $this->enable_anchors = $a_val;
478  }
479 
485  function getEnableAnchors()
486  {
487  return $this->enable_anchors;
488  }
489 
490  function setIntLinkHelpDefault($a_type, $a_id)
491  {
492  $this->int_link_def_type = $a_type;
493  $this->int_link_def_id = $a_id;
494  }
495 
496  function setIntLinkReturn($a_return)
497  {
498  $this->int_link_return = $a_return;
499  }
500 
501  function enableChangeComments($a_enabled)
502  {
503  $this->change_comments = $a_enabled;
504  }
505 
507  {
508  return $this->change_comments;
509  }
510 
511  function enableNotes($a_enabled, $a_parent_id)
512  {
513  $this->notes_enabled = $a_enabled;
514  $this->notes_parent_id = $a_parent_id;
515  }
516 
517  function isEnabledNotes()
518  {
519  return $this->notes_enabled;
520  }
521 
525  function enableContentIncludes($a_enable)
526  {
527  $this->setEnablePCType("ContentInclude", (bool) $a_enable);
528  }
529 
534  {
535  return $this->getEnablePCType("ContentInclude");
536  }
537 
543  function setOfflineDirectory ($offdir) {
544  $this->offline_directory = $offdir;
545  }
546 
547 
552  function getOfflineDirectory () {
553  return $this->offline_directory;
554  }
555 
556 
563  function setViewPageLink($a_link, $a_target = "")
564  {
565  $this->view_page_link = $a_link;
566  $this->view_page_target = $a_target;
567  }
568 
572  function getViewPageLink()
573  {
574  return $this->view_page_link;
575  }
576 
580  function getViewPageTarget()
581  {
582  return $this->view_page_target;
583  }
584 
585  function setActivationListener(&$a_obj, $a_meth)
586  {
587  $this->act_obj =& $a_obj;
588  $this->act_meth = $a_meth;
589  }
590 
591  function setEnabledActivation($a_act)
592  {
593  $this->activation = $a_act;
594  }
595 
597  {
598  return $this->activation;
599  }
600 
602  {
603  $this->scheduled_activation = $a_act;
604  }
605 
607  {
608  return $this->scheduled_activation;
609  }
610 
616  public function setPageToc($a_val)
617  {
618  $this->page_toc = $a_val;
619  }
620 
626  public function getPageToc()
627  {
628  return $this->page_toc;
629  }
630 
636  function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
637  {
638  $this->enabled_news = $a_enabled;
639  $this->news_obj_id = $a_news_obj_id;
640  $this->news_obj_type = $a_news_obj_type;
641  }
642 
648  function getEnabledNews()
649  {
650  return $this->enabled_news;
651  }
652 
656  function setTabHook($a_object, $a_function)
657  {
658  $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
659  }
660 
661 
667  function setEnabledInternalLinks($a_enabledinternallinks)
668  {
669  $this->enabledinternallinks = $a_enabledinternallinks;
670  }
671 
678  {
680  }
681 
687  function setEditPreview($a_editpreview)
688  {
689  $this->editpreview = $a_editpreview;
690  }
691 
697  function getEditPreview()
698  {
699  return $this->editpreview;
700  }
701 
707  function setPreventHTMLUnmasking($a_preventhtmlunmasking)
708  {
709  $this->preventhtmlunmasking = $a_preventhtmlunmasking;
710  }
711 
718  {
719  return $this->preventhtmlunmasking;
720  }
721 
727  function setEnabledTabs($a_enabledtabs)
728  {
729  $this->tabs_enabled = $a_enabledtabs;
730  }
731 
737  function getEnabledTabs()
738  {
739  return $this->tabs_enabled;
740  }
741 
747  function setEnabledRepositoryObjects($a_enabledrepositoryobjects)
748  {
749  $this->setEnablePCType("Resources", $a_enabledrepositoryobjects);
750  }
751 
758  {
759  return $this->getEnablePCType("Resources");
760  }
761 
766  public function setEnabledLoginPage($a_enablegloginpage)
767  {
768  $this->setEnablePCType("LoginPageElement", (bool) $a_enablegloginpage);
769  }
770 
775  public function getEnabledLoginPage()
776  {
777  return $this->getEnablePCType("LoginPageElement");
778  }
779 
785  function setEnabledMaps($a_enabledmaps)
786  {
787  $this->setEnablePCType("Map", (bool) $a_enabledmaps);
788  }
789 
795  function getEnabledMaps()
796  {
797  return $this->getEnablePCType("Map");
798  }
799 
805  function setEnabledPCTabs($a_enabledpctabs)
806  {
807  $this->setEnablePCType("Tabs", (bool) $a_enabledpctabs);
808  }
809 
815  function getEnabledPCTabs()
816  {
817  return $this->getEnablePCType("Tabs");
818  }
819 
825  function setEnabledFileLists($a_enabledfilelists)
826  {
827  $this->setEnablePCType("FileList", (bool) $a_enabledfilelists);
828  }
829 
836  {
837  return $this->getEnablePCType("FileList");
838  }
839 
845  function setEnabledPageFocus($a_enabledpagefocus)
846  {
847  $this->enabledpagefocus = $a_enabledpagefocus;
848  }
849 
856  {
857  return $this->enabledpagefocus;
858  }
859 
865  function getEnabledProfile()
866  {
867  return $this->getEnablePCType("Profile");
868  }
869 
874  public function setEnabledProfile($a_enableprofile)
875  {
876  $this->setEnablePCType("Profile", (bool)$a_enableprofile);
877  }
878 
885  {
886  return $this->getEnablePCType("Verification");
887  }
888 
893  public function setEnabledVerification($a_enableverification)
894  {
895  $this->setEnablePCType("Verification", (bool)$a_enableverification);
896  }
897 
903  function getEnabledBlog()
904  {
905  return $this->getEnablePCType("Blog");
906  }
907 
912  public function setEnabledBlog($a_enableblog)
913  {
914  $this->setEnablePCType("Blog", (bool)$a_enableblog);
915  }
916 
922  function getEnabledSkills()
923  {
924  return $this->getEnablePCType("Skills");
925  }
926 
931  public function setEnabledSkills($a_enableskills)
932  {
933  $this->setEnablePCType("Skills", (bool)$a_enableskills);
934  }
935 
941  function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
942  {
943  $this->exp_frame = $a_exp_frame;
944  $this->exp_id = $a_exp_id;
945  $this->exp_target_script = $a_exp_target_script;
946  }
947 
953  function setPrependingHtml($a_prependinghtml)
954  {
955  $this->prependinghtml = $a_prependinghtml;
956  }
957 
963  function getPrependingHtml()
964  {
965  return $this->prependinghtml;
966  }
967 
973  function setEnabledWikiLinks($a_enablewikilinks)
974  {
975  $this->enablewikilinks = $a_enablewikilinks;
976  }
977 
984  {
985  return $this->enablewikilinks;
986  }
987 
993  function setEnableEditing($a_enableediting)
994  {
995  $this->enableediting = $a_enableediting;
996  }
997 
1003  function getEnableEditing()
1004  {
1005  return $this->enableediting;
1006  }
1007 
1013  function setRawPageContent($a_rawpagecontent)
1014  {
1015  $this->rawpagecontent = $a_rawpagecontent;
1016  }
1017 
1024  {
1025  return $this->rawpagecontent;
1026  }
1027 
1033  function setLayoutMode($a_layout_mode)
1034  {
1035  $this->layout_mode = $a_layout_mode;
1036  }
1037 
1043  function getLayoutMode()
1044  {
1045  return $this->layout_mode;
1046  }
1047 
1053  function setStyleId($a_styleid)
1054  {
1055  $this->styleid = $a_styleid;
1056  }
1057 
1063  function getStyleId()
1064  {
1065  return $this->styleid;
1066  }
1067 
1073  function setEnabledSelfAssessment($a_enabledselfassessment, $a_scorm = true)
1074  {
1075  $this->setEnablePCType("Question", (bool) $a_enabledselfassessment);
1076  $this->enabledselfassessment = $a_enabledselfassessment;
1077  $this->enabledselfassessment_scorm = $a_scorm;
1078  }
1079 
1080 
1087  {
1088  return $this->enabledselfassessment;
1089  }
1090 
1097  {
1098  return $this->enabledselfassessment_scorm;
1099  }
1100 
1106  function setCompareMode($a_val)
1107  {
1108  $this->compare_mode = $a_val;
1109  }
1110 
1116  function getCompareMode()
1117  {
1118  return $this->compare_mode;
1119  }
1120 
1126  function setAbstractOnly($a_val)
1127  {
1128  $this->abstract_only = $a_val;
1129  }
1130 
1136  function getAbstractOnly()
1137  {
1138  return $this->abstract_only;
1139  }
1140 
1150  function activateMetaDataEditor($a_rep_obj_id, $a_sub_obj_id, $a_type,
1151  $a_observer_obj = NULL, $a_observer_func = "")
1152  {
1153  $this->use_meta_data = true;
1154  $this->meta_data_rep_obj_id = $a_rep_obj_id;
1155  $this->meta_data_sub_obj_id = $a_sub_obj_id;
1156  $this->meta_data_type = $a_type;
1157  $this->meta_data_observer_obj = $a_observer_obj;
1158  $this->meta_data_observer_func = $a_observer_func;
1159  }
1160 
1167  {
1168  global $ilCtrl;
1169 
1170  $file_download_link = $this->getFileDownloadLink();
1171  if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline")
1172  {
1173  $file_download_link = $ilCtrl->getLinkTarget($this, "downloadFile");
1174  }
1175  return $file_download_link;
1176  }
1177 
1184  {
1185  global $ilCtrl;
1186 
1187  $fullscreen_link = $this->getFullscreenLink();
1188  if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline")
1189  {
1190  $fullscreen_link = $ilCtrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
1191  }
1192  return $fullscreen_link;
1193  }
1194 
1201  {
1202  global $ilCtrl;
1203 
1205  if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline")
1206  {
1207  $l = $ilCtrl->getLinkTarget($this, "");
1208  }
1209  return $l;
1210  }
1211 
1216  {
1217  $xml = "";
1218  if($this->getOutputMode() == "edit")
1219  {
1220  global $ilPluginAdmin;
1221 
1222  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE,
1223  "COPage", "pgcp");
1224  foreach ($pl_names as $pl_name)
1225  {
1226  $plugin = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE,
1227  "COPage", "pgcp", $pl_name);
1228  if ($plugin->isValidParentType($this->getPageObject()->getParentType()))
1229  {
1230  $xml = '<ComponentPlugin Name="'.$plugin->getPluginName().
1231  '" InsertText="'.$plugin->getUIText(ilPageComponentPlugin::TXT_CMD_INSERT).'" />';
1232  }
1233  }
1234  }
1235  if ($xml != "")
1236  {
1237  $xml = "<ComponentPlugins>".$xml."</ComponentPlugins>";
1238  }
1239 
1240  return $xml;
1241  }
1242 
1243 
1247  function &executeCommand()
1248  {
1249  global $ilCtrl, $ilTabs, $lng;
1250 
1251  $next_class = $this->ctrl->getNextClass($this);
1252 
1253  $cmd = $this->ctrl->getCmd();
1254  //$this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
1255  // , "view", "ilEditClipboardGUI");
1256  $this->getTabs();
1257 
1258  $ilCtrl->setReturn($this, "edit");
1259 //echo "-".$next_class."-";
1260  switch($next_class)
1261  {
1262  case 'ilmdeditorgui':
1263  //$this->setTabs();
1264  $ilTabs->setTabActive("meta_data");
1265  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
1266  $md_gui =& new ilMDEditorGUI($this->meta_data_rep_obj_id,
1267  $this->meta_data_sub_obj_id, $this->meta_data_type);
1268  if (is_object($this->meta_data_observer_obj))
1269  {
1270  $md_gui->addObserver($this->meta_data_observer_obj,
1271  $this->meta_data_observer_func, "General");
1272  }
1273  $this->ctrl->forwardCommand($md_gui);
1274  break;
1275 
1276  case "ileditclipboardgui":
1277  //$this->tabs_gui->clearTargets();
1278  //$this->ctrl->setReturn($this, "view");
1279  $clip_gui = new ilEditClipboardGUI();
1280  $clip_gui->setPageBackTitle($this->page_back_title);
1281  //$ret =& $clip_gui->executeCommand();
1282  $ret =& $this->ctrl->forwardCommand($clip_gui);
1283  break;
1284 
1285  // notes
1286  case "ilnotegui":
1287  switch($_GET["notes_mode"])
1288  {
1289  default:
1290  $html = $this->edit();
1291  $ilTabs->setTabActive("edit");
1292  return $html;
1293  }
1294  break;
1295 
1296  case 'ilpublicuserprofilegui':
1297  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
1298  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1299  $ret = $this->ctrl->forwardCommand($profile_gui);
1300  break;
1301 
1302  case "ilpageeditorgui":
1303  if (!$this->getEnableEditing())
1304  {
1305  ilUtil::sendFailure($lng->txt("permission_denied"), true);
1306  $ilCtrl->redirect($this, "preview");
1307  }
1308  $page_editor =& new ilPageEditorGUI($this->getPageObject(), $this);
1309  $page_editor->setLocator($this->locator);
1310  $page_editor->setHeader($this->getHeader());
1311  $page_editor->setPageBackTitle($this->page_back_title);
1312  $page_editor->setEnableInternalLinks($this->getEnabledInternalLinks());
1313  $page_editor->setEnableKeywords($this->getEnableKeywords());
1314  $page_editor->setEnableAnchors($this->getEnableAnchors());
1315  $page_editor->setIntLinkHelpDefault($this->int_link_def_type,
1316  $this->int_link_def_id);
1317  $page_editor->setIntLinkReturn($this->int_link_return);
1318  //$page_editor->executeCommand();
1319  $ret =& $this->ctrl->forwardCommand($page_editor);
1320  break;
1321 
1322  case 'ilnewsitemgui':
1323  include_once("./Services/News/classes/class.ilNewsItemGUI.php");
1324  $news_item_gui = new ilNewsItemGUI();
1325  $news_item_gui->setEnableEdit(true);
1326  $news_item_gui->setContextObjId($this->news_obj_id);
1327  $news_item_gui->setContextObjType($this->news_obj_type);
1328  $news_item_gui->setContextSubObjId($this->obj->getId());
1329  $news_item_gui->setContextSubObjType("pg");
1330 
1331  $ret = $ilCtrl->forwardCommand($news_item_gui);
1332  break;
1333 
1334  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1335  $ret = $this->ctrl->forwardCommand($profile_gui);
1336  break;
1337 
1338  case "ilpropertyformgui":
1339  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1340  $form = $this->initOpenedContentForm();
1341  $this->ctrl->forwardCommand($form);
1342  break;
1343 
1344  case "ilinternallinkgui":
1345  $this->lng->loadLanguageModule("content");
1346  require_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
1347  $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1348  //$link_gui->filterLinkType("RepositoryItem");
1349 
1350  $link_gui->filterLinkType("PageObject_FAQ");
1351  $link_gui->filterLinkType("GlossaryItem");
1352  $link_gui->filterLinkType("Media_Media");
1353  $link_gui->filterLinkType("Media_FAQ");
1354 
1355  $link_gui->setFilterWhiteList(true);
1356  $link_gui->setMode("asynch");
1357  $ilCtrl->forwardCommand($link_gui);
1358  break;
1359 
1360 
1361  default:
1362  $cmd = $this->ctrl->getCmd("preview");
1363  $ret = $this->$cmd();
1364  break;
1365  }
1366 //echo "+$ret+";
1367  return $ret;
1368  }
1369 
1370  function deactivatePage()
1371  {
1372  $this->getPageObject()->setActivationStart(null);
1373  $this->getPageObject()->setActivationEnd(null);
1374  $this->getPageObject()->setActive(false);
1375  $this->getPageObject()->update();
1376  $this->ctrl->redirect($this, "edit");
1377  }
1378 
1379  function activatePage()
1380  {
1381  $this->getPageObject()->setActivationStart(null);
1382  $this->getPageObject()->setActivationEnd(null);
1383  $this->getPageObject()->setActive(true);
1384  $this->getPageObject()->update();
1385  $this->ctrl->redirect($this, "edit");
1386  }
1387 
1388  /*
1389  * display content of page
1390  */
1391  function showPage()
1392  {
1393  global $tree, $ilUser, $ilias, $lng, $ilCtrl, $ilBench, $ilSetting, $ilTabs;
1394 
1395  $ilBench->start("ContentPresentation", "ilPageObjectGUI_showPage");
1396 
1397  $this->initSelfAssessmentRendering();
1398 
1399  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1401 
1402 
1403  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1404 
1405  // needed for overlays in iim
1406  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1408 
1409  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1411 
1412  // init template
1413  //if($this->outputToTemplate())
1414  //{
1415  if($this->getOutputMode() == "edit")
1416  {
1417 //echo ":".$this->getTemplateTargetVar().":";
1418  $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1419  //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1420 
1421  // to do: status dependent class
1422  $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1423 
1424  // user comment
1425  if ($this->isEnabledChangeComments())
1426  {
1427  $tpl->setCurrentBlock("change_comment");
1428  $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1429  $tpl->parseCurrentBlock();
1430  $tpl->setCurrentBlock("adm_content");
1431  }
1432 
1433  // explorer updater
1434  if ($this->exp_frame != "")
1435  {
1436  $tpl->setCurrentBlock("updater");
1437  $tpl->setVariable("UPDATER_FRAME", $this->exp_frame);
1438  $tpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
1439  $tpl->setVariable("HREF_UPDATER", $this->exp_target_script);
1440  $tpl->parseCurrentBlock();
1441  }
1442 
1443 /* $tpl->setVariable("TXT_INSERT_BEFORE", $this->lng->txt("cont_set_before"));
1444  $tpl->setVariable("TXT_INSERT_AFTER", $this->lng->txt("cont_set_after"));
1445  $tpl->setVariable("TXT_INSERT_CANCEL", $this->lng->txt("cont_set_cancel"));
1446  $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1447 */
1448  $tpl->setVariable("WYSIWYG_ACTION",
1449  $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
1450 
1451 
1452  // determine media, html and javascript mode
1453  $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
1454  ? "disable"
1455  : "enable";
1456  $sel_html_mode = ($ilUser->getPref("ilPageEditor_HTMLMode") == "disable")
1457  ? "disable"
1458  : "enable";
1459  $sel_js_mode = "disable";
1460  //if($ilSetting->get("enable_js_edit", 1))
1461  //{
1462  $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1463  ? "enable"
1464  : "disable";
1465  //}
1466 
1467  // show prepending html
1468  $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1469  $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
1470 
1471  // presentation view
1472  if ($this->getViewPageLink() != "")
1473  {
1474  $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"),
1475  $this->getViewPageLink(), $this->getViewPageTarget());
1476  }
1477 
1478  // show actions drop down
1479  $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
1480 
1481  // get js files for JS enabled editing
1482  if ($sel_js_mode == "enable")
1483  {
1484  $this->insertHelp($tpl);
1485  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1488  ilYuiUtil::initPanel(false);
1489  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
1490  $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
1491 
1492  include_once './Services/Style/classes/class.ilObjStyleSheet.php';
1493  $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
1494  preloader.src = './templates/default/images/loader.gif';
1495  ilCOPage.setContentCss('".
1498  ", ./Services/COPage/css/tiny_extra.css".
1499  "')");
1500 
1501  $GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
1502  $tpl->touchBlock("init_dragging");
1503 
1504  $tpl->setVariable("IL_TINY_MENU",
1505  self::getTinyMenu(
1506  $this->getPageObject()->getParentType(),
1507  $this->getEnabledInternalLinks(),
1508  $this->getPageObject()->getParentType() == "wpg",
1509  $this->getEnableKeywords(), $this->getStyleId(), true, true,
1510  $this->getEnableAnchors()
1511  ));
1512 
1513  // add int link parts
1514  include_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
1515  $tpl->setCurrentBlock("int_link_prep");
1516  $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1517  $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1518  "", false, true, false)));
1519  $tpl->parseCurrentBlock();
1520 
1521  // internal links per js
1522  //$tpl->setVariable("IL_INT_LINK_URL",
1523  // $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
1524  // "showLinkHelp", false, true, false));
1525 
1526  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1528  $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
1529 
1530  }
1531 
1532  // multiple actions
1533  $cnt_pcs = $this->getPageObject()->countPageContents();
1534  if ($cnt_pcs > 1 ||
1535  ($this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0))
1536  {
1537  $tpl->setCurrentBlock("multi_actions");
1538  if ($sel_js_mode == "enable")
1539  {
1540  $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
1541  $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
1542  $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
1543  $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
1544  $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
1545  $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
1546  $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
1547  }
1548  $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
1549  $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
1550  $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
1551  $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
1552  $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
1553  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
1554  $tpl->parseCurrentBlock();
1555  }
1556  }
1557  else
1558  {
1559  if($this->getOutputSubmode() == 'translation')
1560  {
1561  $tpl = new ilTemplate("tpl.page_translation_content.html", true, true, "Services/COPage");
1562  }
1563  else
1564  {
1565  // presentation
1566  if ($this->getOutputMode() != IL_PAGE_PREVIEW)
1567  {
1568  $tpl = new ilTemplate("tpl.page_content.html", true, true, "Services/COPage");
1569  if ($this->getEnabledPageFocus())
1570  {
1571  $tpl->touchBlock("page_focus");
1572  }
1573  }
1574  else // preview
1575  {
1576  $tpl = new ilTemplate("tpl.page_preview.html", true, true, "Services/COPage");
1577  include_once("./Services/User/classes/class.ilUserUtil.php");
1578 
1579  $c_old_nr = $this->getPageObject()->old_nr;
1580  if ($c_old_nr > 0)
1581  {
1582  $hist_info =
1583  $this->getPageObject()->getHistoryInfo($c_old_nr);
1584 
1585  if (!$this->getCompareMode())
1586  {
1587  // previous revision
1588  if (is_array($hist_info["previous"]))
1589  {
1590  $tpl->setCurrentBlock("previous_rev");
1591  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1592  $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1593  $tpl->setVariable("HREF_PREV",
1594  $ilCtrl->getLinkTarget($this, "preview"));
1595  $tpl->parseCurrentBlock();
1596  }
1597  else
1598  {
1599  $tpl->setCurrentBlock("previous_rev_disabled");
1600  $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
1601  $tpl->parseCurrentBlock();
1602  }
1603 
1604  // next revision
1605  $tpl->setCurrentBlock("next_rev");
1606  $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
1607  $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1608  $tpl->setVariable("HREF_NEXT",
1609  $ilCtrl->getLinkTarget($this, "preview"));
1610  $tpl->parseCurrentBlock();
1611 
1612  // latest revision
1613  $tpl->setCurrentBlock("latest_rev");
1614  $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
1615  $ilCtrl->setParameter($this, "old_nr", "");
1616  $tpl->setVariable("HREF_LATEST",
1617  $ilCtrl->getLinkTarget($this, "preview"));
1618  $tpl->parseCurrentBlock();
1619 
1620  // rollback
1621  if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID)
1622  {
1623  $tpl->setCurrentBlock("rollback");
1624  $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
1625  $tpl->setVariable("HREF_ROLLBACK",
1626  $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
1627  $ilCtrl->setParameter($this, "old_nr", "");
1628  $tpl->setVariable("TXT_ROLLBACK",
1629  $lng->txt("cont_rollback"));
1630  $tpl->parseCurrentBlock();
1631  }
1632  }
1633 
1634  $tpl->setCurrentBlock("hist_nav");
1635  $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
1636  $tpl->setVariable("VAL_REVISION_DATE",
1637  ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
1638  $tpl->setVariable("VAL_REV_USER",
1639  ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
1640  $tpl->parseCurrentBlock();
1641  }
1642  }
1643  }
1644  }
1645  if ($this->getOutputMode() != IL_PAGE_PRESENTATION &&
1646  $this->getOutputMode() != IL_PAGE_OFFLINE &&
1647  $this->getOutputMode() != IL_PAGE_PREVIEW &&
1648  $this->getOutputMode() != IL_PAGE_PRINT)
1649  {
1650  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1651  }
1652 
1653  // output media object edit list (of media links)
1654  if($this->getOutputMode() == "edit")
1655  {
1656  $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
1657  $this->obj->getId());
1658  $mob_links = array();
1659  foreach($links as $link)
1660  {
1661  if ($link["type"] == "mob")
1662  {
1663  if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob")
1664  {
1665  $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
1666  }
1667  }
1668  }
1669 
1670  // linked media objects
1671  if (count($mob_links) > 0)
1672  {
1673  $tpl->setCurrentBlock("med_link");
1674  $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1675  $tpl->setVariable("SEL_MED_LINKS",
1676  ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
1677  $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1678  $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1679  //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1680  $tpl->parseCurrentBlock();
1681  }
1682 
1683  // content snippets used
1684  $snippets = $this->getPageObject()->collectContentIncludes();
1685  if (count($snippets) > 0)
1686  {
1687  foreach ($snippets as $s)
1688  {
1689  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1690  $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1691  }
1692  $tpl->setCurrentBlock("med_link");
1693  $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1694  $tpl->setVariable("SEL_SNIPPETS",
1695  ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
1696  $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1697  $tpl->parseCurrentBlock();
1698  }
1699 
1700  // scheduled activation?
1701  if (!$this->getPageObject()->getActive() &&
1702  $this->getPageObject()->getActivationStart() != "" &&
1704  {
1705  $tpl->setCurrentBlock("activation_txt");
1706  $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
1707  $tpl->setVariable("SA_FROM",
1709  new ilDateTime($this->getPageObject()->getActivationStart(),
1710  IL_CAL_DATETIME)));
1711  $tpl->setVariable("SA_TO",
1713  new ilDateTime($this->getPageObject()->getActivationEnd(),
1714  IL_CAL_DATETIME)));
1715  $tpl->parseCurrentBlock();
1716  }
1717  }
1718 
1719  if ($_GET["reloadTree"] == "y")
1720  {
1721  $tpl->setCurrentBlock("reload_tree");
1722  if ($this->obj->getParentType() == "dbk")
1723  {
1724  $tpl->setVariable("LINK_TREE",
1725  $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
1726  }
1727  else
1728  {
1729  $tpl->setVariable("LINK_TREE",
1730  $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
1731  }
1732  $tpl->parseCurrentBlock();
1733  }
1734 // }
1735  // get content
1736  $builded = $this->obj->buildDom();
1737 
1738  // manage hierarchical ids
1739  if($this->getOutputMode() == "edit")
1740  {
1741 
1742  // add pc ids, if necessary
1743  if (!$this->obj->checkPCIds())
1744  {
1745  $this->obj->insertPCIds();
1746  $this->obj->update(true, true);
1747  }
1748 
1749  $this->obj->addFileSizes();
1750  $this->obj->addHierIDs();
1751 
1752  $hids = $this->obj->getHierIds();
1753  $row1_ids = $this->obj->getFirstRowIds();
1754  $col1_ids = $this->obj->getFirstColumnIds();
1755  $litem_ids = $this->obj->getListItemIds();
1756  $fitem_ids = $this->obj->getFileItemIds();
1757 
1758  // standard menues
1759  $hids = $this->obj->getHierIds();
1760  foreach($hids as $hid)
1761  {
1762  $tpl->setCurrentBlock("add_dhtml");
1763  $tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
1764  $tpl->parseCurrentBlock();
1765  }
1766 
1767  // column menues for tables
1768  foreach($col1_ids as $hid)
1769  {
1770  $tpl->setCurrentBlock("add_dhtml");
1771  $tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
1772  $tpl->parseCurrentBlock();
1773  }
1774 
1775  // row menues for tables
1776  foreach($row1_ids as $hid)
1777  {
1778  $tpl->setCurrentBlock("add_dhtml");
1779  $tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
1780  $tpl->parseCurrentBlock();
1781  }
1782 
1783  // list item menues
1784  foreach($litem_ids as $hid)
1785  {
1786  $tpl->setCurrentBlock("add_dhtml");
1787  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1788  $tpl->parseCurrentBlock();
1789  }
1790 
1791  // file item menues
1792  foreach($fitem_ids as $hid)
1793  {
1794  $tpl->setCurrentBlock("add_dhtml");
1795  $tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
1796  $tpl->parseCurrentBlock();
1797  }
1798  }
1799  else
1800  {
1801  $this->obj->addFileSizes();
1802  }
1803 
1804 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
1805 //echo "<br>-".htmlentities($this->getLinkXML())."-";
1806 
1807  // set default link xml, if nothing was set yet
1808  if (!$this->link_xml_set)
1809  {
1810  $this->setDefaultLinkXml();
1811  }
1812 
1813  //$content = $this->obj->getXMLFromDom(false, true, true,
1814  // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1815  $link_xml = $this->getLinkXML();
1816 
1817  // disable/enable auto margins
1818  if ($this->getStyleId() > 0)
1819  {
1820  if (ilObject::_lookupType($this->getStyleId()) == "sty")
1821  {
1822  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1823  $style = new ilObjStyleSheet($this->getStyleId());
1824  $template_xml = $style->getTemplateXML();
1825  $disable_auto_margins = "n";
1826  if ($style->lookupStyleSetting("disable_auto_margins"))
1827  {
1828  $disable_auto_margins = "y";
1829  }
1830  }
1831  }
1832 
1833  if ($this->getAbstractOnly())
1834  {
1835  $content = "<dummy><PageObject><PageContent><Paragraph>".
1836  $this->obj->getFirstParagraphText().$link_xml.
1837  "</Paragraph></PageContent></PageObject></dummy>";
1838  }
1839  else
1840  {
1841  $content = $this->obj->getXMLFromDom(false, true, true,
1842  $link_xml.$this->getQuestionXML().$template_xml);
1843  }
1844 
1845  // check validation errors
1846  if($builded !== true)
1847  {
1848  $this->displayValidationError($builded);
1849  }
1850  else
1851  {
1852  $this->displayValidationError($_SESSION["il_pg_error"]);
1853  }
1854  unset($_SESSION["il_pg_error"]);
1855 
1856  if(isset($_SESSION["citation_error"]))
1857  {
1858  ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
1859  ilSession::clear("citation_error");
1860  }
1861 
1862  // get title
1863  $pg_title = $this->getPresentationTitle();
1864 
1865  $add_path = ilUtil::getImagePath("add.png");
1866  $col_path = ilUtil::getImagePath("col.png");
1867  $row_path = ilUtil::getImagePath("row.png");
1868  $item_path = ilUtil::getImagePath("item.png");
1869  $med_disabled_path = ilUtil::getImagePath("media_disabled.png");
1870 
1871  if ($this->getOutputMode() != "offline")
1872  {
1873  $enlarge_path = ilUtil::getImagePath("enlarge.png");
1874  $wb_path = ilUtil::getWebspaceDir("output")."/";
1875  }
1876  else
1877  {
1878  $enlarge_path = "images/enlarge.png";
1879  $wb_path = "";
1880  }
1881  $pg_title_class = ($this->getOutputMode() == "print")
1882  ? "ilc_PrintPageTitle"
1883  : "";
1884 
1885  // page splitting only for learning modules and
1886  // digital books
1887  $enable_split_new = ($this->obj->getParentType() == "lm" ||
1888  $this->obj->getParentType() == "dbk")
1889  ? "y"
1890  : "n";
1891 
1892  // page splitting to next page only for learning modules and
1893  // digital books if next page exists in tree
1894  if (($this->obj->getParentType() == "lm" ||
1895  $this->obj->getParentType() == "dbk") &&
1896  ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
1897  $this->obj->getId()))
1898  {
1899  $enable_split_next = "y";
1900  }
1901  else
1902  {
1903  $enable_split_next = "n";
1904  }
1905 
1906 
1907  $paragraph_plugins = new ilParagraphPlugins();
1908  $paragraph_plugins->initialize ();
1909 
1910  if ($this->getOutputMode() == IL_PAGE_PRESENTATION)
1911  {
1912  $paragraph_plugin_string = $paragraph_plugins->serializeToString();
1913  $_SESSION ["paragraph_plugins"] = $paragraph_plugins;
1914  }
1915 
1916  $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1917 
1918  //$wb_path = "../".$this->ilias->ini->readVariable("server","webspace_dir");
1919  //echo "-".$this->sourcecode_download_script.":";
1920 
1921  if ($this->getEnabledPCTabs())
1922  {
1923  //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1924  //ilYuiUtil::initTabView();
1925  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1928  }
1929 
1930  $file_download_link = $this->determineFileDownloadLink();
1931  $fullscreen_link = $this->determineFullscreenLink();
1932  $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1933 
1934  // default values for various parameters (should be used by
1935  // all instances in the future)
1936  $media_mode = ($this->getOutputMode() == "edit")
1937  ? $ilUser->getPref("ilPageEditor_MediaMode")
1938  : "enable";
1939 
1940  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1941  $paste = (ilEditClipboard::getAction() == "copy" &&
1942  $this->getOutputMode() == "edit");
1943 
1944  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1945 
1946  $flv_video_player = ($this->getOutputMode() != "offline")
1949 
1950  // added UTF-8 encoding otherwise umlaute are converted too
1951  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
1952  $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
1953  'layout_mode' => $this->getLayoutMode() ? "y" : "n",
1954  'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1955  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1956  'img_add' => $add_path,
1957  'img_col' => $col_path,
1958  'img_row' => $row_path,
1959  'img_item' => $item_path,
1960  'enable_split_new' => $enable_split_new,
1961  'enable_split_next' => $enable_split_next,
1962  'link_params' => $this->link_params,
1963  'file_download_link' => $file_download_link,
1964  'fullscreen_link' => $fullscreen_link,
1965  'med_disabled_path' => $med_disabled_path,
1966  'img_path' => $img_path,
1967  'parent_id' => $this->obj->getParentId(),
1968  'download_script' => $this->sourcecode_download_script,
1969  'encoded_download_script' => urlencode($this->sourcecode_download_script),
1970  // digilib
1971  'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
1972  'pagebreak' => $this->lng->txt('dgl_pagebreak'),
1973  'page' => $this->lng->txt('page'),
1974  'citate_page' => $this->lng->txt('citate_page'),
1975  'citate_from' => $this->lng->txt('citate_from'),
1976  'citate_to' => $this->lng->txt('citate_to'),
1977  'citate' => $this->lng->txt('citate'),
1978  'enable_rep_objects' => $this->getEnabledRepositoryObjects() ? "y" : "n",
1979  'enable_login_page' => $this->getEnabledLoginPage() ? "y" : "n",
1980  'enable_map' => ($this->getEnabledMaps() && ilGoogleMapUtil::isActivated()) ? "y" : "n",
1981  'enable_tabs' => $this->getEnabledPCTabs() ? "y" : "n",
1982  'enable_sa_qst' => $this->getEnabledSelfAssessment() ? "y" : "n",
1983  'enable_file_list' => $this->getEnabledFileLists() ? "y" : "n",
1984  'enable_content_includes' => $this->isEnabledContentIncludes() ? "y" : "n",
1985  'paste' => $paste ? "y" : "n",
1986  'media_mode' => $media_mode,
1987  'javascript' => $sel_js_mode,
1988  'paragraph_plugins' => $paragraph_plugin_string,
1989  'disable_auto_margins' => $disable_auto_margins,
1990  'page_toc' => $this->getPageToc() ? "y" : "n",
1991  'enable_profile' => $this->getEnabledProfile() ? "y" : "n",
1992  'enable_verification' => $this->getEnabledVerification() ? "y" : "n",
1993  'enable_blog' => $this->getEnabledBlog() ? "y" : "n",
1994  'enable_skills' => $this->getEnabledSkills() ? "y" : "n",
1995  'enable_qover' => $this->getEnablePCType("QuestionOverview") ? "y" : "n",
1996  'flv_video_player' => $flv_video_player
1997  );
1998  if($this->link_frame != "") // todo other link types
1999  $params["pg_frame"] = $this->link_frame;
2000 
2001  //$content = str_replace("&nbsp;", "", $content);
2002 
2003  // this ensures that cache is emptied with every update
2004  $params["version"] = ILIAS_VERSION;
2005  // ensure no cache hit, if included files/media objects have been changed
2006  $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
2007 
2008  // run xslt
2009  $md5 = md5(serialize($params).$link_xml.$template_xml);
2010 
2011 //$a = microtime();
2012 
2013  // check cache (same parameters, non-edit mode and rendered time
2014  // > last change
2015  if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
2016  !$this->getAbstractOnly() &&
2017  $md5 == $this->obj->getRenderMd5() &&
2018  ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
2019  $this->obj->getRenderedTime() != "" &&
2020  $this->obj->old_nr == 0)
2021  {
2022  // cache hit
2023  $output = $this->obj->getRenderedContent();
2024  }
2025  else
2026  {
2027  if ($this->getLayoutMode() == true)
2028  {
2029 // $xsl = file_get_contents("./Services/COPage/xsl/page_layout.xsl");
2030  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2031  }
2032  else
2033  {
2034  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2035  }
2036 //echo htmlentities($content);
2037  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
2038  $xh = xslt_create();
2039  // echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
2040  // echo "mode:".$this->getOutputMode().":<br>";
2041  $output = xslt_process($xh, "arg:/_xml","arg:/_xsl", NULL, $args, $params);
2042 
2043  if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
2044  && !$this->getAbstractOnly()
2045  && $this->obj->old_nr == 0)
2046  {
2047 //echo "writerenderedcontent";
2048  $this->obj->writeRenderedContent($output, $md5);
2049  }
2050  //echo xslt_error($xh);
2051  xslt_free($xh);
2052  }
2053 
2054 //$b = microtime();
2055 //echo "$a - $b";
2056 //echo "<pre>".htmlentities($output)."</pre>";
2057 
2058  // unmask user html
2059  if (($this->getOutputMode() != "edit" ||
2060  $ilUser->getPref("ilPageEditor_HTMLMode") != "disable")
2061  && !$this->getPreventHTMLUnmasking())
2062  {
2063  $output = str_replace("&lt;","<",$output);
2064  $output = str_replace("&gt;",">",$output);
2065  }
2066  $output = str_replace("&amp;", "&", $output);
2067 
2068  // replace latex code: todo: finish
2069 // if ($this->getOutputMode() != "offline")
2070 // {
2071  $output = ilUtil::insertLatexImages($output);
2072 /* }
2073  else
2074  {
2075  $output = ilUtil::buildLatexImages($output,
2076  $this->getOfflineDirectory());
2077  }*/
2078 
2079  // insert page snippets
2080  $output = $this->insertContentIncludes($output);
2081 
2082  // insert resource blocks
2083  $output = $this->insertResources($output);
2084 
2085  // insert page toc
2086  if ($this->getPageToc())
2087  {
2088  $output = $this->insertPageToc($output);
2089  }
2090 
2091  // insert advanced output trigger
2092  $output = $this->insertAdvTrigger($output);
2093 
2094  // workaround for preventing template engine
2095  // from hiding paragraph text that is enclosed
2096  // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
2097  $output = $this->replaceCurlyBrackets($output);
2098 
2099  // remove all newlines (important for code / pre output)
2100  $output = str_replace("\n", "", $output);
2101 
2102  // add question HTML (always after the cache!)
2103  $qhtml = $this->getQuestionHTML();
2104  if (is_array($qhtml))
2105  {
2106  foreach ($qhtml as $k => $h)
2107  {
2108  $output = str_replace($this->pl_start."Question;il__qst_$k".$this->pl_end, " ".$h, $output);
2109  }
2110  }
2111 
2112 //echo htmlentities($output);
2113  $output = $this->postOutputProcessing($output);
2114 //echo htmlentities($output);
2115  if($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getEnabledScheduledActivation()))
2116  {
2117  $output = '<div class="il_editarea_disabled">'.$output.'</div>';
2118  }
2119 
2120  $output = $this->insertMaps($output);
2121  $output = $this->obj->insertSourceCodeParagraphs($output, $this->getOutputMode());
2122 
2123  $ilBench->stop("ContentPresentation", "ilPageObjectGUI_showPage");
2124 
2125  $output = $this->selfAssessmentRendering($output);
2126 
2127  // output
2128  if ($ilCtrl->isAsynch() && !$this->getRawPageContent() &&
2129  $this->getOutputMode() == "edit")
2130  {
2131  if ($_GET["updated_pc_id_str"] != "")
2132  {
2133  echo $_GET["updated_pc_id_str"];
2134  }
2135  $tpl->setVariable($this->getTemplateOutputVar(), $output);
2136  $tpl->setCurrentBlock("edit_page");
2137  $tpl->parseCurrentBlock();
2138  echo $tpl->get("edit_page");
2139  exit;
2140  }
2141  if ($this->outputToTemplate())
2142  {
2143  $tpl->setVariable($this->getTemplateOutputVar(), $output);
2144  $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
2145  return $output;
2146  }
2147  else
2148  {
2149  if ($this->getRawPageContent()) // e.g. needed in glossaries
2150  {
2151  return $output;
2152  }
2153  else
2154  {
2155  $tpl->setVariable($this->getTemplateOutputVar(), $output);
2156  return $tpl->get();
2157  }
2158  }
2159  }
2160 
2167  function replaceCurlyBrackets($output)
2168  {
2169 //echo "<br><br>".htmlentities($output);
2170 
2171  while (is_int($start = strpos($output, "<!--ParStart-->")) &&
2172  is_int($end = strpos($output, "<!--ParEnd-->", $start)))
2173  {
2174  $output = substr($output, 0, $start).
2175  str_replace(array("{","}"), array("&#123;","&#125;"),
2176  substr($output, $start + 15, $end - ($start + 15))).
2177  substr($output, $end + 13);
2178  }
2179 
2180 // $output = str_replace("{", "&#123;", $output);
2181 // $output = str_replace("}", "&#125;", $output);
2182 //echo "<br><br>".htmlentities($output);
2183  return $output;
2184  }
2185 
2189  protected function getActivationCaptions()
2190  {
2191  global $lng;
2192 
2193  return array("deactivatePage" => $lng->txt("cont_deactivate_page"),
2194  "activatePage" => $lng->txt("cont_activate_page"));
2195  }
2196 
2200  function addActionsMenu($a_tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode)
2201  {
2202  global $lng, $ilCtrl;
2203 
2204  // actions
2205  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2206 
2207  // activate/deactivate
2208  $list = new ilAdvancedSelectionListGUI();
2209  $list->setListTitle($lng->txt("actions"));
2210  $list->setId("copage_act");
2211  $entries = false;
2212  if ($this->getEnabledActivation())
2213  {
2214  $entries = true;
2215  $captions = $this->getActivationCaptions();
2216  if ($this->getPageObject()->getActive())
2217  {
2218  $list->addItem($captions["deactivatePage"], "",
2219  $ilCtrl->getLinkTarget($this, "deactivatePage"));
2220  }
2221  else
2222  {
2223  $list->addItem($captions["activatePage"], "",
2224  $ilCtrl->getLinkTarget($this, "activatePage"));
2225  }
2226 
2227  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2228  }
2229 
2230  // initially opened content
2231  if ($this->getPageConfig()->getUseAttachedContent())
2232  {
2233  $entries = true;
2234  $list->addItem($lng->txt("cont_initial_attached_content"), "",
2235  $ilCtrl->getLinkTarget($this, "initialOpenedContent"));
2236  }
2237 
2238  if ($entries)
2239  {
2240  $a_tpl->setVariable("PAGE_ACTIONS", $list->getHTML());
2241  }
2242 
2243  $lng->loadLanguageModule("content");
2244  $list = new ilAdvancedSelectionListGUI();
2245  $list->setListTitle($lng->txt("cont_edit_mode"));
2246  $list->setId("copage_ed_mode");
2247 
2248  // media mode
2249  if ($sel_media_mode == "enable")
2250  {
2251  $ilCtrl->setParameter($this, "media_mode", "disable");
2252  $list->addItem($lng->txt("cont_deactivate_media"), "",
2253  $ilCtrl->getLinkTarget($this, "setEditMode"));
2254  }
2255  else
2256  {
2257  $ilCtrl->setParameter($this, "media_mode", "enable");
2258  $list->addItem($lng->txt("cont_activate_media"), "",
2259  $ilCtrl->getLinkTarget($this, "setEditMode"));
2260  }
2261  $ilCtrl->setParameter($this, "media_mode", "");
2262 
2263  // html mode
2264  if (!$this->getPreventHTMLUnmasking())
2265  {
2266  if ($sel_html_mode == "enable")
2267  {
2268  $ilCtrl->setParameter($this, "html_mode", "disable");
2269  $list->addItem($lng->txt("cont_deactivate_html"), "",
2270  $ilCtrl->getLinkTarget($this, "setEditMode"));
2271  }
2272  else
2273  {
2274  $ilCtrl->setParameter($this, "html_mode", "enable");
2275  $list->addItem($lng->txt("cont_activate_html"), "",
2276  $ilCtrl->getLinkTarget($this, "setEditMode"));
2277  }
2278  }
2279  $ilCtrl->setParameter($this, "html_mode", "");
2280 
2281  // js mode
2282  if ($sel_js_mode == "enable")
2283  {
2284  $ilCtrl->setParameter($this, "js_mode", "disable");
2285  $list->addItem($lng->txt("cont_deactivate_js"), "",
2286  $ilCtrl->getLinkTarget($this, "setEditMode"));
2287  }
2288  else
2289  {
2290  $ilCtrl->setParameter($this, "js_mode", "enable");
2291  $list->addItem($lng->txt("cont_activate_js"), "",
2292  $ilCtrl->getLinkTarget($this, "setEditMode"));
2293  }
2294  $ilCtrl->setParameter($this, "js_mode", "");
2295 
2296  $a_tpl->setVariable("EDIT_MODE", $list->getHTML());
2297  }
2298 
2302  function setEditMode()
2303  {
2304  global $ilCtrl, $ilUser;
2305 
2306  if ($_GET["media_mode"] != "")
2307  {
2308  if ($_GET["media_mode"] == "disable")
2309  {
2310  $ilUser->writePref("ilPageEditor_MediaMode", "disable");
2311  }
2312  else
2313  {
2314  $ilUser->writePref("ilPageEditor_MediaMode", "");
2315  }
2316  }
2317  if ($_GET["html_mode"] != "")
2318  {
2319  if ($_GET["html_mode"] == "disable")
2320  {
2321  $ilUser->writePref("ilPageEditor_HTMLMode", "disable");
2322  }
2323  else
2324  {
2325  $ilUser->writePref("ilPageEditor_HTMLMode", "");
2326  }
2327  }
2328  if ($_GET["js_mode"] != "")
2329  {
2330  if ($_GET["js_mode"] == "disable")
2331  {
2332  $ilUser->writePref("ilPageEditor_JavaScript", "disable");
2333  }
2334  else
2335  {
2336  $ilUser->writePref("ilPageEditor_JavaScript", "");
2337  }
2338  }
2339 
2340  $ilCtrl->redirect($this, "edit");
2341  }
2342 
2343 
2347  static function getTinyMenu($a_par_type,
2348  $a_int_links = false, $a_wiki_links = false, $a_keywords = false,
2349  $a_style_id = 0, $a_paragraph_styles = true, $a_save_return = true,
2350  $a_anchors = false)
2351  {
2352  global $lng;
2353 
2354  $mathJaxSetting = new ilSetting("MathJax");
2355 
2356  include_once("./Services/COPage/classes/class.ilPageEditorSettings.php");
2357 
2358  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2359 
2360  $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2361 
2362  // debug ghost element
2363  if (DEVMODE == 1)
2364  {
2365  $btpl->touchBlock("debug_ghost");
2366  }
2367 
2368  // paste from word
2369  $btpl->setCurrentBlock("pword_button");
2370  $btpl->setVariable("IMG_PWORD", ilUtil::img(ilUtil::getImagePath("tn_pword.png"),
2371  "", 20, 20));
2372  $btpl->parseCurrentBlock();
2373  ilTooltipGUI::addTooltip("il_edm_pword",
2374  $lng->txt("cont_pword"),
2375  "iltinymenu_bd");
2376 
2377  // bullet list
2378  $btpl->setCurrentBlock("blist_button");
2379  $btpl->setVariable("IMG_BLIST", ilUtil::img(ilUtil::getImagePath("tn_blist.png"),
2380  "", 20, 20));
2381  $btpl->parseCurrentBlock();
2382  ilTooltipGUI::addTooltip("il_edm_blist",
2383  $lng->txt("cont_blist"),
2384  "iltinymenu_bd");
2385 
2386  // numbered list
2387  $btpl->setCurrentBlock("nlist_button");
2388  $btpl->setVariable("IMG_NLIST", ilUtil::img(ilUtil::getImagePath("tn_nlist.png"),
2389  "", 20, 20));
2390  $btpl->parseCurrentBlock();
2391  ilTooltipGUI::addTooltip("il_edm_nlist",
2392  $lng->txt("cont_nlist"),
2393  "iltinymenu_bd");
2394 
2395  // list indent
2396  $btpl->setCurrentBlock("list_indent");
2397  $btpl->setVariable("IMG_LIST_INDENT", ilUtil::img(ilUtil::getImagePath("tn_indent.png"),
2398  "", 20, 20));
2399  $btpl->parseCurrentBlock();
2400  ilTooltipGUI::addTooltip("ilIndentBut",
2401  $lng->txt("cont_list_indent"),
2402  "iltinymenu_bd");
2403 
2404 
2405  // list outdent
2406  $btpl->setCurrentBlock("list_outdent");
2407  $btpl->setVariable("IMG_LIST_OUTDENT", ilUtil::img(ilUtil::getImagePath("tn_outdent.png"),
2408  "", 20, 20));
2409  $btpl->parseCurrentBlock();
2410  ilTooltipGUI::addTooltip("ilOutdentBut",
2411  $lng->txt("cont_list_outdent"),
2412  "iltinymenu_bd");
2413 
2414  if ($a_int_links)
2415  {
2416  $btpl->touchBlock("bb_ilink_button");
2417  ilTooltipGUI::addTooltip("iosEditInternalLinkTrigger", $lng->txt("cont_link_to_internal"),
2418  "iltinymenu_bd");
2419  }
2420  ilTooltipGUI::addTooltip("il_edm_xlink", $lng->txt("cont_link_to_external"),
2421  "iltinymenu_bd");
2422 
2423  // remove format
2424  $btpl->setCurrentBlock("rformat_button");
2425  $btpl->setVariable("IMG_RFORMAT", ilUtil::img(ilUtil::getImagePath("tn_rformat.png"),
2426  "", 20, 20));
2427  $btpl->parseCurrentBlock();
2428  ilTooltipGUI::addTooltip("il_edm_rformat", $lng->txt("cont_remove_format"),
2429  "iltinymenu_bd");
2430 
2431  if ($a_paragraph_styles)
2432  {
2433  // new paragraph
2434  $btpl->setCurrentBlock("new_par");
2435  $btpl->setVariable("IMG_NEWPAR", "+");
2436  $btpl->parseCurrentBlock();
2437  ilTooltipGUI::addTooltip("il_edm_newpar", $lng->txt("cont_insert_new_paragraph"),
2438  "iltinymenu_bd");
2439 
2440  $btpl->setCurrentBlock("par_edit");
2441  $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2442  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2443  $btpl->setVariable("STYLE_SELECTOR", ilPCParagraphGUI::getStyleSelector($a_selected,
2444  ilPCParagraphGUI::_getCharacteristics($a_style_id), true));
2445 
2446  ilTooltipGUI::addTooltip("ilAdvSelListAnchorText_style_selection",
2447  $lng->txt("cont_paragraph_styles"), "iltinymenu_bd");
2448 
2449  $btpl->parseCurrentBlock();
2450  }
2451 
2452  if ($a_keywords)
2453  {
2454  $btpl->setCurrentBlock("bb_kw_button");
2455  $btpl->setVariable("CC_KW", "kw");
2456  $btpl->parseCurrentBlock();
2457  ilTooltipGUI::addTooltip("il_edm_kw", $lng->txt("cont_text_keyword"),
2458  "iltinymenu_bd");
2459 
2460  }
2461 
2462  if ($a_wiki_links)
2463  {
2464  $btpl->setCurrentBlock("bb_wikilink_button");
2465  $btpl->setVariable("TXT_WLN2", $lng->txt("obj_wiki"));
2466  $btpl->parseCurrentBlock();
2467  ilTooltipGUI::addTooltip("il_edm_wlink", $lng->txt("cont_link_to_wiki"),
2468  "iltinymenu_bd");
2469  }
2470 
2471  $aset = new ilSetting("adve");
2472 
2473  include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
2474  foreach (ilPageContentGUI::_getCommonBBButtons() as $c => $st)
2475  {
2476  // these are handled via drop down now...
2477  if (in_array($c, array("com", "quot", "acc", "code")))
2478  {
2479  continue;
2480  }
2482  $a_par_type, "active_".$c, true))
2483  {
2484  $cc_code = $c;
2485  if ($aset->get("use_physical"))
2486  {
2487  $cc_code = str_replace(array("str", "emp", "imp"), array("B", "I", "U"), $cc_code);
2488  }
2489 
2490  if ($c != "tex" || $mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2491  {
2492  $btpl->setCurrentBlock("bb_".$c."_button");
2493  $btpl->setVariable("CC_".strtoupper($c), $cc_code);
2494  $btpl->parseCurrentBlock();
2495  ilTooltipGUI::addTooltip("il_edm_cc_".$c,
2496  $lng->txt("cont_cc_".$c),
2497  "iltinymenu_bd");
2498 
2499 // $btpl->setVariable("TXT_".strtoupper($c), $this->lng->txt("cont_text_".$c));
2500  }
2501  }
2502  }
2503 
2504  if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX"))
2505  {
2506  ilTooltipGUI::addTooltip("il_edm_tex", $lng->txt("cont_tex"),
2507  "iltinymenu_bd");
2508  }
2509  ilTooltipGUI::addTooltip("il_edm_fn", $lng->txt("cont_fn"),
2510  "iltinymenu_bd");
2511 
2512  if ($a_save_return)
2513  {
2514  $btpl->setCurrentBlock("save_return");
2515  $btpl->setVariable("TXT_SAVE_RETURN", $lng->txt("save_return"));
2516  $btpl->parseCurrentBlock();
2517  }
2518 
2519  if ($a_anchors)
2520  {
2521  $btpl->setCurrentBlock("bb_anc_button");
2522  $btpl->setVariable("CC_ANC", "anc");
2523  $btpl->parseCurrentBlock();
2524  ilTooltipGUI::addTooltip("il_edm_anc", $lng->txt("cont_anchor"),
2525  "iltinymenu_bd");
2526  }
2527 
2528 /* // footnote
2529  $btpl->setVariable("TXT_ILN", $this->lng->txt("cont_text_iln"));
2530  $btpl->setVariable("TXT_BB_TIP", $this->lng->txt("cont_bb_tip"));
2531  $btpl->setVariable("TXT_WLN", $lng->txt("wiki_wiki_page"));
2532 */
2533 // $btpl->setVariable("PAR_TA_NAME", $a_ta_name);
2534 
2535  $btpl->setVariable("TXT_SAVE", $lng->txt("save"));
2536  $btpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
2537 
2538  $btpl->setVariable("TXT_CHAR_FORMAT", $lng->txt("cont_char_format"));
2539  $btpl->setVariable("TXT_LISTS", $lng->txt("cont_lists"));
2540  $btpl->setVariable("TXT_LINKS", $lng->txt("cont_links"));
2541  $btpl->setVariable("TXT_MORE_FUNCTIONS", $lng->txt("cont_more_functions"));
2542  $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2543 
2544  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2545  $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type));
2546  ilTooltipGUI::addTooltip("ilAdvSelListAnchorElement_char_style_selection",
2547  $lng->txt("cont_more_character_styles"), "iltinymenu_bd");
2548 
2549  return $btpl->get();
2550  }
2551 
2556  {
2557  global $ilCtrl;
2558 
2559  $int_links = $this->getPageObject()->getInternalLinks();
2560 //var_dump($int_links);
2561  $link_info = "<IntLinkInfos>";
2562  $targetframe = "None";
2563  foreach ($int_links as $int_link)
2564  {
2565  $target = $int_link["Target"];
2566  if (substr($target, 0, 4) == "il__")
2567  {
2568  $target_arr = explode("_", $target);
2569  $target_id = $target_arr[count($target_arr) - 1];
2570  $type = $int_link["Type"];
2571 
2572  $targetframe = ($int_link["TargetFrame"] != "")
2573  ? $int_link["TargetFrame"]
2574  : "None";
2575 
2576  $ltarget="_top";
2577  if ($targetframe != "None")
2578  {
2579  $ltarget="_blank";
2580  }
2581 
2582  // anchor
2583  $anc = $anc_add = "";
2584  if ($int_link["Anchor"] != "")
2585  {
2586  $anc = $int_link["Anchor"];
2587  $anc_add = "_".rawurlencode($int_link["Anchor"]);
2588  }
2589 
2590  $href = "";
2591  switch($type)
2592  {
2593  case "PageObject":
2594  case "StructureObject":
2596  if ($type == "PageObject")
2597  {
2598  $href = "./goto.php?target=pg_".$target_id.$anc_add;
2599  }
2600  else
2601  {
2602  $href = "./goto.php?target=st_".$target_id;
2603  }
2604  break;
2605 
2606  case "GlossaryItem":
2607  if ($targetframe == "None")
2608  {
2609  $targetframe = "Glossary";
2610  }
2611  $href = "./goto.php?target=git_".$target_id;
2612  break;
2613 
2614  case "MediaObject":
2615  $ilCtrl->setParameter($this, "mob_id", $target_id);
2616  //$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
2617  $href = $ilCtrl->getLinkTarget($this, "displayMedia");
2618  $ilCtrl->setParameter($this, "mob_id", "");
2619  break;
2620 
2621  case "RepositoryItem":
2622  $obj_type = ilObject::_lookupType($target_id, true);
2624  $href = "./goto.php?target=".$obj_type."_".$target_id;
2625  break;
2626 
2627 
2628  }
2629  $anc_par = 'Anchor="'.$anc.'"';
2630  $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".$anc_par." ".
2631  "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
2632  }
2633  }
2634  $link_info.= "</IntLinkInfos>";
2635  $this->setLinkXML($link_info);
2636  }
2637 
2641  function downloadFile()
2642  {
2643  $this->obj->buildDom();
2644  $files = $this->obj->collectFileItems();
2645 
2646  $file = explode("_", $_GET["file_id"]);
2647  require_once("./Modules/File/classes/class.ilObjFile.php");
2648  $file_id = $file[count($file) - 1];
2649 
2650  // file must be in page
2651  if (!in_array($file_id, $files))
2652  {
2653  exit;
2654  }
2655  $fileObj =& new ilObjFile($file_id, false);
2656  $fileObj->sendFile();
2657  exit;
2658  }
2659 
2664  {
2665  $this->displayMedia(true);
2666  }
2667 
2671  function displayMedia($a_fullscreen = false)
2672  {
2673  $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2674  $tpl->setCurrentBlock("ilMedia");
2675 
2676  //$int_links = $page_object->getInternalLinks();
2677  $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2678 
2679  // @todo
2680  //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2681 
2682  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2683  $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2684  require_once("./Services/COPage/classes/class.ilPageObject.php");
2685  $pg_obj = $this->getPageObject();
2686  $pg_obj->buildDom();
2687 
2688  if (!empty ($_GET["pg_id"]))
2689  {
2690  $xml = "<dummy>";
2691  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2692  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2693  $xml.= $link_xml;
2694  $xml.="</dummy>";
2695  }
2696  else
2697  {
2698  $xml = "<dummy>";
2699  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2700  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2701  $xml.= $link_xml;
2702  $xml.="</dummy>";
2703  }
2704 
2705  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2706  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2707  $xh = xslt_create();
2708 
2709  $mode = "media";
2710  if ($a_fullscreen)
2711  {
2712  $mode = "fullscreen";
2713  }
2714 
2715 //echo "<b>XML:</b>".htmlentities($xml);
2716  // determine target frames for internal links
2717  $wb_path = ilUtil::getWebspaceDir("output")."/";
2718  $enlarge_path = ilUtil::getImagePath("enlarge.png");
2719  $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
2720  'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => "",
2721  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2722  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
2723 //echo "<br><br>".htmlentities($output);
2724  //echo xslt_error($xh);
2725  xslt_free($xh);
2726 
2727  // unmask user html
2728  $tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2730  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2731  $tpl->setVariable("MEDIA_CONTENT", $output);
2732  echo $tpl->get();
2733  exit;
2734  }
2735 
2740  {
2741  $pg_obj = $this->getPageObject();
2742  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2743  }
2744 
2748  function insertMaps($a_html)
2749  {
2750  $c_pos = 0;
2751  $start = strpos($a_html, "[[[[[Map;");
2752  if (is_int($start))
2753  {
2754  $end = strpos($a_html, "]]]]]", $start);
2755  }
2756  $i = 1;
2757  while ($end > 0)
2758  {
2759  $param = substr($a_html, $start + 9, $end - $start - 9);
2760 
2761  $param = explode(";", $param);
2762  if (is_numeric($param[0]) && is_numeric($param[1]) && is_numeric($param[2]))
2763  {
2764  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php");
2765  $map_gui = new ilGoogleMapGUI();
2766  $map_gui->setMapId("map_".$i);
2767  $map_gui->setLatitude($param[0]);
2768  $map_gui->setLongitude($param[1]);
2769  $map_gui->setZoom($param[2]);
2770  $map_gui->setWidth($param[3]."px");
2771  $map_gui->setHeight($param[4]."px");
2772  $map_gui->setEnableTypeControl(true);
2773  $map_gui->setEnableNavigationControl(true);
2774  $map_gui->setEnableCentralMarker(true);
2775  $h2 = substr($a_html, 0, $start).
2776  $map_gui->getHtml().
2777  substr($a_html, $end + 5);
2778  $a_html = $h2;
2779  $i++;
2780  }
2781  $start = strpos($a_html, "[[[[[Map;", $start + 5);
2782  $end = 0;
2783  if (is_int($start))
2784  {
2785  $end = strpos($a_html, "]]]]]", $start);
2786  }
2787  }
2788 
2789  return $a_html;
2790  }
2791 
2795  function insertContentIncludes($a_html)
2796  {
2797  global $ilCtrl, $lng;
2798 
2799  $c_pos = 0;
2800  $start = strpos($a_html, "{{{{{ContentInclude;");
2801  if (is_int($start))
2802  {
2803  $end = strpos($a_html, "}}}}}", $start);
2804  }
2805  $i = 1;
2806  while ($end > 0)
2807  {
2808  $param = substr($a_html, $start + 20, $end - $start - 20);
2809  $param = explode(";", $param);
2810 
2811  if ($param[0] == "mep" && is_numeric($param[1]) && $param[2] <= 0)
2812  {
2813  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPageGUI.php");
2814 
2815  if (ilMediaPoolPage::_exists($param[1]))
2816  {
2817  $page_gui = new ilMediaPoolPageGUI($param[1], 0, true);
2818  if ($this->getOutputMode() != "offline")
2819  {
2820  $page_gui->setFileDownloadLink($this->determineFileDownloadLink());
2821  $page_gui->setFullscreenLink($this->determineFullscreenLink());
2822  $page_gui->setSourceCodeDownloadScript($this->determineSourcecodeDownloadScript());
2823  }
2824  else
2825  {
2826  $page_gui->setOutputMode(IL_PAGE_OFFLINE);
2827  }
2828 
2829  $html = $page_gui->getRawContent();
2830  }
2831  else
2832  {
2833  if ($this->getOutputMode() == "edit")
2834  {
2835  $html = "// ".$lng->txt("cont_missing_snippet")." //";
2836  }
2837  }
2838  $h2 = substr($a_html, 0, $start).
2839  $html.
2840  substr($a_html, $end + 5);
2841  $a_html = $h2;
2842  $i++;
2843  }
2844  $start = strpos($a_html, "{{{{{ContentInclude;", $start + 5);
2845  $end = 0;
2846  if (is_int($start))
2847  {
2848  $end = strpos($a_html, "}}}}}", $start);
2849  }
2850  }
2851  return $a_html;
2852  }
2853 
2860  function insertPageToc($a_output)
2861  {
2862  global $lng;
2863 
2864  include_once("./Services/Utilities/classes/class.ilStr.php");
2865 
2866  // extract all headings
2867  $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2868  $page_heads = array();
2869  foreach ($offsets as $os)
2870  {
2871  $level = (int) substr($a_output, $os + 10, 1);
2872  if (in_array($level, array(1,2,3)))
2873  {
2874  $anchor = str_replace("TocH", "TocA",
2875  substr($a_output, $os, strpos($a_output, "<", $os) - $os - 3)
2876  );
2877 
2878  // get heading
2879  $tag_start = stripos($a_output, "<h".$level." ", $os);
2880  $tag_end = stripos($a_output, "</h".$level.">", $tag_start);
2881  $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2882 
2883  // get headings text
2884  $text_start = stripos($head, ">") + 1;
2885  $text_end = strripos($head, "<!--", $text_start);
2886  $text = substr($head, $text_start, $text_end - $text_start);
2887  $page_heads[] = array("level" => $level, "text" => $text,
2888  "anchor" => $anchor);
2889  }
2890  }
2891 
2892  if (count($page_heads) > 1)
2893  {
2894  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2895  $list = new ilNestedList();
2896  $list->setAutoNumbering(true);
2897  $list->setListClass("ilc_page_toc_PageTOCList");
2898  $list->setItemClass("ilc_page_toc_PageTOCItem");
2899  $i = 0;
2900  $c_depth = 1;
2901  $c_par[1] = 0;
2902  $c_par[2] = 0;
2903  $nr[1] = 1;
2904  $nr[2] = 1;
2905  $nr[3] = 1;
2906  foreach ($page_heads as $ind => $h)
2907  {
2908  $i++;
2909  $par = 0;
2910 
2911  // check if we have a parent for one level up
2912  $par = 0;
2913  if ($h["level"] == 2 && $c_par[1] > 0)
2914  {
2915  $par = $c_par[1];
2916  }
2917  if ($h["level"] == 3 && $c_par[2] > 0)
2918  {
2919  $par = $c_par[2];
2920  }
2921 
2922  $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2923 
2924  // add the list node
2925  $list->addListNode(
2926  "<a href='#".$h["anchor"]."' class='ilc_page_toc_PageTOCLink'>".$h["text"]."</a>",
2927  $i, $par);
2928 
2929  // set the node as current parent of the level
2930  if ($h["level"] == 1)
2931  {
2932  $c_par[1] = $i;
2933  $c_par[2] = 0;
2934  }
2935  if ($h["level"] == 2)
2936  {
2937  $c_par[2] = $i;
2938  }
2939  }
2940 
2941  $tpl = new ilTemplate("tpl.page_toc.html", true, true,
2942  "Services/COPage");
2943  $tpl->setVariable("PAGE_TOC", $list->getHTML());
2944  $tpl->setVariable("TXT_PAGE_TOC", $lng->txt("cont_page_toc"));
2945  $tpl->setVariable("TXT_HIDE", $lng->txt("hide"));
2946  $tpl->setVariable("TXT_SHOW", $lng->txt("show"));
2947 
2948  $a_output = str_replace("{{{{{PageTOC}}}}}",
2949  $tpl->get(), $a_output);
2950  $numbers = $list->getNumbers();
2951 
2952  if (count($numbers) > 0)
2953  {
2954  include_once("./Services/Utilities/classes/class.ilStr.php");
2955  foreach ($numbers as $n)
2956  {
2957  $a_output =
2958  ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n." ", $a_output);
2959  }
2960  }
2961  }
2962  else
2963  {
2964  $a_output = str_replace("{{{{{PageTOC}}}}}",
2965  "", $a_output);
2966  }
2967 
2968  return $a_output;
2969  }
2970 
2977  function insertResources($a_output)
2978  {
2979  // this is edit mode only
2980 
2981  if ($this->getEnablePCType("Resources") &&
2982  ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview"))
2983  {
2984  include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2985  $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2986  }
2987  return $a_output;
2988  }
2989 
2990 
2991 
2998  function insertAdvTrigger($a_output)
2999  {
3000  global $lng;
3001 
3002  if (!$this->getAbstractOnly())
3003  {
3004  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
3005  $lng->txt("cont_show_adv"), $a_output);
3006  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
3007  $lng->txt("cont_hide_adv"), $a_output);
3008  }
3009  else
3010  {
3011  $a_output = str_replace("{{{{{LV_show_adv}}}}}",
3012  "", $a_output);
3013  $a_output = str_replace("{{{{{LV_hide_adv}}}}}",
3014  "", $a_output);
3015  }
3016 
3017  return $a_output;
3018  }
3019 
3020 
3025  function postOutputProcessing($a_output)
3026  {
3027  return $a_output;
3028  }
3029 
3033  function insertHelp($a_tpl)
3034  {
3035  global $lng;
3036 
3037  $a_tpl->setCurrentBlock("help_img");
3038  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.png"));
3039  $a_tpl->parseCurrentBlock();
3040  $a_tpl->setCurrentBlock("help_item");
3041  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_add_elements"));
3042  $a_tpl->parseCurrentBlock();
3043 
3044  $a_tpl->setCurrentBlock("help_img");
3045  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
3046  $a_tpl->parseCurrentBlock();
3047  $a_tpl->setCurrentBlock("help_img");
3048  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("drop_streaked_area.png"));
3049  $a_tpl->parseCurrentBlock();
3050  $a_tpl->setCurrentBlock("help_item");
3051  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_drag_and_drop_elements"));
3052  $a_tpl->parseCurrentBlock();
3053 
3054  $a_tpl->setCurrentBlock("help_img");
3055  $a_tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
3056  $a_tpl->parseCurrentBlock();
3057  $a_tpl->setCurrentBlock("help_item");
3058  $a_tpl->setVariable("TXT_HELP", $lng->txt("cont_double_click_to_delete"));
3059  $a_tpl->parseCurrentBlock();
3060 
3061  $a_tpl->setCurrentBlock("help");
3062  $a_tpl->parseCurrentBlock();
3063  }
3064 
3065  /*
3066  * preview
3067  */
3068  function preview()
3069  {
3070  global $tree;
3072  return $this->showPage();
3073  }
3074 
3078  function edit()
3079  {
3080  global $tree, $lng, $ilCtrl, $ilSetting, $ilUser;
3081 
3082  if (!$this->getEnableEditing())
3083  {
3084  ilUtil::sendFailure($lng->txt("permission_denied"), true);
3085  $ilCtrl->redirect($this, "preview");
3086  }
3087 
3088  include_once("./Services/Captcha/classes/class.ilCaptchaUtil.php");
3089  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3091  !$ilUser->isCaptchaVerified())
3092  {
3093  $form = $this->initCaptchaForm();
3094  if ($_POST["captcha_code"] && $form->checkInput())
3095  {
3096  $ilUser->setCaptchaVerified(true);
3097  }
3098  else
3099  {
3100  return $form->getHTML();
3101  }
3102  }
3103 
3104  $this->setOutputMode(IL_PAGE_EDIT);
3105 
3106  $html = $this->showPage();
3107 
3108  if ($this->isEnabledNotes())
3109  {
3110  $html.= "<br /><br />".$this->getNotesHTML();
3111  }
3112 
3113  return $html;
3114  }
3115 
3123  {
3124  global $tpl;
3125 
3126 // 'pl_hier_id' => string '2_1_1_1' (length=7)
3127 // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
3128  $html = $this->edit();
3129 
3130  $tpl->addOnLoadCode("ilCOPage.insertJSAtPlaceholder('".
3131  $_GET["pl_hier_id"].":".$_GET["pl_pc_id"].
3132  "');", 3);
3133 
3134  return $html;
3135  }
3136 
3140  public function initCaptchaForm()
3141  {
3142  global $lng, $ilCtrl;
3143 
3144  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3145  $form = new ilPropertyFormGUI();
3146 
3147  // captcha code
3148  include_once("./Services/Captcha/classes/class.ilCaptchaInputGUI.php");
3149  $ci = new ilCaptchaInputGUI($lng->txt("cont_captcha_code"), "captcha_code");
3150  $ci->setRequired(true);
3151  $form->addItem($ci);
3152 
3153  $form->addCommandButton("edit", $lng->txt("ok"));
3154 
3155  $form->setTitle($lng->txt("cont_captcha_verification"));
3156  $form->setFormAction($ilCtrl->getFormAction($this));
3157 
3158  return $form;
3159  }
3160 
3161  /*
3162  * presentation
3163  */
3165  {
3166  global $tree;
3167  $this->setOutputMode($a_mode);
3168 
3169  return $this->showPage();
3170  }
3171 
3172  function getHTML()
3173  {
3174  $this->getTabs("preview");
3175  return $this->showPage();
3176  }
3177 
3181  function showMediaFullscreen($a_style_id = 0)
3182  {
3183  $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
3184  $this->tpl->setCurrentBlock("ContentStyle");
3185  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
3186  $this->tpl->parseCurrentBlock();
3187 
3188  $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
3189  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3190  $this->tpl->setCurrentBlock("ilMedia");
3191 
3192  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3193  $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
3194  if (!empty ($_GET["pg_id"]))
3195  {
3196  require_once("./Services/COPage/classes/class.ilPageObject.php");
3197  $pg_obj =& new ilPageObject($this->obj->getParentType(), $_GET["pg_id"]);
3198  $pg_obj->buildDom();
3199 
3200  $xml = "<dummy>";
3201  // todo: we get always the first alias now (problem if mob is used multiple
3202  // times in page)
3203  $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
3204  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3205  $xml.="</dummy>";
3206  }
3207  else
3208  {
3209  $xml = "<dummy>";
3210  $xml.= $media_obj->getXML(IL_MODE_ALIAS);
3211  $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
3212  $xml.="</dummy>";
3213  }
3214 
3215 //echo htmlentities($xml); exit;
3216 
3217  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
3218  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
3219  $xh = xslt_create();
3220 
3221 //echo "<b>XML:</b>".htmlentities($xml);
3222  // determine target frames for internal links
3223  //$pg_frame = $_GET["frame"];
3224  $wb_path = ilUtil::getWebspaceDir("output")."/";
3225 // $wb_path = "../".$this->ilias->ini->readVariable("server","webspace_dir");
3226  $mode = "fullscreen";
3227  $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
3228  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
3229  echo xslt_error($xh);
3230  xslt_free($xh);
3231 
3232  // unmask user html
3233  $this->tpl->setVariable("MEDIA_CONTENT", $output);
3234  }
3235 
3241  function displayValidationError($a_error)
3242  {
3243  if(is_array($a_error))
3244  {
3245  $error_str = "<b>Validation Error(s):</b><br>";
3246  foreach ($a_error as $error)
3247  {
3248  $err_mess = implode($error, " - ");
3249  if (!is_int(strpos($err_mess, ":0:")))
3250  {
3251  $error_str .= htmlentities($err_mess)."<br />";
3252  }
3253  }
3254  $this->tpl->setVariable("MESSAGE", $error_str);
3255  }
3256  }
3257 
3261  function history()
3262  {
3263  global $tpl, $lng, $ilAccess;
3264 
3265  if (!$this->getEnableEditing())
3266  {
3267  return;
3268  }
3269 
3270  $tpl->addJavaScript("./Services/COPage/js/page_history.js");
3271 
3272  include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
3273  $table_gui = new ilPageHistoryTableGUI($this, "history");
3274  $table_gui->setId("hist_table");
3275  $entries = $this->getPageObject()->getHistoryEntries();
3276  $entries[] = array('page_id' => $this->getPageObject()->getId(),
3277  'parent_type' => $this->getPageObject()->getParentType(),
3278  'hdate' => $this->getPageObject()->getLastChange(),
3279  'parent_id' => $this->getPageObject()->getParentId(),
3280  'nr' => 0,
3281  'sortkey' => 999999,
3282  'user' => $this->getPageObject()->last_change_user);
3283  $table_gui->setData($entries);
3284  return $table_gui->getHTML();
3285  }
3286 
3291  {
3292  global $tpl, $lng, $ilAccess, $ilCtrl;
3293 
3294  if (!$this->getEnableEditing())
3295  {
3296  return;
3297  }
3298 
3299  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3300  $c_gui = new ilConfirmationGUI();
3301 
3302  // set confirm/cancel commands
3303  $ilCtrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3304  $c_gui->setFormAction($ilCtrl->getFormAction($this, "rollback"));
3305  $c_gui->setHeaderText($lng->txt("cont_rollback_confirmation"));
3306  $c_gui->setCancel($lng->txt("cancel"), "history");
3307  $c_gui->setConfirm($lng->txt("confirm"), "rollback");
3308 
3309  $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3310 
3311  $c_gui->addItem("id[]", $_GET["old_nr"],
3313 
3314  $tpl->setContent($c_gui->getHTML());
3315  }
3316 
3320  function rollback()
3321  {
3322  global $ilCtrl;
3323 
3324  if (!$this->getEnableEditing())
3325  {
3326  return;
3327  }
3328 
3329  $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3330 
3331  if ($hentry["content"] != "")
3332  {
3333  $this->obj->setXMLContent($hentry["content"]);
3334  $this->obj->buildDom(true);
3335  if ($this->obj->update())
3336  {
3337  $ilCtrl->redirect($this, "history");
3338  }
3339  }
3340  $ilCtrl->redirect($this, "history");
3341  }
3342 
3350  {
3351  global $ilHelp;
3352 
3353  $ilHelp->setScreenIdComponent("copg");
3354  }
3355 
3361  function getTabs($a_activate = "")
3362  {
3363  global $ilTabs, $ilCtrl, $ilUser;
3364 
3365  $this->setScreenIdComponent();
3366 
3367  if (!$this->getEnabledTabs())
3368  {
3369  return;
3370  }
3371 
3372 //echo "-".$ilCtrl->getNextClass()."-".$ilCtrl->getCmd()."-";
3373  // back to upper context
3374 
3375  if (!$this->getEditPreview())
3376  {
3377  $ilTabs->addTarget("pg", $ilCtrl->getLinkTarget($this, "preview")
3378  , array("", "preview"));
3379 
3380  if ($this->getEnableEditing())
3381  {
3382  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3383  , array("", "edit"));
3384  }
3385  }
3386  else
3387  {
3388  if ($this->getEnableEditing())
3389  {
3390  $ilTabs->addTarget("edit", $ilCtrl->getLinkTarget($this, "edit")
3391  , array("", "edit"));
3392  }
3393 
3394  $ilTabs->addTarget("cont_preview", $ilCtrl->getLinkTarget($this, "preview")
3395  , array("", "preview"));
3396  }
3397 
3398  //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3399  // , "properties", get_class($this));
3400 
3401  if ($this->use_meta_data && !$this->layout_mode)
3402  {
3403  $ilTabs->addTarget("meta_data",
3404  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
3405  "", "ilmdeditorgui");
3406  }
3407 
3408  $lm_set = new ilSetting("lm");
3409 
3410  if ($this->getEnableEditing() && !$this->layout_mode &&
3411  $lm_set->get("page_history", 1))
3412  {
3413  $ilTabs->addTarget("history", $this->ctrl->getLinkTarget($this, "history")
3414  , "history", get_class($this));
3415  }
3416 
3417 /* $tabs = $this->ctrl->getTabs();
3418  foreach ($tabs as $tab)
3419  {
3420  $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3421  , $tab["cmd"], $tab["class"]);
3422  }
3423 */
3424  if ($this->getEnableEditing() && $ilUser->getId() != ANONYMOUS_USER_ID)
3425  {
3426  $ilTabs->addTarget("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
3427  , "view", "ilEditClipboardGUI");
3428  }
3429 
3430  if ($this->getEnabledScheduledActivation())
3431  {
3432  $ilTabs->addTarget("cont_activation", $this->ctrl->getLinkTarget($this, "editActivation"),
3433  "editActivation", get_class($this));
3434  }
3435 
3436  if ($this->getEnabledNews())
3437  {
3438  $ilTabs->addTarget("news",
3439  $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3440  "", "ilnewsitemgui");
3441  }
3442 
3443  // external hook to add tabs
3444  if (is_array($this->tab_hook))
3445  {
3446  $func = $this->tab_hook["func"];
3447  $this->tab_hook["obj"]->$func();
3448  }
3449  //$ilTabs->setTabActive("pg");
3450  }
3451 
3455  function compareVersion()
3456  {
3457  global $lng;
3458 
3459  if (!$this->getEnableEditing())
3460  {
3461  return;
3462  }
3463 
3464  $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3465  $compare = $this->obj->compareVersion($_POST["left"], $_POST["right"]);
3466 
3467  // left page
3468  $lpage = $compare["l_page"];
3469  $lpage_gui = new ilPageObjectGUI("wpg");
3470  $lpage_gui->setOutputMode(IL_PAGE_PREVIEW);
3471  $lpage_gui->setPageObject($lpage);
3472  $lpage_gui->setPreventHTMLUnmasking(true);
3473  $lpage_gui->setPresentationTitle($this->getPresentationTitle());
3474  $lpage_gui->setCompareMode(true);
3475  $lhtml = $lpage_gui->showPage();
3476  $lhtml = $this->replaceDiffTags($lhtml);
3477  $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3478  $tpl->setVariable("LEFT", $lhtml);
3479 
3480  // right page
3481  $rpage = $compare["r_page"];
3482  $rpage_gui = new ilPageObjectGUI("wpg");
3483  $rpage_gui->setOutputMode(IL_PAGE_PREVIEW);
3484  $rpage_gui->setPageObject($rpage);
3485  $rpage_gui->setPreventHTMLUnmasking(true);
3486  $rpage_gui->setPresentationTitle($this->getPresentationTitle());
3487  $rpage_gui->setCompareMode(true);
3488  $rhtml = $rpage_gui->showPage();
3489  $rhtml = $this->replaceDiffTags($rhtml);
3490  $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3491  $tpl->setVariable("RIGHT", $rhtml);
3492 
3493  $tpl->setVariable("TXT_NEW", $lng->txt("cont_pc_new"));
3494  $tpl->setVariable("TXT_MODIFIED", $lng->txt("cont_pc_modified"));
3495  $tpl->setVariable("TXT_DELETED", $lng->txt("cont_pc_deleted"));
3496 
3497 //var_dump($left);
3498 //var_dump($right);
3499 
3500  return $tpl->get();
3501  }
3502 
3503  function replaceDiffTags($a_html)
3504  {
3505  $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3506  $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3507  $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3508  $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3509 
3510  return $a_html;
3511  }
3512 
3516  function editActivation()
3517  {
3518  global $ilCtrl, $lng, $tpl;
3519 
3520  $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3521  $this->initActivationForm();
3522  $this->getActivationFormValues();
3523  $atpl->setVariable("FORM", $this->form->getHTML());
3524  $atpl->setCurrentBlock("updater");
3525  $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3526  $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3527  $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3528  $atpl->parseCurrentBlock();
3529  $tpl->setContent($atpl->get());
3530  }
3531 
3536  {
3537  global $ilCtrl, $lng;
3538 
3539  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3540  $this->form = new ilPropertyFormGUI();
3541  $this->form->setFormAction($ilCtrl->getFormAction($this));
3542  $this->form->setTitle($lng->txt("cont_page_activation"));
3543 
3544  // activation type radio
3545  $rad = new ilRadioGroupInputGUI($lng->txt("cont_activation"), "activation");
3546  $rad_op1 = new ilRadioOption($lng->txt("cont_activated"), "activated");
3547 
3548  $rad->addOption($rad_op1);
3549  $rad_op2 = new ilRadioOption($lng->txt("cont_deactivated"), "deactivated");
3550  $rad->addOption($rad_op2);
3551  $rad_op3 = new ilRadioOption($lng->txt("cont_scheduled_activation"), "scheduled");
3552 
3553  $dt_prop = new ilDateTimeInputGUI($lng->txt("cont_start"), "start");
3554  $dt_prop->setShowTime(true);
3555  $rad_op3->addSubItem($dt_prop);
3556  $dt_prop2 = new ilDateTimeInputGUI($lng->txt("cont_end"), "end");
3557  $dt_prop2->setShowTime(true);
3558  $rad_op3->addSubItem($dt_prop2);
3559 
3560  // show activation information
3561  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3562  $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3563  $rad_op3->addSubItem($cb);
3564 
3565 
3566  $rad->addOption($rad_op3);
3567 
3568  $this->form->addCommandButton("saveActivation", $lng->txt("save"));
3569 
3570  $this->form->addItem($rad);
3571  }
3572 
3577  {
3578  $values = array();
3579  $values["activation"] = "deactivated";
3580  if ($this->getPageObject()->getActive())
3581  {
3582  $values["activation"] = "activated";
3583  }
3584 
3585  $dt_prop = $this->form->getItemByPostVar("start");
3586  if ($this->getPageObject()->getActivationStart() != "")
3587  {
3588  $values["activation"] = "scheduled";
3589  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationStart(),
3590  IL_CAL_DATETIME));
3591  }
3592  $dt_prop = $this->form->getItemByPostVar("end");
3593  if ($this->getPageObject()->getActivationEnd() != "")
3594  {
3595  $values["activation"] = "scheduled";
3596  $dt_prop->setDate(new ilDateTime($this->getPageObject()->getActivationEnd(),
3597  IL_CAL_DATETIME));
3598  }
3599 
3600  $values["show_activation_info"] = $this->getPageObject()->getShowActivationInfo();
3601 
3602  $this->form->setValuesByArray($values);
3603  }
3604 
3608  function saveActivation()
3609  {
3610  global $tpl, $lng, $ilCtrl;
3611 
3612  $this->initActivationForm();
3613 
3614  if ($this->form->checkInput())
3615  {
3616  $this->getPageObject()->setActive(true);
3617  $this->getPageObject()->setActivationStart(null);
3618  $this->getPageObject()->setActivationEnd(null);
3619  $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3620  if ($_POST["activation"] == "deactivated")
3621  {
3622  $this->getPageObject()->setActive(false);
3623  }
3624  if ($_POST["activation"] == "scheduled")
3625  {
3626  $this->getPageObject()->setActive(false);
3627  $this->getPageObject()->setActivationStart(
3628  $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME));
3629  $this->getPageObject()->setActivationEnd(
3630  $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME));
3631  }
3632  $this->getPageObject()->update();
3633  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
3634  $ilCtrl->redirect($this, "editActivation");
3635  }
3636  $this->form->getValuesByPost();
3637  $tpl->setContent($this->form->getHTML());
3638  }
3639 
3649  function getNotesHTML($a_content_object = null, $a_enable_private_notes = true, $a_enable_public_notes = false, $a_enable_notes_deletion = false, $a_callback = null)
3650  {
3651  global $ilCtrl;
3652 
3653  include_once("Services/Notes/classes/class.ilNoteGUI.php");
3654 
3655  // scorm 2004 page gui
3656  if(!$a_content_object)
3657  {
3658  $notes_gui = new ilNoteGUI($this->notes_parent_id,
3659  (int)$this->obj->getId(), "pg");
3660 
3661  $a_enable_private_notes = true;
3662  $a_enable_public_notes = true;
3663  $a_enable_notes_deletion = false;
3664  }
3665  // wiki page gui, blog posting gui
3666  else
3667  {
3668  $notes_gui = new ilNoteGUI($a_content_object->getParentId(),
3669  $a_content_object->getId(), $a_content_object->getParentType());
3670  }
3671 
3672  if($a_enable_private_notes)
3673  {
3674  $notes_gui->enablePrivateNotes();
3675  }
3676  if ($a_enable_public_notes)
3677  {
3678  $notes_gui->enablePublicNotes();
3679  if ((bool)$a_enable_notes_deletion)
3680  {
3681  $notes_gui->enablePublicNotesDeletion(true);
3682  }
3683  }
3684 
3685  if($a_callback)
3686  {
3687  $notes_gui->addObserver($a_callback);
3688  }
3689 
3690  $next_class = $this->ctrl->getNextClass($this);
3691  if ($next_class == "ilnotegui")
3692  {
3693  $html = $this->ctrl->forwardCommand($notes_gui);
3694  }
3695  else
3696  {
3697  $html = $notes_gui->getNotesHTML();
3698  }
3699  return $html;
3700  }
3701 
3705  function getQuestionJsOfPage($a_no_interaction = false)
3706  {
3707  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
3708  $q_ids = $this->getPageObject()->getQuestionIds();
3709  $js = array();
3710  if (count($q_ids) > 0)
3711  {
3712  foreach ($q_ids as $q_id)
3713  {
3714  $q_exporter = new ilQuestionExporter($a_no_interaction);
3715  $js[$q_id] = $q_exporter->exportQuestion($q_id);
3716  }
3717  }
3718  return $js;
3719  }
3720 
3724  function initSelfAssessmentRendering($a_force_no_form = false)
3725  {
3726  global $tpl, $ilCtrl, $lng;
3727 
3728  if ($this->getEnabledSelfAssessment())
3729  {
3730  $qhtml = $this->getQuestionJsOfPage(($this->getOutputMode()=="edit" || $a_force_no_form)
3731  ? true
3732  : false);
3733 // $qhtml = $this->getQuestionJsOfPage(true);
3734  $this->setQuestionHTML($qhtml);
3735  //include JQuery Libraries before Prototpye
3736 // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js");
3737 // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js");
3738  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
3741  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/pure.js");
3742  $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/question_handling.js");
3743  $tpl->addCss("./Modules/Scorm2004/templates/default/question_handling.css");
3744  if (!$this->getEnabledSelfAssessmentScorm() && $this->getOutputMode() != IL_PAGE_PREVIEW
3745  && $this->getOutputMode() != "offline")
3746  {
3747  $tpl->addJavaScript("./Services/COPage/js/ilCOPageQuestionHandler.js");
3748  $url = $ilCtrl->getLinkTarget($this, "processAnswer", "", true, false);
3749  $tpl->addOnloadCode("ilCOPageQuestionHandler.initCallback('".$url."');");
3750  }
3751 
3752  $lk = $this->getPageConfig()->getLocalizationLanguage();
3753  self::addPreparationJavascript($tpl, $lk);
3754  }
3755  }
3756 
3763  static function addPreparationJavascript($a_tpl, $a_lang)
3764  {
3765  global $lng;
3766 
3767  $a_tpl->addOnloadCode(self::getJSTextInitCode($a_lang).
3768  'ilCOPagePres.updateQuestionOverviews();
3769  ');
3770  }
3771 
3778  static function getJSTextInitCode($a_lang)
3779  {
3780  global $lng, $ilUser;
3781 
3782  if ($a_lang == "")
3783  {
3784  $a_lang = $ilUser->getLanguage();
3785  }
3786 
3787  return
3788  '
3789  ilias.questions.txt.wrong_answers = "'.$lng->txtlng("content", "cont_wrong_answers", $a_lang).'";
3790  ilias.questions.txt.wrong_answers_single = "'.$lng->txtlng("content", "cont_wrong_answers_single", $a_lang).'";
3791  ilias.questions.txt.tries_remaining = "'.$lng->txtlng("content", "cont_tries_remaining", $a_lang).'";
3792  ilias.questions.txt.please_try_again = "'.$lng->txtlng("content", "cont_please_try_again", $a_lang).'";
3793  ilias.questions.txt.all_answers_correct = "'.$lng->txtlng("content", "cont_all_answers_correct", $a_lang).'";
3794  ilias.questions.txt.nr_of_tries_exceeded = "'.$lng->txtlng("content", "cont_nr_of_tries_exceeded", $a_lang).'";
3795  ilias.questions.txt.correct_answers_shown = "'.$lng->txtlng("content", "cont_correct_answers_shown", $a_lang).'";
3796  ilias.questions.txt.correct_answers_also = "'.$lng->txtlng("content", "cont_correct_answers_also", $a_lang).'";
3797  ilias.questions.txt.correct_answer_also = "'.$lng->txtlng("content", "cont_correct_answer_also", $a_lang).'";
3798  ilias.questions.txt.ov_all_correct = "'.$lng->txtlng("content", "cont_ov_all_correct", $a_lang).'";
3799  ilias.questions.txt.ov_some_correct = "'.$lng->txtlng("content", "cont_ov_some_correct", $a_lang).'";
3800  ilias.questions.txt.ov_wrong_answered = "'.$lng->txtlng("content", "cont_ov_wrong_answered", $a_lang).'";
3801  ilias.questions.txt.please_select = "'.$lng->txtlng("content", "cont_please_select", $a_lang).'";
3802  ilias.questions.refresh_lang();
3803  ';
3804 
3805  }
3806 
3807 
3811  function processAnswer()
3812  {
3813  global $ilLog;
3814 
3815  /*$ilLog->write($_POST);
3816  $ilLog->write($_POST["id"]);
3817  $ilLog->write($_POST["type"]);
3818  $ilLog->write($_POST["answer"]);
3819  $ilLog->write($_GET);*/
3820 
3821  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3823  ilUtil::stripSlashes($_POST["type"]),
3825  ilUtil::stripSlashes($_POST["answer"]));
3826  }
3827 
3834  function selfAssessmentRendering($a_output)
3835  {
3836  if ($this->getEnabledSelfAssessment())
3837  {
3838  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
3839  $a_output = "<script>var ScormApi=null;".ilQuestionExporter::questionsJS()."</script>".$a_output;
3840  }
3841  return $a_output;
3842  }
3843 
3844  //
3845  // Initially opened content (e.g. used in learning modules), that
3846  // is presented in another than the main content area (e.g. a picture in
3847  // the bottom left area)
3848  //
3849 
3857  {
3858  global $ilTabs, $ilCtrl;
3859 
3860  $ilTabs->activateTab("edit");
3861  $form = $this->initOpenedContentForm();
3862 
3863  $this->tpl->setContent($form->getHTML());
3864  }
3865 
3873  {
3874  global $ilCtrl;
3875 
3876  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3877  $form = new ilPropertyFormGUI();
3878 
3879  // link input
3880  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3881  $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3883  $ac->setInternalLinkDefault("Media_Media", 0);
3884  $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3885  $val = $this->obj->getInitialOpenedContent();
3886  if ($val["id"] != "" && $val["type"] != "")
3887  {
3888  $ac->setValue($val["type"]."|".$val["id"]."|".$val["target"]);
3889  }
3890 
3891  $form->addItem($ac);
3892 
3893  $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3894  $form->addCommandButton("edit", $this->lng->txt("cancel"));
3895  $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3896  $form->setFormAction($ilCtrl->getFormAction($this));
3897 
3898  return $form;
3899  }
3900 
3908  {
3909  global $ilCtrl;
3910 
3911  $this->obj->saveInitialOpenedContent(
3912  ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3913  ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3914  ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3915  );
3916 
3917  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3918  $ilCtrl->redirect($this, "edit");
3919  }
3920 
3921 }
3922 ?>