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

content/classes/class.ilLMTableOfContentsExplorer.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 require_once("content/classes/class.ilLMExplorer.php");
00025 require_once("content/classes/class.ilStructureObject.php");
00026 
00027 /*
00028 * Table of Contents Explorer
00029 *
00030 * @author Alex Killing <alex.killing@gmx.de>
00031 * @version $Id: class.ilLMTableOfContentsExplorer.php 11711 2006-07-30 14:11:38Z akill $
00032 *
00033 * @ingroup ModulesIliasLearningModule
00034 */
00035 class ilTableOfContentsExplorer extends ilLMExplorer
00036 {
00037 
00043         var $root_id;
00044         var $output;
00045         var $offline;
00046 
00053         function ilTableOfContentsExplorer($a_target,&$a_lm_obj, $a_export_format = "")
00054         {
00055                 parent::ilLMExplorer($a_target, $a_lm_obj);
00056                 $this->setExpandTarget("lm_presentation.php?cmd=".$_GET["cmd"]."&ref_id=".$this->lm_obj->getRefId());
00057                 $this->setSessionExpandVariable("lmtocexpand");
00058                 $this->export_format = $a_export_format;
00059                 $this->lm_obj =& $a_lm_obj;
00060 
00061                 $this->addFilter("du");
00062                 $this->addFilter("st");
00063                 if ($a_lm_obj->getTOCMode() == "pages")
00064                 {
00065                         $this->addFilter("pg");
00066                 }
00067                 $this->setFiltered(true);
00068                 $this->setFilterMode(IL_FM_POSITIVE);
00069 
00070                 // Determine whether the view of a learning resource should
00071                 // be shown in the frameset of ilias, or in a separate window.
00072                 //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
00073                 $showViewInFrameset = true;
00074 
00075                 if ($showViewInFrameset)
00076                 {
00077                         $this->setFrameTarget(ilFrameTargetInfo::_getFrame("MainContent"));
00078                 }
00079                 else
00080                 {
00081                         $this->setFrameTarget("_top");
00082                 }
00083 
00084         }
00085 
00089         function setOfflineMode($a_offline = true)
00090         {
00091                 $this->offline = $a_offline;
00092 
00093                 if ($a_offline)
00094                 {
00095                         if ($this->export_format == "scorm")
00096                         {
00097                                 $this->setFrameTarget("");
00098                         }
00099                 }
00100 
00101         }
00102 
00106         function offlineMode()
00107         {
00108                 return $this->offline;
00109         }
00110 
00114         function buildTitle($a_title, $a_id, $a_type)
00115         {
00116                 global $lng;
00117 
00118                 include_once("content/classes/class.ilObjContentObject.php");
00119                 $access_str = "";
00120                 if (!ilObjContentObject::_checkPreconditionsOfPage(
00121                         ilObject::_lookupObjId($_GET["ref_id"]), $a_id))
00122                 {
00123                         $access_str = " (".$lng->txt("cont_no_access").")";
00124                 }
00125                 
00126                 if ($a_type == "st")
00127                 {
00128                         return ilStructureObject::_getPresentationTitle($a_id,
00129                                 $this->lm_obj->isActiveNumbering()).$access_str;
00130                 }
00131 
00132                 if ($this->lm_obj->getTOCMode() == "chapters" || $a_type != "pg")
00133                 {
00134                         return $a_title.$access_str;
00135                 }
00136                 else
00137                 {
00138                         if ($a_type == "pg")
00139                         {
00140                                 return ilLMPageObject::_getPresentationTitle($a_id,
00141                                         $this->lm_obj->getPageHeader(), $this->lm_obj->isActiveNumbering()).$access_str;
00142                         }
00143                 }
00144                 
00145         }
00146 
00150         function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
00151         {
00152                 // Determine whether the view of a learning resource should
00153                 // be shown in the frameset of ilias, or in a separate window.
00154                 //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
00155                 $showViewInFrameset = true;
00156 
00157                 if ($this->offlineMode() &&
00158                         $this->export_format == "scorm")
00159                 {
00160                         return "";
00161                 }
00162 
00163                 if ($showViewInFrameset && !$this->offlineMode())
00164                 {
00165                         return ilFrameTargetInfo::_getFrame("MainContent");
00166                 }
00167                 else
00168                 {
00169                         return "_top";
00170                 }
00171         }
00172 
00176         function buildLinkTarget($a_node_id, $a_type)
00177         {
00178                 if (!$this->offlineMode())
00179                 {
00180                         return parent::buildLinkTarget($a_node_id, $a_type);
00181                 }
00182                 else
00183                 {
00184                         if ($a_node_id < 1)
00185                         {
00186                                 $a_node_id = $this->tree->getRootId();
00187                         }
00188                         if ($a_type != "pg")
00189                         {
00190                                 $a_node = $this->tree->fetchSuccessorNode($a_node_id, "pg");
00191                                 $a_node_id = $a_node["child"];
00192                         }
00193 
00194                         if ($nid = ilLMObject::_lookupNID($this->lm_obj->getId(), $a_node_id, "pg"))
00195                         {
00196                                 return "lm_pg_".$nid.".html";
00197                         }
00198                         else
00199                         {
00200                                 return "lm_pg_".$a_node_id.".html";
00201                         }
00202                 }
00203         }
00204 
00205         /*function isClickable($a_type, $a_obj_id)
00206         {
00207                 return true;
00208         }*/
00209 
00213         function getImage($a_name)
00214         {
00215                 return ilUtil::getImagePath($a_name, false, "output", $this->offlineMode());
00216         }
00217         
00221         function forceExpanded($a_obj_id)
00222         {
00223                 if ($this->offlineMode())
00224                 {
00225                         return true;
00226                 }
00227                 else
00228                 {
00229                         return true;
00230                 }
00231         }
00232 
00233         function isVisible($a_id, $a_type)
00234         {
00235                 if(!ilLMObject::_lookupActive($a_id))
00236                 {
00237                         return false;
00238                 }
00239                 else
00240                 {
00241                         return true;
00242                 }
00243         }
00244 
00245 } // END class ilTableOfContentsExplorer
00246 ?>

Generated on Fri Dec 13 2013 13:52:09 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1