ILIAS  eassessment Revision 61809
 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: class.ilSolutionExplorer.php 12484 2006-11-09 10:52:16Z hschottm $
29 *
30 * @ingroup ModulesTestQuestionPool
31 */
32 
33 include_once "./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");
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 
81  function setSelectableType($a_type)
82  {
83  $this->selectable_type = $a_type;
84  }
85  function setRefId($a_ref_id)
86  {
87  $this->ref_id = $a_ref_id;
88  }
89 
90 
91  function buildLinkTarget($a_node_id, $a_type)
92  {
93  if($a_type == $this->selectable_type)
94  {
95  $this->ctrl->setParameterByClass($this->target_class,'source_id',$a_node_id);
96  return $this->ctrl->getLinkTargetByClass($this->target_class,'linkChilds');
97  }
98  else
99  {
100  $this->ctrl->setParameterByClass($this->target_class,"ref_id",$this->ref_id);
101  return $this->ctrl->getLinkTargetByClass($this->target_class,'addSolutionHint');
102  }
103 
104  }
105 
106  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
107  {
108  return '';
109  }
110 
111  function isClickable($a_type, $a_ref_id)
112  {
113  return $a_type == $this->selectable_type and $a_ref_id != $this->ref_id;
114  }
115 
116  function showChilds($a_ref_id)
117  {
118  global $rbacsystem;
119 
120  if ($a_ref_id == 0)
121  {
122  return true;
123  }
124 
125  if ($rbacsystem->checkAccess("read", $a_ref_id))
126  {
127  return true;
128  }
129  else
130  {
131  return false;
132  }
133  }
134 
135 
143  function formatHeader($a_obj_id,$a_option)
144  {
145  global $lng, $ilias;
146 
147  include_once "./classes/class.ilTemplate.php";
148  $tpl = new ilTemplate("tpl.tree.html", true, true);
149 
150  $tpl->setCurrentBlock("text");
151  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
152  $tpl->parseCurrentBlock();
153 
154  $tpl->setCurrentBlock("row");
155  $tpl->parseCurrentBlock();
156 
157  $this->output[] = $tpl->get();
158  }
159 
160 } // END class ilSolutionExplorer
161 ?>