ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLMEditorExplorer.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once("./Modules/LearningModule/classes/class.ilLMExplorer.php");
25 
26 /*
27 * Explorer View for Learning Module Editor
28 *
29 * @author Alex Killing <alex.killing@gmx.de>
30 * @version $Id: class.ilLMEditorExplorer.php 18325 2008-12-23 14:29:56Z akill $
31 *
32 * @ingroup ModulesIliasLearningModule
33 */
35 {
42  function ilLMEditorExplorer($a_target, &$a_lm_obj, $a_gui_class)
43  {
44  global $ilCtrl;
45 
46  $this->ctrl =& $ilCtrl;
47  $this->gui_class = $a_gui_class;
48  $this->force_open_path = array();
49 
50  parent::ilLMExplorer($a_target, $a_lm_obj);
51  }
52 
56  function setForceOpenPath($a_path)
57  {
58  $this->force_open_path = $a_path;
59  }
60 
68  function formatHeader(&$tpl, $a_obj_id,$a_option)
69  {
70  global $lng, $ilias;
71 
72  $tpl->setCurrentBlock("icon");
73  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_lm_s.gif"));
74  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_".$this->lm_obj->getType()));
75  $tpl->parseCurrentBlock();
76 
77 
78  $tpl->setCurrentBlock("link");
79  $tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true));
80 
81  if ($this->lm_obj->getType() == "lm")
82  {
83  $this->ctrl->setParameterByClass("ilObjLearningModuleGUI",
84  "obj_id", "");
85  $link = $this->ctrl->getLinkTargetByClass("ilObjLearningModuleGUI",
86  "chapters");
87  }
88  else
89  {
90  $this->ctrl->setParameterByClass("ilObjDlBookGUI",
91  "obj_id", "");
92  $link = $this->ctrl->getLinkTargetByClass("ilObjDlBookGUI",
93  "chapters");
94  }
95  $tpl->setVariable("LINK_TARGET", $link);
96 
97  $tpl->setVariable("TARGET", " target=\"".$this->frame_target."\"");
98  $tpl->parseCurrentBlock();
99 
100  //$tpl->setCurrentBlock("row");
101  //$tpl->parseCurrentBlock();
102 
103  $tpl->touchBlock("element");
104  }
105 
109  function buildTitle($a_title, $a_id, $a_type)
110  {
111 //echo "<br>-$a_title-$a_type-$a_id-";
112  if ($a_type == "st")
113  {
115  $this->lm_obj->isActiveNumbering());
116  }
117 
118  return $a_title;
119  /*
120  if ($this->lm_obj->getTOCMode() == "chapters" || $a_type != "pg")
121  {
122  return $a_title;
123  }
124  else
125  {
126  if ($a_type == "pg")
127  {
128  return ilLMPageObject::_getPresentationTitle($a_id,
129  $this->lm_obj->getPageHeader(), $this->lm_obj->isActiveNumbering());
130  }
131  }*/
132  }
133 
134 
138  function buildLinkTarget($a_node_id, $a_type)
139  {
140  switch($a_type)
141  {
142  case "pg":
143  $this->ctrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_node_id);
144  return $this->ctrl->getLinkTargetByClass("ilLMPageObjectGUI",
145  "edit", array($this->gui_class));
146  break;
147 
148  case "st":
149  $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $a_node_id);
150  return $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI",
151  "view", array($this->gui_class));
152  break;
153  }
154  }
155 
156 
160  function getImage($a_name, $a_type = "", $a_id = "")
161  {
162  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
163 
164  if ($a_type == "pg")
165  {
166  include_once("./Services/COPage/classes/class.ilPageObject.php");
167  $lm_set = new ilSetting("lm");
168  $active = ilPageObject::_lookupActive($a_id, $this->lm_obj->getType(),
169  $lm_set->get("time_scheduled_page_activation"));
170 
171  // is page scheduled?
172  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
173  ilPageObject::_isScheduledActivation($a_id, $this->lm_obj->getType()))
174  ? "_sc"
175  : "";
176 
177  $a_name = "icon_pg".$img_sc."_s.gif";
178 
179  if (!$active)
180  {
181  $a_name = "icon_pg_d".$img_sc."_s.gif";
182  }
183  else
184  {
185  include_once("./Services/COPage/classes/class.ilPageObject.php");
187  $this->lm_obj->getType());
188  if ($contains_dis)
189  {
190  $a_name = "icon_pg_del".$img_sc."_s.gif";
191  }
192  }
193  }
194  return ilUtil::getImagePath($a_name);
195  }
196 
200  function getImageAlt($a_default_text, $a_type = "", $a_id = "")
201  {
202  global $lng;
203 
204  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
205 
206  if ($a_type == "pg")
207  {
208  include_once("./Services/COPage/classes/class.ilPageObject.php");
209  $lm_set = new ilSetting("lm");
210  $active = ilPageObject::_lookupActive($a_id, $this->lm_obj->getType(),
211  $lm_set->get("time_scheduled_page_activation"));
212 
213  if (!$active)
214  {
215  return $lng->txt("cont_page_deactivated");
216  }
217  else
218  {
219  include_once("./Services/COPage/classes/class.ilPageObject.php");
221  $this->lm_obj->getType());
222  if ($contains_dis)
223  {
224  return $lng->txt("cont_page_deactivated_elements");
225  }
226  }
227  }
228  return $a_default_text;
229  }
230 
234  function forceExpanded($a_obj_id)
235  {
236  if (in_array($a_obj_id, $this->force_open_path))
237  {
238  return true;
239  }
240  return false;
241  }
242 
243 } // END class.ilLMEditorExplorer
244 ?>