00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once ("./Services/COPage/classes/class.ilPageEditorGUI.php");
00025 include_once("./Services/COPage/classes/class.ilPageObject.php");
00026 include_once("./Modules/LearningModule/classes/class.ilEditClipboardGUI.php");
00027 include_once("./Services/COPage/classes/class.ilParagraphPlugins.php");
00028 include_once("./Services/COPage/classes/class.ilParagraphPlugin.php");
00029 include_once("./Services/Utilities/classes/class.ilDOMUtil.php");
00030
00031
00045 class ilPageObjectGUI
00046 {
00047 var $ilias;
00048 var $tpl;
00049 var $lng;
00050 var $ctrl;
00051 var $obj;
00052 var $output_mode;
00053 var $output_submode;
00054 var $presentation_title;
00055 var $target_script;
00056 var $return_location;
00057 var $target_var;
00058 var $template_output_var;
00059 var $output2template;
00060 var $link_params;
00061 var $bib_id;
00062 var $citation;
00063 var $sourcecode_download_script;
00064 var $change_comments;
00065 var $question_html;
00066 var $activation = false;
00067 var $activated = true;
00068 var $enabledinternallinks = true;
00069
00074 function ilPageObjectGUI(&$a_page_object)
00075 {
00076 global $ilias, $tpl, $lng, $ilCtrl,$ilTabs;
00077
00078 $this->ctrl =& $ilCtrl;
00079
00080 $this->ilias =& $ilias;
00081 $this->tpl =& $tpl;
00082 $this->ctrl =& $ilCtrl;
00083 $this->lng =& $lng;
00084 $this->obj =& $a_page_object;
00085 $this->output_mode = "presentation";
00086 $this->setPageObject($a_page_object);
00087 $this->output2template = true;
00088 $this->question_xml = "";
00089 $this->question_html = "";
00090 $this->tabs_gui =& $ilTabs;
00091
00092
00093 $this->template_output_var = "PAGE_CONTENT";
00094 $this->citation = false;
00095 $this->change_comments = false;
00096 $this->page_back_title = $this->lng->txt("page");
00097 }
00098
00104 function _forwards()
00105 {
00106 return array("ilPageEditorGUI");
00107 }
00108
00109
00110 function setBibId($a_id)
00111 {
00112
00113 $this->bib_id = $a_id;
00114 }
00115
00116 function getBibId()
00117 {
00118 return $this->bib_id ? $this->bib_id : 0;
00119 }
00120
00121 function setPageObject(&$a_pg_obj)
00122 {
00123 $this->obj =& $a_pg_obj;
00124 }
00125
00126 function &getPageObject()
00127 {
00128 return $this->obj;
00129 }
00130
00134 function setOutputMode($a_mode = "presentation")
00135 {
00136 $this->output_mode = $a_mode;
00137 }
00138
00139 function getOutputMode()
00140 {
00141 return $this->output_mode;
00142 }
00143
00144 function setTemplateOutput($a_output = true)
00145 {
00146 $this->output2template = $a_output;
00147 }
00148
00149 function outputToTemplate()
00150 {
00151 return $this->output2template;
00152 }
00153
00154 function setPresentationTitle($a_title = "")
00155 {
00156 $this->presentation_title = $a_title;
00157 }
00158
00159 function getPresentationTitle()
00160 {
00161 return $this->presentation_title;
00162 }
00163
00164 function setHeader($a_title = "")
00165 {
00166 $this->header = $a_title;
00167 }
00168
00169 function getHeader()
00170 {
00171 return $this->header;
00172 }
00173
00174 function setLinkParams($l_params = "")
00175 {
00176 $this->link_params = $l_params;
00177 }
00178
00179 function getLinkParams()
00180 {
00181 return $this->link_params;
00182 }
00183
00184 function setLinkFrame($l_frame = "")
00185 {
00186 $this->link_frame = $l_frame;
00187 }
00188
00189 function getLinkFrame()
00190 {
00191 return $this->link_frame;
00192 }
00193
00194 function setLinkXML($link_xml)
00195 {
00196 $this->link_xml = $link_xml;
00197 }
00198
00199 function getLinkXML()
00200 {
00201 return $this->link_xml;
00202 }
00203
00204 function setQuestionXML($question_xml)
00205 {
00206 $this->question_xml = $question_xml;
00207 }
00208
00209 function setQuestionHTML($question_html)
00210 {
00211 $this->question_html = $question_html;
00212 }
00213
00214 function getQuestionXML()
00215 {
00216 return $this->question_xml;
00217 }
00218
00219 function getQuestionHTML()
00220 {
00221 return $this->question_html;
00222 }
00223
00224 function setTemplateTargetVar($a_variable)
00225 {
00226 $this->target_var = $a_variable;
00227 }
00228
00229 function getTemplateTargetVar()
00230 {
00231 return $this->target_var;
00232 }
00233
00234 function setTemplateOutputVar($a_value)
00235 {
00236
00237 $this->template_output_var = $a_value;
00238 }
00239
00240 function getTemplateOutputVar()
00241 {
00242 return $this->template_output_var;
00243 }
00244
00245 function setOutputSubmode($a_mode)
00246 {
00247
00248 $this->output_submode = $a_mode;
00249 }
00250
00251 function getOutputSubmode()
00252 {
00253 return $this->output_submode;
00254 }
00255
00256
00257 function setSourcecodeDownloadScript ($script_name) {
00258 $this->sourcecode_download_script = $script_name;
00259 }
00260
00261 function getSourcecodeDownloadScript () {
00262 return $this->sourcecode_download_script;
00263 }
00264
00265 function enableCitation($a_enabled)
00266 {
00267 $this->citation = $a_enabled;
00268 }
00269
00270 function isEnabledCitation()
00271 {
00272 return $this->citation;
00273 }
00274
00275 function setLocator(&$a_locator)
00276 {
00277 $this->locator =& $a_locator;
00278 }
00279
00280 function setTabs($a_tabs)
00281 {
00282 $this->tabs_gui = $a_tabs;
00283 }
00284
00285 function setPageBackTitle($a_title)
00286 {
00287 $this->page_back_title = $a_title;
00288 }
00289
00290 function setFileDownloadLink($a_download_link)
00291 {
00292 $this->file_download_link = $a_download_link;
00293 }
00294
00295 function getFileDownloadLink()
00296 {
00297 return $this->file_download_link;
00298 }
00299
00300 function setFullscreenLink($a_fullscreen_link)
00301 {
00302 $this->fullscreen_link = $a_fullscreen_link;
00303 }
00304
00305 function getFullscreenLink()
00306 {
00307 return $this->fullscreen_link;
00308 }
00309
00310 function setIntLinkHelpDefault($a_type, $a_id)
00311 {
00312 $this->int_link_def_type = $a_type;
00313 $this->int_link_def_id = $a_id;
00314 }
00315
00316 function setIntLinkReturn($a_return)
00317 {
00318 $this->int_link_return = $a_return;
00319 }
00320
00321 function enableChangeComments($a_enabled)
00322 {
00323 $this->change_comments = $a_enabled;
00324 }
00325
00326 function isEnabledChangeComments()
00327 {
00328 return $this->change_comments;
00329 }
00330
00336 function setOfflineDirectory ($offdir) {
00337 $this->offline_directory = $offdir;
00338 }
00339
00340
00345 function getOfflineDirectory () {
00346 return $this->offline_directory;
00347 }
00348
00349
00356 function setViewPageLink($a_link, $a_target = "")
00357 {
00358 $this->view_page_link = $a_link;
00359 $this->view_page_target = $a_target;
00360 }
00361
00365 function getViewPageLink()
00366 {
00367 return $this->view_page_link;
00368 }
00369
00373 function getViewPageTarget()
00374 {
00375 return $this->view_page_target;
00376 }
00377
00378 function setActivationListener(&$a_obj, $a_meth)
00379 {
00380 $this->act_obj =& $a_obj;
00381 $this->act_meth = $a_meth;
00382 }
00383
00384 function setActivated($a_act)
00385 {
00386 $this->activated = $a_act;
00387 }
00388
00389 function getActivated()
00390 {
00391 return $this->activated;
00392 }
00393
00394 function setEnabledActivation($a_act)
00395 {
00396 $this->activation = $a_act;
00397 }
00398
00399 function getEnabledActivation()
00400 {
00401 return $this->activation;
00402 }
00403
00409 function setEnabledInternalLinks($a_enabledinternallinks)
00410 {
00411 $this->enabledinternallinks = $a_enabledinternallinks;
00412 }
00413
00419 function getEnabledInternalLinks()
00420 {
00421 return $this->enabledinternallinks;
00422 }
00423
00427 function &executeCommand()
00428 {
00429 $next_class = $this->ctrl->getNextClass($this);
00430
00431 $cmd = $this->ctrl->getCmd();
00432 $this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
00433 , "view", "ilEditClipboardGUI");
00434
00435 switch($next_class)
00436 {
00437 case "ileditclipboardgui":
00438 $this->tabs_gui->clearTargets();
00439
00440 $clip_gui = new ilEditClipboardGUI();
00441 $clip_gui->setPageBackTitle($this->page_back_title);
00442
00443 $ret =& $this->ctrl->forwardCommand($clip_gui);
00444 break;
00445
00446 case "ilpageeditorgui":
00447 $page_editor =& new ilPageEditorGUI($this->getPageObject(), $this);
00448 $page_editor->setLocator($this->locator);
00449 $page_editor->setHeader($this->getHeader());
00450 $page_editor->setPageBackTitle($this->page_back_title);
00451 $page_editor->setIntLinkHelpDefault($this->int_link_def_type,
00452 $this->int_link_def_id);
00453 $page_editor->setIntLinkReturn($this->int_link_return);
00454
00455 $ret =& $this->ctrl->forwardCommand($page_editor);
00456 break;
00457
00458
00459 case "ilmediapooltargetselector":
00460 include_once("./classes/class.ilMediaPoolTargetSelector.php");
00461 $target_sel =& new ilMediaPoolTargetSelector();
00462 $ret =& $this->ctrl->forwardCommand($target_sel);
00463 break;
00464
00465 default:
00466 $ret =& $this->$cmd();
00467 break;
00468 }
00469 }
00470
00471
00472 function deactivatePage()
00473 {
00474 $act_meth = $this->act_meth;
00475 $this->act_obj->$act_meth(false);
00476 $this->ctrl->redirectByClass("illmpageobjectgui", "view");
00477 }
00478
00479 function activatePage()
00480 {
00481 $act_meth = $this->act_meth;
00482 $this->act_obj->$act_meth(true);
00483 $this->ctrl->redirectByClass("illmpageobjectgui", "view");
00484 }
00485
00486
00487
00488
00489 function showPage()
00490 {
00491 global $tree, $ilUser, $ilias;
00492
00493
00494 if($this->outputToTemplate())
00495 {
00496 if($this->getOutputMode() == "edit")
00497 {
00498
00499 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
00500
00501
00502 $this->tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
00503
00504
00505 if ($this->isEnabledChangeComments())
00506 {
00507 $this->tpl->setCurrentBlock("change_comment");
00508 $this->tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
00509 $this->tpl->parseCurrentBlock();
00510 $this->tpl->setCurrentBlock("adm_content");
00511 }
00512
00513
00514 $this->tpl->setVariable("TXT_INSERT_BEFORE", $this->lng->txt("cont_set_before"));
00515 $this->tpl->setVariable("TXT_INSERT_AFTER", $this->lng->txt("cont_set_after"));
00516 $this->tpl->setVariable("TXT_INSERT_CANCEL", $this->lng->txt("cont_set_cancel"));
00517 $this->tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
00518 $this->tpl->setVariable("JS_DRAGDROP", ILIAS_HTTP_PATH."/Services/COPage/js/wz_dragdrop.js");
00519 $this->tpl->setVariable("IMG_DRAGDROP",
00520 ilUtil::getImagePath("icon_drag.gif"));
00521
00522 if (!ilPageEditorGUI::_isBrowserJSEditCapable())
00523 {
00524 $this->tpl->setVariable("TXT_JAVA_SCRIPT_CAPABLE", "<br />".$this->lng->txt("cont_browser_not_js_capable"));
00525 }
00526 $this->tpl->setVariable("TXT_CHANGE_EDIT_MODE", $this->lng->txt("cont_set_edit_mode"));
00527
00528 if ($this->getEnabledActivation())
00529 {
00530 $this->tpl->setCurrentBlock("de_activate_page");
00531 if ($this->getActivated())
00532 {
00533 $this->tpl->setVariable("TXT_DE_ACTIVATE_PAGE", $this->lng->txt("cont_deactivate_page"));
00534 $this->tpl->setVariable("CMD_DE_ACTIVATE_PAGE", "deactivatePage");
00535 }
00536 else
00537 {
00538 $this->tpl->setVariable("TXT_DE_ACTIVATE_PAGE", $this->lng->txt("cont_activate_page"));
00539 $this->tpl->setVariable("CMD_DE_ACTIVATE_PAGE", "activatePage");
00540 }
00541 $this->tpl->parseCurrentBlock();
00542 }
00543
00544
00545 $med_mode = array("enable" => $this->lng->txt("cont_enable_media"),
00546 "disable" => $this->lng->txt("cont_disable_media"));
00547 $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
00548 ? "disable"
00549 : "enable";
00550
00551 $js_mode = array("enable" => $this->lng->txt("cont_enable_js"),
00552 "disable" => $this->lng->txt("cont_disable_js"));
00553
00554 $this->tpl->setVariable("SEL_MEDIA_MODE",
00555 ilUtil::formSelect($sel_media_mode, "media_mode", $med_mode, false, true,
00556 0, "ilEditSelect"));
00557
00558
00559 $html_mode = array("enable" => $this->lng->txt("cont_enable_html"),
00560 "disable" => $this->lng->txt("cont_disable_html"));
00561 $sel_html_mode = ($ilUser->getPref("ilPageEditor_HTMLMode") == "disable")
00562 ? "disable"
00563 : "enable";
00564 $this->tpl->setVariable("SEL_HTML_MODE",
00565 ilUtil::formSelect($sel_html_mode, "html_mode", $html_mode, false, true,
00566 0, "ilEditSelect"));
00567
00568 if ($this->getViewPageLink() != "")
00569 {
00570 $this->tpl->setCurrentBlock("view_link");
00571 $this->tpl->setVariable("LINK_VIEW_PAGE",
00572 $this->getViewPageLink());
00573 $this->tpl->setVariable("TARGET_VIEW_PAGE",
00574 $this->getViewPageTarget());
00575 $this->tpl->setVariable("TXT_VIEW_PAGE", $this->lng->txt("view"));
00576 $this->tpl->parseCurrentBlock();
00577 }
00578
00579
00580 $sel_js_mode = "disable";
00581 if($ilias->getSetting("enable_js_edit"))
00582 {
00583 $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
00584 ? "enable"
00585 : "disable";
00586 $this->tpl->setVariable("SEL_JAVA_SCRIPT",
00587 ilUtil::formSelect($sel_js_mode, "js_mode", $js_mode, false, true,
00588 0, "ilEditSelect"));
00589 }
00590
00591
00592 if ($sel_js_mode == "disable")
00593 {
00594 $this->tpl->setCurrentBlock("multi_actions");
00595 $this->tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
00596 $this->tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
00597 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00598 $this->tpl->parseCurrentBlock();
00599 }
00600 }
00601 else
00602 {
00603 if($this->getOutputSubmode() == 'translation')
00604 {
00605 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_translation_content.html", "Services/COPage");
00606 }
00607 else
00608 {
00609
00610 if($this->getOutputMode() != 'preview')
00611 {
00612 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_content.html", "Services/COPage");
00613 }
00614 else
00615 {
00616 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_preview.html", "Services/COPage");
00617 }
00618 }
00619 }
00620 if ($this->getOutputMode() != "presentation" &&
00621 $this->getOutputMode() != "offline" &&
00622 $this->getOutputMode() != "print")
00623 {
00624 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
00625 }
00626
00627
00628 if($this->getOutputMode() == "edit")
00629 {
00630 $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
00631 $this->obj->getId());
00632 $mob_links = array();
00633 foreach($links as $link)
00634 {
00635 if ($link["type"] == "mob")
00636 {
00637 if (ilObject::_exists($link["id"]))
00638 {
00639 $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
00640 }
00641 }
00642 }
00643
00644 if (count($mob_links) > 0)
00645 {
00646 $this->tpl->setCurrentBlock("med_link");
00647 $this->tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
00648 $this->tpl->setVariable("SEL_MED_LINKS",
00649 ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
00650 $this->tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
00651 $this->tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
00652
00653 $this->tpl->parseCurrentBlock();
00654 }
00655 }
00656
00657 if ($_GET["reloadTree"] == "y")
00658 {
00659 $this->tpl->setCurrentBlock("reload_tree");
00660 if ($this->obj->getParentType() == "dbk")
00661 {
00662 $this->tpl->setVariable("LINK_TREE",
00663 $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer"));
00664 }
00665 else
00666 {
00667 $this->tpl->setVariable("LINK_TREE",
00668 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer"));
00669 }
00670 $this->tpl->parseCurrentBlock();
00671 }
00672 }
00673
00674
00675 $builded = $this->obj->buildDom();
00676 $this->obj->addFileSizes();
00677
00678
00679 if($this->getOutputMode() == "edit")
00680 {
00681 $this->obj->addHierIDs();
00682
00683 $hids = $this->obj->getHierIds();
00684 $row1_ids = $this->obj->getFirstRowIds();
00685 $col1_ids = $this->obj->getFirstColumnIds();
00686 $litem_ids = $this->obj->getListItemIds();
00687 $fitem_ids = $this->obj->getFileItemIds();
00688
00689
00690 $hids = $this->obj->getHierIds();
00691 foreach($hids as $hid)
00692 {
00693 $this->tpl->setCurrentBlock("add_dhtml");
00694 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
00695 $this->tpl->parseCurrentBlock();
00696 }
00697
00698
00699 foreach($col1_ids as $hid)
00700 {
00701 $this->tpl->setCurrentBlock("add_dhtml");
00702 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
00703 $this->tpl->parseCurrentBlock();
00704 }
00705
00706
00707 foreach($row1_ids as $hid)
00708 {
00709 $this->tpl->setCurrentBlock("add_dhtml");
00710 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
00711 $this->tpl->parseCurrentBlock();
00712 }
00713
00714
00715 foreach($litem_ids as $hid)
00716 {
00717 $this->tpl->setCurrentBlock("add_dhtml");
00718 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
00719 $this->tpl->parseCurrentBlock();
00720 }
00721
00722
00723 foreach($fitem_ids as $hid)
00724 {
00725 $this->tpl->setCurrentBlock("add_dhtml");
00726 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
00727 $this->tpl->parseCurrentBlock();
00728 }
00729 }
00730
00731 $this->obj->addSourceCodeHighlighting($this->getOutputMode());
00732
00733
00734 $content = $this->obj->getXMLFromDom(false, true, true,
00735 $this->getLinkXML().$this->getQuestionXML());
00736
00737
00738 if($builded !== true)
00739 {
00740 $this->displayValidationError($builded);
00741 }
00742 else
00743 {
00744 $this->displayValidationError($_SESSION["il_pg_error"]);
00745 }
00746 unset($_SESSION["il_pg_error"]);
00747
00748 if(isset($_SESSION["citation_error"]))
00749 {
00750 ilUtil::sendInfo($this->lng->txt("cont_citation_selection_not_valid"));
00751 session_unregister("citation_error");
00752 unset($_SESSION["citation_error"]);
00753 }
00754
00755
00756 $pg_title = $this->getPresentationTitle();
00757
00758
00759
00760
00761 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
00762 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
00763 $xh = xslt_create();
00764
00765
00766
00767
00768
00769 $add_path = ilUtil::getImagePath("add.gif");
00770 $col_path = ilUtil::getImagePath("col.gif");
00771 $row_path = ilUtil::getImagePath("row.gif");
00772 $item_path = ilUtil::getImagePath("item.gif");
00773 $med_disabled_path = ilUtil::getImagePath("media_disabled.gif");
00774
00775 if ($this->getOutputMode() != "offline")
00776 {
00777 $enlarge_path = ilUtil::getImagePath("enlarge.gif");
00778 $wb_path = ilUtil::getWebspaceDir("output");
00779 }
00780 else
00781 {
00782 $enlarge_path = "images/enlarge.gif";
00783 $wb_path = ".";
00784 }
00785 $pg_title_class = ($this->getOutputMode() == "print")
00786 ? "ilc_PrintPageTitle"
00787 : "";
00788
00789
00790
00791 $enable_split_new = ($this->obj->getParentType() == "lm" ||
00792 $this->obj->getParentType() == "dbk")
00793 ? "y"
00794 : "n";
00795
00796
00797
00798 if (($this->obj->getParentType() == "lm" ||
00799 $this->obj->getParentType() == "dbk") &&
00800 ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
00801 $this->obj->getId()))
00802 {
00803 $enable_split_next = "y";
00804 }
00805 else
00806 {
00807 $enable_split_next = "n";
00808 }
00809
00810
00811 $paragraph_plugins = new ilParagraphPlugins();
00812 $paragraph_plugins->initialize ();
00813
00814
00815 if ($this->getOutputMode() == "presentation" )
00816 {
00817 $paragraph_plugin_string = $paragraph_plugins->serializeToString();
00818 $_SESSION ["paragraph_plugins"] = $paragraph_plugins;
00819 }
00820
00821 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
00822
00823
00824
00825
00826
00827 $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
00828 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
00829 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
00830 'img_add' => $add_path,
00831 'img_col' => $col_path,
00832 'img_row' => $row_path,
00833 'img_item' => $item_path,
00834 'enable_split_new' => $enable_split_new,
00835 'enable_split_next' => $enable_split_next,
00836 'link_params' => $this->link_params,
00837 'file_download_link' => $this->getFileDownloadLink(),
00838 'fullscreen_link' => $this->getFullscreenLink(),
00839 'med_disabled_path' => $med_disabled_path,
00840 'img_path' => $img_path,
00841 'parent_id' => $this->obj->getParentId(),
00842 'download_script' => $this->sourcecode_download_script,
00843 'encoded_download_script' => urlencode($this->sourcecode_download_script),
00844
00845 'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
00846 'pagebreak' => $this->lng->txt('dgl_pagebreak'),
00847 'page' => $this->lng->txt('page'),
00848 'citate_page' => $this->lng->txt('citate_page'),
00849 'citate_from' => $this->lng->txt('citate_from'),
00850 'citate_to' => $this->lng->txt('citate_to'),
00851 'citate' => $this->lng->txt('citate'),
00852
00853 'media_mode' => $ilUser->getPref("ilPageEditor_MediaMode"),
00854 'javascript' => $sel_js_mode,
00855 'paragraph_plugins' => $paragraph_plugin_string);
00856 if($this->link_frame != "")
00857 $params["pg_frame"] = $this->link_frame;
00858
00859
00860
00861
00862
00863
00864
00865 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00866
00867
00868
00869 xslt_free($xh);
00870
00871
00872 if ($this->getOutputMode() != "edit" ||
00873 $ilUser->getPref("ilPageEditor_HTMLMode") != "disable")
00874 {
00875 $output = str_replace("<","<",$output);
00876 $output = str_replace(">",">",$output);
00877 }
00878 $output = str_replace("&", "&", $output);
00879
00880 if ($this->getOutputMode() != "offline")
00881 {
00882 $output = ilUtil::insertLatexImages($output);
00883 }
00884 else
00885 {
00886 $output = ilUtil::buildLatexImages($output,
00887 $this->getOfflineDirectory());
00888 }
00889
00890
00891
00892
00893 $output = str_replace("{", "{", $output);
00894 $output = str_replace("}", "}", $output);
00895
00896
00897
00898
00899 $output = str_replace("\n", "", $output);
00900
00901 $qhtml = $this->getQuestionHTML();
00902 if (strlen($qhtml))
00903 {
00904
00905
00906
00907 $output = preg_replace("/(<div( xmlns:xhtml\=\"http:\/\/www.w3.org\/1999\/xhtml\"){0,1} class\=\"ilc_Question\">)/ims", "\\1" . $qhtml, $output);
00908
00909
00910
00911 }
00912
00913 if($this->getOutputMode() == "edit" && !$this->getActivated())
00914 {
00915 $output = '<div class="il_editarea_disabled">'.$output.'</div>';
00916 }
00917
00918
00919 if($this->outputToTemplate())
00920 {
00921 $this->tpl->setVariable($this->getTemplateOutputVar(), $output);
00922 return $output;
00923 }
00924 else
00925 {
00926 return $output;
00927 }
00928 }
00929
00930
00931
00932
00933 function preview()
00934 {
00935 global $tree;
00936 $this->setOutputMode("preview");
00937 return $this->showPage();
00938 }
00939
00940
00941
00942
00943 function view()
00944 {
00945 global $tree;
00946 $this->setOutputMode("edit");
00947 return $this->showPage();
00948 }
00949
00950
00951
00952
00953 function presentation($mode = "presentation")
00954 {
00955 global $tree;
00956 $this->setOutputMode($mode);
00957 return $this->showPage();
00958 }
00959
00960
00964 function showMediaFullscreen($a_style_id = 0)
00965 {
00966 $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
00967 $this->tpl->setCurrentBlock("ContentStyle");
00968 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
00969 $this->tpl->parseCurrentBlock();
00970
00971 $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
00972 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00973 $this->tpl->setCurrentBlock("ilMedia");
00974
00975 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
00976 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00977 if (!empty ($_GET["pg_id"]))
00978 {
00979 require_once("./Services/COPage/classes/class.ilPageObject.php");
00980 $pg_obj =& new ilPageObject($this->obj->getParentType(), $_GET["pg_id"]);
00981 $pg_obj->buildDom();
00982
00983 $xml = "<dummy>";
00984
00985
00986 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
00987 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00988 $xml.="</dummy>";
00989 }
00990 else
00991 {
00992 $xml = "<dummy>";
00993 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00994 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00995 $xml.="</dummy>";
00996 }
00997
00998
00999
01000 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
01001 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
01002 $xh = xslt_create();
01003
01004
01005
01006
01007 $wb_path = ilUtil::getWebspaceDir("output");
01008
01009 $mode = "fullscreen";
01010 $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
01011 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
01012 echo xslt_error($xh);
01013 xslt_free($xh);
01014
01015
01016 $this->tpl->setVariable("MEDIA_CONTENT", $output);
01017 }
01018
01024 function displayValidationError($a_error)
01025 {
01026 if(is_array($a_error))
01027 {
01028 $error_str = "<b>Validation Error(s):</b><br>";
01029 foreach ($a_error as $error)
01030 {
01031 $err_mess = implode($error, " - ");
01032 if (!is_int(strpos($err_mess, ":0:")))
01033 {
01034 $error_str .= htmlentities($err_mess)."<br />";
01035 }
01036 }
01037 $this->tpl->setVariable("MESSAGE", $error_str);
01038 }
01039 }
01040
01041 }
01042 ?>