• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/Pages/class.ilPageObjectGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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 
00070         function ilPageObjectGUI(&$a_page_object)
00071         {
00072                 global $ilias, $tpl, $lng, $ilCtrl,$ilTabs;
00073 
00074                 $this->ctrl =& $ilCtrl;
00075 
00076                 $this->ilias =& $ilias;
00077                 $this->tpl =& $tpl;
00078                 $this->ctrl =& $ilCtrl;
00079                 $this->lng =& $lng;
00080                 $this->obj =& $a_page_object;
00081                 $this->output_mode = "presentation";
00082                 $this->setPageObject($a_page_object);
00083                 $this->output2template = true;
00084                 $this->question_xml = "";
00085                 $this->tabs_gui =& $ilTabs;
00086 
00087                 // USED FOR TRANSLATIONS
00088                 $this->template_output_var = "PAGE_CONTENT";
00089                 $this->citation = false;
00090                 $this->change_comments = false;
00091                 $this->page_back_title = $this->lng->txt("page");
00092         }
00093 
00099         function _forwards()
00100         {
00101                 return array("ilPageEditorGUI");
00102         }
00103 
00104 
00105         function setBibId($a_id)
00106         {
00107                 // USED FOR SELECTION WHICH PAGE TURNS AND LATER PAGES SHOULD BE SHOWN
00108                 $this->bib_id = $a_id;
00109         }
00110 
00111         function getBibId()
00112         {
00113                 return $this->bib_id ? $this->bib_id : 0;
00114         }
00115 
00116         function setPageObject(&$a_pg_obj)
00117         {
00118                 $this->obj =& $a_pg_obj;
00119         }
00120 
00121         function &getPageObject()
00122         {
00123                 return $this->obj;
00124         }
00125 
00129         function setOutputMode($a_mode = "presentation")
00130         {
00131                 $this->output_mode = $a_mode;
00132         }
00133 
00134         function getOutputMode()
00135         {
00136                 return $this->output_mode;
00137         }
00138 
00139         function setTemplateOutput($a_output = true)
00140         {
00141                 $this->output2template = $a_output;
00142         }
00143 
00144         function outputToTemplate()
00145         {
00146                 return $this->output2template;
00147         }
00148 
00149         function setPresentationTitle($a_title = "")
00150         {
00151                 $this->presentation_title = $a_title;
00152         }
00153 
00154         function getPresentationTitle()
00155         {
00156                 return $this->presentation_title;
00157         }
00158 
00159         function setHeader($a_title = "")
00160         {
00161                 $this->header = $a_title;
00162         }
00163 
00164         function getHeader()
00165         {
00166                 return $this->header;
00167         }
00168 
00169         function setLinkParams($l_params = "")
00170         {
00171                 $this->link_params = $l_params;
00172         }
00173 
00174         function getLinkParams()
00175         {
00176                 return $this->link_params;
00177         }
00178 
00179         function setLinkFrame($l_frame = "")
00180         {
00181                 $this->link_frame = $l_frame;
00182         }
00183 
00184         function getLinkFrame()
00185         {
00186                 return $this->link_frame;
00187         }
00188 
00189         function setLinkXML($link_xml)
00190         {
00191                 $this->link_xml = $link_xml;
00192         }
00193 
00194         function getLinkXML()
00195         {
00196                 return $this->link_xml;
00197         }
00198 
00199         function setQuestionXML($question_xml)
00200         {
00201                 $this->question_xml = $question_xml;
00202         }
00203 
00204         function getQuestionXML()
00205         {
00206                 return $this->question_xml;
00207         }
00208 
00209         function setTemplateTargetVar($a_variable)
00210         {
00211                 $this->target_var = $a_variable;
00212         }
00213 
00214         function getTemplateTargetVar()
00215         {
00216                 return $this->target_var;
00217         }
00218 
00219         function setTemplateOutputVar($a_value)
00220         {
00221                 // USED FOR TRANSLATION PRESENTATION OF dbk OBJECTS
00222                 $this->template_output_var = $a_value;
00223         }
00224 
00225         function getTemplateOutputVar()
00226         {
00227                 return $this->template_output_var;
00228         }
00229 
00230         function setOutputSubmode($a_mode)
00231         {
00232                 // USED FOR TRANSLATION PRESENTATION OF dbk OBJECTS
00233                 $this->output_submode = $a_mode;
00234         }
00235 
00236         function getOutputSubmode()
00237         {
00238                 return $this->output_submode;
00239         }
00240 
00241 
00242         function setSourcecodeDownloadScript ($script_name) {
00243                 $this->sourcecode_download_script = $script_name;
00244         }
00245         
00246         function getSourcecodeDownloadScript () {
00247                 return $this->sourcecode_download_script;
00248         }
00249 
00250         function enableCitation($a_enabled)
00251         {
00252                 $this->citation = $a_enabled;
00253         }
00254 
00255         function isEnabledCitation()
00256         {
00257                 return $this->citation;
00258         }
00259 
00260         function setLocator(&$a_locator)
00261         {
00262                 $this->locator =& $a_locator;
00263         }
00264 
00265         function setTabs($a_tabs)
00266         {
00267                 $this->tabs_gui = $a_tabs;
00268         }
00269         
00270         function setPageBackTitle($a_title)
00271         {
00272                 $this->page_back_title = $a_title;
00273         }
00274 
00275         function setFileDownloadLink($a_download_link)
00276         {
00277                 $this->file_download_link = $a_download_link;
00278         }
00279 
00280         function getFileDownloadLink()
00281         {
00282                 return $this->file_download_link;
00283         }
00284 
00285         function setFullscreenLink($a_fullscreen_link)
00286         {
00287                 $this->fullscreen_link = $a_fullscreen_link;
00288         }
00289 
00290         function getFullscreenLink()
00291         {
00292                 return $this->fullscreen_link;
00293         }
00294 
00295         function setIntLinkHelpDefault($a_type, $a_id)
00296         {
00297                 $this->int_link_def_type = $a_type;
00298                 $this->int_link_def_id = $a_id;
00299         }
00300         
00301         function setIntLinkReturn($a_return)
00302         {
00303                 $this->int_link_return = $a_return;
00304         }
00305 
00306         function enableChangeComments($a_enabled)
00307         {
00308                 $this->change_comments = $a_enabled;
00309         }
00310         
00311         function isEnabledChangeComments()
00312         {
00313                 return $this->change_comments;
00314         }
00315 
00322         function setViewPageLink($a_link, $a_target = "")
00323         {
00324                 $this->view_page_link = $a_link;
00325                 $this->view_page_target = $a_target;
00326         }
00327         
00331         function getViewPageLink()
00332         {
00333                 return $this->view_page_link;
00334         }
00335         
00339         function getViewPageTarget()
00340         {
00341                 return $this->view_page_target;
00342         }
00343 
00347         function &executeCommand()
00348         {
00349                 $next_class = $this->ctrl->getNextClass($this);
00350 //echo ":$next_class:";
00351                 $cmd = $this->ctrl->getCmd();
00352                 $this->ctrl->addTab("clipboard", $this->ctrl->getLinkTargetByClass("ilEditClipboardGUI", "view")
00353                         , "view", "ilEditClipboardGUI");
00354 
00355                 switch($next_class)
00356                 {
00357                         case "ileditclipboardgui":
00358                                 $this->tabs_gui->clearTargets();
00359                                 //$this->ctrl->setReturn($this, "view");
00360                                 $clip_gui = new ilEditClipboardGUI();
00361                                 $clip_gui->setPageBackTitle($this->page_back_title);
00362                                 //$ret =& $clip_gui->executeCommand();
00363                                 $ret =& $this->ctrl->forwardCommand($clip_gui);
00364                                 break;
00365 
00366                         case "ilpageeditorgui":
00367                                 $page_editor =& new ilPageEditorGUI($this->getPageObject());
00368                                 $page_editor->setLocator($this->locator);
00369                                 $page_editor->setHeader($this->getHeader());
00370                                 $page_editor->setPageBackTitle($this->page_back_title);
00371                                 $page_editor->setIntLinkHelpDefault($this->int_link_def_type,
00372                                         $this->int_link_def_id);
00373                                 $page_editor->setIntLinkReturn($this->int_link_return);
00374                                 //$page_editor->executeCommand();
00375                                 $ret =& $this->ctrl->forwardCommand($page_editor);
00376                                 break;
00377                                 
00378                         case "ilmediapooltargetselector":
00379                                 include_once("content/classes/class.ilMediaPoolTargetSelector.php");
00380                                 $target_sel =& new ilMediaPoolTargetSelector();
00381                                 $ret =& $this->ctrl->forwardCommand($target_sel);
00382                                 break;
00383 
00384                         default:
00385                                 $ret =& $this->$cmd();
00386                                 break;
00387                 }
00388         }
00389 
00390 
00391         /*
00392         * display content of page
00393         */
00394         function showPage()
00395         {
00396                 global $tree, $ilUser, $ilias;
00397 
00398                 // init template
00399                 if($this->outputToTemplate())
00400                 {
00401                         if($this->getOutputMode() == "edit")
00402                         {
00403 //echo ":".$this->getTemplateTargetVar().":";
00404                                 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "content");
00405                                 
00406                                 // user comment
00407                                 if ($this->isEnabledChangeComments())
00408                                 {
00409                                         $this->tpl->setCurrentBlock("change_comment");
00410                                         $this->tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
00411                                         $this->tpl->parseCurrentBlock();
00412                                         $this->tpl->setCurrentBlock("adm_content");
00413                                 }
00414                                 
00415                                 $this->tpl->setVariable("TXT_INSERT_BEFORE", $this->lng->txt("cont_set_before"));
00416                                 $this->tpl->setVariable("TXT_INSERT_AFTER", $this->lng->txt("cont_set_after"));
00417                                 $this->tpl->setVariable("TXT_INSERT_CANCEL", $this->lng->txt("cont_set_cancel"));
00418                                 $this->tpl->setVariable("TXT_CONFIRM_DELETE", $this->lng->txt("cont_confirm_delete"));
00419                                 $this->tpl->setVariable("JS_DRAGDROP", ILIAS_HTTP_PATH."/content/js/wz_dragdrop.js");
00420                                 $this->tpl->setVariable("IMG_DRAGDROP",
00421                                         ilUtil::getImagePath("ilias_logo.png"));
00422                                 
00423                                 if (!ilPageEditorGUI::_isBrowserJSEditCapable())
00424                                 {
00425                                         $this->tpl->setVariable("TXT_JAVA_SCRIPT_CAPABLE", "<br />".$this->lng->txt("cont_browser_not_js_capable"));
00426                                 }
00427                                 $this->tpl->setVariable("TXT_CHANGE_EDIT_MODE", $this->lng->txt("cont_set_edit_mode"));
00428                 
00429                                 $med_mode = array("enable" => $this->lng->txt("cont_enable_media"),
00430                                         "disable" => $this->lng->txt("cont_disable_media"));
00431                                 $sel_media_mode = ($ilUser->getPref("ilPageEditor_MediaMode") == "disable")
00432                                         ? "disable"
00433                                         : "enable";
00434                                         
00435                                 //if (DEVMODE)
00436                                 //{
00437                                         $js_mode = array("enable" => $this->lng->txt("cont_enable_js"),
00438                                                 "disable" => $this->lng->txt("cont_disable_js"));
00439                                 //}
00440                                 //else
00441                                 //{
00442                                 //      $js_mode = array("disable" => $this->lng->txt("cont_disable_js"));
00443                                 //}
00444                                 
00445                                 $this->tpl->setVariable("SEL_MEDIA_MODE",
00446                                         ilUtil::formSelect($sel_media_mode, "media_mode", $med_mode, false, true));
00447                                 
00448                                 if ($this->getViewPageLink() != "")
00449                                 {
00450                                         $this->tpl->setCurrentBlock("view_link");
00451                                         $this->tpl->setVariable("LINK_VIEW_PAGE",
00452                                                 $this->getViewPageLink());
00453                                         $this->tpl->setVariable("TARGET_VIEW_PAGE",
00454                                                 $this->getViewPageTarget());
00455                                         $this->tpl->setVariable("TXT_VIEW_PAGE", $this->lng->txt("view"));
00456                                         $this->tpl->parseCurrentBlock();
00457                                 }
00458                                         
00459                                 // javascript activation
00460                                 $sel_js_mode = "disable";
00461                                 if($ilias->getSetting("enable_js_edit"))
00462                                 {
00463                                         $sel_js_mode = (ilPageEditorGUI::_doJSEditing())
00464                                                 ? "enable"
00465                                                 : "disable";
00466                                         $this->tpl->setVariable("SEL_JAVA_SCRIPT",
00467                                                 ilUtil::formSelect($sel_js_mode, "js_mode", $js_mode, false, true));
00468                                 }
00469                         }
00470                         else
00471                         {
00472                                 if($this->getOutputSubmode() == 'translation')
00473                                 {
00474                                         $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_translation_content.html", "content");
00475                                 }
00476                                 else
00477                                 {
00478                                         // presentation
00479                                         if($this->getOutputMode() != 'preview')
00480                                         {
00481                                                 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_content.html", "content");
00482                                         }
00483                                         else    // preview
00484                                         {
00485                                                 $this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_preview.html", "content");
00486                                         }
00487                                 }
00488                         }
00489                         if ($this->getOutputMode() != "presentation" &&
00490                                 $this->getOutputMode() != "offline" &&
00491                                 $this->getOutputMode() != "print")
00492                         {
00493                                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
00494                         }
00495 
00496                         // output media object edit list (of media links)
00497                         if($this->getOutputMode() == "edit")
00498                         {
00499                                 $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType().":pg",
00500                                         $this->obj->getId());
00501                                 $mob_links = array();
00502                                 foreach($links as $link)
00503                                 {
00504                                         if ($link["type"] == "mob")
00505                                         {
00506                                                 if (ilObject::_exists($link["id"]))
00507                                                 {
00508                                                         $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"])." [".$link["id"]."]";
00509                                                 }
00510                                         }
00511                                 }
00512                                 
00513                                 if (count($mob_links) > 0)
00514                                 {
00515                                         $this->tpl->setCurrentBlock("med_link");
00516                                         $this->tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
00517                                         $this->tpl->setVariable("SEL_MED_LINKS",
00518                                                 ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
00519                                         $this->tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
00520                                         $this->tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
00521                                         //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
00522                                         $this->tpl->parseCurrentBlock();
00523                                 }
00524                         }
00525                         
00526                         if ($_GET["reloadTree"] == "y")
00527                         {
00528                                 $this->tpl->setCurrentBlock("reload_tree");
00529                                 if ($this->obj->getParentType() == "dbk")
00530                                 {
00531                                         $this->tpl->setVariable("LINK_TREE",
00532                                                 $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer"));
00533                                 }
00534                                 else
00535                                 {
00536                                         $this->tpl->setVariable("LINK_TREE",
00537                                                 $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer"));
00538                                 }
00539                                 $this->tpl->parseCurrentBlock();
00540                         }
00541 
00542                 }
00543                 
00544                 // get content
00545                 $builded = $this->obj->buildDom();
00546                 $this->obj->addFileSizes();
00547                 
00548                 // manage hierarchical ids
00549                 if($this->getOutputMode() == "edit")
00550                 {
00551                         $this->obj->addHierIDs();
00552                         
00553                         $hids = $this->obj->getHierIds();
00554                         $row1_ids = $this->obj->getFirstRowIds();
00555                         $col1_ids = $this->obj->getFirstColumnIds();
00556                         $litem_ids = $this->obj->getListItemIds();
00557                         $fitem_ids = $this->obj->getFileItemIds();
00558                         
00559                         // standard menues
00560                         $hids = $this->obj->getHierIds();
00561                         foreach($hids as $hid)
00562                         {
00563                                 $this->tpl->setCurrentBlock("add_dhtml");
00564                                 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_".$hid);
00565                                 $this->tpl->parseCurrentBlock();
00566                         }
00567 
00568                         // column menues for tables
00569                         foreach($col1_ids as $hid)
00570                         {
00571                                 $this->tpl->setCurrentBlock("add_dhtml");
00572                                 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_r".$hid);
00573                                 $this->tpl->parseCurrentBlock();
00574                         }
00575                         
00576                         // row menues for tables
00577                         foreach($row1_ids as $hid)
00578                         {
00579                                 $this->tpl->setCurrentBlock("add_dhtml");
00580                                 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_c".$hid);
00581                                 $this->tpl->parseCurrentBlock();
00582                         }
00583                         
00584                         // list item menues
00585                         foreach($litem_ids as $hid)
00586                         {
00587                                 $this->tpl->setCurrentBlock("add_dhtml");
00588                                 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
00589                                 $this->tpl->parseCurrentBlock();
00590                         }
00591                         
00592                         // file item menues
00593                         foreach($fitem_ids as $hid)
00594                         {
00595                                 $this->tpl->setCurrentBlock("add_dhtml");
00596                                 $this->tpl->setVariable("CONTEXTMENU", "contextmenu_i".$hid);
00597                                 $this->tpl->parseCurrentBlock();
00598                         }
00599                 }
00600 
00601                 $this->obj->addSourceCodeHighlighting($this->getOutputMode());
00602 //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
00603 //echo "<br>-".htmlentities($this->getLinkXML())."-";
00604                 $content = $this->obj->getXMLFromDom(false, true, true,
00605                         $this->getLinkXML().$this->getQuestionXML());
00606 
00607                 // check validation errors
00608                 if($builded !== true)
00609                 {
00610                         $this->displayValidationError($builded);
00611                 }
00612                 else
00613                 {
00614                         $this->displayValidationError($_SESSION["il_pg_error"]);
00615                 }
00616                 unset($_SESSION["il_pg_error"]);
00617 
00618                 if(isset($_SESSION["citation_error"]))
00619                 {
00620                         sendInfo($this->lng->txt("cont_citation_selection_not_valid"));
00621                         session_unregister("citation_error");
00622                         unset($_SESSION["citation_error"]);
00623                 }
00624 
00625                 // get title
00626                 $pg_title = $this->getPresentationTitle();
00627 
00628                 //$content = str_replace("&nbsp;", "", $content);
00629 
00630                 // run xslt
00631                 $xsl = file_get_contents("./content/page.xsl");
00632                 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
00633                 $xh = xslt_create();
00634 
00635 //echo "<b>XML</b>:".htmlentities($content).":<br>";
00636                 //              echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
00637                 //              echo "mode:".$this->getOutputMode().":<br>";
00638 
00639                 $add_path = ilUtil::getImagePath("add.gif");
00640                 $col_path = ilUtil::getImagePath("col.gif");
00641                 $row_path = ilUtil::getImagePath("row.gif");
00642                 $item_path = ilUtil::getImagePath("item.gif");
00643                 $med_disabled_path = ilUtil::getImagePath("media_disabled.gif");
00644                  
00645                 if ($this->getOutputMode() != "offline")
00646                 {
00647                         $enlarge_path = ilUtil::getImagePath("enlarge.gif");
00648                         $wb_path = ilUtil::getWebspaceDir("output");
00649                 }
00650                 else
00651                 {
00652                         $enlarge_path = "images/enlarge.gif";
00653                         $wb_path = ".";
00654                 }
00655                 $pg_title_class = ($this->getOutputMode() == "print")
00656                         ? "ilc_PrintPageTitle"
00657                         : "";
00658                         
00659                 // page splitting only for learning modules and
00660                 // digital books
00661                 $enable_split_new = ($this->obj->getParentType() == "lm" ||
00662                         $this->obj->getParentType() == "dbk")
00663                         ? "y"
00664                         : "n";
00665 
00666                 // page splitting to next page only for learning modules and
00667                 // digital books if next page exists in tree
00668                 if (($this->obj->getParentType() == "lm" ||
00669                         $this->obj->getParentType() == "dbk") &&
00670                         ilObjContentObject::hasSuccessorPage($this->obj->getParentId(),
00671                                 $this->obj->getId()))
00672                 {
00673                         $enable_split_next = "y";
00674                 }
00675                 else
00676                 {
00677                         $enable_split_next = "n";
00678                 }
00679                 
00680       
00681                 $paragraph_plugins = new ilParagraphPlugins();
00682                 $paragraph_plugins->initialize ();                                                      
00683                 
00684 /*        if (!session_is_registered("paragraph_plugins")) 
00685                 {
00686                         $paragraph_plugins = new ilParagraphPlugins();
00687                         $paragraph_plugins->initialize ();                                                                      
00688                         $_SESSION ["paragraph_plugins"] = $paragraph_plugins; 
00689                 } 
00690 */              
00691                                 
00692         if ($this->getOutputMode() == "presentation")
00693                 {                   
00694                 $paragraph_plugin_string = $paragraph_plugins->serializeToString();
00695                 $_SESSION ["paragraph_plugins"] = $paragraph_plugins; 
00696                 }
00697                 
00698                 $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
00699 
00700         //$wb_path = "../".$this->ilias->ini->readVariable("server","webspace_dir");
00701         //echo "-".$this->sourcecode_download_script.":";
00702 
00703                 // added UTF-8 encoding otherwise umlaute are converted too
00704                 $params = array ('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title,ENT_QUOTES,"UTF-8"),
00705                                                  'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class,
00706                                                  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path,
00707                                                  'img_add' => $add_path,
00708                                                  'img_col' => $col_path,
00709                                                  'img_row' => $row_path,
00710                                                  'img_item' => $item_path,
00711                                                  'enable_split_new' => $enable_split_new,
00712                                                  'enable_split_next' => $enable_split_next,
00713                                                  'link_params' => $this->link_params,
00714                                                  'file_download_link' => $this->getFileDownloadLink(),
00715                                                  'fullscreen_link' => $this->getFullscreenLink(),
00716                                                  'med_disabled_path' => $med_disabled_path,
00717                                                  'img_path' => $img_path,
00718                                                  'parent_id' => $this->obj->getParentId(),
00719                                                  'download_script' => $this->sourcecode_download_script,
00720                                                  'encoded_download_script' => urlencode($this->sourcecode_download_script),
00721                                                  // digilib
00722                                                  'bib_id' => $this->getBibId(),'citation' => (int) $this->isEnabledCitation(),
00723                                                  'pagebreak' => $this->lng->txt('dgl_pagebreak'),
00724                                                  'page' => $this->lng->txt('page'),
00725                                                  'citate_page' => $this->lng->txt('citate_page'),
00726                                                  'citate_from' => $this->lng->txt('citate_from'),
00727                                                  'citate_to' => $this->lng->txt('citate_to'),
00728                                                  'citate' => $this->lng->txt('citate'),
00729 
00730                                                  'media_mode' => $ilUser->getPref("ilPageEditor_MediaMode"),
00731                                                  'javascript' => $sel_js_mode,
00732                                                  'paragraph_plugins' => $paragraph_plugin_string);
00733                 if($this->link_frame != "")             // todo other link types
00734                         $params["pg_frame"] = $this->link_frame;
00735 
00736                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00737 //echo xslt_error($xh);
00738                 xslt_free($xh);
00739 
00740                 // unmask user html
00741                 $output = str_replace("&lt;","<",$output);
00742                 $output = str_replace("&gt;",">",$output);
00743                 $output = str_replace("&amp;", "&", $output);
00744 
00745                 // (horrible) workaround for preventing template engine
00746                 // from hiding paragraph text that is enclosed
00747                 // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
00748                 $output = str_replace("{", "&#123;", $output);
00749                 $output = str_replace("}", "&#125;", $output);
00750 
00751 //echo "<b>HTML</b>:".htmlentities($output).":<br>";
00752 
00753                 // remove all newlines (important for code / pre output)
00754                 $output = str_replace("\n", "", $output);
00755 
00756                 // output
00757                 if($this->outputToTemplate())
00758                 {
00759                         $this->tpl->setVariable($this->getTemplateOutputVar(), $output);
00760             return $output;
00761                 }
00762                 else
00763                 {
00764                         return $output;
00765                 }
00766         }
00767 
00768         /*
00769         * preview
00770         */
00771         function preview()
00772         {
00773                 global $tree;
00774                 $this->setOutputMode("preview");
00775                 return $this->showPage();
00776         }
00777 
00778         /*
00779         * edit
00780         */
00781         function view()
00782         {
00783                 global $tree;
00784                 $this->setOutputMode("edit");
00785                 return $this->showPage();
00786         }
00787 
00788         /*
00789         * presentation
00790         */
00791         function presentation($mode = "presentation")
00792         {
00793                 global $tree;
00794                 $this->setOutputMode($mode);
00795                 return $this->showPage();
00796         }
00797 
00798         
00802         function showMediaFullscreen($a_style_id = 0)
00803         {
00804                 $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "content");
00805                 $this->tpl->setCurrentBlock("ContentStyle");
00806                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
00807                 $this->tpl->parseCurrentBlock();
00808 
00809                 $this->tpl->setVariable("PAGETITLE", " - ".ilObject::_lookupTitle($_GET["mob_id"]));
00810                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00811                 $this->tpl->setCurrentBlock("ilMedia");
00812 
00813                 require_once("content/classes/Media/class.ilObjMediaObject.php");
00814                 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00815                 if (!empty ($_GET["pg_id"]))
00816                 {
00817                         require_once("content/classes/Pages/class.ilPageObject.php");
00818                         $pg_obj =& new ilPageObject($this->obj->getParentType(), $_GET["pg_id"]);
00819                         $pg_obj->buildDom();
00820 
00821                         $xml = "<dummy>";
00822                         // todo: we get always the first alias now (problem if mob is used multiple
00823                         // times in page)
00824                         $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
00825                         $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00826                         $xml.="</dummy>";
00827                 }
00828                 else
00829                 {
00830                         $xml = "<dummy>";
00831                         $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00832                         $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00833                         $xml.="</dummy>";
00834                 }
00835 
00836 //echo htmlentities($xml); exit;
00837 
00838                 $xsl = file_get_contents("./content/page.xsl");
00839                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00840                 $xh = xslt_create();
00841 
00842 //echo "<b>XML:</b>".htmlentities($xml);
00843                 // determine target frames for internal links
00844                 //$pg_frame = $_GET["frame"];
00845                 $wb_path = ilUtil::getWebspaceDir("output");
00846 //              $wb_path = "../".$this->ilias->ini->readVariable("server","webspace_dir");
00847                 $mode = "fullscreen";
00848                 $params = array ('mode' => $mode, 'webspace_path' => $wb_path);
00849                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00850                 echo xslt_error($xh);
00851                 xslt_free($xh);
00852 
00853                 // unmask user html
00854                 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00855         }
00856 
00862         function displayValidationError($a_error)
00863         {
00864                 if(is_array($a_error))
00865                 {
00866                         $error_str = "<b>Validation Error(s):</b><br>";
00867                         foreach ($a_error as $error)
00868                         {
00869                                 $err_mess = implode($error, " - ");
00870                                 if (!is_int(strpos($err_mess, ":0:")))
00871                                 {
00872                                         $error_str .= htmlentities($err_mess)."<br />";
00873                                 }
00874                         }
00875                         $this->tpl->setVariable("MESSAGE", $error_str);
00876                 }
00877         }
00878 
00879 }
00880 ?>

Generated on Fri Dec 13 2013 11:57:57 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1