ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMaterialExplorer.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 /*
25 * Material Explorer for survey question pools
26 *
27 * @author Helmut Schottmüller <helmut.schottmueller@mac.com>
28 * @version $Id: class.ilMaterialExplorer.php 28404 2011-04-07 05:44:49Z hschottm $
29 *
30 * @ingroup ModulesSurveyQuestionPool
31 */
32 
33 include_once("./classes/class.ilExplorer.php");
34 
36 {
37 
43  var $root_id;
44  var $output;
45  var $ctrl;
46 
48  var $ref_id;
50 
51  var $force_open_path = array();
52 
58  function ilMaterialExplorer($a_target, $a_target_class)
59  {
60  global $tree,$ilCtrl;
61 
62  $this->ctrl = $ilCtrl;
63  $this->target_class = $a_target_class;
64  parent::ilExplorer($a_target);
65  $this->tree = $tree;
66  $this->root_id = $this->tree->readRootId();
67  $this->order_column = "title";
68 
69  $this->setSessionExpandVariable("expand");
70 
71  // add here all container objects
72  $this->addFilter("root");
73  $this->addFilter("cat");
74  $this->addFilter("grp");
75  $this->addFilter("fold");
76  $this->addFilter("crs");
77 
79  $this->setFiltered(true);
80  }
81 
82  function setSelectableType($a_type)
83  {
84  $this->selectable_type = $a_type;
85  }
86  function setRefId($a_ref_id)
87  {
88  $this->ref_id = $a_ref_id;
89  }
90 
91 
92  function buildLinkTarget($a_node_id, $a_type)
93  {
94  if($a_type == $this->selectable_type)
95  {
96  $this->ctrl->setParameterByClass($this->target_class,'source_id',$a_node_id);
97  return $this->ctrl->getLinkTargetByClass($this->target_class,'linkChilds');
98  }
99  else
100  {
101  $this->ctrl->setParameterByClass($this->target_class,"ref_id",$this->ref_id);
102  return $this->ctrl->getLinkTargetByClass($this->target_class,'addSolutionHint');
103  }
104 
105  }
106 
107  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
108  {
109  return '';
110  }
111 
112  function isClickable($a_type, $a_ref_id)
113  {
114  return $a_type == $this->selectable_type and $a_ref_id != $this->ref_id;
115  }
116 
117  function showChilds($a_ref_id)
118  {
119  global $rbacsystem;
120 
121  if ($a_ref_id == 0)
122  {
123  return true;
124  }
125 
126  if ($rbacsystem->checkAccess("read", $a_ref_id))
127  {
128  return true;
129  }
130  else
131  {
132  return false;
133  }
134  }
135 
136 
144  function formatHeader($a_obj_id,$a_option)
145  {
146  global $lng, $ilias;
147 
148  include_once "./classes/class.ilTemplate.php";
149  $tpl = new ilTemplate("tpl.tree.html", true, true);
150 
151  $tpl->setCurrentBlock("text");
152  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
153  $tpl->parseCurrentBlock();
154 
155  // $tpl->setCurrentBlock("row");
156  // $tpl->parseCurrentBlock();
157 
158  $this->output[] = $tpl->get();
159  }
160 
164  function setForceOpenPath($a_path)
165  {
166  $this->force_open_path = $a_path;
167  }
168 
172  function forceExpanded($a_obj_id)
173  {
174  if (in_array($a_obj_id, $this->force_open_path))
175  {
176  return true;
177  }
178  return false;
179  }
180 
181 } // END class ilSolutionExplorer
182 ?>