ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPageObjectGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
17 {
18  const PRESENTATION = "presentation";
19  const EDIT = "edit";
20  const PREVIEW = "preview";
21  const OFFLINE = "offline";
22  const PRINTING = "print";
23  protected $profile_back_url = "";
24 
25  protected $enabled_href = true;
26 
30  protected $tpl;
31 
35  protected $lng;
36 
40  protected $ctrl;
41 
45  protected $tabs_gui;
46 
50  protected $access;
51 
55  protected $plugin_admin;
56 
60  protected $log;
61 
65  protected $user;
66 
70  protected $help;
71 
75  public $obj;
76 
80  protected $output_mode;
81 
85  public $target_var;
88  public $link_params;
92  public $activation = false;
93  public $activated = true;
94  public $editpreview = false;
95  public $use_meta_data = false;
96  public $link_xml_set = false;
97  public $enableediting = true;
98  public $rawpagecontent = false;
99  public $enabledcontentincludes = false;
100  public $compare_mode = false;
101  public $page_config = null;
102  public $tabs_enabled = true;
103  public $render_page_container = false;
104  private $abstract_only = false;
105  protected $parent_type = "";
106 
110  protected $tool_context;
111 
112  //var $pl_start = "&#123;&#123;&#123;&#123;&#123;";
113  //var $pl_end = "&#125;&#125;&#125;&#125;&#125;";
114  public $pl_start = "{{{{{";
115  public $pl_end = "}}}}}";
116 
120  protected $ui;
121 
122  protected $page_linker;
123 
127  protected $abstract_pcid = "";
128 
132  protected $toolbar;
133 
138 
148  public function __construct(
149  $a_parent_type,
150  $a_id,
151  $a_old_nr = 0,
152  $a_prevent_get_id = false,
153  $a_lang = "",
154  $concrete_lang = ""
155  ) {
156  global $DIC;
157 
158  $this->log = ilLoggerFactory::getLogger('copg');
159  $this->tpl = $DIC->ui()->mainTemplate();
160  $this->ctrl = $DIC->ctrl();
161  $this->lng = $DIC->language();
162  $this->tabs_gui = $DIC->tabs();
163  $this->plugin_admin = $DIC["ilPluginAdmin"];
164  $this->access = $DIC->access();
165  $this->user = $DIC->user();
166  $this->help = $DIC["ilHelp"];
167  $this->ui = $DIC->ui();
168  $this->toolbar = $DIC->toolbar();
169  $this->concrete_lang = $concrete_lang;
170 
171  $this->setParentType($a_parent_type);
172  $this->setId($a_id);
173  if ($a_old_nr == 0 && !$a_prevent_get_id && $_GET["old_nr"] > 0) {
174  $a_old_nr = $_GET["old_nr"];
175  }
176  $this->setOldNr($a_old_nr);
177 
178  if ($a_lang == "" && $_GET["transl"] != "") {
179  $this->setLanguage($_GET["transl"]);
180  } else {
181  if ($a_lang == "") {
182  $a_lang = "-";
183  }
184  $this->setLanguage($a_lang);
185  }
186 
187 
188  $this->setOutputMode(self::PRESENTATION);
189  $this->setEnabledPageFocus(true);
190  $this->initPageObject();
191  $this->setPageConfig($this->getPageObject()->getPageConfig());
192 
193  $this->page_linker = new ilPageLinker(get_class($this));
194 
195  $this->output2template = true;
196  $this->question_xml = "";
197  $this->question_html = "";
198 
199  $this->template_output_var = "PAGE_CONTENT";
200  $this->change_comments = false;
201  $this->page_back_title = $this->lng->txt("page");
202  $this->lng->loadLanguageModule("content");
203  $this->lng->loadLanguageModule("copg");
204 
205  $this->tool_context = $DIC->globalScreen()->tool()->context();
206 
207  $this->setTemplateOutput(false);
208 
209  $this->ctrl->saveParameter($this, "transl");
210 
211  $this->afterConstructor();
212  }
213 
217  public function afterConstructor()
218  {
219  }
220 
221 
225  final protected function initPageObject()
226  {
227  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
229  $this->getParentType(),
230  $this->getId(),
231  $this->getOldNr(),
232  $this->getLanguage()
233  );
234  $page->setConcreteLang($this->concrete_lang);
235  $this->setPageObject($page);
236  }
237 
243  public function setParentType($a_val)
244  {
245  $this->parent_type = $a_val;
246  }
247 
253  public function getParentType()
254  {
255  return $this->parent_type;
256  }
257 
263  public function setId($a_val)
264  {
265  $this->id = $a_val;
266  }
267 
273  public function getId()
274  {
275  return $this->id;
276  }
277 
283  public function setOldNr($a_val)
284  {
285  $this->old_nr = $a_val;
286  }
287 
293  public function getOldNr()
294  {
295  return $this->old_nr;
296  }
297 
303  public function setLanguage($a_val)
304  {
305  $this->language = $a_val;
306  }
307 
313  public function getLanguage()
314  {
315  if ($this->language == "") {
316  return "-";
317  }
318 
319  return $this->language;
320  }
321 
327  public function setEnablePCType($a_pc_type, $a_val)
328  {
329  $this->getPageConfig()->setEnablePCType($a_pc_type, $a_val);
330  }
331 
337  public function getEnablePCType($a_pc_type)
338  {
339  return $this->getPageConfig()->getEnablePCType($a_pc_type);
340  }
341 
347  public function setPageConfig($a_val)
348  {
349  $this->page_config = $a_val;
350  }
351 
357  public function getPageConfig()
358  {
359  return $this->page_config;
360  }
361 
367  public function setPageObject(ilPageObject $a_pg_obj)
368  {
369  $this->obj = $a_pg_obj;
370  }
371 
377  public function getPageObject()
378  {
379  return $this->obj;
380  }
381 
387  public function setOutputMode($a_mode = self::PRESENTATION)
388  {
389  $this->output_mode = $a_mode;
390  }
391 
392  public function getOutputMode()
393  {
394  return $this->output_mode;
395  }
396 
397  public function setTemplateOutput($a_output = true)
398  {
399  $this->output2template = $a_output;
400  }
401 
402  public function outputToTemplate()
403  {
404  return $this->output2template;
405  }
406 
407  public function setPresentationTitle($a_title = "")
408  {
409  $this->presentation_title = $a_title;
410  }
411 
412  public function getPresentationTitle()
413  {
415  }
416 
417  public function setHeader($a_title = "")
418  {
419  $this->header = $a_title;
420  }
421 
422  public function getHeader()
423  {
424  return $this->header;
425  }
426 
427  public function setLinkParams($l_params = "")
428  {
429  $this->link_params = $l_params;
430  }
431 
432  public function getLinkParams()
433  {
434  return $this->link_params;
435  }
436 
437  public function setLinkFrame($l_frame = "")
438  {
439  $this->link_frame = $l_frame;
440  }
441 
442  public function getLinkFrame()
443  {
444  return $this->link_frame;
445  }
446 
447  public function setPageLinker($page_linker)
448  {
449  $this->page_linker = $page_linker;
450  }
451 
452  public function getLinkXML()
453  {
454  return $this->link_xml;
455  }
456 
457  public function setQuestionXML($question_xml)
458  {
459  $this->question_xml = $question_xml;
460  }
461 
463  {
464  $this->getPageConfig()->setQuestionHTML($question_html);
465  }
466 
467  public function getQuestionXML()
468  {
469  return $this->question_xml;
470  }
471 
472  public function getQuestionHTML()
473  {
474  return $this->getPageConfig()->getQuestionHTML();
475  }
476 
477  public function setTemplateTargetVar($a_variable)
478  {
479  $this->target_var = $a_variable;
480  }
481 
482  public function getTemplateTargetVar()
483  {
484  return $this->target_var;
485  }
486 
487  public function setTemplateOutputVar($a_value)
488  {
489  $this->template_output_var = $a_value;
490  }
491 
492  public function getTemplateOutputVar()
493  {
495  }
496 
502  public function setSourcecodeDownloadScript($script_name)
503  {
504  $this->sourcecode_download_script = $script_name;
505  }
506 
512  public function getSourcecodeDownloadScript()
513  {
515  }
516 
517  public function setLocator(&$a_locator)
518  {
519  $this->locator = $a_locator;
520  }
521 
522  public function setTabs($a_tabs)
523  {
524  $this->tabs_gui = $a_tabs;
525  }
526 
527  public function setPageBackTitle($a_title)
528  {
529  $this->page_back_title = $a_title;
530  }
531 
537  public function setFileDownloadLink($a_download_link)
538  {
539  $this->file_download_link = $a_download_link;
540  }
541 
547  public function getFileDownloadLink()
548  {
549  return $this->file_download_link;
550  }
551 
557  public function setFullscreenLink($a_fullscreen_link)
558  {
559  $this->fullscreen_link = $a_fullscreen_link;
560  }
561 
567  public function getFullscreenLink()
568  {
569  return $this->fullscreen_link;
570  }
571 
572  public function setIntLinkReturn($a_return)
573  {
574  $this->int_link_return = $a_return;
575  }
576 
577  public function enableChangeComments($a_enabled)
578  {
579  $this->change_comments = $a_enabled;
580  }
581 
582  public function isEnabledChangeComments()
583  {
584  return $this->change_comments;
585  }
586 
587  public function enableNotes($a_enabled, $a_parent_id)
588  {
589  $this->notes_enabled = $a_enabled;
590  $this->notes_parent_id = $a_parent_id;
591  }
592 
593  public function isEnabledNotes()
594  {
595  return $this->notes_enabled;
596  }
597 
603  public function setOfflineDirectory($offdir)
604  {
605  $this->offline_directory = $offdir;
606  }
607 
608 
613  public function getOfflineDirectory()
614  {
615  return $this->offline_directory;
616  }
617 
618 
625  public function setViewPageLink($a_link, $a_target = "")
626  {
627  $this->view_page_link = $a_link;
628  $this->view_page_target = $a_target;
629  }
630 
634  public function getViewPageLink()
635  {
636  return $this->view_page_link;
637  }
638 
642  public function getViewPageTarget()
643  {
644  return $this->view_page_target;
645  }
646 
652  public function getViewPageText()
653  {
654  return $this->lng->txt("cont_presentation_view");
655  }
656 
657  public function setActivationListener(&$a_obj, $a_meth)
658  {
659  $this->act_obj = $a_obj;
660  $this->act_meth = $a_meth;
661  }
662 
668  public function setEnabledNews($a_enabled, $a_news_obj_id = 0, $a_news_obj_type = 0)
669  {
670  $this->enabled_news = $a_enabled;
671  $this->news_obj_id = $a_news_obj_id;
672  $this->news_obj_type = $a_news_obj_type;
673  }
674 
680  public function getEnabledNews()
681  {
682  return $this->enabled_news;
683  }
684 
688  public function setTabHook($a_object, $a_function)
689  {
690  $this->tab_hook = array("obj" => $a_object, "func" => $a_function);
691  }
692 
698  public function setEditPreview($a_editpreview)
699  {
700  $this->editpreview = $a_editpreview;
701  }
702 
708  public function getEditPreview()
709  {
710  return $this->editpreview;
711  }
712 
718  public function setEnabledTabs($a_enabledtabs)
719  {
720  $this->tabs_enabled = $a_enabledtabs;
721  }
722 
728  public function getEnabledTabs()
729  {
730  return $this->tabs_enabled;
731  }
732 
738  public function setEnabledPageFocus($a_enabledpagefocus)
739  {
740  $this->enabledpagefocus = $a_enabledpagefocus;
741  }
742 
747  public function setOpenPlaceHolder($a_val)
748  {
749  $this->open_place_holder = $a_val;
750  }
751 
756  public function getOpenPlaceHolder()
757  {
759  }
760 
761 
767  public function getEnabledPageFocus()
768  {
769  return $this->enabledpagefocus;
770  }
771 
777  public function setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
778  {
779  return;
780  $this->exp_frame = $a_exp_frame;
781  $this->exp_id = $a_exp_id;
782  $this->exp_target_script = $a_exp_target_script;
783  }
784 
790  public function setPrependingHtml($a_prependinghtml)
791  {
792  $this->prependinghtml = $a_prependinghtml;
793  }
794 
800  public function getPrependingHtml()
801  {
802  return $this->prependinghtml;
803  }
804 
810  public function setEnableEditing($a_enableediting)
811  {
812  $this->enableediting = $a_enableediting;
813  }
814 
820  public function getEnableEditing()
821  {
822  return $this->enableediting;
823  }
824 
830  public function setRawPageContent($a_rawpagecontent)
831  {
832  $this->rawpagecontent = $a_rawpagecontent;
833  }
834 
840  public function getRawPageContent()
841  {
842  return $this->rawpagecontent;
843  }
844 
850  public function setStyleId($a_styleid)
851  {
852  $this->styleid = $a_styleid;
853  }
854 
860  public function getStyleId()
861  {
862  return $this->styleid;
863  }
864 
870  public function setCompareMode($a_val)
871  {
872  $this->compare_mode = $a_val;
873  }
874 
880  public function getCompareMode()
881  {
882  return $this->compare_mode;
883  }
884 
890  public function setAbstractOnly($a_val, $pcid = "")
891  {
892  $this->abstract_only = $a_val;
893  $this->abstract_pcid = $pcid;
894  }
895 
901  public function getAbstractOnly()
902  {
903  return $this->abstract_only;
904  }
905 
911  public function setRenderPageContainer($a_val)
912  {
913  $this->render_page_container = $a_val;
914  }
915 
921  public function getRenderPageContainer()
922  {
924  }
925 
932  public function getDisabledText()
933  {
934  return $this->lng->txt("inactive");
935  }
936 
937  public function getEnabledHref() : bool
938  {
939  return $this->enabled_href;
940  }
941 
942  public function setEnabledHref(bool $enable) : void
943  {
944  $this->enabled_href = $enable;
945  }
946 
956  public function activateMetaDataEditor(
957  $a_rep_obj,
958  $a_type,
959  $a_sub_obj_id,
960  $a_observer_obj = null,
961  $a_observer_func = ""
962  ) {
963  $this->use_meta_data = true;
964  $this->meta_data_rep_obj = $a_rep_obj;
965  $this->meta_data_sub_obj_id = $a_sub_obj_id;
966  $this->meta_data_type = $a_type;
967  $this->meta_data_observer_obj = $a_observer_obj;
968  $this->meta_data_observer_func = $a_observer_func;
969  }
970 
976  public function determineFileDownloadLink()
977  {
978  $file_download_link = $this->getFileDownloadLink();
979  if ($this->getFileDownloadLink() == "" && $this->getOutputMode() != "offline") {
980  $file_download_link = $this->ctrl->getLinkTarget($this, "downloadFile");
981  }
982  return $file_download_link;
983  }
984 
990  public function determineFullscreenLink()
991  {
992  $fullscreen_link = $this->getFullscreenLink();
993  if ($this->getFullscreenLink() == "" && $this->getOutputMode() != "offline") {
994  $fullscreen_link = $this->ctrl->getLinkTarget($this, "displayMediaFullscreen", "", false, false);
995  }
996  return $fullscreen_link;
997  }
998 
1005  {
1007  if ($this->sourcecode_download_script == "" && $this->getOutputMode() != "offline") {
1008  $l = $this->ctrl->getLinkTarget($this, "");
1009  }
1010  return $l;
1011  }
1012 
1016  public function getComponentPluginsXML()
1017  {
1018  $xml = "";
1019  if ($this->getOutputMode() == "edit") {
1020  $pl_names = $this->plugin_admin->getActivePluginsForSlot(
1022  "COPage",
1023  "pgcp"
1024  );
1025  foreach ($pl_names as $pl_name) {
1026  $plugin = $this->plugin_admin->getPluginObject(
1028  "COPage",
1029  "pgcp",
1030  $pl_name
1031  );
1032  if ($plugin->isValidParentType($this->getPageObject()->getParentType())) {
1033  $xml .= '<ComponentPlugin Name="' . $plugin->getPluginName() .
1034  '" InsertText="' . $plugin->txt(ilPageComponentPlugin::TXT_CMD_INSERT) . '" />';
1035  }
1036  }
1037  }
1038  if ($xml != "") {
1039  $xml = "<ComponentPlugins>" . $xml . "</ComponentPlugins>";
1040  }
1041  return $xml;
1042  }
1043 
1044 
1048  public function executeCommand()
1049  {
1050  $this->ctrl->setReturn($this, "edit");
1051 
1052  $next_class = $this->ctrl->getNextClass($this);
1053  $this->log->debug("next_class: " . $next_class);
1054 
1055  if ($next_class == "" && $this->ctrl->getCmd() == "edit") {
1056  $this->tabs_gui->clearTargets();
1057  } else {
1058  $this->getTabs();
1059  }
1060 
1061 
1062  switch ($next_class) {
1063  case 'ilobjectmetadatagui':
1064  $this->tabs_gui->activateTab("meta_data");
1065  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
1066  $md_gui = new ilObjectMetaDataGUI($this->meta_data_rep_obj, $this->meta_data_type, $this->meta_data_sub_obj_id);
1067  if (is_object($this->meta_data_observer_obj)) {
1068  $md_gui->addMDObserver(
1069  $this->meta_data_observer_obj,
1070  $this->meta_data_observer_func,
1071  "General"
1072  );
1073  }
1074  $this->ctrl->forwardCommand($md_gui);
1075  break;
1076 
1077  case "ileditclipboardgui":
1078  $this->setBackToEditTabs();
1079  $clip_gui = new ilEditClipboardGUI();
1080  $clip_gui->setPageBackTitle($this->page_back_title);
1081  $ret = $this->ctrl->forwardCommand($clip_gui);
1082  break;
1083 
1084  // notes
1085  case "ilnotegui":
1086  switch ($_GET["notes_mode"]) {
1087  default:
1088  $html = $this->edit();
1089  $this->tabs_gui->setTabActive("edit");
1090  return $html;
1091  }
1092  break;
1093 
1094  case 'ilpublicuserprofilegui':
1095  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
1096  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1097  $ret = $this->ctrl->forwardCommand($profile_gui);
1098  break;
1099 
1100  case "ilpageeditorgui":
1101  $this->setEditorToolContext();
1102 
1103  if (!$this->getEnableEditing()) {
1104  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
1105  $this->ctrl->redirect($this, "preview");
1106  }
1107  $page_editor = new ilPageEditorGUI($this->getPageObject(), $this);
1108  $page_editor->setLocator($this->locator);
1109  $page_editor->setHeader($this->getHeader());
1110  $page_editor->setPageBackTitle($this->page_back_title);
1111  $page_editor->setIntLinkReturn($this->int_link_return);
1112  //$page_editor->executeCommand();
1113  $ret = $this->ctrl->forwardCommand($page_editor);
1114  break;
1115 
1116  case 'ilnewsitemgui':
1117  include_once("./Services/News/classes/class.ilNewsItemGUI.php");
1118  $news_item_gui = new ilNewsItemGUI();
1119  $news_item_gui->setEnableEdit(true);
1120  $news_item_gui->setContextObjId($this->news_obj_id);
1121  $news_item_gui->setContextObjType($this->news_obj_type);
1122  $news_item_gui->setContextSubObjId($this->obj->getId());
1123  $news_item_gui->setContextSubObjType("pg");
1124 
1125  $ret = $this->ctrl->forwardCommand($news_item_gui);
1126  break;
1127 
1128  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
1129  $ret = $this->ctrl->forwardCommand($profile_gui);
1130  break;
1131 
1132  case "ilpropertyformgui":
1133  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1134  $form = $this->initOpenedContentForm();
1135  $this->ctrl->forwardCommand($form);
1136  break;
1137 
1138  case "ilinternallinkgui":
1139  $this->lng->loadLanguageModule("content");
1140  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1141  $link_gui = new ilInternalLinkGUI("Media_Media", 0);
1142 
1143  $link_gui->filterLinkType("PageObject_FAQ");
1144  $link_gui->filterLinkType("GlossaryItem");
1145  $link_gui->filterLinkType("Media_Media");
1146  $link_gui->filterLinkType("Media_FAQ");
1147 
1148  $link_gui->setFilterWhiteList(true);
1149  $this->ctrl->forwardCommand($link_gui);
1150  break;
1151 
1152  case "ilquestioneditgui":
1153  $this->setQEditTabs("question");
1154  include_once("./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php");
1155  $edit_gui = new ilQuestionEditGUI();
1156  $edit_gui->setPageConfig($this->getPageConfig());
1157 // $edit_gui->addNewIdListener($this, "setNewQuestionId");
1158  $edit_gui->setSelfAssessmentEditingMode(true);
1159  $ret = $this->ctrl->forwardCommand($edit_gui);
1160  $this->tpl->setContent($ret);
1161  break;
1162 
1163  case 'ilassquestionfeedbackeditinggui':
1164 
1165  $this->onFeedbackEditingForwarding();
1166 
1167  // set tabs
1168  $this->setQEditTabs("feedback");
1169 
1170  // load required lang mods
1171  $this->lng->loadLanguageModule("assessment");
1172 
1173  // set context tabs
1174  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
1175  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
1176  $questionGUI = assQuestionGUI::_getQuestionGUI(assQuestion::_getQuestionType((int) $_GET['q_id']), (int) $_GET['q_id']);
1177  $questionGUI->object->setObjId(0);
1178  $questionGUI->object->setSelfAssessmentEditingMode(true);
1179  $questionGUI->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
1180 
1181  // forward to ilAssQuestionFeedbackGUI
1182  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1183  $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $this->ctrl, $this->access, $this->tpl, $this->tabs_gui, $this->lng);
1184  $this->ctrl->forwardCommand($gui);
1185  break;
1186 
1187 /* case "ilpagemultilanggui":
1188  $this->ctrl->setReturn($this, "edit");
1189  include_once("./Services/COPage/classes/class.ilPageMultiLangGUI.php");
1190  $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId(),
1191  $this->getPageConfig()->getSinglePageMode());
1192  //$this->setTabs("settings");
1193  //$this->setSubTabs("cont_multilinguality");
1194  $ret = $this->ctrl->forwardCommand($ml_gui);
1195  break;*/
1196 
1197 
1198  case 'ilLearninghistorygui':
1199  $user_id = null;
1200  if ($this->getPageObject()->getParentType() == "prtf") {
1201  $user_id = ilObject::_lookupOwner($this->getPageObject()->getPortfolioId());
1202  }
1203  $hist_gui = new ilLearningHistoryGUI();
1204  $hist_gui->setUserId($user_id);
1205  $this->ctrl->forwardCommand($hist_gui);
1206  break;
1207 
1208  default:
1209  $cmd = $this->ctrl->getCmd("preview");
1210  // presentation view
1211  if ($this->getViewPageLink() != "" && $cmd != "edit") {
1212  $this->tabs_gui->addNonTabbedLink(
1213  "pres_view",
1214  $this->getViewPageText(),
1215  $this->getViewPageLink(),
1216  $this->getViewPageTarget()
1217  );
1218  }
1219  $ret = $this->$cmd();
1220  if ($this->getOutputMode() == self::PREVIEW && $cmd == "preview") {
1221  $this->showEditToolbar();
1222  }
1223  break;
1224  }
1225  //echo "+$ret+";
1226 
1227  return $ret;
1228  }
1229 
1236  public function setQEditTabs($a_active)
1237  {
1238  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1239 
1240  $this->tabs_gui->clearTargets();
1241 
1242  $this->tabs_gui->setBackTarget(
1243  $this->lng->txt("back"),
1244  $this->ctrl->getLinkTarget($this, "edit")
1245  );
1246 
1247  $this->ctrl->setParameterByClass("ilquestioneditgui", "q_id", $_GET["q_id"]);
1248  $this->tabs_gui->addTab(
1249  "question",
1250  $this->lng->txt("question"),
1251  $this->ctrl->getLinkTargetByClass("ilquestioneditgui", "editQuestion")
1252  );
1253 
1254  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
1255  $this->ctrl->setParameterByClass("ilAssQuestionFeedbackEditingGUI", "q_id", $_GET["q_id"]);
1256  $this->tabs_gui->addTab(
1257  "feedback",
1258  $this->lng->txt("feedback"),
1259  $this->ctrl->getLinkTargetByClass("ilAssQuestionFeedbackEditingGUI", ilAssQuestionFeedbackEditingGUI::CMD_SHOW)
1260  );
1261 
1262  $this->tabs_gui->activateTab($a_active);
1263  }
1264 
1269  {
1270  }
1271 
1272 
1273  public function deactivatePage()
1274  {
1275  $this->getPageObject()->setActivationStart(null);
1276  $this->getPageObject()->setActivationEnd(null);
1277  $this->getPageObject()->setActive(false);
1278  $this->getPageObject()->update();
1279  $this->ctrl->redirect($this, "edit");
1280  }
1281 
1282  public function activatePage()
1283  {
1284  $this->getPageObject()->setActivationStart(null);
1285  $this->getPageObject()->setActivationEnd(null);
1286  $this->getPageObject()->setActive(true);
1287  $this->getPageObject()->update();
1288  $this->ctrl->redirect($this, "edit");
1289  }
1290 
1294  protected function showEditToolbar()
1295  {
1296  $ui = $this->ui;
1297  $lng = $this->lng;
1298  if ($this->getEnableEditing()) {
1299  $b = $ui->factory()->button()->standard(
1300  $lng->txt("edit_page"),
1301  $this->ctrl->getLinkTarget($this, "edit")
1302  );
1303  $this->toolbar->addComponent($b);
1304  }
1305  }
1306 
1310  public function showPage()
1311  {
1312  $main_tpl = $this->tpl;
1313 
1314  // jquery and jquery ui are always provided for components
1315  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1318 
1319  // $this->initSelfAssessmentRendering();
1320  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1322 
1323  $main_tpl->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
1324 
1325  // needed for overlays in iim
1326  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
1328 
1329  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1331 
1332  // init template
1333  //if($this->outputToTemplate())
1334  //{
1335  if ($this->getOutputMode() == "edit") {
1336  $this->initEditing();
1337  if (!$this->getPageObject()->getEditLock()) {
1338  return;
1339  }
1340 
1341  $this->getPageObject()->buildDom();
1342 
1343  $this->log->debug("ilPageObjectGUI, showPage() in edit mode.");
1344 
1345  //echo ":".$this->getTemplateTargetVar().":";
1346  $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
1347  //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
1348 
1349  // to do: status dependent class
1350  $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
1351 
1352  // user comment
1353  if ($this->isEnabledChangeComments()) {
1354  $tpl->setCurrentBlock("change_comment");
1355  $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
1356  $tpl->parseCurrentBlock();
1357  }
1358 
1359  if ($this->getPageConfig()->getUsePageContainer()) {
1360  $tpl->setVariable("PAGE_CONTAINER_CLASS", "ilc_page_cont_PageContainer");
1361  }
1362 
1363  $tpl->setVariable(
1364  "WYSIWYG_ACTION",
1365  $this->ctrl->getFormActionByClass("ilpageeditorgui", "", "", true)
1366  );
1367 
1368  // determine media, html and javascript mode
1369  $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
1370  ? "enable"
1371  : "disable";
1372  $sel_js_mode = "enable";
1373 
1374  // show prepending html
1375  $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
1376  $tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
1377 
1378 
1379  // get js files for JS enabled editing
1380  if ($sel_js_mode == "enable") {
1381 
1382  // add int link parts
1383  include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
1384  $tpl->setCurrentBlock("int_link_prep");
1385  $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
1386  $this->ctrl->getLinkTargetByClass(
1387  array("ilpageeditorgui", "ilinternallinkgui"),
1388  "",
1389  false,
1390  true,
1391  false
1392  )
1393  ));
1394  $tpl->parseCurrentBlock();
1395 
1396  $editor_init = new \ILIAS\COPage\Editor\UI\Init();
1397  $editor_init->initUI($main_tpl, (string) $this->getOpenPlaceHolder());
1398  }
1399  } else {
1400  // presentation or preview here
1401 
1402  $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
1403  if ($this->getEnabledPageFocus()) {
1404  $tpl->touchBlock("page_focus");
1405  }
1406 
1407  include_once("./Services/User/classes/class.ilUserUtil.php");
1408 
1409  // presentation
1410  if ($this->isPageContainerToBeRendered()) {
1411  $tpl->touchBlock("page_container_1");
1412  $tpl->touchBlock("page_container_2");
1413  $tpl->touchBlock("page_container_3");
1414  }
1415 
1416  // history
1417  $c_old_nr = $this->getPageObject()->old_nr;
1418  if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
1419  $hist_info =
1420  $this->getPageObject()->getHistoryInfo($c_old_nr);
1421 
1422  if (!$this->getCompareMode()) {
1423  $this->ctrl->setParameter($this, "history_mode", "1");
1424 
1425  // previous revision
1426  if (is_array($hist_info["previous"])) {
1427  $tpl->setCurrentBlock("previous_rev");
1428  $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1429  $this->ctrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
1430  $tpl->setVariable(
1431  "HREF_PREV",
1432  $this->ctrl->getLinkTarget($this, "preview")
1433  );
1434  $tpl->parseCurrentBlock();
1435  } else {
1436  $tpl->setCurrentBlock("previous_rev_disabled");
1437  $tpl->setVariable("TXT_PREV_REV", $this->lng->txt("cont_previous_rev"));
1438  $tpl->parseCurrentBlock();
1439  }
1440 
1441  // next revision
1442  if ($c_old_nr > 0) {
1443  $tpl->setCurrentBlock("next_rev");
1444  $tpl->setVariable("TXT_NEXT_REV", $this->lng->txt("cont_next_rev"));
1445  $this->ctrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
1446  $tpl->setVariable(
1447  "HREF_NEXT",
1448  $this->ctrl->getLinkTarget($this, "preview")
1449  );
1450  $tpl->parseCurrentBlock();
1451 
1452  // latest revision
1453  $tpl->setCurrentBlock("latest_rev");
1454  $tpl->setVariable("TXT_LATEST_REV", $this->lng->txt("cont_latest_rev"));
1455  $this->ctrl->setParameter($this, "old_nr", "");
1456  $tpl->setVariable(
1457  "HREF_LATEST",
1458  $this->ctrl->getLinkTarget($this, "preview")
1459  );
1460  $tpl->parseCurrentBlock();
1461  }
1462 
1463  $this->ctrl->setParameter($this, "history_mode", "");
1464 
1465  // rollback
1466  if ($c_old_nr > 0 && $this->user->getId() != ANONYMOUS_USER_ID) {
1467  $tpl->setCurrentBlock("rollback");
1468  $this->ctrl->setParameter($this, "old_nr", $c_old_nr);
1469  $tpl->setVariable(
1470  "HREF_ROLLBACK",
1471  $this->ctrl->getLinkTarget($this, "rollbackConfirmation")
1472  );
1473  $this->ctrl->setParameter($this, "old_nr", "");
1474  $tpl->setVariable(
1475  "TXT_ROLLBACK",
1476  $this->lng->txt("cont_rollback")
1477  );
1478  $tpl->parseCurrentBlock();
1479  }
1480  }
1481 
1482  $tpl->setCurrentBlock("hist_nav");
1483  $tpl->setVariable("TXT_REVISION", $this->lng->txt("cont_revision"));
1484  $tpl->setVariable(
1485  "VAL_REVISION_DATE",
1486  ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME))
1487  );
1488  $tpl->setVariable(
1489  "VAL_REV_USER",
1490  ilUserUtil::getNamePresentation($hist_info["current"]["user_id"])
1491  );
1492  $tpl->parseCurrentBlock();
1493  }
1494  }
1495  if ($this->getOutputMode() != self::PRESENTATION &&
1496  $this->getOutputMode() != self::OFFLINE &&
1497  $this->getOutputMode() != self::PREVIEW &&
1498  $this->getOutputMode() != self::PRINTING) {
1499  $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
1500  }
1501 
1502  // output media object edit list (of media links)
1503  if ($this->getOutputMode() == "edit") {
1505  $this->obj->getParentType() . ":pg",
1506  $this->obj->getId(),
1507  $this->obj->getLanguage()
1508  );
1509  $mob_links = array();
1510  foreach ($links as $link) {
1511  if ($link["type"] == "mob") {
1512  if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
1513  $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
1514  }
1515  }
1516  }
1517 
1518  // linked media objects
1519  if (count($mob_links) > 0) {
1520  $tpl->setCurrentBlock("med_link");
1521  $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
1522  $tpl->setVariable(
1523  "SEL_MED_LINKS",
1524  ilUtil::formSelect(0, "mob_id", $mob_links, false, true)
1525  );
1526  $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
1527  $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
1528  //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
1529  $tpl->parseCurrentBlock();
1530  }
1531 
1532  // content snippets used
1533  include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
1534  $this->getPageObject()->buildDom();
1536  $this->getPageObject(),
1537  $this->getPageObject()->getDomDoc()
1538  );
1539  if (count($snippets) > 0) {
1540  foreach ($snippets as $s) {
1541  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
1542  $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
1543  }
1544  $tpl->setCurrentBlock("med_link");
1545  $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
1546  $tpl->setVariable(
1547  "SEL_SNIPPETS",
1548  ilUtil::formSelect(0, "ci_id", $sn_arr, false, true)
1549  );
1550  $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
1551  $tpl->parseCurrentBlock();
1552  }
1553 
1554  // scheduled activation?
1555  if (!$this->getPageObject()->getActive() &&
1556  $this->getPageObject()->getActivationStart() != "" &&
1557  $this->getPageConfig()->getEnableScheduledActivation()) {
1558  $tpl->setCurrentBlock("activation_txt");
1559  $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $this->lng->txt("cont_scheduled_activation"));
1560  $tpl->setVariable(
1561  "SA_FROM",
1563  new ilDateTime(
1564  $this->getPageObject()->getActivationStart(),
1566  )
1567  )
1568  );
1569  $tpl->setVariable(
1570  "SA_TO",
1572  new ilDateTime(
1573  $this->getPageObject()->getActivationEnd(),
1575  )
1576  )
1577  );
1578  $tpl->parseCurrentBlock();
1579  }
1580  }
1581 
1582  if ($_GET["reloadTree"] == "y") {
1583  $tpl->setCurrentBlock("reload_tree");
1584  $tpl->setVariable(
1585  "LINK_TREE",
1586  $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false)
1587  );
1588  $tpl->parseCurrentBlock();
1589  }
1590  // }
1591  // get content
1592  $builded = $this->obj->buildDom();
1593 
1594  // manage hierarchical ids
1595  if ($this->getOutputMode() == "edit") {
1596 
1597  // add pc ids, if necessary
1598  if (!$this->obj->checkPCIds()) {
1599  $this->obj->insertPCIds();
1600  $this->obj->update(true, true);
1601  }
1602 
1603  $this->obj->addFileSizes();
1604  $this->obj->addHierIDs();
1605 
1606  $hids = $this->obj->getHierIds();
1607  $row1_ids = $this->obj->getFirstRowIds();
1608  $col1_ids = $this->obj->getFirstColumnIds();
1609  $litem_ids = $this->obj->getListItemIds();
1610  $fitem_ids = $this->obj->getFileItemIds();
1611 
1612  // standard menues
1613  $hids = $this->obj->getHierIds();
1614  foreach ($hids as $hid) {
1615  $tpl->setCurrentBlock("add_dhtml");
1616  $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
1617  $tpl->parseCurrentBlock();
1618  }
1619 
1620  // column menues for tables
1621  foreach ($col1_ids as $hid) {
1622  $tpl->setCurrentBlock("add_dhtml");
1623  $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
1624  $tpl->parseCurrentBlock();
1625  }
1626 
1627  // row menues for tables
1628  foreach ($row1_ids as $hid) {
1629  $tpl->setCurrentBlock("add_dhtml");
1630  $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
1631  $tpl->parseCurrentBlock();
1632  }
1633 
1634  // list item menues
1635  foreach ($litem_ids as $hid) {
1636  $tpl->setCurrentBlock("add_dhtml");
1637  $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1638  $tpl->parseCurrentBlock();
1639  }
1640 
1641  // file item menues
1642  foreach ($fitem_ids as $hid) {
1643  $tpl->setCurrentBlock("add_dhtml");
1644  $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
1645  $tpl->parseCurrentBlock();
1646  }
1647  } else {
1648  $this->obj->addFileSizes();
1649  }
1650 
1651  //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>"; exit;
1652  //echo "<br>-".htmlentities($this->getLinkXML())."-"; exit;
1653 
1654  // set default link xml, if nothing was set yet
1655  if (!$this->link_xml_set) {
1656  $this->setDefaultLinkXml();
1657  }
1658 
1659  //$content = $this->obj->getXMLFromDom(false, true, true,
1660  // $this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
1661  $link_xml = $this->getLinkXML();
1662  //echo "<br>-".htmlentities($link_xml)."-"; exit;
1663  // disable/enable auto margins
1664  if ($this->getStyleId() > 0) {
1665  if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1666  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1667  $style = new ilObjStyleSheet($this->getStyleId());
1668  $template_xml = $style->getTemplateXML();
1669  $disable_auto_margins = "n";
1670  if ($style->lookupStyleSetting("disable_auto_margins")) {
1671  $disable_auto_margins = "y";
1672  }
1673  }
1674  }
1675 
1676  $append_footnotes = "y";
1677  if ($this->getAbstractOnly()) {
1678  if (!$this->abstract_pcid) {
1679  $content = "<dummy><PageObject><PageContent><Paragraph>" .
1680  $this->obj->getFirstParagraphText() . $link_xml .
1681  "</Paragraph></PageContent></PageObject></dummy>";
1682  } else {
1683  $append_footnotes = "n";
1684  $par = $this->obj->getParagraphForPCID($this->abstract_pcid);
1685  $content = "<dummy><PageObject><PageContent><Paragraph Characteristic='" . $par->getCharacteristic() . "'>" .
1686  $par->getText() . $link_xml .
1687  "</Paragraph></PageContent></PageObject>" . $this->obj->getMultimediaXML() . "</dummy>";
1688  }
1689  } else {
1690  $content = $this->obj->getXMLFromDom(
1691  false,
1692  true,
1693  true,
1694  $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML(),
1695  false,
1696  $this->getStyleId()
1697  );
1698  }
1699 
1700  // check validation errors
1701  if ($builded !== true) {
1702  $this->displayValidationError($builded);
1703  } else {
1704  $this->displayValidationError($_SESSION["il_pg_error"]);
1705  }
1706  unset($_SESSION["il_pg_error"]);
1707 
1708  // get title
1709  $pg_title = $this->getPresentationTitle();
1710 
1711  if ($this->getOutputMode() == "edit") {
1712  $col_path = ilUtil::getImagePath("col.svg");
1713  $row_path = ilUtil::getImagePath("row.svg");
1714  $item_path = ilUtil::getImagePath("icon_peadl.svg");
1715  $cell_path = ilUtil::getImagePath("cell.svg");
1716  }
1717 
1718  if ($this->getOutputMode() != "offline") {
1719  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1720  $wb_path = ilUtil::getWebspaceDir("output") . "/";
1721  } else {
1722  $enlarge_path = "images/enlarge.svg";
1723  $wb_path = "";
1724  }
1725  $pg_title_class = ($this->getOutputMode() == "print")
1726  ? "ilc_PrintPageTitle"
1727  : "";
1728 
1729  // page splitting only for learning modules and
1730  // digital books
1731  $enable_split_new = ($this->obj->getParentType() == "lm")
1732  ? "y"
1733  : "n";
1734 
1735  // page splitting to next page only for learning modules and
1736  // digital books if next page exists in tree
1737  if (($this->obj->getParentType() == "lm") &&
1739  $this->obj->getParentId(),
1740  $this->obj->getId()
1741  )) {
1742  $enable_split_next = "y";
1743  } else {
1744  $enable_split_next = "n";
1745  }
1746 
1747  $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
1748 
1749 
1750  if ($this->getPageConfig()->getEnablePCType("Tabs")) {
1751  //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
1752  //ilYuiUtil::initTabView();
1753  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1756  }
1757 
1758  // needed for placeholders
1759  $this->tpl->addCss(ilObjStyleSheet::getPlaceHolderStylePath());
1760 
1761  $file_download_link = $this->determineFileDownloadLink();
1762  $fullscreen_link = $this->determineFullscreenLink();
1763  $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
1764 
1765  // default values for various parameters (should be used by
1766  // all instances in the future)
1767  $media_mode = ($this->getOutputMode() == "edit")
1768  ? $this->user->getPref("ilPageEditor_MediaMode")
1769  : "enable";
1770 
1771  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1772  $paste = (ilEditClipboard::getAction() == "copy" &&
1773  $this->getOutputMode() == "edit");
1774 
1775  include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1776 
1777  $flv_video_player = ($this->getOutputMode() != "offline")
1780 
1781  $cfg = $this->getPageConfig();
1782 
1783  $current_ts = time();
1784  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1785 
1786  $enable_href = $this->getEnabledHref();
1787  if ($this->getOutputMode() == self::EDIT) {
1788  $enable_href = false;
1789  }
1790 
1791  // added UTF-8 encoding otherwise umlaute are converted too
1792  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1793  $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"),
1794  'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n",
1795  'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
1796  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
1797  'img_col' => $col_path,
1798  'img_row' => $row_path,
1799  'img_cell' => $cell_path,
1800  'img_item' => $item_path,
1801  'acc_save_url' => "./ilias.php?baseClass=ilaccordionpropertiesstorage&cmd=setOpenedTab" .
1802  "&user_id=" . $this->user->getId(),
1803  'append_footnotes' => $append_footnotes,
1804  'compare_mode' => $this->getCompareMode() ? "y" : "n",
1805  'enable_split_new' => $enable_split_new,
1806  'enable_split_next' => $enable_split_next,
1807  'link_params' => $this->link_params,
1808  'file_download_link' => $file_download_link,
1809  'fullscreen_link' => $fullscreen_link,
1810  'img_path' => $img_path,
1811  'parent_id' => $this->obj->getParentId(),
1812  'download_script' => $this->sourcecode_download_script,
1813  'encoded_download_script' => urlencode($this->sourcecode_download_script),
1814  'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n",
1815  'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n",
1816  'enable_map' => ($cfg->getEnablePCType("Map") && ilMapUtil::isActivated()) ? "y" : "n",
1817  'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n",
1818  'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n",
1819  'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n",
1820  'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n",
1821  'enable_content_templates' => (count($this->getPageObject()->getContentTemplates()) > 0) ? "y" : "n",
1822  'paste' => $paste ? "y" : "n",
1823  'media_mode' => $media_mode,
1824  'javascript' => $sel_js_mode,
1825  'paragraph_plugins' => $paragraph_plugin_string,
1826  'disable_auto_margins' => $disable_auto_margins,
1827  'page_toc' => $cfg->getEnablePageToc() ? "y" : "n",
1828  'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n",
1829  'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n",
1830  'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n",
1831  'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n",
1832  'enable_learning_history' => $cfg->getEnablePCType("LearningHistory") ? "y" : "n",
1833  'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n",
1834  'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n",
1835  'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n",
1836  'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n",
1837  'current_ts' => $current_ts,
1838  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1839  'flv_video_player' => $flv_video_player,
1840  'page_perma_link' => $this->getPagePermaLink(),
1841  'enable_href' => $enable_href
1842  );
1843  if ($this->link_frame != "") { // todo other link types
1844  $params["pg_frame"] = $this->link_frame;
1845  }
1846 
1847  //$content = str_replace("&nbsp;", "", $content);
1848 
1849  // this ensures that cache is emptied with every update
1850  $params["version"] = ILIAS_VERSION;
1851  // ensure no cache hit, if included files/media objects have been changed
1852  $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
1853 
1854 
1855  // should be modularized
1856  include_once("./Services/COPage/classes/class.ilPCSection.php");
1857  $md5_adds = ilPCSection::getCacheTriggerString($this->getPageObject());
1858  // run xslt
1859  $md5 = md5(serialize($params) . $link_xml . $template_xml . $md5_adds);
1860 
1861  //$a = microtime();
1862 
1863  // check cache (same parameters, non-edit mode and rendered time
1864  // > last change
1865  $is_error = false;
1866  if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") &&
1867  !$this->getCompareMode() &&
1868  !$this->getAbstractOnly() &&
1869  $md5 == $this->obj->getRenderMd5() &&
1870  ($this->obj->getLastChange() < $this->obj->getRenderedTime()) &&
1871  $this->obj->getRenderedTime() != "" &&
1872  $this->obj->old_nr == 0) {
1873  // cache hit
1874  $output = $this->obj->getRenderedContent();
1875  } else {
1876  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1877  $this->log->debug("Calling XSLT, content: " . substr($content, 0, 100));
1878  try {
1879  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1880  $xh = xslt_create();
1881  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1882  } catch (Exception $e) {
1883  $output = "";
1884  if ($this->getOutputMode() == "edit") {
1885  $output = "<pre>" . $e->getMessage() . "<br>" . htmlentities($content) . "</pre>";
1886  $is_error = true;
1887  }
1888  }
1889  if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview")
1890  && !$this->getAbstractOnly()
1891  && $this->obj->old_nr == 0) {
1892  $this->obj->writeRenderedContent($output, $md5);
1893  }
1894  xslt_free($xh);
1895  }
1896 
1897  if (!$is_error) {
1898  // unmask user html
1899  if (($this->getOutputMode() != "edit" ||
1900  $this->user->getPref("ilPageEditor_HTMLMode") != "disable")
1901  && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
1902  $output = str_replace("&lt;", "<", $output);
1903  $output = str_replace("&gt;", ">", $output);
1904  }
1905  $output = str_replace("&amp;", "&", $output);
1906 
1907  include_once './Services/MathJax/classes/class.ilMathJax.php';
1908  $output = ilMathJax::getInstance()->insertLatexImages($output);
1909 
1910  // insert page snippets
1911  //$output = $this->insertContentIncludes($output);
1912 
1913  // insert resource blocks
1914  $output = $this->insertResources($output);
1915 
1916  // insert page toc
1917  if ($this->getPageConfig()->getEnablePageToc()) {
1918  $output = $this->insertPageToc($output);
1919  }
1920 
1921  // insert advanced output trigger
1922  $output = $this->insertAdvTrigger($output);
1923 
1924  // workaround for preventing template engine
1925  // from hiding paragraph text that is enclosed
1926  // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
1927  $output = $this->replaceCurlyBrackets($output);
1928 
1929  // remove all newlines (important for code / pre output)
1930  $output = str_replace("\n", "", $output);
1931 
1932  //echo htmlentities($output);
1933  $output = $this->postOutputProcessing($output);
1934  //echo htmlentities($output);
1935  if ($this->getOutputMode() == "edit" &&
1936  !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
1937  $output = '<div class="copg-disabled-page"><div class="ilCopgDisabledText">' . $this->getDisabledText() . '</div>' . $output . '</div>';
1938  }
1939 
1940  // for all page components...
1941  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
1943  foreach ($defs as $def) {
1945  $pc_class = $def["pc_class"];
1946  $pc_obj = new $pc_class($this->getPageObject());
1947  $pc_obj->setSourcecodeDownloadScript($this->determineSourcecodeDownloadScript());
1948  $pc_obj->setFileDownloadLink($this->determineFileDownloadLink());
1949  $pc_obj->setFullscreenLink($this->determineFullscreenLink());
1950  $pc_obj->setProfileBackUrl($this->getProfileBackUrl());
1951 
1952  // post xsl page content modification by pc elements
1953  $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode(), $this->getAbstractOnly());
1954  }
1955  }
1956 
1957  $this->addResourcesToTemplate($main_tpl);
1958 
1959  // $output = $this->selfAssessmentRendering($output);
1960 
1961  // output
1962  if ($this->ctrl->isAsynch() && !$this->getRawPageContent() &&
1963  $this->getOutputMode() == "edit") {
1964  // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
1965  if ($_GET["updated_pc_id_str"] != "") {
1966  echo $_GET["updated_pc_id_str"];
1967  }
1968  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1969  $tpl->setCurrentBlock("edit_page");
1970  $tpl->parseCurrentBlock();
1971  echo $tpl->get("edit_page");
1972  exit;
1973  }
1974  if ($this->outputToTemplate()) {
1975  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1976  $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
1977  return $output;
1978  } else {
1979  if ($this->getRawPageContent()) { // e.g. needed in glossaries
1980  return $output;
1981  } else {
1982  $tpl->setVariable($this->getTemplateOutputVar(), $output);
1983  return $tpl->get();
1984  }
1985  }
1986  }
1987 
1994  public function replaceCurlyBrackets($output)
1995  {
1996  //echo "<br><br>".htmlentities($output);
1997 
1998  while (is_int($start = strpos($output, "<!--ParStart-->")) &&
1999  is_int($end = strpos($output, "<!--ParEnd-->", $start))) {
2000  $output = substr($output, 0, $start) .
2001  str_replace(
2002  array("{","}"),
2003  array("&#123;","&#125;"),
2004  substr($output, $start + 15, $end - ($start + 15))
2005  ) .
2006  substr($output, $end + 13);
2007  }
2008 
2009  // $output = str_replace("{", "&#123;", $output);
2010  // $output = str_replace("}", "&#125;", $output);
2011  //echo "<br><br>".htmlentities($output);
2012  return $output;
2013  }
2014 
2018  public function getActivationCaptions()
2019  {
2020  return array("deactivatePage" => $this->lng->txt("cont_deactivate_page"),
2021  "activatePage" => $this->lng->txt("cont_activate_page"));
2022  }
2023 
2027  public function setEditMode()
2028  {
2029  if ($_GET["media_mode"] != "") {
2030  if ($_GET["media_mode"] == "disable") {
2031  $this->user->writePref("ilPageEditor_MediaMode", "disable");
2032  } else {
2033  $this->user->writePref("ilPageEditor_MediaMode", "");
2034  }
2035  }
2036  if ($_GET["html_mode"] != "") {
2037  if ($_GET["html_mode"] == "disable") {
2038  $this->user->writePref("ilPageEditor_HTMLMode", "disable");
2039  } else {
2040  $this->user->writePref("ilPageEditor_HTMLMode", "");
2041  }
2042  }
2043  if ($_GET["js_mode"] != "") {
2044  if ($_GET["js_mode"] == "disable") {
2045  $this->user->writePref("ilPageEditor_JavaScript", "disable");
2046  } else {
2047  $this->user->writePref("ilPageEditor_JavaScript", "");
2048  }
2049  }
2050 
2051  $this->ctrl->redirect($this, "edit");
2052  }
2053 
2054 
2058  public static function getTinyMenu(
2059  $a_par_type,
2060  $a_int_links = false,
2061  $a_wiki_links = false,
2062  $a_keywords = false,
2063  $a_style_id = 0,
2064  $a_paragraph_styles = true,
2065  $a_save_return = true,
2066  $a_anchors = false,
2067  $a_save_new = true,
2068  $a_user_links = false,
2069  \ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper = null
2070  ) {
2071  global $DIC;
2072 
2073  $lng = $DIC->language();
2074  $ctrl = $DIC->ctrl();
2075  $ui = $DIC->ui();
2076 
2077  $aset = new ilSetting("adve");
2078 
2079  // character styles
2080  $chars = array(
2081  "Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")),
2082  "Quotation" => array("code" => "quot", "txt" => $lng->txt("cont_char_style_quot")),
2083  "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")),
2084  "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))
2085  );
2086  foreach (ilPCParagraphGUI::_getTextCharacteristics($a_style_id) as $c) {
2087  if (!isset($chars[$c])) {
2088  $chars[$c] = array("code" => "", "txt" => $c);
2089  }
2090  }
2091  $char_formats = [];
2092  foreach ($chars as $key => $char) {
2094  $a_par_type,
2095  "active_" . $char["code"],
2096  true
2097  )) {
2098  $t = "text_inline";
2099  $tag = "span";
2100  switch ($key) {
2101  case "Code": $tag = "code"; break;
2102  }
2103  $html = '<' . $tag . ' class="ilc_' . $t . '_' . $key . '" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char["txt"] . "</" . $tag . ">";
2104  $char_formats[] = ["text" => $html, "action" => "selection.format", "data" => ["format" => $key]];
2105  }
2106  }
2107 
2108 
2109  $numbered_list = '<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 110-2zM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 01-.5-.5V5h-.5a.5.5 0 010-1H6zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2H4.5a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 010-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 110-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 110-1H6c.6 0 1 .4 1 1z" fill-rule="evenodd"></path></svg>';
2110 
2111  $bullet_list = '<svg width="24" height="24"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1z" fill-rule="evenodd"></path></svg>';
2112 
2113  $indent = '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z" fill-rule="evenodd"></path></svg>';
2114 
2115  $outdent = '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm1.6-3.8a1 1 0 01-1.2 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 011.2 1.6L6.8 12l1.8 1.2z" fill-rule="evenodd"></path></svg>';
2116 
2117  // menu
2118  $str = "str";
2119  $emp = "emp";
2120  $imp = "imp";
2121  if ($aset->get("use_physical")) {
2122  $str = "B";
2123  $emp = "I";
2124  $imp = "U";
2125  }
2126  $c_formats = [];
2127  foreach (["str", "emp", "imp", "sup", "sub"] as $c) {
2129  $a_par_type,
2130  "active_" . $c,
2131  true
2132  )) {
2133  switch ($c) {
2134  case "str":
2135  $c_formats[] = ["text" => '<span class="ilc_text_inline_Strong">' . $str . '</span>',
2136  "action" => "selection.format",
2137  "data" => ["format" => "Strong"]
2138  ];
2139  break;
2140  case "emp":
2141  $c_formats[] = ["text" => '<span class="ilc_text_inline_Emph">' . $emp . '</span>',
2142  "action" => "selection.format",
2143  "data" => ["format" => "Emph"]
2144  ];
2145  break;
2146  case "imp":
2147  $c_formats[] = ["text" => '<span class="ilc_text_inline_Important">' . $imp . '</span>',
2148  "action" => "selection.format",
2149  "data" => ["format" => "Important"]
2150  ];
2151  break;
2152  case "sup":
2153  $c_formats[] = ["text" => 'x<sup>2</sup>',
2154  "action" => "selection.format",
2155  "data" => ["format" => "Sup"]
2156  ];
2157  break;
2158  case "sub":
2159  $c_formats[] = ["text" => 'x<sub>2</sub>',
2160  "action" => "selection.format",
2161  "data" => ["format" => "Sub"]
2162  ];
2163  break;
2164  }
2165  }
2166  }
2167  $c_formats[] = ["text" => "<i>A</i>",
2168  "action" => $char_formats
2169  ];
2170  $c_formats[] = ["text" => '<i><b><u>T</u></b><sub>x</sub></i>',
2171  "action" => "selection.removeFormat",
2172  "data" => []
2173  ];
2174  $menu = [
2175  "cont_char_format" => $c_formats,
2176  "cont_lists" => [
2177  ["text" => $bullet_list, "action" => "list.bullet", "data" => []],
2178  ["text" => $numbered_list, "action" => "list.number", "data" => []],
2179  ["text" => $outdent, "action" => "list.outdent", "data" => []],
2180  ["text" => $indent, "action" => "list.indent", "data" => []]
2181  ]
2182  ];
2183 
2184  // more...
2185 
2186  // links
2187  $links = [];
2188  if ($a_wiki_links) {
2189  $links[] = ["text" => $lng->txt("cont_wiki_link_dialog"), "action" => "link.wikiSelection", "data" => [
2190  "url" => $ctrl->getLinkTargetByClass("ilwikipagegui", "")]];
2191  $links[] = ["text" => "[[" . $lng->txt("cont_wiki_page") . "]]", "action" => "link.wiki", "data" => []];
2192  }
2193  if ($a_int_links) {
2194  $links[] = ["text" => $lng->txt("cont_text_iln_link"), "action" => "link.internal", "data" => []];
2195  }
2197  $a_par_type,
2198  "active_xln",
2199  true
2200  )) {
2201  $links[] = ["text" => $lng->txt("cont_text_xln"), "action" => "link.external", "data" => []];
2202  }
2203  if ($a_user_links) {
2204  $links[] = ["text" => $lng->txt("cont_link_user"), "action" => "link.user", "data" => []];
2205  }
2206 
2207 
2208  // more
2209  $menu["cont_more_functions"] = [];
2210  $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_link") . '<i class="mce-ico mce-i-link"></i>', "action" => $links];
2211 
2212  if ($a_keywords) {
2213  $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_keyword"), "action" => "selection.keyword", "data" => []];
2214  }
2215  $mathJaxSetting = new ilSetting("MathJax");
2217  $a_par_type,
2218  "active_tex",
2219  true
2220  )) {
2221  if ($mathJaxSetting->get("enable") || defined("URL_TO_LATEX")) {
2222  $menu["cont_more_functions"][] = ["text" => 'Tex', "action" => "selection.tex", "data" => []];
2223  }
2224  }
2226  $a_par_type,
2227  "active_fn",
2228  true
2229  )) {
2230  $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_footnote"), "action" => "selection.fn", "data" => []];
2231  }
2232  if ($a_anchors) {
2233  $menu["cont_more_functions"][] = ["text" => $lng->txt("cont_anchor"), "action" => "selection.anchor", "data" => []];
2234  }
2235 
2236  $btpl = new ilTemplate("tpl.tiny_menu.html", true, true, "Services/COPage");
2237 
2238  foreach ($menu as $section_title => $section) {
2239  foreach ($section as $item) {
2240  if (is_array($item["action"])) {
2241  $buttons = [];
2242  foreach ($item["action"] as $i) {
2243  $buttons[] = $ui_wrapper->getButton($i["text"], "par-action", $i["action"], $i["data"]);
2244  }
2245  $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($item["text"]);
2246  $btpl->setCurrentBlock("button");
2247  $btpl->setVariable("BUTTON", $ui->renderer()->renderAsync($dd));
2248  $btpl->parseCurrentBlock();
2249  } else {
2250  $b = $ui_wrapper->getRenderedButton($item["text"], "par-action", $item["action"], $item["data"]);
2251  $btpl->setCurrentBlock("button");
2252  $btpl->setVariable("BUTTON", $b);
2253  $btpl->parseCurrentBlock();
2254  }
2255  }
2256  $btpl->setCurrentBlock("section");
2257  $btpl->setVariable("TXT_SECTION", $lng->txt($section_title));
2258  $btpl->parseCurrentBlock();
2259  }
2260 
2261 
2262  if ($a_paragraph_styles) {
2263  $sel = new \ILIAS\COPage\Editor\Components\Paragraph\ParagraphStyleSelector($ui_wrapper, $a_style_id);
2264  $dd = $sel->getStyleSelector("");
2265  $btpl->setCurrentBlock("par_edit");
2266  $btpl->setVariable("TXT_PAR_FORMAT", $lng->txt("cont_par_format"));
2267 
2268  $btpl->setVariable("STYLE_SELECTOR", $ui->renderer()->render($dd));
2269 
2270  $btpl->parseCurrentBlock();
2271  }
2272 
2273  // block styles
2274  $sel = new \ILIAS\COPage\Editor\Components\Section\SectionStyleSelector($ui_wrapper, $a_style_id);
2275  $dd = $sel->getStyleSelector("", $type = "par-action", $action = "sec.class", $attr = "class", true);
2276  $btpl->setVariable("TXT_BLOCK", $lng->txt("cont_sur_block_format"));
2277  $btpl->setVariable("BLOCK_STYLE_SELECTOR", $ui->renderer()->render($dd));
2278 
2279 
2280  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2281 
2282  $btpl->setVariable(
2283  "SPLIT_BUTTON",
2284  $ui_wrapper->getRenderedButton($lng->txt("save_return"), "par-action", "save.return")
2285  );
2286 
2287  $btpl->setVariable(
2288  "CANCEL_BUTTON",
2289  $ui_wrapper->getRenderedButton($lng->txt("cancel"), "par-action", "component.cancel")
2290  );
2291 
2292  $btpl->setVariable("TXT_SAVING", $lng->txt("cont_saving"));
2293 
2294  $btpl->setVariable("SRC_LOADER", \ilUtil::getImagePath("loader.svg"));
2295 
2296  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
2297 
2298  $btpl->setVariable("CHAR_STYLE_SELECTOR", ilPCParagraphGUI::getCharStyleSelector($a_par_type, true, $a_style_id));
2300  "ilAdvSelListAnchorElement_char_style_selection",
2301  $lng->txt("cont_more_character_styles"),
2302  "iltinymenu_bd"
2303  );
2304 
2305  return $btpl->get();
2306  }
2307 
2311  public function setDefaultLinkXml()
2312  {
2313  $this->page_linker->setProfileBackUrl($this->getProfileBackUrl());
2314  $this->page_linker->setOffline($this->getOutputMode() == self::OFFLINE);
2315  $this->setLinkXML($this->page_linker->getLinkXml($this->getPageObject()->getInternalLinks()));
2316  }
2317 
2323  public function setLinkXml($xml)
2324  {
2325  $this->link_xml = $xml;
2326  $this->link_xml_set = true;
2327  }
2328 
2329 
2333  public function getProfileBackUrl()
2334  {
2335  if ($this->profile_back_url != "") {
2336  return $this->profile_back_url;
2337  }
2338  if ($this->getOutputMode() === self::OFFLINE) {
2339  return "";
2340  }
2341  return $this->ctrl->getLinkTargetByClass(strtolower(get_class($this)), "preview");
2342  }
2343 
2347  public function setProfileBackUrl($url)
2348  {
2349  $this->profile_back_url = $url;
2350  }
2351 
2352 
2356  public function downloadFile()
2357  {
2358  $download_ok = false;
2359 
2360  require_once("./Modules/File/classes/class.ilObjFile.php");
2361  $pg_obj = $this->getPageObject();
2362  $pg_obj->buildDom();
2363  $int_links = $pg_obj->getInternalLinks();
2364  foreach ($int_links as $il) {
2365  if ($il["Target"] == str_replace("_file_", "_dfile_", $_GET["file_id"])) {
2366  $file = explode("_", $_GET["file_id"]);
2367  $file_id = (int) $file[count($file) - 1];
2368  $download_ok = true;
2369  }
2370  }
2371  if (in_array($_GET["file_id"], $pg_obj->getAllFileObjIds())) {
2372  $file = explode("_", $_GET["file_id"]);
2373  $file_id = (int) $file[count($file) - 1];
2374  $download_ok = true;
2375  }
2376 
2377  $pcs = ilPageContentUsage::getUsagesOfPage($pg_obj->getId(), $pg_obj->getParentType() . ":pg", 0, false);
2378  foreach ($pcs as $pc) {
2379  $files = ilObjFile::_getFilesOfObject("mep:pg", $pc["id"], 0);
2380  $file = explode("_", $_GET["file_id"]);
2381  $file_id = (int) $file[count($file) - 1];
2382  if (in_array($file_id, $files)) {
2383  $download_ok = true;
2384  }
2385  }
2386 
2387  if ($download_ok) {
2388  $fileObj = new ilObjFile($file_id, false);
2389  $fileObj->sendFile();
2390  exit;
2391  }
2392  }
2393 
2397  public function displayMediaFullscreen()
2398  {
2399  $this->displayMedia(true);
2400  }
2401 
2405  public function displayMedia($a_fullscreen = false)
2406  {
2407  $tpl = $this->tpl;
2408 
2409  $tpl = new ilCOPageGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
2410  $tpl->setCurrentBlock("ilMedia");
2411 
2412  //$int_links = $page_object->getInternalLinks();
2413  $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2414 
2415  // @todo
2416  $link_xml = $this->page_linker->getLinkXML($med_links);
2417 
2418  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2419  $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2420  require_once("./Services/COPage/classes/class.ilPageObject.php");
2421  if ($_GET["pg_type"] === "mep") {
2422  $pg_obj = new ilMediaPoolPage((int) $_GET["pg_id"]);
2423  } else {
2424  $pg_obj = $this->getPageObject();
2425  }
2426 
2427  $pg_obj->buildDom();
2428 
2429  if (!empty($_GET["pg_id"])) {
2430  $xml = "<dummy>";
2431  $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2432  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2433  $xml .= $link_xml;
2434  $xml .= "</dummy>";
2435  } else {
2436  $xml = "<dummy>";
2437  $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2438  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2439  $xml .= $link_xml;
2440  $xml .= "</dummy>";
2441  }
2442 
2443  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2444  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2445  $xh = xslt_create();
2446 
2447  $mode = "media";
2448  if ($a_fullscreen) {
2449  $mode = "fullscreen";
2450  }
2451 
2452  //echo "<b>XML:</b>".htmlentities($xml);
2453  // determine target frames for internal links
2454  $wb_path = ilUtil::getWebspaceDir("output") . "/";
2455  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
2456  $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
2457  'link_params' => "ref_id=" . $_GET["ref_id"],'fullscreen_link' => "",
2458  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
2459  'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path);
2460  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2461  //echo "<br><br>".htmlentities($output);
2462  //echo xslt_error($xh);
2463  xslt_free($xh);
2464 
2465  // unmask user html
2466  require_once('./Services/Style/Content/classes/class.ilObjStyleSheet.php');
2467  $tpl->setVariable(
2468  "LOCATION_CONTENT_STYLESHEET",
2470  );
2471  $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2472  $tpl->setVariable("MEDIA_CONTENT", $output);
2473 
2474  // add js
2475  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2477  $tpl->fillJavaScriptFiles();
2478  $tpl->fillCssFiles();
2479 
2480  echo $tpl->get();
2481  exit;
2482  }
2483 
2487  public function download_paragraph()
2488  {
2489  $pg_obj = $this->getPageObject();
2490  $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
2491  }
2492 
2499  public function insertPageToc($a_output)
2500  {
2501  include_once("./Services/Utilities/classes/class.ilStr.php");
2502 
2503  // extract all headings
2504  $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
2505  $page_heads = array();
2506  foreach ($offsets as $os) {
2507  $level = (int) substr($a_output, $os + 10, 1);
2508  if (in_array($level, array(1,2,3))) {
2509  $anchor = str_replace(
2510  "TocH",
2511  "TocA",
2512  substr($a_output, $os, strpos($a_output, "-->", $os) - $os)
2513  );
2514 
2515  // get heading
2516  $tag_start = stripos($a_output, "<h" . $level . " ", $os);
2517  $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
2518  $head = substr($a_output, $tag_start, $tag_end - $tag_start);
2519 
2520  // get headings text
2521  $text_start = stripos($head, ">") + 1;
2522  $text_end = strripos($head, "<!--", $text_start);
2523  $text = substr($head, $text_start, $text_end - $text_start);
2524  $page_heads[] = array("level" => $level, "text" => $text,
2525  "anchor" => $anchor);
2526  }
2527  }
2528  if (count($page_heads) > 1) {
2529  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
2530  $list = new ilNestedList();
2531  $list->setAutoNumbering(true);
2532  $list->setListClass("ilc_page_toc_PageTOCList");
2533  $list->setItemClass("ilc_page_toc_PageTOCItem");
2534  $i = 0;
2535  $c_depth = 1;
2536  $c_par[1] = 0;
2537  $c_par[2] = 0;
2538  $nr[1] = 1;
2539  $nr[2] = 1;
2540  $nr[3] = 1;
2541  foreach ($page_heads as $ind => $h) {
2542  $i++;
2543  $par = 0;
2544 
2545  // check if we have a parent for one level up
2546  $par = 0;
2547  if ($h["level"] == 2 && $c_par[1] > 0) {
2548  $par = $c_par[1];
2549  }
2550  if ($h["level"] == 3 && $c_par[2] > 0) {
2551  $par = $c_par[2];
2552  }
2553 
2554  $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
2555 
2556  // add the list node
2557  $list->addListNode(
2558  "<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>",
2559  $i,
2560  $par
2561  );
2562 
2563  // set the node as current parent of the level
2564  if ($h["level"] == 1) {
2565  $c_par[1] = $i;
2566  $c_par[2] = 0;
2567  }
2568  if ($h["level"] == 2) {
2569  $c_par[2] = $i;
2570  }
2571  }
2572 
2573  $tpl = new ilTemplate(
2574  "tpl.page_toc.html",
2575  true,
2576  true,
2577  "Services/COPage"
2578  );
2579  $tpl->setVariable("PAGE_TOC", $list->getHTML());
2580  $tpl->setVariable("TXT_PAGE_TOC", $this->lng->txt("cont_page_toc"));
2581  $tpl->setVariable("TXT_HIDE", $this->lng->txt("hide"));
2582  $tpl->setVariable("TXT_SHOW", $this->lng->txt("show"));
2583 
2584  $a_output = str_replace(
2585  "{{{{{PageTOC}}}}}",
2586  $tpl->get(),
2587  $a_output
2588  );
2589  $numbers = $list->getNumbers();
2590 
2591  if (count($numbers) > 0) {
2592  include_once("./Services/Utilities/classes/class.ilStr.php");
2593  foreach ($numbers as $n) {
2594  $a_output =
2595  ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n . " ", $a_output);
2596  }
2597  }
2598  } else {
2599  $a_output = str_replace(
2600  "{{{{{PageTOC}}}}}",
2601  "",
2602  $a_output
2603  );
2604  }
2605 
2606  return $a_output;
2607  }
2608 
2615  public function insertResources($a_output)
2616  {
2617  // this is edit mode only
2618 
2619  if ($this->getEnablePCType("Resources") &&
2620  ($this->getOutputMode() == "edit" || $this->getOutputMode() == "preview")) {
2621  include_once("./Services/COPage/classes/class.ilPCResourcesGUI.php");
2622  $a_output = ilPCResourcesGUI::insertResourcesIntoPageContent($a_output, $this->getOutputMode());
2623  }
2624  return $a_output;
2625  }
2626 
2627 
2628 
2635  public function insertAdvTrigger($a_output)
2636  {
2637  if (!$this->getAbstractOnly()) {
2638  $a_output = str_replace(
2639  "{{{{{LV_show_adv}}}}}",
2640  $this->lng->txt("cont_show_adv"),
2641  $a_output
2642  );
2643  $a_output = str_replace(
2644  "{{{{{LV_hide_adv}}}}}",
2645  $this->lng->txt("cont_hide_adv"),
2646  $a_output
2647  );
2648  } else {
2649  $a_output = str_replace(
2650  "{{{{{LV_show_adv}}}}}",
2651  "",
2652  $a_output
2653  );
2654  $a_output = str_replace(
2655  "{{{{{LV_hide_adv}}}}}",
2656  "",
2657  $a_output
2658  );
2659  }
2660 
2661  return $a_output;
2662  }
2663 
2664 
2669  public function postOutputProcessing($a_output)
2670  {
2671  return $a_output;
2672  }
2673 
2674 
2678  public function previewHistory()
2679  {
2680  $this->preview();
2681  }
2682 
2686  public function preview()
2687  {
2688  $this->setOutputMode(self::PREVIEW);
2689  return $this->showPage();
2690  }
2691 
2695  protected function setEditorToolContext()
2696  {
2697  $collection = $this->tool_context->current()->getAdditionalData();
2698  if ($collection->exists(ilCOPageEditGSToolProvider::SHOW_EDITOR)) {
2699  $collection->replace(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2700  } else {
2701  $collection->add(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
2702  }
2703  }
2704 
2710  protected function initEditing()
2711  {
2712  // editing allowed?
2713  if (!$this->getEnableEditing()) {
2714  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
2715  $this->ctrl->redirect($this, "preview");
2716  }
2717 
2718  // not so nive workaround for container pages, bug #0015831
2719  $ptype = $this->getParentType();
2720  if ($ptype == "cont" && $_GET["ref_id"] > 0) {
2721  $ptype = ilObject::_lookupType((int) $_GET["ref_id"], true);
2722  }
2723  $this->setScreenIdComponent();
2724  $this->help->setScreenId("edit_" . $ptype);
2725 
2726  require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
2727  if (
2728  $this->user->isAnonymous() &&
2729  !$this->user->isCaptchaVerified() &&
2730  ilCaptchaUtil::isActiveForWiki()
2731  ) {
2732  $form = $this->initCaptchaForm();
2733  if ($_POST['captcha_code'] && $form->checkInput()) {
2734  $this->user->setCaptchaVerified(true);
2735  } else {
2736  return $form->getHTML();
2737  }
2738  }
2739 
2740  // edit lock
2741  if (!$this->getPageObject()->getEditLock()) {
2742  $this->showEditLockInfo();
2743  return;
2744  } else {
2745  $this->setEditorToolContext();
2746  }
2747 
2748  $this->lng->toJS("paste");
2749  $this->lng->toJS("delete");
2750  $this->lng->toJS("cont_delete_content");
2751  $this->lng->toJS("copg_confirm_el_deletion");
2752  $this->lng->toJS("cont_saving");
2753  $this->lng->toJS("cont_ed_par");
2754  $this->lng->toJS("cont_no_block");
2755  $this->lng->toJS("copg_error");
2756  $this->lng->toJS("cont_ed_click_to_add_pg");
2757  $this->lng->toJS("cont_ed_new_item_after");
2758  $this->lng->toJS("cont_ed_new_item_before");
2759  $this->lng->toJS("cont_ed_item_up");
2760  $this->lng->toJS("cont_ed_item_down");
2761  $this->lng->toJS("cont_ed_delete_item");
2762  // workaroun: we need this js for the new editor version, e.g. for new section form to work
2763  // @todo: solve this in a smarter way
2764  $this->tpl->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
2767  }
2768 
2769  protected function showEditLockInfo()
2770  {
2771  $info = $this->lng->txt("content_no_edit_lock");
2772  $lock = $this->getPageObject()->getEditLockInfo();
2773  $info .= "</br>" . $this->lng->txt("content_until") . ": " .
2774  ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX));
2775  $info .= "</br>" . $this->lng->txt("obj_usr") . ": " .
2776  ilUserUtil::getNamePresentation($lock["edit_lock_user"]);
2777 
2778  $back_link = $this->ui->factory()->link()->standard(
2779  $this->lng->txt("back"),
2780  $this->ctrl->getLinkTarget($this, "finishEditing")
2781  );
2782 
2783  $mbox = $this->ui->factory()->messageBox()->info($info)
2784  ->withLinks([$back_link]);
2785  $rendered_mbox = $this->ui->renderer()->render($mbox);
2786 
2787  if (!$this->ctrl->isAsynch()) {
2788  $this->tpl->setContent($rendered_mbox);
2789  } else {
2790  echo $rendered_mbox;
2791  exit;
2792  }
2793  }
2794 
2798  public function edit()
2799  {
2800  $this->setOutputMode(self::EDIT);
2801  $html = $this->showPage();
2802 
2803  if ($this->isEnabledNotes()) {
2804  $html .= "<br /><br />" . $this->getNotesHTML();
2805  }
2806 
2807  return $html;
2808  }
2809 
2814  public function getBlockingInfoMessage() : string
2815  {
2816  $ctrl = $this->ctrl;
2817  $lng = $this->lng;
2818  $ui = $this->ui;
2819 
2820  $lock = $this->getPageObject()->getEditLockInfo();
2821  $info = $this->lng->txt("cont_got_lock_release");
2822  $info = str_replace("%1", ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)), $info);
2823 
2824  $mbox = $ui->factory()->messageBox()->info($info);
2825 
2826  return $ui->renderer()->render($mbox);
2827  }
2828 
2829 
2836  public function insertJSAtPlaceholder()
2837  {
2838  $tpl = $this->tpl;
2839 
2840  if ($_GET["pl_hier_id"] == "") {
2841  $this->obj->buildDom();
2842  $this->obj->addHierIDs();
2843  $hid = $this->obj->getHierIdsForPCIds(array($_GET["pl_pc_id"]));
2844  $_GET["pl_hier_id"] = $hid[$_GET["pl_pc_id"]];
2845  }
2846 
2847  // 'pl_hier_id' => string '2_1_1_1' (length=7)
2848  // 'pl_pc_id' => string '1f77eb1d8a478497d69b99d938fda8f' (length=31)
2849  $this->setOpenPlaceHolder($_GET["pl_pc_id"]);
2850 
2851  $html = $this->edit();
2852  return $html;
2853  }
2854 
2858  public function initCaptchaForm()
2859  {
2860  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2861  $form = new ilPropertyFormGUI();
2862 
2863  require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
2864  $ci = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
2865  $ci->setRequired(true);
2866  $form->addItem($ci);
2867 
2868  $form->addCommandButton('edit', $this->lng->txt('ok'));
2869 
2870  $form->setTitle($this->lng->txt('cont_captcha_verification'));
2871  $form->setFormAction($this->ctrl->getFormAction($this));
2872 
2873  return $form;
2874  }
2875 
2876  /*
2877  * presentation
2878  */
2879  public function presentation($a_mode = self::PRESENTATION)
2880  {
2881  $this->setOutputMode($a_mode);
2882 
2883  return $this->showPage();
2884  }
2885 
2886  public function getHTML()
2887  {
2888  $this->getTabs("preview");
2889  return $this->showPage();
2890  }
2891 
2895  public function showMediaFullscreen($a_style_id = 0)
2896  {
2897  $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
2898  $this->tpl->setCurrentBlock("ContentStyle");
2899  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
2900  $this->tpl->parseCurrentBlock();
2901 
2902  $this->tpl->setVariable("PAGETITLE", " - " . ilObject::_lookupTitle($_GET["mob_id"]));
2903  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2904  $this->tpl->setCurrentBlock("ilMedia");
2905 
2906  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2907  $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2908  if (!empty($_GET["pg_id"])) {
2909  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
2910  $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
2911  $pg_obj->buildDom();
2912 
2913  $xml = "<dummy>";
2914  // todo: we get always the first alias now (problem if mob is used multiple
2915  // times in page)
2916  $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2917  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2918  $xml .= "</dummy>";
2919  } else {
2920  $xml = "<dummy>";
2921  $xml .= $media_obj->getXML(IL_MODE_ALIAS);
2922  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
2923  $xml .= "</dummy>";
2924  }
2925 
2926  //echo htmlentities($xml); exit;
2927 
2928  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2929  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2930  $xh = xslt_create();
2931 
2932  //echo "<b>XML:</b>".htmlentities($xml);
2933  // determine target frames for internal links
2934  //$pg_frame = $_GET["frame"];
2935  $wb_path = ilUtil::getWebspaceDir("output") . "/";
2936  $mode = "fullscreen";
2937  $params = array('mode' => $mode,
2938  'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
2939  'webspace_path' => $wb_path);
2940  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2941  echo xslt_error($xh);
2942  xslt_free($xh);
2943 
2944  // unmask user html
2945  $this->tpl->setVariable("MEDIA_CONTENT", $output);
2946  }
2947 
2953  public function displayValidationError($a_error)
2954  {
2955  if (is_array($a_error)) {
2956  $error_str = "<b>Error(s):</b><br>";
2957  foreach ($a_error as $error) {
2958  $err_mess = implode(" - ", $error);
2959  if (!is_int(strpos($err_mess, ":0:"))) {
2960  $error_str .= htmlentities($err_mess) . "<br />";
2961  }
2962  }
2963  $this->tpl->setVariable("MESSAGE", $error_str);
2964  }
2965  }
2966 
2967  protected function setBackToEditTabs() : void
2968  {
2969  $this->tabs_gui->clearTargets();
2970  $this->tabs_gui->setBackTarget(
2971  $this->lng->txt("back"),
2972  $this->ctrl->getLinkTarget($this, "edit")
2973  );
2974  }
2975 
2979  public function history()
2980  {
2981  if (!$this->getEnableEditing()) {
2982  return;
2983  }
2984 
2985  $this->setBackToEditTabs();
2986 
2987  $this->tpl->addJavaScript("./Services/COPage/js/page_history.js");
2988 
2989  include_once("./Services/COPage/classes/class.ilPageHistoryTableGUI.php");
2990  $table_gui = new ilPageHistoryTableGUI($this, "history");
2991  $table_gui->setId("hist_table");
2992  $entries = $this->getPageObject()->getHistoryEntries();
2993  $entries[] = array('page_id' => $this->getPageObject()->getId(),
2994  'parent_type' => $this->getPageObject()->getParentType(),
2995  'hdate' => $this->getPageObject()->getLastChange(),
2996  'parent_id' => $this->getPageObject()->getParentId(),
2997  'nr' => 0,
2998  'sortkey' => 999999,
2999  'user' => $this->getPageObject()->last_change_user);
3000  $table_gui->setData($entries);
3001  return $table_gui->getHTML();
3002  }
3003 
3007  public function rollbackConfirmation()
3008  {
3009  if (!$this->getEnableEditing()) {
3010  return;
3011  }
3012 
3013  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
3014  $c_gui = new ilConfirmationGUI();
3015 
3016  // set confirm/cancel commands
3017  $this->ctrl->setParameter($this, "rollback_nr", $_GET["old_nr"]);
3018  $c_gui->setFormAction($this->ctrl->getFormAction($this, "rollback"));
3019  $c_gui->setHeaderText($this->lng->txt("cont_rollback_confirmation"));
3020  $c_gui->setCancel($this->lng->txt("cancel"), "history");
3021  $c_gui->setConfirm($this->lng->txt("confirm"), "rollback");
3022 
3023  $hentry = $this->obj->getHistoryEntry($_GET["old_nr"]);
3024 
3025  $c_gui->addItem(
3026  "id[]",
3027  $_GET["old_nr"],
3029  );
3030 
3031  $this->tpl->setContent($c_gui->getHTML());
3032  }
3033 
3037  public function rollback()
3038  {
3039  if (!$this->getEnableEditing()) {
3040  return;
3041  }
3042 
3043  $hentry = $this->obj->getHistoryEntry($_GET["rollback_nr"]);
3044 
3045  if ($hentry["content"] != "") {
3046  $this->obj->setXMLContent($hentry["content"]);
3047  $this->obj->buildDom(true);
3048  if ($this->obj->update()) {
3049  $this->ctrl->redirect($this, "history");
3050  }
3051  }
3052  $this->ctrl->redirect($this, "history");
3053  }
3054 
3061  public function setScreenIdComponent()
3062  {
3063  $this->help->setScreenIdComponent("copg");
3064  }
3065 
3071  public function getTabs($a_activate = "")
3072  {
3073  $this->setScreenIdComponent();
3074 
3075  if (!$this->getEnabledTabs()) {
3076  return;
3077  }
3078 
3079  // back to upper context
3080  if (!$this->getEditPreview()) {
3081  $this->tabs_gui->addTarget("pg", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3082  } else {
3083  $this->tabs_gui->addTarget("cont_preview", $this->ctrl->getLinkTarget($this, "preview"), array("", "preview"));
3084  }
3085 
3086  //$tabs_gui->addTarget("properties", $this->ctrl->getLinkTarget($this, "properties")
3087  // , "properties", get_class($this));
3088 
3089  if ($this->use_meta_data) {
3090  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
3091  $mdgui = new ilObjectMetaDataGUI(
3092  $this->meta_data_rep_obj,
3093  $this->meta_data_type,
3094  $this->meta_data_sub_obj_id
3095  );
3096  $mdtab = $mdgui->getTab();
3097  if ($mdtab) {
3098  $this->tabs_gui->addTarget(
3099  "meta_data",
3100  $mdtab,
3101  "",
3102  "ilobjectmetadatagui"
3103  );
3104  }
3105  }
3106 
3107  $lm_set = new ilSetting("lm");
3108 
3109  /*
3110  if ($this->getEnableEditing() && $lm_set->get("page_history", 1)) {
3111  $this->tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
3112  if ($_GET["history_mode"] == "1" || $this->ctrl->getCmd() == "compareVersion") {
3113  $this->tabs_gui->activateTab("history");
3114  }
3115  }*/
3116 
3117  /* $tabs = $this->ctrl->getTabs();
3118  foreach ($tabs as $tab)
3119  {
3120  $tabs_gui->addTarget($tab["lang_var"], $tab["link"]
3121  , $tab["cmd"], $tab["class"]);
3122  }
3123  */
3124 
3125  /*
3126  if ($this->getEnableEditing() && $this->user->getId() != ANONYMOUS_USER_ID) {
3127  $this->tabs_gui->addTarget("clipboard", $this->ctrl->getLinkTargetByClass(array(get_class($this), "ilEditClipboardGUI"), "view"), "view", "ilEditClipboardGUI");
3128  }*/
3129 
3130  if ($this->getPageConfig()->getEnableScheduledActivation()) {
3131  $this->tabs_gui->addTarget(
3132  "cont_activation",
3133  $this->ctrl->getLinkTarget($this, "editActivation"),
3134  "editActivation",
3135  get_class($this)
3136  );
3137  }
3138 
3139  if ($this->getEnabledNews()) {
3140  $this->tabs_gui->addTarget(
3141  "news",
3142  $this->ctrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
3143  "",
3144  "ilnewsitemgui"
3145  );
3146  }
3147 
3148  // external hook to add tabs
3149  if (is_array($this->tab_hook)) {
3150  $func = $this->tab_hook["func"];
3151  $this->tab_hook["obj"]->$func();
3152  }
3153  //$this->tabs_gui->setTabActive("pg");
3154  }
3155 
3159  public function compareVersion()
3160  {
3161  if (!$this->getEnableEditing()) {
3162  return;
3163  }
3164 
3165  $tpl = new ilTemplate("tpl.page_compare.html", true, true, "Services/COPage");
3166  $compare = $this->obj->compareVersion((int) $_POST["left"], (int) $_POST["right"]);
3167 
3168  // left page
3169  $lpage = $compare["l_page"];
3170  $cfg = $this->getPageConfig();
3171  $cfg->setPreventHTMLUnmasking(true);
3172 
3173  $this->setOutputMode(self::PREVIEW);
3174  $this->setPageObject($lpage);
3175  $this->setPresentationTitle($this->getPresentationTitle());
3176  $this->setCompareMode(true);
3177 
3178  $lhtml = $this->showPage();
3179  $lhtml = $this->replaceDiffTags($lhtml);
3180  $lhtml = str_replace("&lt;br /&gt;", "<br />", $lhtml);
3181  $tpl->setVariable("LEFT", $lhtml);
3182 
3183  // right page
3184  $rpage = $compare["r_page"];
3185  $this->setPageObject($rpage);
3186  $this->setPresentationTitle($this->getPresentationTitle());
3187  $this->setCompareMode(true);
3188  $this->setOutputMode(self::PREVIEW);
3189 
3190  $rhtml = $this->showPage();
3191  $rhtml = $this->replaceDiffTags($rhtml);
3192  $rhtml = str_replace("&lt;br /&gt;", "<br />", $rhtml);
3193  $tpl->setVariable("RIGHT", $rhtml);
3194 
3195  $tpl->setVariable("TXT_NEW", $this->lng->txt("cont_pc_new"));
3196  $tpl->setVariable("TXT_MODIFIED", $this->lng->txt("cont_pc_modified"));
3197  $tpl->setVariable("TXT_DELETED", $this->lng->txt("cont_pc_deleted"));
3198 
3199  //var_dump($left);
3200  //var_dump($right);
3201 
3202  return $tpl->get();
3203  }
3204 
3205  public function replaceDiffTags($a_html)
3206  {
3207  $a_html = str_replace("[ilDiffInsStart]", '<span class="ilDiffIns">', $a_html);
3208  $a_html = str_replace("[ilDiffDelStart]", '<span class="ilDiffDel">', $a_html);
3209  $a_html = str_replace("[ilDiffInsEnd]", '</span>', $a_html);
3210  $a_html = str_replace("[ilDiffDelEnd]", '</span>', $a_html);
3211 
3212  return $a_html;
3213  }
3214 
3218  public function editActivation()
3219  {
3220  $this->setBackToEditTabs();
3221 
3222  $atpl = new ilTemplate("tpl.page_activation.php", true, true, "Services/COPage");
3223  $this->initActivationForm();
3224  $this->getActivationFormValues();
3225  $atpl->setVariable("FORM", $this->form->getHTML());
3226  $atpl->setCurrentBlock("updater");
3227  $atpl->setVariable("UPDATER_FRAME", $this->exp_frame);
3228  $atpl->setVariable("EXP_ID_UPDATER", $this->exp_id);
3229  $atpl->setVariable("HREF_UPDATER", $this->exp_target_script);
3230  $atpl->parseCurrentBlock();
3231  $this->tpl->setContent($atpl->get());
3232  }
3233 
3237  public function initActivationForm()
3238  {
3239  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
3240  $this->form = new ilPropertyFormGUI();
3241  $this->form->setFormAction($this->ctrl->getFormAction($this));
3242  $this->form->setTitle($this->lng->txt("cont_page_activation"));
3243 
3244  // activation type radio
3245  $rad = new ilRadioGroupInputGUI($this->lng->txt("cont_activation"), "activation");
3246  $rad_op1 = new ilRadioOption($this->lng->txt("cont_activated"), "activated");
3247 
3248  $rad->addOption($rad_op1);
3249  $rad_op2 = new ilRadioOption($this->lng->txt("cont_deactivated"), "deactivated");
3250  $rad->addOption($rad_op2);
3251  $rad_op3 = new ilRadioOption($this->lng->txt("cont_scheduled_activation"), "scheduled");
3252 
3253  $dt_prop = new ilDateTimeInputGUI($this->lng->txt("cont_start"), "start");
3254  $dt_prop->setRequired(true);
3255  $dt_prop->setShowTime(true);
3256  $rad_op3->addSubItem($dt_prop);
3257  $dt_prop2 = new ilDateTimeInputGUI($this->lng->txt("cont_end"), "end");
3258  $dt_prop2->setRequired(true);
3259  $dt_prop2->setShowTime(true);
3260  $rad_op3->addSubItem($dt_prop2);
3261 
3262  // show activation information
3263  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_show_activation_info"), "show_activation_info");
3264  $cb->setInfo($this->lng->txt("cont_show_activation_info_info"));
3265  $rad_op3->addSubItem($cb);
3266 
3267 
3268  $rad->addOption($rad_op3);
3269 
3270  $this->form->addCommandButton("saveActivation", $this->lng->txt("save"));
3271 
3272  $this->form->addItem($rad);
3273  }
3274 
3278  public function getActivationFormValues()
3279  {
3280  $activation = "deactivated";
3281  if ($this->getPageObject()->getActive()) {
3282  $activation = "activated";
3283  }
3284 
3285  $dt_prop = $this->form->getItemByPostVar("start");
3286  if ($this->getPageObject()->getActivationStart() != "") {
3287  $activation = "scheduled";
3288  $dt_prop->setDate(new ilDateTime(
3289  $this->getPageObject()->getActivationStart(),
3291  ));
3292  }
3293  $dt_prop = $this->form->getItemByPostVar("end");
3294  if ($this->getPageObject()->getActivationEnd() != "") {
3295  $activation = "scheduled";
3296  $dt_prop->setDate(new ilDateTime(
3297  $this->getPageObject()->getActivationEnd(),
3299  ));
3300  }
3301 
3302  $this->form->getItemByPostVar("activation")->setValue($activation);
3303  $this->form->getItemByPostVar("show_activation_info")->setChecked($this->getPageObject()->getShowActivationInfo());
3304  }
3305 
3309  public function saveActivation()
3310  {
3311  $this->initActivationForm();
3312 
3313  if ($this->form->checkInput()) {
3314  $this->getPageObject()->setActive(true);
3315  $this->getPageObject()->setActivationStart(null);
3316  $this->getPageObject()->setActivationEnd(null);
3317  $this->getPageObject()->setShowActivationInfo($_POST["show_activation_info"]);
3318  if ($_POST["activation"] == "deactivated") {
3319  $this->getPageObject()->setActive(false);
3320  }
3321  if ($_POST["activation"] == "scheduled") {
3322  $this->getPageObject()->setActive(false);
3323  $this->getPageObject()->setActivationStart(
3324  $this->form->getItemByPostVar("start")->getDate()->get(IL_CAL_DATETIME)
3325  );
3326  $this->getPageObject()->setActivationEnd(
3327  $this->form->getItemByPostVar("end")->getDate()->get(IL_CAL_DATETIME)
3328  );
3329  }
3330  $this->getPageObject()->update();
3331  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
3332  $this->ctrl->redirect($this, "editActivation");
3333  }
3334  $this->form->setValuesByPost();
3335  $this->tpl->setContent($this->form->getHTML());
3336  }
3337 
3347  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, $export = false)
3348  {
3349  include_once("Services/Notes/classes/class.ilNoteGUI.php");
3350 
3351  // scorm 2004 page gui
3352  if (!$a_content_object) {
3353  $notes_gui = new ilNoteGUI(
3354  $this->notes_parent_id,
3355  (int) $this->obj->getId(),
3356  "pg"
3357  );
3358 
3359  $a_enable_private_notes = true;
3360  $a_enable_public_notes = true;
3361  $a_enable_notes_deletion = false;
3362  }
3363  // wiki page gui, blog posting gui
3364  else {
3365  $notes_gui = new ilNoteGUI(
3366  $a_content_object->getParentId(),
3367  $a_content_object->getId(),
3368  $a_content_object->getParentType()
3369  );
3370  }
3371 
3372  if ($a_enable_private_notes) {
3373  $notes_gui->enablePrivateNotes();
3374  }
3375  if ($a_enable_public_notes) {
3376  $notes_gui->enablePublicNotes();
3377  if ((bool) $a_enable_notes_deletion) {
3378  $notes_gui->enablePublicNotesDeletion(true);
3379  }
3380  }
3381  if ($export) {
3382  $notes_gui->setExportMode();
3383  }
3384 
3385  if ($a_callback) {
3386  $notes_gui->addObserver($a_callback);
3387  }
3388 
3389  $next_class = $this->ctrl->getNextClass($this);
3390  if ($next_class == "ilnotegui") {
3391  $html = $this->ctrl->forwardCommand($notes_gui);
3392  } else {
3393  $html = $notes_gui->getNotesHTML();
3394  }
3395  return $html;
3396  }
3397 
3401  public function processAnswer()
3402  {
3403  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
3405  ilUtil::stripSlashes($_POST["type"]),
3407  ilUtil::stripSlashes($_POST["answer"])
3408  );
3409  }
3410 
3411 
3412  //
3413  // Initially opened content (e.g. used in learning modules), that
3414  // is presented in another than the main content area (e.g. a picture in
3415  // the bottom left area)
3416  //
3417 
3424  public function initialOpenedContent()
3425  {
3426  $this->tabs_gui->activateTab("edit");
3427  $form = $this->initOpenedContentForm();
3428 
3429  $this->tpl->setContent($form->getHTML());
3430  }
3431 
3438  public function initOpenedContentForm()
3439  {
3440  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3441  $form = new ilPropertyFormGUI();
3442 
3443  // link input
3444  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
3445  $ac = new ilLinkInputGUI($this->lng->txt('cont_resource'), 'opened_content');
3447  $ac->setInternalLinkDefault("Media_Media", 0);
3448  $ac->setInternalLinkFilterTypes(array("PageObject_FAQ", "GlossaryItem", "Media_Media", "Media_FAQ"));
3449  $val = $this->obj->getInitialOpenedContent();
3450  if ($val["id"] != "" && $val["type"] != "") {
3451  $ac->setValue($val["type"] . "|" . $val["id"] . "|" . $val["target"]);
3452  }
3453 
3454  $form->addItem($ac);
3455 
3456  $form->addCommandButton("saveInitialOpenedContent", $this->lng->txt("save"));
3457  $form->addCommandButton("edit", $this->lng->txt("cancel"));
3458  $form->setTitle($this->lng->txt("cont_initial_attached_content"));
3459  $form->setFormAction($this->ctrl->getFormAction($this));
3460 
3461  return $form;
3462  }
3463 
3470  public function saveInitialOpenedContent()
3471  {
3472  $this->obj->saveInitialOpenedContent(
3473  ilUtil::stripSlashes($_POST["opened_content_ajax_type"]),
3474  ilUtil::stripSlashes($_POST["opened_content_ajax_id"]),
3475  ilUtil::stripSlashes($_POST["opened_content_ajax_target"])
3476  );
3477 
3478  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
3479  $this->ctrl->redirect($this, "edit");
3480  }
3481 
3485 
3486 
3490  public function switchToLanguage()
3491  {
3492  $l = ilUtil::stripSlashes($_GET["totransl"]);
3493  $p = $this->getPageObject();
3494  if (!ilPageObject::_exists($p->getParentType(), $p->getId(), $l)) {
3496  return;
3497  }
3498  $this->ctrl->setParameter($this, "transl", $_GET["totransl"]);
3499  $this->ctrl->redirect($this, "edit");
3500  }
3501 
3506  {
3507  $l = ilUtil::stripSlashes($_GET["totransl"]);
3508  $this->ctrl->setParameter($this, "totransl", $l);
3509  $this->lng->loadLanguageModule("meta");
3510 
3511  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
3512  $cgui = new ilConfirmationGUI();
3513  $cgui->setFormAction($this->ctrl->getFormAction($this));
3514  $cgui->setHeaderText($this->lng->txt("cont_page_translation_does_not_exist") . ": " .
3515  $this->lng->txt("meta_l_" . $l));
3516  $cgui->setCancel($this->lng->txt("cancel"), "editMasterLanguage");
3517  $cgui->setConfirm($this->lng->txt("confirm"), "createPageTranslation");
3518  $this->tpl->setContent($cgui->getHTML());
3519  }
3520 
3524  public function editMasterLanguage()
3525  {
3526  $this->ctrl->setParameter($this, "transl", "");
3527  $this->ctrl->redirect($this, "edit");
3528  }
3529 
3533  public function createPageTranslation()
3534  {
3535  $l = ilUtil::stripSlashes($_GET["totransl"]);
3536 
3537  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
3539  $this->getPageObject()->getParentType(),
3540  $this->getPageObject()->getId(),
3541  0,
3542  "-"
3543  );
3544  $p->copyPageToTranslation($l);
3545  $this->ctrl->setParameter($this, "transl", $l);
3546  $this->ctrl->redirect($this, "edit");
3547  }
3548 
3552  public function releasePageLock()
3553  {
3554  $this->getPageObject()->releasePageLock();
3555  ilUtil::sendSuccess($this->lng->txt("cont_page_lock_released"), true);
3556  $this->finishEditing();
3557  }
3558 
3559  public function finishEditing()
3560  {
3561  $this->ctrl->redirect($this, "preview");
3562  }
3563 
3564  protected function isPageContainerToBeRendered()
3565  {
3566  return (
3567  $this->getRenderPageContainer() || ($this->getOutputMode() == self::PREVIEW && $this->getPageConfig()->getUsePageContainer())
3568  );
3569  }
3570 
3577  public function getPagePermaLink()
3578  {
3579  return "";
3580  }
3581 
3587  {
3588  $collector = new \ILIAS\COPage\ResourcesCollector($this->getOutputMode(), $this->getPageObject());
3589 
3590  foreach ($collector->getJavascriptFiles() as $js) {
3591  $tpl->addJavascript($js);
3592  }
3593 
3594  foreach ($collector->getCssFiles() as $css) {
3595  $tpl->addCss($css);
3596  }
3597 
3598  foreach ($collector->getOnloadCode() as $code) {
3599  $tpl->addOnloadCode($code);
3600  }
3601  }
3602 
3607  public function getAdditionalPageActions() : array
3608  {
3609  return [];
3610  }
3611 }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
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.
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.
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.
insertAdvTrigger($a_output)
Insert adv content trigger.
exit
Definition: login.php:29
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
rollbackConfirmation()
Rollback confirmation.
setEditorToolContext()
Set editor tool context.
Page linker.
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
static getPlaceHolderStylePath()
get placeholder style path (for Page Layouts)
setEnablePCType($a_pc_type, $a_val)
Set enable pc type.
getPageObject()
Get Page Object.
const ILIAS_VERSION
const IL_CAL_DATETIME
Class ilEditClipboardGUI.
editMasterLanguage()
Edit master language.
$c
Definition: cli.php:37
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_SESSION["AccountId"]
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
setTemplateOutput($a_output=true)
__construct( $a_parent_type, $a_id, $a_old_nr=0, $a_prevent_get_id=false, $a_lang="", $concrete_lang="")
Constructor.
This class represents a property form user interface.
displayMediaFullscreen()
Show media in fullscreen mode.
special template class to simplify handling of ITX/PEAR
$type
This class represents a captcha input in a property form.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getPrependingHtml()
Get Prepending HTML.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
setParentType($a_val)
Set parent type.
setQuestionXML($question_xml)
Class ChatMainBarProvider .
static hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
xslt_free(&$proc)
getProfileBackUrl()
Get profile back url.
getBlockingInfoMessage()
Get block info message.
compareVersion()
Compares two revisions of the page.
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
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.
if(strpos($jquery_path, './')===0) elseif(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:54
getLanguage()
Get language.
User Interface for NewsItem entities.
setEnabledNews($a_enabled, $a_news_obj_id=0, $a_news_obj_type=0)
Set enabled news.
static getPCDefinitions()
Get PC definitions.
confirmPageTranslationCreation()
Confirm page translation creation.
This class represents a checkbox property in a property form.
getTabs($a_activate="")
adds tabs to tab gui object
static _lookupTitle($a_id)
lookup object title
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
setEnableEditing($a_enableediting)
Set Enable Editing.
Class ilInternalLinkGUI.
insertJSAtPlaceholder()
InsertJS at placeholder.
Class ilMediaPoolPage.
static requirePCClassByName($a_name)
Get instance.
showEditToolbar()
Show edit toolbar.
setDefaultLinkXml()
Set standard link xml.
executeCommand()
execute command
static _getTextCharacteristics($a_style_id, $a_include_core=false)
Get text characteristics.
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 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
setLinkXml($xml)
Set linkXML.
user()
Definition: user.php:4
setLinkParams($l_params="")
setTemplateTargetVar($a_variable)
getEnabledTabs()
Get Output tabs.
previewHistory()
Preview history.
Page Editor GUI class.
setPageLinker($page_linker)
This class represents a date/time property in a property form.
Notes GUI class.
getOldNr()
Get old nr (historic page)
help()
Definition: help.php:2
setInfo($a_info)
Set Information Text.
static insertResourcesIntoPageContent($a_content)
Insert resources (see also ilContainerContentGUI::determinePageEmbeddedBlocks for presentation) ...
static isTypeAllowed($a_type)
Is type allowed.
getParentType()
Get parent type.
$section
Definition: Utf8Test.php:83
presentation($a_mode=self::PRESENTATION)
xslt_error(&$proc)
static collectContentIncludes($a_page, $a_domdoc)
get all content includes that are used within the page
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
initEditing()
Init editing.
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.
addResourcesToTemplate(ilGlobalTemplateInterface $tpl)
Add resources to template.
setFullscreenLink($a_fullscreen_link)
Set fullscreen link.
determineFullscreenLink()
Determine fullscreen link.
getEnabledNews()
Get enabled news.
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.
addSubItem($a_item)
Add Subitem.
special template class to simplify handling of ITX/PEAR
setOfflineDirectory($offdir)
set offline directory to offdir
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, \ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper=null)
Get Tiny Menu.
setEnabledHref(bool $enable)
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.
getPageConfig()
Get page config object.
setPageObject(ilPageObject $a_pg_obj)
Set Page Object.
setCompareMode($a_val)
Set compare mode.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
setExplorerUpdater($a_exp_frame, $a_exp_id, $a_exp_target_script)
Set Explorer Updater.
global $DIC
Definition: goto.php:24
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.
setRawPageContent($a_rawpagecontent)
Set Get raw page content only.
setPresentationTitle($a_title="")
ui()
Definition: ui.php:5
setSourcecodeDownloadScript($script_name)
Set sourcecode download script.
static _lookupOwner($a_id)
lookup object owner
$xml
Definition: metadata.php:332
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.
getOpenPlaceHolder()
Get open placeholder.
static getCacheTriggerString($a_page)
Get page cache update trigger string.
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)
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.
getOfflineDirectory()
get offline directory
static isActivated()
Checks whether Map feature is activated.
displayMedia($a_fullscreen=false)
Display media.
setEnabledTabs($a_enabledtabs)
Set Output tabs.
setPageConfig($a_val)
Set page config object.
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.
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
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static getInstance()
Singleton: get instance.
getEnabledPageFocus()
Get Enable page focus.
setEditMode()
Set edit mode.
onFeedbackEditingForwarding()
On feedback editing forwarding.
getAdditionalPageActions()
Get additional page actions.
getViewPageLink()
get view page link
setAbstractOnly($a_val, $pcid="")
Set abstract only.
initPageObject()
Init page object.
setTabHook($a_object, $a_function)
Set tab hook.
Class ilObjStyleSheet.
showPage()
display content of page
$ret
Definition: parser.php:6
setProfileBackUrl($url)
Get profile back url.
setOpenPlaceHolder($a_val)
Set open placeholder.
const IL_MODE_OUTPUT
static getLogger($a_component_id)
Get component logger.
$url
setOutputMode($a_mode=self::PRESENTATION)
Set Output Mode.
enablePrivateNotes($a_enable=true)
enable private notes
getSourcecodeDownloadScript()
Get sourcecode download script.
static saveQuestionAnswer($a_type, $a_id, $a_answer)
Save question answer.
language()
Definition: language.php:2
insertResources($a_output)
Insert resources.
processAnswer()
Process answer.
getRenderPageContainer()
Get render page container.
getPagePermaLink()
Get page perma link.
setLanguage($a_val)
Set language.
getNotesHTML($a_content_object=null, $a_enable_private_notes=true, $a_enable_public_notes=false, $a_enable_notes_deletion=false, $a_callback=null, $export=false)
Get html for public and/or private notes.
setQEditTabs($a_active)
Set question editing tabs.
getViewPageTarget()
get view page target frame
static getWebspaceDir($mode="filesystem")
get webspace directory
createPageTranslation()
Create page translation.
$_POST["username"]
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 (LIST, BOTH, INT, EXT)
static strPosAll($a_haystack, $a_needle)
Get all positions of a string.
static replaceFirsOccurence($a_old, $a_new, $a_str)
Replaces the first occurence of $a_old in $a_str with $a_new.
setActivationListener(&$a_obj, $a_meth)
$i
Definition: metadata.php:24
setQuestionHTML($question_html)
Confirmation screen class.
displayValidationError($a_error)
display validation error
static initJavascript()
Init javascript.