ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilIntLinkRepItemExplorer.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 
33 include_once("classes/class.ilExplorer.php");
34 
36 {
37  var $mode = "text";
38 
45  function ilLMMenuObjectSelector($a_target)
46  {
47  global $tree,$ilCtrl;
48 
49  $this->ctrl =& $ilCtrl;
50  parent::ilExplorer($a_target);
51  }
52 
53  function setSelectableTypes($a_types)
54  {
55  $this->selectable_types = $a_types;
56  }
57 
58  function setMode($a_mode)
59  {
60  $this->mode = $a_mode;
61  }
62 
63  function setSetLinkTargetScript($a_script)
64  {
65  $this->link_target_script = $a_script;
66  }
67 
68  function setRefId($a_ref_id)
69  {
70  $this->ref_id = $a_ref_id;
71  }
72 
73  function buildLinkTarget($a_node_id, $a_type)
74  {
75  if ($this->mode != "link")
76  {
77  return "#";
78  }
79  else
80  {
81  //$tpl->setVariable("LINK_TARGET", "content");
82  $link =
83  ilUtil::appendUrlParameterString($this->link_target_script,
84  "linktype=RepositoryItem".
85  "&linktarget=il__".$a_type."_".$a_node_id);
86 
87  return ($link);
88  }
89  }
90 
91 
92  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
93  {
94  if ($this->mode == "link")
95  {
96  return "content";
97  }
98  else
99  {
100  return '';
101  }
102  }
103 
107  function isClickable($a_type, $a_ref_id)
108  {
109  global $ilUser;
110 
111  if ($ilUser->getPref("ilPageEditor_JavaScript") != "enable"
112  && $this->mode != "link")
113  {
114  return false;
115  }
116  else
117  {
118  return in_array($a_type,$this->selectable_types);
119  }
120  }
121 
122 
126  function buildTitle($a_title, $a_id, $a_type)
127  {
128  return $a_title;
129  }
130 
134  function buildDescription($a_desc, $a_id, $a_type)
135  {
136  global $ilUser;
137 
138  if ($ilUser->getPref("ilPageEditor_JavaScript") != "enable")
139  {
140  if (in_array($a_type,$this->selectable_types))
141  {
142  if ($this->mode != "link")
143  {
144  return "[iln ".$a_type."=\"$a_id\"] [/iln]";
145  }
146  }
147  }
148  return "";
149  }
150 
154  function buildOnClick($a_node_id, $a_type, $a_title)
155  {
156  return "parent.content.addInternalLink('[iln ".$a_type."=&quot;".$a_node_id."&quot;] [/iln]','".$a_title."');setTimeout('window.close()',300);return(false);";
157  }
158 
159 
160 
161  function showChilds($a_ref_id)
162  {
163  global $rbacsystem;
164 
165  if ($a_ref_id == 0)
166  {
167  return true;
168  }
169 
170  if ($rbacsystem->checkAccess("read", $a_ref_id))
171  {
172  return true;
173  }
174  else
175  {
176  return false;
177  }
178  }
179 
180 
188  function formatHeader(&$tpl, $a_obj_id,$a_option)
189  {
190  global $lng, $ilias;
191 
192  $tpl->setCurrentBlock("icon");
193  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_root_s.gif"));
194  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("repository"));
195  $tpl->parseCurrentBlock();
196 
197  $tpl->setCurrentBlock("text");
198  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
199  $tpl->parseCurrentBlock();
200 
201  //$tpl->setCurrentBlock("row");
202  //$tpl->parseCurrentBlock();
203 
204  $tpl->touchBlock("element");
205 
206  }
207 } // END class ilLMMenuObjectSelector
208 ?>