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