ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLinkResourceGUI.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 
24 include_once "./classes/class.ilObjectGUI.php";
25 
38 {
43  function ilObjLinkResourceGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
44  {
45  global $ilCtrl;
46 
47  $this->type = "webr";
48  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
49 
50  // CONTROL OPTIONS
51  $this->ctrl =& $ilCtrl;
52  $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
53 
54  $this->lng->loadLanguageModule('webr');
55  }
56 
57  function &executeCommand()
58  {
59  global $rbacsystem;
60 
61  //if($this->ctrl->getTargetScript() == 'link_resources.php')
62  if($_GET["baseClass"] == 'ilLinkResourceHandlerGUI')
63  {
64  $this->__prepareOutput();
65  }
66 
67  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
68  $this->getCreationMode() == true)
69  {
70  $this->prepareOutput();
71  }
72 
73 
74  $next_class = $this->ctrl->getNextClass($this);
75  $cmd = $this->ctrl->getCmd();
76 
77  switch($next_class)
78  {
79  case "ilinfoscreengui":
80  $this->infoScreen(); // forwards command
81  break;
82 
83  case 'ilmdeditorgui':
84 
85  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
86 
87  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
88  $md_gui->addObserver($this->object,'MDUpdateListener','General');
89 
90  $this->ctrl->forwardCommand($md_gui);
91  break;
92 
93  case 'ilpermissiongui':
94  include_once("./classes/class.ilPermissionGUI.php");
95  $perm_gui =& new ilPermissionGUI($this);
96  $ret =& $this->ctrl->forwardCommand($perm_gui);
97  break;
98 
99  default:
100  if(!$cmd)
101  {
102  $cmd = "view";
103  }
104  $cmd .= "Object";
105  $this->$cmd();
106 
107  break;
108  }
109 
110  if(!$this->getCreationMode())
111  {
112  // Fill meta header tags
113  include_once('Services/MetaData/classes/class.ilMDUtils.php');
114  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'webr');
115  }
116  return true;
117  }
118 
126  public function createObject()
127  {
129  $this->fillCloneTemplate('CLONE_WIZARD',$_REQUEST['new_type']);
130  }
131 
132  function viewObject()
133  {
134  global $ilAccess,$ilErr;
135 
136  if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
137  {
138  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
139  }
140 
141 
142  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
143  {
145  return true;
146  }
147  else
148  {
149  $this->listItemsObject();
150 
151  return true;
152  }
153  }
154 
155  function listItemsObject()
156  {
157  global $rbacsystem;
158 
159  include_once "./Services/Table/classes/class.ilTableGUI.php";
160  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
161 
162  // MINIMUM ACCESS LEVEL = 'read'
163  if(!$rbacsystem->checkAccess("read", $this->object->getRefId()))
164  {
165  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
166  }
167 
168  $this->object->initLinkResourceItemsObject();
169  if(!count($items = $this->object->items_obj->getActivatedItems()))
170  {
171  ilUtil::sendInfo($this->lng->txt('webr_no_items_created'));
172 
173  return true;
174  }
175 
176  $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_view_items.html","Modules/WebResource");
177 
178  $tpl =& new ilTemplate("tpl.table.html", true, true);
179  #$items_sliced = array_slice($items, $_GET["offset"], $_GET["limit"]);
180 
181  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lnkr_view_items_row.html",'Modules/WebResource');
182 
183  $items = ilUtil::sortArray($items,
184  'title',
185  $_GET['sort_order'] ? $_GET['sort_order'] : 'asc');
186  $counter = 0;
187  foreach($items as $item_id => $item)
188  {
190  {
191  $item = ilParameterAppender::_append($item);
192  }
193  if(strlen($item['description']))
194  {
195  $tpl->setCurrentBlock("description");
196  $tpl->setVariable("DESCRIPTION",$item['description']);
197  $tpl->parseCurrentBlock();
198  }
199  $tpl->setCurrentBlock("row");
200  $tpl->setVariable("ROW_CSS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
201  $tpl->setVariable("TITLE",$item['title']);
202  $tpl->setVariable("TARGET",$item['target']);
203  $tpl->parseCurrentBlock();
204  }
205 
206  // create table
207  $tbl = new ilTableGUI();
208 
209  // title & header columns
210  $tbl->setTitle($this->lng->txt("web_resources"),"icon_webr.gif",$this->lng->txt("web_resources"));
211  $tbl->setHeaderNames(array($this->lng->txt("title")));
212  $tbl->setHeaderVars(array("title"),array("ref_id" => $this->object->getRefId(),
213  "cmd" => 'listItems'));
214  $tbl->setColumnWidth(array("100%"));
215  $tbl->disable('linkbar');
216  $tbl->disable('numinfo');
217 
218  $tbl->setOrderColumn('title');
219  $tbl->setOrderDirection($_GET['sort_order']);
220  $tbl->setLimit($_GET["limit"]);
221  $tbl->setOffset($_GET["offset"]);
222  $tbl->setMaxCount(count($items));
223 
224  // render table
225  $tbl->setTemplate($tpl);
226  $tbl->render();
227 
228  $this->tpl->setVariable("ITEM_TABLE", $tpl->get());
229 
230  return true;
231  }
232 
233  function editItemsObject()
234  {
235  global $rbacsystem;
236 
237  include_once "./Services/Table/classes/class.ilTableGUI.php";
238  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
239 
240 
241  // MINIMUM ACCESS LEVEL = 'read'
242  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
243  {
244  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
245  }
246 
247  $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_edit_items.html","Modules/WebResource");
248  $this->__showButton('showAddItem',$this->lng->txt('webr_add_item'));
249 
250  $this->object->initLinkResourceItemsObject();
251  if(!count($items = $this->object->items_obj->getAllItems()))
252  {
253  ilUtil::sendInfo($this->lng->txt('webr_no_items_created'));
254 
255  return true;
256  }
257 
258  $tpl =& new ilTemplate("tpl.table.html", true, true);
259  #$items_sliced = array_slice($items, $_GET["offset"], $_GET["limit"]);
260 
261  $tpl->setCurrentBlock("tbl_form_header");
262  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
263  $tpl->parseCurrentBlock();
264 
265  $tpl->setCurrentBlock("tbl_action_btn");
266  $tpl->setVariable("BTN_NAME",'askDeleteItems');
267  $tpl->setVariable("BTN_VALUE",$this->lng->txt('delete'));
268  $tpl->parseCurrentBlock();
269 
270  $tpl->setCurrentBlock("plain_buttons");
271  $tpl->setVariable("PBTN_NAME",'updateItems');
272  $tpl->setVariable("PBTN_VALUE",$this->lng->txt('save'));
273  $tpl->parseCurrentBlock();
274 
275  $tpl->setCurrentBlock("tbl_action_row");
276  $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
277  $tpl->setVariable("COLUMN_COUNTS",ilParameterAppender::_isEnabled() ? 8 : 7);
278  $tpl->parseCurrentBlock();
279 
280 
281 
282  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.lnkr_edit_items_row.html",'Modules/WebResource');
283 
284  $items = ilUtil::sortArray($items,
285  $_GET['sort_by'] ? $_GET['sort_by'] : 'title',
286  $_GET['sort_order'] ? $_GET['sort_order'] : 'asc');
287 
288  $counter = 0;
289  foreach($items as $item_id => $item)
290  {
292  {
293  $params_list = array();
294  foreach($params = ilParameterAppender::_getParams($item['link_id']) as $id => $param)
295  {
296  $txt_param = $param['name'];
297  switch($param['value'])
298  {
299  case LINKS_USER_ID:
300  $txt_param .= '=IL_USER_ID';
301  break;
302 
303  case LINKS_SESSION_ID:
304  $txt_param .= '=IL_SESSION_ID';
305  break;
306 
307  case LINKS_LOGIN:
308  $txt_param .= '=IL_LOGIN';
309  break;
310  }
311  $params_list[] = $txt_param;
312  }
313  $tpl->setCurrentBlock("params");
314  $tpl->setVariable("DYN_PARAM",count($params_list) ?
315  implode('<br />',$params_list) :
316  $this->lng->txt('links_not_available'));
317  $tpl->parseCurrentBlock();
318  }
319 
320 
321  if(strlen($item['description']))
322  {
323  $tpl->setCurrentBlock("description");
324  $tpl->setVariable("DESCRIPTION",$item['description']);
325  $tpl->parseCurrentBlock();
326  }
327 
328  $tpl->setCurrentBlock("row");
329  $tpl->setVariable("ROW_CSS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
330 
331  $tpl->setVariable("CHECK_ITEM",ilUtil::formCheckbox(0,'item_id[]',$item['link_id']));
332  $tpl->setVariable("TITLE",$item['title']);
333 
334  if($item['last_check'])
335  {
336  $last_check = ilDatePresentation::formatDate(new ilDateTime($item['last_check'],IL_CAL_UNIX));
337  }
338  else
339  {
340  $last_check = $this->lng->txt('webr_never_checked');
341  }
342  $tpl->setVariable("TXT_LAST_CHECK",$this->lng->txt('webr_last_check_table'));
343  $tpl->setVariable("LAST_CHECK",$last_check);
344 
345  $target = substr($item['target'],0,70);
346  if(strlen($item['target']) > 70)
347  {
348  $target = substr($item['target'],0,70).'...';
349  }
350  else
351  {
352  $target = $item['target'];
353  }
354 
355 
356 
357  $tpl->setVariable("TARGET",$target);
358  $tpl->setVariable("VALID",ilUtil::formCheckbox($item['valid'] ? 1 : 0,'valid['.$item['link_id'].']',1));
359  $tpl->setVariable("ACTIVE",ilUtil::formCheckbox($item['active'] ? 1 : 0,'active['.$item['link_id'].']',1));
360  $tpl->setVariable("DISABLE_CHECK",ilUtil::formCheckbox($item['disable_check'] ? 1 : 0,'disable['.$item['link_id'].']',1));
361  $tpl->setVariable("EDIT_IMG",ilUtil::getImagePath('icon_pencil.gif'));
362  $tpl->setVariable("EDIT_ALT",$this->lng->txt('edit'));
363 
364  $this->ctrl->setParameter($this,'item_id',$item['link_id']);
365  $tpl->setVariable("EDIT_LINK",$this->ctrl->getLinkTarget($this,'editItem'));
366 
367  $tpl->parseCurrentBlock();
368  }
369 
370  // create table
371  $tbl = new ilTableGUI();
372 
373 
374 
375 
376  // title & header columns
377  $tbl->setTitle($this->lng->txt("web_resources"),"icon_webr.gif",$this->lng->txt("web_resources"));
378 
380  {
381  $tbl->setHeaderNames(array('',
382  $this->lng->txt("title"),
383  $this->lng->txt("target"),
384  $this->lng->txt('valid'),
385  $this->lng->txt('active'),
386  $this->lng->txt('disable_check'),
387  $this->lng->txt('details')));
388  $tbl->setHeaderVars(array("",
389  "title",
390  "target",
391  "valid",
392  "active",
393  "disable_check",
394  ""),array("ref_id" => $this->object->getRefId(),
395  "cmd" => 'editItems'));
396  $tbl->setColumnWidth(array("",
397  "50%",
398  "30%",
399  "5%",
400  "5%",
401  "5%",
402  "5%"));
403  }
404  else
405  {
406  $tbl->setHeaderNames(array('',
407  $this->lng->txt("title"),
408  $this->lng->txt("target"),
409  $this->lng->txt("links_dyn_parameter"),
410  $this->lng->txt('valid'),
411  $this->lng->txt('active'),
412  $this->lng->txt('disable_check'),
413  $this->lng->txt('details')));
414 
415  $tbl->setHeaderVars(array("",
416  "title",
417  "target",
418  "parameter",
419  "valid",
420  "active",
421  "disable_check",
422  ""),array("ref_id" => $this->object->getRefId(),
423  "cmd" => 'editItems'));
424  $tbl->setColumnWidth(array("",
425  "40%",
426  "20%",
427  "20%",
428  "5%",
429  "5%",
430  "5%",
431  "5%"));
432  }
433  $tbl->disable('linkbar');
434  $tbl->disable('numinfo');
435  $tbl->enable('sort');
436 
437  $tbl->setOrderColumn($_GET['sort_by']);
438  $tbl->setOrderDirection($_GET['sort_order']);
439  $tbl->setLimit($_GET["limit"]);
440  $tbl->setOffset($_GET["offset"]);
441  $tbl->setMaxCount(count($items));
442 
443  // render table
444  $tbl->setTemplate($tpl);
445  $tbl->render();
446 
447  $this->tpl->setVariable("ITEM_TABLE", $tpl->get());
448 
449  return true;
450  }
451 
453  {
454  global $rbacsystem;
455 
456  // MINIMUM ACCESS LEVEL = 'write'
457  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
458  {
459  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
460  }
461  if(!count($_POST['item_id']))
462  {
463  ilUtil::sendInfo($this->lng->txt('webr_select_one'));
464  $this->editItemsObject();
465 
466  return true;
467  }
468 
469  ilUtil::sendInfo($this->lng->txt('webr_sure_delete_items'));
470  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.lnkr_ask_delete.html','Modules/WebResource');
471 
472  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
473  $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath('icon_webr.gif'));
474  $this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->lng->txt('obj_webr'));
475  $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('webr_delete_items'));
476  $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('title'));
477  $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel'));
478  $this->tpl->setVariable("BTN_DELETE",$this->lng->txt('delete'));
479 
480  $this->object->initLinkResourceItemsObject();
481 
482  $counter = 0;
483  foreach($_POST['item_id'] as $id)
484  {
485  $this->object->items_obj->readItem($id);
486  $this->tpl->setCurrentBlock("item_row");
487  $this->tpl->setVariable("ITEM_TITLE",$this->object->items_obj->getTitle());
488  $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
489  $this->tpl->setVariable("TARGET",$this->object->items_obj->getTarget());
490  $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
491  $this->tpl->parseCurrentBlock();
492  }
493  $_SESSION['webr_item_ids'] = $_POST['item_id'];
494 
495  return true;
496  }
497 
498  function deleteItemsObject()
499  {
500  global $rbacsystem;
501 
502  // MINIMUM ACCESS LEVEL = 'write'
503  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
504  {
505  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
506  }
507  if(!count($_SESSION['webr_item_ids']))
508  {
509  ilUtil::sendInfo($this->lng->txt('webr_select_one'));
510  $this->editItemsObject();
511 
512  return true;
513  }
514 
515  $this->object->initLinkResourceItemsObject();
516  foreach($_SESSION['webr_item_ids'] as $id)
517  {
518  $this->object->items_obj->delete($id);
519  }
520  ilUtil::sendInfo($this->lng->txt('webr_deleted_items'));
521 
522  $this->editItemsObject();
523  return true;
524  }
525 
526 
527  function updateItemsObject()
528  {
529  global $rbacsystem;
530 
531  // MINIMUM ACCESS LEVEL = 'write'
532  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
533  {
534  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
535  }
536  $this->object->initLinkResourceItemsObject();
537  foreach($this->object->items_obj->getAllItems() as $item)
538  {
539  $update = false;
540 
541  $valid = (int) $_POST['valid'][$item['link_id']];
542  $active = (int) $_POST['active'][$item['link_id']];
543  $disable = (int) $_POST['disable'][$item['link_id']];
544 
545  if($valid != $item['valid'] or
546  $active != $item['active'] or
547  $disable != $item['disable_check'])
548  {
549  $this->object->items_obj->readItem($item['link_id']);
550  $this->object->items_obj->setValidStatus($valid);
551  $this->object->items_obj->setActiveStatus($active);
552  $this->object->items_obj->setDisableCheckStatus($disable);
553  $this->object->items_obj->update();
554  }
555  }
556 
557  ilUtil::sendInfo($this->lng->txt('webr_modified_items'));
558  $this->editItemsObject();
559 
560  return true;
561  }
562 
563  function editItemObject()
564  {
565  global $rbacsystem;
566 
567  // MINIMUM ACCESS LEVEL = 'write'
568  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
569  {
570  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
571  }
572 
573  $this->object->initLinkResourceItemsObject();
574  $item = $this->object->items_obj->getItem($_GET['item_id'] ? $_GET['item_id'] : $_SESSION['webr_item_id']);
575 
576 
577  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.lnkr_edit_item.html','Modules/WebResource');
578 
579  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
580  $this->tpl->setVariable("TBL_TITLE_IMG",ilUtil::getImagePath('icon_webr.gif'));
581  $this->tpl->setVariable("TBL_TITLE_IMG_ALT",$this->lng->txt('obj_webr'));
582  $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('webr_edit_item'));
583  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
584  $this->tpl->setVariable("TXT_DESCRIPTION",$this->lng->txt('description'));
585  $this->tpl->setVariable("TITLE",ilUtil::prepareFormOutput($item['title']));
586  $this->tpl->setVariable("DESCRIPTION",ilUtil::prepareFormOutput($item['description']));
587  $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
588  $this->tpl->setVariable("TARGET",ilUtil::prepareFormOutput($item['target']));
589  $this->tpl->setVariable("TXT_ACTIVE",$this->lng->txt('webr_active'));
590  $this->tpl->setVariable("ACTIVE_CHECK",ilUtil::formCheckbox($item['active'] ? 1 : 0,'active',1));
591  $this->tpl->setVariable("TXT_VALID",$this->lng->txt('valid'));
592  $this->tpl->setVariable("VALID_CHECK",ilUtil::formCheckbox($item['valid'] ? 1 : 0,'valid',1));
593  $this->tpl->setVariable("TXT_DISABLE",$this->lng->txt('disable_check'));
594  $this->tpl->setVariable("DISABLE_CHECK",ilUtil::formCheckbox($item['disable_check'] ? 1 : 0,'disable',1));
595  $this->tpl->setVariable("TXT_CREATED",$this->lng->txt('created'));
596  $this->tpl->setVariable('CREATED',ilDatePresentation::formatDate(new ilDateTime($item['create_date'],IL_CAL_UNIX)));
597  $this->tpl->setVariable("TXT_MODIFIED",$this->lng->txt('last_change'));
598  $this->tpl->setVariable('MODIFIED',ilDatePresentation::formatDate(new ilDateTime($item['last_update'],IL_CAL_UNIX)));
599  $this->tpl->setVariable("TXT_LAST_CHECK",$this->lng->txt('webr_last_check'));
600 
601  // add dynamic params
602  include_once('./Modules/WebResource/classes/class.ilParameterAppender.php');
603 
605  {
606  $counter = 0;
607  foreach($params = ilParameterAppender::_getParams($item['link_id']) as $id => $param)
608  {
609  if(!$counter++)
610  {
611  $this->tpl->setCurrentBlock("header_info");
612  $this->tpl->setVariable("TXT_PARAM_EXIST",$this->lng->txt('links_existing_params'));
613  $this->tpl->parseCurrentBlock();
614  }
615  $this->tpl->setCurrentBlock("show_params");
616 
617  $txt_param = $param['name'];
618  switch($param['value'])
619  {
620  case LINKS_USER_ID:
621  $txt_param .= '=IL_USER_ID';
622  break;
623 
624  case LINKS_SESSION_ID:
625  $txt_param .= '=IL_SESSION_ID';
626  break;
627 
628  case LINKS_LOGIN:
629  $txt_param .= '=IL_LOGIN';
630  break;
631  }
632  $this->tpl->setVariable("PARAMETER",$txt_param);
633 
634  // Delete link
635  $this->ctrl->setParameter($this,'param_id',$id);
636  $this->tpl->setVariable("DEL_TARGET",$this->ctrl->getLinkTarget($this,'deleteParameter'));
637  $this->tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
638  $this->tpl->parseCurrentBlock();
639  }
640 
641  $this->tpl->setCurrentBlock("params");
642  $this->tpl->setVariable("TXT_ADD_PARAM",$this->lng->txt('links_add_param'));
643  $this->tpl->setVariable("TXT_DYNAMIC",$this->lng->txt('links_dynamic'));
644  $this->tpl->setVariable("TXT_NAME",$this->lng->txt('links_name'));
645  $this->tpl->setVariable("TXT_VALUE",$this->lng->txt('links_value'));
646  $this->tpl->setVariable("DYNAMIC_INFO",$this->lng->txt('link_dynamic_info'));
647 
648  $this->tpl->setVariable("NAME",$_POST['name'] ? ilUtil::prepareFormOutput($_POST['name'],true) : '');
649  $this->tpl->setVariable("VAL_SEL",ilUtil::formSelect((int) $_POST['value'],
650  'value',
652  false,
653  true));
654  $this->tpl->parseCurrentBlock();
655  }
656 
657 
658 
659  if($item['last_check'])
660  {
661  $last_check = ilDatePresentation::formatDate(new ilDateTime($item['last_check'],IL_CAL_UNIX));
662  }
663  else
664  {
665  $last_check = $this->lng->txt('webr_never_checked');
666  }
667 
668  $this->tpl->setVariable("LAST_CHECK",$last_check);
669  $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel'));
670  $this->tpl->setVariable("BTN_UPDATE",$this->lng->txt('save'));
671 
672  $_SESSION['webr_item_id'] = $_GET['item_id'] ? $_GET['item_id'] : $_SESSION['webr_item_id'];
673 
674  return true;
675  }
676 
678  {
679  if(!((int) $_GET['param_id']))
680  {
681  ilUtil::sendInfo('No parameter id given');
682  $this->editItemObject();
683 
684  return false;
685  }
686 
687  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
688 
689  $appender = new ilParameterAppender($this->object->getId());
690  $appender->delete((int) $_GET['param_id']);
691 
692  ilUtil::sendInfo($this->lng->txt('links_parameter_deleted'));
693 
694  $this->editItemObject();
695  return true;
696  }
697 
698 
699  function updateItemObject()
700  {
701  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
702 
703  global $rbacsystem;
704 
705  // MINIMUM ACCESS LEVEL = 'write'
706  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
707  {
708  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
709  }
710  if(!$_POST['title'] or $_POST['target'] == 'http://')
711  {
712  ilUtil::sendInfo($this->lng->txt('webr_fillout_all'));
713 
714  $this->editItemObject();
715  return false;
716  }
718  {
719  $appender =& new ilParameterAppender($this->object->getId());
720  $appender->setName(ilUtil::stripSlashes($_POST['name']));
721  $appender->setValue(ilUtil::stripSlashes($_POST['value']));
722 
723  if(!$appender->validate())
724  {
725  switch($appender->getErrorCode())
726  {
727  case LINKS_ERR_NO_NAME:
728  ilUtil::sendInfo($this->lng->txt('links_no_name_given'));
729  $this->editItemObject();
730  return false;
731 
732  case LINKS_ERR_NO_VALUE:
733  ilUtil::sendInfo($this->lng->txt('links_no_value_given'));
734  $this->editItemObject();
735  return false;
736 
737  default:
738  break;
739  }
740  }
741  }
742 
743  $this->object->initLinkResourceItemsObject();
744 
745  $this->object->items_obj->readItem($_SESSION['webr_item_id']);
746  $this->object->items_obj->setLinkId($_SESSION['webr_item_id']);
747  $this->object->items_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
748  $this->object->items_obj->setDescription(ilUtil::stripSlashes($_POST['description']));
749  $this->object->items_obj->setTarget(ilUtil::stripSlashes($_POST['target']));
750  $this->object->items_obj->setActiveStatus($_POST['active']);
751  $this->object->items_obj->setValidStatus($_POST['valid']);
752  $this->object->items_obj->setDisableCheckStatus($_POST['disable']);
753  $this->object->items_obj->update();
754 
755  if(is_object($appender))
756  {
757  $appender->add($_SESSION['webr_item_id']);
758  }
759 
760  unset($_SESSION['webr_item_id']);
761  ilUtil::sendInfo($this->lng->txt('webr_item_updated'));
762  $this->editItemsObject();
763 
764  return true;
765  }
766 
767 
768 
769  function showAddItemObject()
770  {
771  global $rbacsystem;
772 
773  $this->tabs_gui->setTabActive('edit_content');
774 
775  // MINIMUM ACCESS LEVEL = 'read'
776  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
777  {
778  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
779  }
780 
781  $title = $_POST['title'] ? ilUtil::prepareFormOutput($_POST['title'],true) : '';
782  $target = $_POST['target'] ? ilUtil::prepareFormOutput($_POST['target'],true) : 'http://';
783 
784 
785  $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.lnkr_add_item.html","Modules/WebResource");
786 
787  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
788  $this->tpl->setVariable("TXT_HEADER",$this->lng->txt('webr_add_item'));
789  $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title'));
790  $this->tpl->setVariable("TXT_DESC",$this->lng->txt('description'));
791  $this->tpl->setVariable("TXT_TARGET",$this->lng->txt('target'));
792  $this->tpl->setVariable("TARGET",$target);
793  $this->tpl->setVariable("TXT_ACTIVE",$this->lng->txt('active'));
794  $this->tpl->setVariable("TXT_CHECK",$this->lng->txt('webr_disable_check'));
795  $this->tpl->setVariable("TXT_REQUIRED_FLD",$this->lng->txt('required_field'));
796  $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
797  $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('add'));
798  $this->tpl->setVariable("CMD_SUBMIT",'addItem');
799  $this->tpl->setVariable("CMD_CANCEL",'editItems');
800 
801  // Params
802  include_once('./Modules/WebResource/classes/class.ilParameterAppender.php');
803 
805  {
806  $this->tpl->setCurrentBlock("params");
807  $this->tpl->setVariable("TXT_DYNAMIC",$this->lng->txt('links_dynamic'));
808  $this->tpl->setVariable("TXT_NAME",$this->lng->txt('links_name'));
809  $this->tpl->setVariable("TXT_VALUE",$this->lng->txt('links_value'));
810  $this->tpl->setVariable("DYNAMIC_INFO",$this->lng->txt('links_dynamic_info'));
811 
812  $this->tpl->setVariable("NAME",$_POST['name'] ? ilUtil::prepareFormOutput($_POST['name'],true) : '');
813  $this->tpl->setVariable("VAL_SEL",ilUtil::formSelect((int) $_POST['value'],
814  'value',
816  false,
817  true));
818  $this->tpl->parseCurrentBlock();
819  }
820 
821  $this->tpl->setVariable("ACTIVE_CHECK",ilUtil::formCheckBox(1,'active',1));
822  $this->tpl->setVariable("CHECK_CHECK",ilUtil::formCheckBox(0,'disable_check',1));
823 
824  }
825 
826  function addItemObject()
827  {
828  include_once('./Modules/WebResource/classes/class.ilParameterAppender.php');
829 
830  global $rbacsystem;
831 
832  // MINIMUM ACCESS LEVEL = 'read'
833  if(!$rbacsystem->checkAccess("write", $this->object->getRefId()))
834  {
835  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
836  }
837 
838  $this->object->initLinkResourceItemsObject();
839 
840  if(!$_POST['title'] or $_POST['target'] == 'http://')
841  {
842  ilUtil::sendInfo($this->lng->txt('webr_fillout_all'));
843 
844  $this->showAddItemObject();
845  return false;
846  }
848  {
849  $appender =& new ilParameterAppender($this->object->getId());
850  $appender->setName(ilUtil::stripSlashes($_POST['name']));
851  $appender->setValue(ilUtil::stripSlashes($_POST['value']));
852 
853  if(!$appender->validate())
854  {
855  switch($appender->getErrorCode())
856  {
857  case LINKS_ERR_NO_NAME:
858  ilUtil::sendInfo($this->lng->txt('links_no_name_given'));
859  $this->showAddItemObject();
860  return false;
861 
862  case LINKS_ERR_NO_VALUE:
863  ilUtil::sendInfo($this->lng->txt('links_no_name_given'));
864  $this->showAddItemObject();
865  return false;
866 
867  default:
868  break;
869  }
870  }
871  }
872  $this->object->items_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
873  $this->object->items_obj->setDescription(ilUtil::stripSlashes($_POST['description']));
874  $this->object->items_obj->setTarget(ilUtil::stripSlashes($_POST['target']));
875  $this->object->items_obj->setActiveStatus($_POST['active']);
876  $this->object->items_obj->setDisableCheckStatus($_POST['disable_check']);
877  $link_id = $this->object->items_obj->add();
878 
879  if(is_object($appender))
880  {
881  $appender->add($link_id);
882  }
883  $this->editItemsObject();
884  }
885 
891  function infoScreenObject()
892  {
893  $this->ctrl->setCmd("showSummary");
894  $this->ctrl->setCmdClass("ilinfoscreengui");
895  $this->infoScreen();
896  }
897 
901  function infoScreen()
902  {
903  global $ilAccess;
904 
905  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
906  {
907  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
908  }
909 
910  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
911  $info = new ilInfoScreenGUI($this);
912 
913  $info->enablePrivateNotes();
914 
915  // standard meta data
916  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
917 
918  // forward the command
919  $this->ctrl->forwardCommand($info);
920  }
921 
922 
923  function historyObject()
924  {
925  global $rbacsystem;
926 
927  if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
928  {
929  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
930  }
931 
932  include_once("classes/class.ilHistoryGUI.php");
933 
934  $hist_gui =& new ilHistoryGUI($this->object->getId());
935 
936  $hist_html = $hist_gui->getHistoryTable(array("ref_id" => $_GET["ref_id"],
937  "cmd" => "history",
938  "cmdClass" =>$_GET["cmdClass"],
939  "cmdNode" =>$_GET["cmdNode"]));
940 
941  $this->tpl->setVariable("ADM_CONTENT", $hist_html);
942  }
943 
948  function saveObject()
949  {
950  global $rbacadmin;
951 
952  // create and insert forum in objecttree
953  $newObj = parent::saveObject();
954 
955  // setup rolefolder & default local roles
956  //$roles = $newObj->initDefaultRoles();
957 
958  // ...finally assign role to creator of object
959  //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");
960 
961  // put here object specific stuff
962 
963  // always send a message
964  //ilUtil::sendInfo($this->lng->txt("object_added"),true);
965  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$newObj->getRefId().
966  "&cmd=showAddItem");
967 
968  //ilUtil::redirect($this->getReturnLocation("save",'adm_object.php?ref_id='.$newObj->getRefId()));
969  }
970 
971 
972  function linkCheckerObject()
973  {
974  global $ilias,$ilUser;
975 
976  $this->__initLinkChecker();
977  $this->object->initLinkResourceItemsObject();
978 
979  $invalid_links = $this->link_checker_obj->getInvalidLinksFromDB();
980 
981 
982  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.link_check.html",'Modules/WebResource');
983 
984  if($last_access = $this->link_checker_obj->getLastCheckTimestamp())
985  {
986  $this->tpl->setCurrentBlock("LAST_MODIFIED");
987  $this->tpl->setVariable("AS_OF",$this->lng->txt('last_change').": ");
988  $this->tpl->setVariable('LAST_CHECK',ilDatePresentation::formatDate(new ilDateTime($last_access,IL_CAL_UNIX)));
989  $this->tpl->parseCurrentBlock();
990  }
991 
992 
993  $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
994 
995  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_webr.gif'));
996  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_webr'));
997  $this->tpl->setVariable("TITLE",$this->object->getTitle().' ('.$this->lng->txt('link_check').')');
998  $this->tpl->setVariable("PAGE_TITLE",$this->lng->txt('title'));
999  $this->tpl->setVariable("URL",$this->lng->txt('url'));
1000  $this->tpl->setVariable("OPTIONS",$this->lng->txt('edit'));
1001 
1002  if(!count($invalid_links))
1003  {
1004  $this->tpl->setCurrentBlock("no_invalid");
1005  $this->tpl->setVariable("TXT_NO_INVALID",$this->lng->txt('no_invalid_links'));
1006  $this->tpl->parseCurrentBlock();
1007  }
1008  else
1009  {
1010  $counter = 0;
1011  foreach($invalid_links as $invalid)
1012  {
1013  $this->object->items_obj->readItem($invalid['page_id']);
1014 
1015  $this->tpl->setCurrentBlock("invalid_row");
1016  $this->tpl->setVariable("ROW_COLOR",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
1017  $this->tpl->setVariable("ROW_PAGE_TITLE",$this->object->items_obj->getTitle());
1018  $this->tpl->setVariable("ROW_URL",$invalid['url']);
1019 
1020 
1021  // EDIT IMAGE
1022  $this->ctrl->setParameter($this,'item_id',$invalid['page_id']);
1023  $this->tpl->setVariable("ROW_EDIT_LINK",$this->ctrl->getLinkTarget($this,'editItem'));
1024  $this->tpl->setVariable("ROW_IMG",ilUtil::getImagePath('icon_pencil.gif'));
1025  $this->tpl->setVariable("ROW_ALT_IMG",$this->lng->txt('edit'));
1026  $this->tpl->parseCurrentBlock();
1027  }
1028  }
1029  if((bool) $ilias->getSetting('cron_web_resource_check'))
1030  {
1031  include_once './classes/class.ilLinkCheckNotify.php';
1032 
1033  // Show message block
1034  $this->tpl->setCurrentBlock("MESSAGE_BLOCK");
1035  $this->tpl->setVariable("INFO_MESSAGE",$this->lng->txt('link_check_message_a'));
1036  $this->tpl->setVariable("CHECK_MESSAGE",ilUtil::formCheckbox(
1037  ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(),$this->object->getId()),
1038  'link_check_message',
1039  1));
1040  $this->tpl->setVariable("INFO_MESSAGE_LONG",$this->lng->txt('link_check_message_b'));
1041  $this->tpl->parseCurrentBlock();
1042 
1043  // Show save button
1044  $this->tpl->setCurrentBlock("CRON_ENABLED");
1045  $this->tpl->setVariable("DOWNRIGHT_IMG",ilUtil::getImagePath('arrow_downright.gif'));
1046  $this->tpl->setVariable("BTN_SUBMIT_LINK_CHECK",$this->lng->txt('save'));
1047  $this->tpl->parseCurrentBlock();
1048  }
1049  $this->tpl->setVariable("BTN_REFRESH",$this->lng->txt('refresh'));
1050 
1051  return true;
1052 
1053  }
1055  {
1056  global $ilDB,$ilUser;
1057 
1058  include_once './classes/class.ilLinkCheckNotify.php';
1059 
1060  $link_check_notify =& new ilLinkCheckNotify($ilDB);
1061  $link_check_notify->setUserId($ilUser->getId());
1062  $link_check_notify->setObjId($this->object->getId());
1063 
1064  if($_POST['link_check_message'])
1065  {
1066  ilUtil::sendInfo($this->lng->txt('link_check_message_enabled'));
1067  $link_check_notify->addNotifier();
1068  }
1069  else
1070  {
1071  ilUtil::sendInfo($this->lng->txt('link_check_message_disabled'));
1072  $link_check_notify->deleteNotifier();
1073  }
1074  $this->linkCheckerObject();
1075 
1076  return true;
1077  }
1078 
1079 
1080 
1082  {
1083  $this->__initLinkChecker();
1084 
1085  if(!$this->link_checker_obj->checkPear())
1086  {
1087  ilUtil::sendInfo($this->lng->txt('missing_pear_library'));
1088  $this->linkCheckerObject();
1089 
1090  return false;
1091  }
1092 
1093 
1094  $this->object->initLinkResourceItemsObject();
1095 
1096  // Set all link to valid. After check invalid links will be set to invalid
1097  $this->object->items_obj->updateValidByCheck();
1098 
1099  foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
1100  {
1101  $this->object->items_obj->readItem($invalid['page_id']);
1102  $this->object->items_obj->setActiveStatus(false);
1103  $this->object->items_obj->setValidStatus(false);
1104  $this->object->items_obj->update(false);
1105  }
1106 
1107  $this->object->items_obj->updateLastCheck();
1108  ilUtil::sendInfo($this->lng->txt('link_checker_refreshed'));
1109 
1110  $this->linkCheckerObject();
1111 
1112  return true;
1113  }
1114 
1116  {
1117  global $ilDB;
1118 
1119  include_once './classes/class.ilLinkChecker.php';
1120 
1121  $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
1122  $this->link_checker_obj->setObjId($this->object->getId());
1123 
1124  return true;
1125  }
1131  function getTabs(&$tabs_gui)
1132  {
1133  global $rbacsystem,$rbacreview,$ilAccess;
1134 
1135  if ($ilAccess->checkAccess('read','',$this->object->getRefId()))
1136  {
1137  $tabs_gui->addTarget("view_content",
1138  $this->ctrl->getLinkTarget($this, "view"), array("", "view"),
1139  array(strtolower(get_class($this)), ""));
1140  }
1141 
1142  if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
1143  {
1144  $tabs_gui->addTarget("edit_content",
1145  $this->ctrl->getLinkTarget($this, "editItems"),
1146  array("editItems", "addItem", "deleteItems", "editItem", "updateItem"),
1147  "");
1148  }
1149 
1150  if ($ilAccess->checkAccess('visible','',$this->ref_id))
1151  {
1152  // this is not nice. tabs should be displayed in ilcoursegui
1153  // not via ilrepositorygui, then next_class == ilinfoscreengui
1154  // could be checked
1155  $force_active = (strtolower($_GET["cmdClass"]) == "ilinfoscreengui"
1156  || $_GET["cmd"] == "infoScreen"
1157  || strtolower($_GET["cmdClass"]) == "ilnotegui")
1158  ? true
1159  : false;
1160  $tabs_gui->addTarget("info_short",
1161  $this->ctrl->getLinkTargetByClass(
1162  array("ilobjlinkresourcegui", "ilinfoscreengui"), "showSummary"),
1163  "infoScreen",
1164  "", "", $force_active);
1165  }
1166 
1167  if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
1168  {
1169  $tabs_gui->addTarget("meta_data",
1170  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
1171  "", 'ilmdeditorgui');
1172  }
1173 
1174  if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
1175  {
1176  $tabs_gui->addTarget("history",
1177  $this->ctrl->getLinkTarget($this, "history"), "history", get_class($this));
1178  }
1179 
1180  if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
1181  {
1182  // Check if pear library is available
1183  if(@include_once('HTTP/Request.php'))
1184  {
1185  $tabs_gui->addTarget("link_check",
1186  $this->ctrl->getLinkTarget($this, "linkChecker"),
1187  array("linkChecker", "refreshLinkCheck"), get_class($this));
1188  }
1189  }
1190 
1191  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
1192  {
1193  $tabs_gui->addTarget("perm_settings",
1194  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1195  }
1196  }
1197 
1198  // PRIVATE
1199  function __prepareOutput()
1200  {
1201  // output objects
1202  //$this->tpl->addBlockFile("CONTENT", "content", "tpl.link_resource.html",'link');
1203  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1204  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1205 
1206  // output locator
1207  $this->__setLocator();
1208 
1209  // output message
1210  if ($this->message)
1211  {
1212  ilUtil::sendInfo($this->message);
1213  }
1214 
1215  // display infopanel if something happened
1217 
1218  // set header
1219  $this->__setHeader();
1220  }
1221 
1222  function __setHeader()
1223  {
1224  include_once './classes/class.ilTabsGUI.php';
1225 
1226  $this->tpl->setCurrentBlock("header_image");
1227  $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_webr_b.gif"));
1228  $this->tpl->parseCurrentBlock();
1229  $this->tpl->setVariable("HEADER",$this->object->getTitle());
1230  $this->tpl->setVariable("H_DESCRIPTION",$this->object->getDescription());
1231 
1232  #$tabs_gui =& new ilTabsGUI();
1233  $this->getTabs($this->tabs_gui);
1234 
1235  // output tabs
1236  #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
1237  }
1238 
1239  function __setLocator()
1240  {
1241  global $tree;
1242  global $ilias_locator, $lng;
1243 
1244  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
1245 
1246  $counter = 0;
1247 
1248  //$this->tpl->touchBlock('locator_separator');
1249  //$this->tpl->touchBlock('locator_item');
1250 
1251  foreach ($tree->getPathFull($this->object->getRefId()) as $key => $row)
1252  {
1253 
1254  //if ($row["child"] == $tree->getRootId())
1255  //{
1256  // continue;
1257  //}
1258 
1259  if($counter++)
1260  {
1261  $this->tpl->touchBlock('locator_separator_prefix');
1262  }
1263 
1264  if ($row["child"] > 0)
1265  {
1266  $this->tpl->setCurrentBlock("locator_img");
1267  $this->tpl->setVariable("IMG_SRC",
1268  ilUtil::getImagePath("icon_".$row["type"]."_s.gif"));
1269  $this->tpl->setVariable("IMG_ALT",
1270  $lng->txt("obj_".$type));
1271  $this->tpl->parseCurrentBlock();
1272  }
1273 
1274  $this->tpl->setCurrentBlock("locator_item");
1275 
1276  if($row["type"] == 'webr')
1277  {
1278  $this->tpl->setVariable("ITEM",$this->object->getTitle());
1279  $this->tpl->setVariable("LINK_ITEM",$this->ctrl->getLinkTarget($this));
1280  }
1281  elseif ($row["child"] != $tree->getRootId())
1282  {
1283  $this->tpl->setVariable("ITEM", $row["title"]);
1284  $this->tpl->setVariable("LINK_ITEM","./repository.php?ref_id=".$row["child"]);
1285  }
1286  else
1287  {
1288  $this->tpl->setVariable("ITEM", $this->lng->txt("repository"));
1289  $this->tpl->setVariable("LINK_ITEM","./repository.php?ref_id=".$row["child"]);
1290  }
1291 
1292  $this->tpl->parseCurrentBlock();
1293  }
1294 
1295  $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
1296  $this->tpl->parseCurrentBlock();
1297  }
1298 
1299  function _goto($a_target)
1300  {
1301  global $ilAccess, $ilErr, $lng;
1302 
1303  // Will be replaced in future releases by ilAccess::checkAccess()
1304  if ($ilAccess->checkAccess("read", "", $a_target))
1305  {
1306  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1307  }
1308  else
1309  {
1310  // to do: force flat view
1311  if ($ilAccess->checkAccess("visible", "", $a_target))
1312  {
1313  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$a_target."&cmd=infoScreen");
1314  }
1315  else
1316  {
1317  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1318  {
1319  $_GET["cmd"] = "frameset";
1320  $_GET["target"] = "";
1321  $_GET["ref_id"] = ROOT_FOLDER_ID;
1322  ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
1323  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1324  include("repository.php");
1325  exit;
1326  }
1327  }
1328  }
1329 
1330  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1331  }
1332 } // END class.ilObjLinkResource
1333 ?>