ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSearchRootSelector.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 * Repository Explorer
26 *
27 * @author Stefan Meyer <meyer@leifos.com>
28 * @version $Id: class.ilSearchRootSelector.php 26886 2010-12-07 13:30:56Z mwarkus $
29 *
30 * @package core
31 */
32 
33 require_once("classes/class.ilExplorer.php");
34 
36 {
37 
43  var $root_id;
44  var $output;
45  var $ctrl;
46 
48  var $ref_id;
55  function ilSearchRootSelector($a_target)
56  {
57  global $tree,$ilCtrl;
58 
59  $this->ctrl = $ilCtrl;
60 
61  parent::ilExplorer($a_target);
62  $this->tree = $tree;
63  $this->root_id = $this->tree->readRootId();
64  $this->order_column = "title";
65 
66  $this->setSessionExpandVariable("search_root_expand");
67 
68  // add here all container objects
69  $this->addFilter("root");
70  $this->addFilter("cat");
71  $this->addFilter("grp");
72  $this->addFilter("fold");
73  $this->addFilter("crs");
74  $this->setClickableTypes(array("root", "cat", "grp", "fold", "crs"));
75 
76  $this->setFiltered(true);
78 
80  }
81 
82  function setClickableTypes($a_types)
83  {
84  $this->clickable_types = $a_types;
85  }
86 
87  function isClickable($a_type, $a_ref_id = 0)
88  {
89  if (in_array($a_type, $this->clickable_types))
90  {
91  return true;
92  }
93  return false;
94  }
95 
96  function setTargetClass($a_class)
97  {
98  $this->target_class = $a_class;
99  }
100  function getTargetClass()
101  {
102  return $this->target_class ? $this->target_class : 'ilsearchgui';
103  }
104  function setCmd($a_cmd)
105  {
106  $this->cmd = $a_cmd;
107  }
108  function getCmd()
109  {
110  return $this->cmd ? $this->cmd : 'selectRoot';
111  }
112 
113  function setSelectableType($a_type)
114  {
115  $this->selectable_type = $a_type;
116  }
117  function setRefId($a_ref_id)
118  {
119  $this->ref_id = $a_ref_id;
120  }
121 
122 
123  function buildLinkTarget($a_node_id, $a_type)
124  {
125  $this->ctrl->setParameterByClass($this->getTargetClass(),"root_id",$a_node_id);
126 
127  return $this->ctrl->getLinkTargetByClass($this->getTargetClass(),$this->getCmd());
128 
129  }
130 
131  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
132  {
133  return '';
134  }
135 
136  function showChilds($a_ref_id)
137  {
138  global $rbacsystem;
139 
140  if ($a_ref_id == 0)
141  {
142  return true;
143  }
144 
145  if ($rbacsystem->checkAccess("read", $a_ref_id))
146  {
147  return true;
148  }
149  else
150  {
151  return false;
152  }
153  }
154 
155 
163  function formatHeader(&$tpl,$a_option)
164  {
165  global $lng, $ilias;
166 
167  #$tpl = new ilTemplate("tpl.tree.html", true, true);
168 
169  if (in_array("root", $this->clickable_types))
170  {
171  $tpl->setCurrentBlock("link");
172  $tpl->setVariable("LINK_NAME",$lng->txt('repository'));
173 
174  $this->ctrl->setParameterByClass($this->getTargetClass(),'root_id',ROOT_FOLDER_ID);
175  $tpl->setVariable("LINK_TARGET",$this->ctrl->getLinkTargetByClass($this->getTargetClass(),$this->getCmd()));
176  $tpl->setVariable("TITLE", $lng->txt("repository"));
177 
178  $tpl->parseCurrentBlock();
179  }
180  // not existent
181  // $tpl->setCurrentBlock("row");
182  // $tpl->parseCurrentBlock();
183 
184  #$this->output[] = $tpl->get();
185 
186  return true;
187  }
188 
189 } // END class ilRepositoryExplorer
190 ?>