ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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$
29 *
30 * @package core
31 */
32 
33 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
34 
36 {
37 
43  public $root_id;
44  public $output;
45  public $ctrl;
46 
48  public $ref_id;
55  public function __construct($a_target)
56  {
57  global $tree,$ilCtrl;
58 
59  $this->ctrl = $ilCtrl;
60 
61  parent::__construct($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  public function setClickableTypes($a_types)
83  {
84  $this->clickable_types = $a_types;
85  }
86 
87  public function isClickable($a_type, $a_ref_id = 0)
88  {
89  if (in_array($a_type, $this->clickable_types)) {
90  return true;
91  }
92  return false;
93  }
94 
95  public function setTargetClass($a_class)
96  {
97  $this->target_class = $a_class;
98  }
99  public function getTargetClass()
100  {
101  return $this->target_class ? $this->target_class : 'ilsearchgui';
102  }
103  public function setCmd($a_cmd)
104  {
105  $this->cmd = $a_cmd;
106  }
107  public function getCmd()
108  {
109  return $this->cmd ? $this->cmd : 'selectRoot';
110  }
111 
112  public function setSelectableType($a_type)
113  {
114  $this->selectable_type = $a_type;
115  }
116  public function setRefId($a_ref_id)
117  {
118  $this->ref_id = $a_ref_id;
119  }
120 
121 
122  public function buildLinkTarget($a_node_id, $a_type)
123  {
124  $this->ctrl->setParameterByClass($this->getTargetClass(), "root_id", $a_node_id);
125 
126  return $this->ctrl->getLinkTargetByClass($this->getTargetClass(), $this->getCmd());
127  }
128 
129  public function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
130  {
131  return '';
132  }
133 
134  public function showChilds($a_ref_id)
135  {
136  global $rbacsystem;
137 
138  if ($a_ref_id == 0) {
139  return true;
140  }
141 
142  if ($rbacsystem->checkAccess("read", $a_ref_id)) {
143  return true;
144  } else {
145  return false;
146  }
147  }
148 
149 
157  public function formatHeader($tpl, $a_obj_id, $a_option)
158  {
159  global $lng, $ilias;
160 
161  #$tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer");
162 
163  if (in_array("root", $this->clickable_types)) {
164  $tpl->setCurrentBlock("link");
165  //$tpl->setVariable("LINK_NAME",$lng->txt('repository'));
166 
167  $this->ctrl->setParameterByClass($this->getTargetClass(), 'root_id', ROOT_FOLDER_ID);
168  $tpl->setVariable("LINK_TARGET", $this->ctrl->getLinkTargetByClass($this->getTargetClass(), $this->getCmd()));
169  $tpl->setVariable("TITLE", $lng->txt("repository"));
170 
171  $tpl->parseCurrentBlock();
172  }
173 
174  #$this->output[] = $tpl->get();
175 
176  return true;
177  }
178 } // END class ilRepositoryExplorer
setFilterMode($a_mode=IL_FM_NEGATIVE)
set filter mode
const TITLE_LENGTH
max length of object title
__construct($a_target)
Constructor public.
setTitleLength($a_length)
Set max title length.
const IL_FM_POSITIVE
isClickable($a_type, $a_ref_id=0)
setFiltered($a_bool)
active/deactivate the filter public
global $ilCtrl
Definition: ilias.php:18
$a_type
Definition: workflow.php:92
buildLinkTarget($a_node_id, $a_type)
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
Create styles array
The data for the language used.
Class ilExplorer class for explorer view in admin frame.
setSessionExpandVariable($a_var_name="expand")
set name of expand session variable
addFilter($a_item)
adds item to the filter public
formatHeader($tpl, $a_obj_id, $a_option)
overwritten method from base class public