ILIAS  release_4-3 Revision
 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("./Services/UIComponent/Explorer/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  if ($this->mode == "asynch")
62  {
63  $this->setAsynchExpanding(true);
64  }
65  }
66 
72  function setSetLinkTargetScript($a_script)
73  {
74  $this->link_target_script = $a_script;
75  }
76 
81  {
82  return $this->link_target_script;
83  }
84 
85 
86  function setRefId($a_ref_id)
87  {
88  $this->ref_id = $a_ref_id;
89  }
90 
91  function buildLinkTarget($a_node_id, $a_type)
92  {
93  if ($this->getSetLinkTargetScript() == "")
94  {
95  return "#";
96  }
97  else
98  {
99  //$tpl->setVariable("LINK_TARGET", "content");
100  $link =
102  "linktype=RepositoryItem".
103  "&linktarget=il__".$a_type."_".$a_node_id);
104 
105  return ($link);
106  }
107  }
108 
109 
110  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
111  {
112  if ($this->mode == "link")
113  {
114 // return "content";
115  }
116  else
117  {
118  return '';
119  }
120  }
121 
125  function isClickable($a_type, $a_ref_id)
126  {
127  global $ilUser;
128 
129  if ($ilUser->getPref("ilPageEditor_JavaScript") != "enable"
130  && $this->mode != "link" && $this->mode != "asynch")
131  {
132  return false;
133  }
134  else
135  {
136  return in_array($a_type,$this->selectable_types);
137  }
138  }
139 
140 
144  function buildTitle($a_title, $a_id, $a_type)
145  {
146  return $a_title;
147  }
148 
152  function buildDescription($a_desc, $a_id, $a_type)
153  {
154  global $ilUser;
155 
156  if ($ilUser->getPref("ilPageEditor_JavaScript") != "enable" &&
157  $this->mode != "asynch")
158  {
159  if (in_array($a_type,$this->selectable_types))
160  {
161  if ($this->mode != "link")
162  {
163  return "[iln ".$a_type."=\"$a_id\"] [/iln]";
164  }
165  }
166  }
167  return "";
168  }
169 
173  function buildOnClick($a_node_id, $a_type, $a_title)
174  {
175  if ($this->getSetLinkTargetScript() == "")
176  {
177  return "return il.IntLink.addInternalLink('[iln ".$a_type."=&quot;".$a_node_id."&quot;]','[/iln]', event);";
178  }
179 // else
180 // {
181 // return "parent.content.addInternalLink('[iln ".$a_type."=&quot;".$a_node_id."&quot;] [/iln]','".$a_title."');setTimeout('window.close()',300);return(false);";
182 // }
183  }
184 
185 
186 
187  function showChilds($a_ref_id)
188  {
189  global $rbacsystem;
190 
191  if ($a_ref_id == 0)
192  {
193  return true;
194  }
195 
196  if ($rbacsystem->checkAccess("read", $a_ref_id))
197  {
198  return true;
199  }
200  else
201  {
202  return false;
203  }
204  }
205 
206 
214  function formatHeader(&$tpl, $a_obj_id,$a_option)
215  {
216  global $lng, $ilias;
217 
218  $tpl->setCurrentBlock("icon");
219  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_root_s.png"));
220  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("repository"));
221  $tpl->parseCurrentBlock();
222 
223  $tpl->setCurrentBlock("text");
224  $tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
225  $tpl->parseCurrentBlock();
226 
227  //$tpl->setCurrentBlock("row");
228  //$tpl->parseCurrentBlock();
229 
230  $tpl->touchBlock("element");
231 
232  }
233 } // END class ilLMMenuObjectSelector
234 ?>