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