ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSolutionExplorer.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 * Solution Explorer for question pools
26 *
27 * @author Helmut Schottmüller <helmut.schottmueller@mac.com>
28 * @version $Id$
29 *
30 * @ingroup ModulesTestQuestionPool
31 */
32 
33 include_once "./Services/UIComponent/Explorer/classes/class.ilExplorer.php";
34 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
35 
37 {
38 
44  var $root_id;
45  var $output;
46  var $ctrl;
47 
49  var $ref_id;
51 
57  function ilSolutionExplorer($a_target, $a_target_class)
58  {
59  global $tree,$ilCtrl;
60 
61  $this->ctrl = $ilCtrl;
62  $this->target_class = $a_target_class;
63  parent::ilExplorer($a_target);
64  $this->tree = $tree;
65  $this->root_id = $this->tree->readRootId();
66  $this->order_column = "title";
67 
68  $this->setSessionExpandVariable("expand_sol");
69 
70  // add here all container objects
71  $this->addFilter("root");
72  $this->addFilter("cat");
73  $this->addFilter("grp");
74  $this->addFilter("fold");
75  $this->addFilter("crs");
76 
78  $this->setFiltered(true);
79  }
80 
84  public function expandPathByRefId($ref_id)
85  {
89  global $tree;
90 
91  if(!$_SESSION[$this->expand_variable])
92  {
94  }
95 
96  $path = $tree->getPathId($ref_id);
97  foreach((array)$path as $node_id)
98  {
99  if(!in_array($node_id, $_SESSION[$this->expand_variable]))
100  $_SESSION[$this->expand_variable][] = $node_id;
101  }
102 
103  $this->expanded = $_SESSION[$this->expand_variable];
104  }
105 
106  function setSelectableType($a_type)
107  {
108  $this->selectable_type = $a_type;
109  }
110  function setRefId($a_ref_id)
111  {
112  $this->ref_id = $a_ref_id;
113  }
114 
115 
116  function buildLinkTarget($a_node_id, $a_type)
117  {
118  if($a_type == $this->selectable_type)
119  {
120  $this->ctrl->setParameterByClass($this->target_class,'source_id',$a_node_id);
121  return $this->ctrl->getLinkTargetByClass($this->target_class,'linkChilds');
122  }
123  else
124  {
125  $this->ctrl->setParameterByClass($this->target_class,"ref_id",$this->ref_id);
126  return $this->ctrl->getLinkTargetByClass($this->target_class,'addSolutionHint');
127  }
128 
129  }
130 
131  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
132  {
133  return '';
134  }
135 
136  function isClickable($a_type, $a_ref_id)
137  {
138  return $a_type == $this->selectable_type and $a_ref_id != $this->ref_id;
139  }
140 
141  function showChilds($a_ref_id)
142  {
143  global $rbacsystem;
144 
145  if ($a_ref_id == 0)
146  {
147  return true;
148  }
149 
150  if ($rbacsystem->checkAccess("read", $a_ref_id))
151  {
152  return true;
153  }
154  else
155  {
156  return false;
157  }
158  }
159 
160 
168  function formatHeader($a_obj_id,$a_option)
169  {
170  global $lng, $ilias;
171 
172  include_once "./Services/UICore/classes/class.ilTemplate.php";
173  $tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer");
174 
175  $tpl->setCurrentBlock("text");
176  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
177  $tpl->parseCurrentBlock();
178 
179  $tpl->setCurrentBlock("row");
180  $tpl->parseCurrentBlock();
181 
182  $this->output[] = $tpl->get();
183  }
184 
185 } // END class ilSolutionExplorer
186 ?>