ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLMMenuObjectSelector.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 require_once("classes/class.ilExplorer.php");
25 
35 {
36 
42  var $root_id;
43  var $output;
44  var $ctrl;
46  var $ref_id;
47 
54  function ilLMMenuObjectSelector($a_target,&$a_gui_obj)
55  {
56  global $tree,$ilCtrl;
57 
58  $this->ctrl = $ilCtrl;
59 
60  $this->gui_obj = $a_gui_obj;
61 
62  parent::ilExplorer($a_target);
63  $this->tree = $tree;
64  $this->root_id = $this->tree->readRootId();
65  $this->order_column = "title";
66  $this->setSessionExpandVariable("lm_menu_expand");
67  $this->addFilter("rolf");
68  $this->addFilter("adm");
69  }
70 
71  function setSelectableTypes($a_types)
72  {
73  $this->selectable_types = $a_types;
74  }
75 
76  function setRefId($a_ref_id)
77  {
78  $this->ref_id = $a_ref_id;
79  }
80 
81 
82  function buildLinkTarget($a_node_id, $a_type)
83  {
84  if(in_array($a_type,$this->selectable_types))
85  {
86  $this->ctrl->setParameter($this->gui_obj,'link_ref_id',$a_node_id);
87  return $this->ctrl->getLinkTarget($this->gui_obj,'addMenuEntry');
88  }
89  }
90 
91  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
92  {
93  return '';
94  }
95 
96  function isClickable($a_type, $a_ref_id)
97  {//return true;
98  return in_array($a_type,$this->selectable_types) and $a_ref_id != $this->ref_id;
99  }
100 
101  function showChilds($a_ref_id)
102  {
103  global $rbacsystem;
104 
105  if ($a_ref_id == 0)
106  {
107  return true;
108  }
109 
110  if ($rbacsystem->checkAccess("read", $a_ref_id))
111  {
112  return true;
113  }
114  else
115  {
116  return false;
117  }
118  }
119 
120 
128  function formatHeader($a_obj_id,$a_option)
129  {
130  global $lng, $ilias;
131 
132  $tpl = new ilTemplate("tpl.tree.html", true, true);
133 
134  $tpl->setCurrentBlock("text");
135  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
136  $tpl->parseCurrentBlock();
137 
138  $tpl->setCurrentBlock("row");
139  $tpl->parseCurrentBlock();
140 
141  $this->output[] = $tpl->get();
142  }
143 } // END class ilLMMenuObjectSelector
144 ?>