ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRepositoryLinkSelector.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.ilRepositoryLinkSelector.php 25692 2010-09-15 09:44:16Z mwarkus $
29 *
30 */
31 
32 require_once("classes/class.ilExplorer.php");
33 
35 {
36 
42  var $root_id;
43  var $output;
44  var $ctrl;
45 
47  var $ref_id;
54  function ilRepositoryLinkSelector($a_target)
55  {
56  global $tree,$ilCtrl;
57 
58  $this->ctrl = $ilCtrl;
59 
60  parent::ilExplorer($a_target);
61  $this->tree = $tree;
62  $this->root_id = $this->tree->readRootId();
63  $this->order_column = "title";
64 
65  $this->setSessionExpandVariable("rep_link_expand");
66 
67  // add here all container objects
68  $this->addFilter("root");
69  $this->addFilter("cat");
70  $this->addFilter("grp");
71  $this->addFilter("fold");
72  $this->addFilter("crs");
73 
75  $this->setFiltered(true);
76 
78  }
79 
80  function setSelectableType($a_type)
81  {
82  $this->selectable_type = $a_type;
83  }
84  function setRefId($a_ref_id)
85  {
86  $this->ref_id = $a_ref_id;
87  }
88 
89 
90  function buildLinkTarget($a_node_id, $a_type)
91  {
92  if($a_type == $this->selectable_type)
93  {
94  $this->ctrl->setParameterByClass('ilrepositorygui','source_id',$a_node_id);
95  return $this->ctrl->getLinkTargetByClass('ilrepositorygui','linkChilds');
96  }
97  else
98  {
99  $this->ctrl->setParameterByClass('ilrepositorygui',"ref_id",$this->ref_id);
100  return $this->ctrl->getLinkTargetByClass('ilrepositorygui','linkSelector');
101  }
102 
103  }
104 
105  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
106  {
107  return '';
108  }
109 
110  function isClickable($a_type, $a_ref_id)
111  {
112  global $rbacsystem;
113 
114  return $a_type == $this->selectable_type
115  and $a_ref_id != $this->ref_id
116  and $rbacsystem->checkAccess('write',$a_ref_id);
117  }
118 
119  function showChilds($a_ref_id)
120  {
121  global $rbacsystem;
122 
123  if ($a_ref_id == 0)
124  {
125  return true;
126  }
127 
128  if ($rbacsystem->checkAccess("read", $a_ref_id))
129  {
130  return true;
131  }
132  else
133  {
134  return false;
135  }
136  }
137 
138 
146  function formatHeader($a_obj_id,$a_option)
147  {
148  global $lng, $ilias;
149 
150  $tpl = new ilTemplate("tpl.tree.html", true, true);
151 
152  $tpl->setCurrentBlock("text");
153  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
154  $tpl->parseCurrentBlock();
155 
156  $tpl->setCurrentBlock("row");
157  $tpl->parseCurrentBlock();
158 
159  $this->output[] = $tpl->get();
160  }
161 
162 } // END class ilRepositoryExplorer
163 ?>