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

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1