ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLinkResourceGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "./classes/class.ilObjectGUI.php";
6 include_once('./Modules/WebResource/classes/class.ilParameterAppender.php');
7 require_once 'Services/LinkChecker/interfaces/interface.ilLinkCheckerGUIRowHandling.php';
8 
22 {
23  const VIEW_MODE_VIEW = 1;
24  const VIEW_MODE_MANAGE = 2;
25  const VIEW_MODE_SORT = 3;
26 
27  const LINK_MOD_CREATE = 1;
28  const LINK_MOD_EDIT = 2;
29  const LINK_MOD_ADD = 3;
30 
35  function __construct()
36  {
37  global $ilCtrl;
38 
39  $this->type = "webr";
40  parent::__construct('',(int) $_GET['ref_id'],true,false);
41 
42  // CONTROL OPTIONS
43  $this->ctrl = $ilCtrl;
44  $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
45 
46  $this->lng->loadLanguageModule('webr');
47  }
48 
49  public function executeCommand()
50  {
51  global $ilCtrl, $ilTabs;
52 
53 
54  //if($this->ctrl->getTargetScript() == 'link_resources.php')
55  if($_GET["baseClass"] == 'ilLinkResourceHandlerGUI')
56  {
57  $_GET['view_mode'] = isset($_GET['switch_mode']) ? $_GET['switch_mode'] : $_GET['view_mode'];
58  $ilCtrl->saveParameter($this, 'view_mode');
59  $this->__prepareOutput();
60  }
61 
62  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
63  $this->getCreationMode() == true)
64  {
65  $this->prepareOutput();
66  }
67 
68 
69  $next_class = $this->ctrl->getNextClass($this);
70  $cmd = $this->ctrl->getCmd();
71 
72  switch($next_class)
73  {
74  case "ilinfoscreengui":
75  $this->infoScreen(); // forwards command
76  break;
77 
78  case 'ilmdeditorgui':
79  $ilTabs->activateTab('id_meta_data');
80  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
81  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
82  $md_gui->addObserver($this->object,'MDUpdateListener','General');
83  $this->ctrl->forwardCommand($md_gui);
84  break;
85 
86  case 'ilpermissiongui':
87  $ilTabs->activateTab('id_permissions');
88  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
89  $perm_gui =& new ilPermissionGUI($this);
90  $ret =& $this->ctrl->forwardCommand($perm_gui);
91  break;
92 
93  case 'ilobjectcopygui':
94  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
95  $cp = new ilObjectCopyGUI($this);
96  $cp->setType('webr');
97  $this->ctrl->forwardCommand($cp);
98  break;
99 
100  case 'ilexportgui':
101  $this->tabs_gui->setTabActive('export');
102  include_once './Services/Export/classes/class.ilExportGUI.php';
103  $exp = new ilExportGUI($this);
104  $exp->addFormat('xml');
105  $this->ctrl->forwardCommand($exp);
106  break;
107 
108  default:
109 
110  if(!$cmd)
111  {
112  $cmd = "view";
113  }
114  $cmd .= "Object";
115  $this->$cmd();
116 
117  break;
118  }
119 
120  if(!$this->getCreationMode())
121  {
122  // Fill meta header tags
123  include_once('Services/MetaData/classes/class.ilMDUtils.php');
124  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'webr');
125  }
126  return true;
127  }
128 
136  public function createObject()
137  {
138  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_create.html','Modules/WebResource');
139  $this->initFormLink(self::LINK_MOD_CREATE);
140  $this->tpl->setVariable('LINK_FORM',$this->form->getHTML());
141 
142  $this->fillCloneTemplate('CLONE_WIZARD',$_REQUEST['new_type']);
143 
144  $this->initImportForm("webr");
145  $this->tpl->setVariable("IMPORT_FORM", $this->form->getHTML());
146  }
147 
153  public function initImportForm($a_new_type = "")
154  {
155  global $lng, $ilCtrl;
156 
157  $lng->loadLanguageModule("webr");
158 
159  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
160  $this->form = new ilPropertyFormGUI();
161  $this->form->setTableWidth('600px');
162  $this->form->setTarget("_top");
163 
164  // Import file
165  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
166  $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
167  $fi->setSuffixes(array("zip"));
168  $fi->setRequired(true);
169  $this->form->addItem($fi);
170 
171  $this->form->addCommandButton("importFile", $lng->txt("import"));
172  $this->form->addCommandButton("cancel", $lng->txt("cancel"));
173  $this->form->setTitle($lng->txt($a_new_type."_import"));
174 
175  $this->form->setFormAction($ilCtrl->getFormAction($this));
176  }
177 
183  protected function importFileObject()
184  {
185  global $rbacsystem, $objDefinition, $tpl, $lng, $ilErr;
186 
187  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
188 
189  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
190  if (!$rbacsystem->checkAccess("create", $this->object->getRefId(), $new_type))
191  {
192  $ilErr->raiseError($this->lng->txt('no_create_permission'),$ilErr->MESSAGE);
193  }
194  $this->ctrl->setParameter($this, "new_type", $new_type);
195  $this->initImportForm($new_type);
196  if ($this->form->checkInput())
197  {
198  include_once './Services/Export/classes/class.ilImport.php';
199  $imp = new ilImport((int) $_GET['ref_id']);
200  $new_id = $imp->importObject(null, $_FILES["importfile"]["tmp_name"],$_FILES["importfile"]["name"], $new_type);
201 
202  // put new object id into tree
203  if ($new_id > 0)
204  {
205  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
206  $newObj->createReference();
207  $newObj->putInTree($_GET["ref_id"]);
208  $newObj->setPermissions($_GET["ref_id"]);
209  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
210  $this->ctrl->returnToParent($this);
211  }
212  return;
213  }
214 
215  $this->form->setValuesByPost();
216  $tpl->setContent($this->form->getHtml());
217  }
218 
219 
224  public function saveObject()
225  {
226  global $ilCtrl;
227 
228  $this->initFormLink(self::LINK_MOD_CREATE);
229  if($this->checkLinkInput(self::LINK_MOD_CREATE,0,0))
230  {
231  // Save new object
232  $_POST['Fobject']['title'] = $_POST['tit'];
233  $_POST['Fobject']['desc'] = $_POST['des'];
234  $link_list = parent::saveObject();
235 
236  // Save link
237  $this->link->setLinkResourceId($link_list->getId());
238  $link_id = $this->link->add();
239 
240  // Dynamic params
241  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
242  {
243  $this->dynamic->setObjId($link_list->getId());
244  $this->dynamic->add($link_id);
245  }
246 
247  ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
248  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".
249  $link_list->getRefId()."&cmd=view");
250  return true;
251  }
252  // Data incomplete or invalid
253  ilUtil::sendFailure($this->lng->txt('err_check_input'));
254  $this->form->setValuesByPost();
255 
256  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_create.html','Modules/WebResource');
257  $this->tpl->setVariable('LINK_FORM',$this->form->getHTML());
258 
259  $this->fillCloneTemplate('CLONE_WIZARD',$_REQUEST['new_type']);
260  return false;
261 
262 
263  if ($_POST["Fobject"]["title"] == "")
264  {
265  ilUtil::sendFailure($this->lng->txt('please_enter_title'));
266  $this->createObject();
267  return false;
268  }
269  }
270 
276  protected function settingsObject()
277  {
278  global $ilTabs;
279 
280  $this->checkPermission('write');
281  $ilTabs->activateTab('id_settings');
282 
283  $this->initFormSettings();
284  $this->tpl->setContent($this->form->getHTML());
285  }
286 
291  protected function saveSettingsObject()
292  {
293  global $ilTabs;
294 
295  $this->checkPermission('write');
296  $ilTabs->activateTab('id_settings');
297 
298  $this->initFormSettings();
299  if($this->form->checkInput())
300  {
301  $this->object->setTitle($this->form->getInput('tit'));
302  $this->object->setDescription($this->form->getInput('des'));
303  $this->object->update();
304 
305  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
306  $sort = new ilContainerSortingSettings($this->object->getId());
307  $sort->setSortMode($this->form->getInput('sor'));
308  $sort->update();
309 
310  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
311  $this->ctrl->redirect($this,'settings');
312  }
313 
314  $this->form->setValuesByPost();
315  ilUtil::sendFailure($this->lng->txt('err_check_input'));
316  $this->tpl->setContent($this->form->getHTML());
317  }
318 
319 
324  protected function initFormSettings()
325  {
326  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
327  $this->form = new ilPropertyFormGUI();
328  $this->form->setFormAction($this->ctrl->getFormAction($this,'saveSettings'));
329  $this->form->setTitle($this->lng->txt('webr_edit_settings'));
330 
331  // Title
332  $tit = new ilTextInputGUI($this->lng->txt('webr_list_title'),'tit');
333  $tit->setValue($this->object->getTitle());
334  $tit->setRequired(true);
335  $tit->setSize(40);
336  $tit->setMaxLength(127);
337  $this->form->addItem($tit);
338 
339  // Description
340  $des = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'des');
341  $des->setValue($this->object->getDescription());
342  $des->setCols(40);
343  $des->setRows(3);
344  $this->form->addItem($des);
345 
346  // Sorting
347  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
348  include_once './Services/Container/classes/class.ilContainer.php';
349 
350  $sor = new ilRadioGroupInputGUI($this->lng->txt('webr_sorting'),'sor');
351  $sor->setRequired(true);
352  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
353  $sor->setValue(ilContainerSortingSettings::_lookupSortMode($this->object->getId()));
354 
355  $opt = new ilRadioOption(
356  $this->lng->txt('webr_sort_title'),
358  );
359  $sor->addOption($opt);
360 
361  $opm = new ilRadioOption(
362  $this->lng->txt('webr_sort_manual'),
364  );
365  $sor->addOption($opm);
366  $this->form->addItem($sor);
367 
368  $this->form->addCommandButton('saveSettings', $this->lng->txt('save'));
369  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
370  }
371 
372 
377  public function editLinkObject()
378  {
379  global $ilCtrl;
380 
381  $this->checkPermission('write');
382  $this->activateTabs('content','id_content_view');
383 
384  if(!(int) $_GET['link_id'])
385  {
386  ilUtil::sendFailure($this->lng->txt('select_one'),true);
387  $ilCtrl->redirect($this,'view');
388  }
389 
390  $this->initFormLink(self::LINK_MOD_EDIT);
391  $this->setValuesFromLink((int) $_GET['link_id']);
392  $this->tpl->setContent($this->form->getHTML());
393  }
394 
399  public function updateLinkObject()
400  {
401  global $ilCtrl;
402 
403  $this->initFormLink(self::LINK_MOD_EDIT);
404  if($this->checkLinkInput(self::LINK_MOD_EDIT,$this->object->getId(),(int) $_REQUEST['link_id']))
405  {
406  $this->link->setLinkId((int) $_REQUEST['link_id']);
407  $this->link->update();
408  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
409  {
410  $this->dynamic->add((int) $_REQUEST['link_id']);
411  }
412 
413  if($this->isContainerMetaDataRequired())
414  {
415  $this->object->setTitle($this->form->getInput('tit'));
416  $this->object->setDescription($this->form->getInput('des'));
417  $this->object->update();
418  }
419 
420  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
421  $ilCtrl->redirect($this,'view');
422  }
423  ilUtil::sendFailure($this->lng->txt('err_check_input'));
424  $this->form->setValuesByPost();
425  $this->tpl->setContent($this->form->getHTML());
426  }
427 
432  public function addLinkObject()
433  {
434  $this->checkPermission('write');
435  $this->activateTabs('content','id_content_view');
436 
437  $this->initFormLink(self::LINK_MOD_ADD);
438  $this->tpl->setContent($this->form->getHTML());
439  }
440 
445  public function saveAddLinkObject()
446  {
447  global $ilCtrl;
448 
449  $this->checkPermission('write');
450 
451  $this->initFormLink(self::LINK_MOD_ADD);
452  if($this->checkLinkInput(self::LINK_MOD_ADD,$this->object->getId(),0))
453  {
454  if($this->isContainerMetaDataRequired())
455  {
456  // Save list data
457  $this->object->setTitle($this->form->getInput('lti'));
458  $this->object->setDescription($this->form->getInput('lde'));
459  $this->object->update();
460  }
461 
462  // Save Link
463  $link_id = $this->link->add();
464 
465  // Dynamic parameters
466  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
467  {
468  $this->dynamic->add($link_id);
469  }
470  ilUtil::sendSuccess($this->lng->txt('webr_link_added'),true);
471  $ilCtrl->redirect($this,'view');
472  }
473  // Error handling
474  ilUtil::sendFailure($this->lng->txt('err_check_input'));
475  $this->form->setValuesByPost();
476 
477  $this->activateTabs('content','id_content_view');
478  $this->tpl->setContent($this->form->getHTML());
479  }
480 
485  protected function deleteParameterObject()
486  {
487  global $ilCtrl;
488 
489  $this->checkPermission('write');
490 
491  $this->ctrl->setParameter($this,'link_id',(int) $_GET['link_id']);
492 
493  if(!isset($_GET['param_id']))
494  {
495  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
496  $ilCtrl->redirect($this,'view');
497  }
498 
499  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
500  $param = new ilParameterAppender($this->object->getId());
501  $param->delete((int) $_GET['param_id']);
502 
503  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
504  $ilCtrl->redirect($this,'editLink');
505  }
506 
507  protected function deleteParameterFormObject()
508  {
509  global $ilCtrl;
510 
511  $this->checkPermission('write');
512 
513  if(!isset($_GET['param_id']))
514  {
515  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
516  $ilCtrl->redirect($this,'view');
517  }
518 
519  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
520  $param = new ilParameterAppender($this->object->getId());
521  $param->delete((int) $_GET['param_id']);
522 
523  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
524  $ilCtrl->redirect($this,'view');
525 
526  }
527 
528 
533  protected function updateLinksObject()
534  {
535  global $ilCtrl;
536 
537  $this->checkPermission('write');
538  $this->activateTabs('content','');
539 
540  if(!is_array($_POST['ids']))
541  {
542  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
543  $ilCtrl->redirect($this,'view');
544  }
545 
546  // Validate
547  $invalid = array();
548  foreach($_POST['ids'] as $link_id)
549  {
550  $data = $_POST['links'][$link_id];
551 
552  if(!strlen($data['tit']))
553  {
554  $invalid[] = $link_id;
555  continue;
556  }
557  if(!strlen($data['tar']))
558  {
559  $invalid[] = $link_id;
560  continue;
561  }
562  if($data['nam'] and !$data['val'])
563  {
564  $invalid[] = $link_id;
565  continue;
566  }
567  if(!$data['nam'] and $data['val'])
568  {
569  $invalid[] = $link_id;
570  continue;
571  }
572  }
573 
574  if(count($invalid))
575  {
576  ilUtil::sendFailure($this->lng->txt('err_check_input'));
577  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
578 
579  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
580  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
581  $table->setInvalidLinks($invalid);
582  $table->parseSelectedLinks($_POST['ids']);
583  $table->updateFromPost();
584  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML());
585  return false;
586  }
587 
588  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
589  $links = new ilLinkResourceItems($this->object->getId());
590 
591  // Save Settings
592  foreach($_POST['ids'] as $link_id)
593  {
594  $data = $_POST['links'][$link_id];
595 
596  $links->setLinkId($link_id);
597  $links->setTitle(ilUtil::stripSlashes($data['tit']));
598  $links->setDescription(ilUtil::stripSlashes($data['des']));
599  $links->setTarget(ilUtil::stripSlashes($data['tar']));
600  $links->setActiveStatus((int) $data['act']);
601  $links->setDisableCheckStatus((int) $data['che']);
602  $links->setValidStatus((int) $data['vali']);
603  $links->update();
604 
605  if(strlen($data['nam']) and $data['val'])
606  {
607  $param = new ilParameterAppender($this->object->getId());
608  $param->setName(ilUtil::stripSlashes($data['nam']));
609  $param->setValue((int) $data['val']);
610  $param->add($link_id);
611  }
612 
613  if($this->isContainerMetaDataRequired())
614  {
615  $this->object->setTitle(ilUtil::stripSlashes($data['tit']));
616  $this->object->setDescription(ilUtil::stripSlashes($data['des']));
617  $this->object->update();
618  }
619 
620  // TODO: Dynamic parameters
621  }
622 
623  ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
624  $ilCtrl->redirect($this,'view');
625  }
626 
632  protected function setValuesFromLink($a_link_id)
633  {
634  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
635  $link = new ilLinkResourceItems($this->object->getId());
636 
637  $values = $link->getItem($a_link_id);
638 
640  {
641  }
642 
643  $this->form->setValuesByArray(
644  array(
645  'tit' => $values['title'],
646  'tar' => $values['target'],
647  'des' => $values['description'],
648  'act' => (int) $values['active'],
649  'che' => (int) $values['disable_check'],
650  'vali' => (int) $values['valid']
651  )
652  );
653  }
654 
655 
663  protected function checkLinkInput($a_mode,$a_webr_id = 0,$a_link_id = 0)
664  {
665  $valid = $this->form->checkInput();
666 
667  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
668  $this->link = new ilLinkResourceItems($a_webr_id);
669  $this->link->setTarget($this->form->getInput('tar'));
670  $this->link->setTitle($this->form->getInput('tit'));
671  $this->link->setDescription($this->form->getInput('des'));
672  $this->link->setDisableCheckStatus($this->form->getInput('che'));
673  $this->link->setActiveStatus($this->form->getInput('act'));
674 
675  if($a_mode == self::LINK_MOD_EDIT)
676  {
677  $this->link->setValidStatus($this->form->getInput('val'));
678  }
679 
681  {
682  return $valid;
683  }
684 
685  $this->dynamic = new ilParameterAppender($a_webr_id);
686  $this->dynamic->setName($this->form->getInput('nam'));
687  $this->dynamic->setValue($this->form->getInput('val'));
688  if(!$this->dynamic->validate())
689  {
690  switch($this->dynamic->getErrorCode())
691  {
692  case LINKS_ERR_NO_NAME:
693  $this->form->getItemByPostVar('nam')->setAlert($this->lng->txt('links_no_name_given'));
694  return false;
695 
696  case LINKS_ERR_NO_VALUE:
697  $this->form->getItemByPostVar('val')->setAlert($this->lng->txt('links_no_value_given'));
698  return false;
699 
701  // Nothing entered => no error
702  return $valid;
703  }
704  $this->dynamic = null;
705  }
706  return $valid;
707  }
708 
709 
715  protected function initFormLink($a_mode)
716  {
717  global $ilTabs;
718 
719  $ilTabs->activateTab("id_content");
720 
721  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
722  $this->form = new ilPropertyFormGUI();
723 
724  switch($a_mode)
725  {
726  case self::LINK_MOD_CREATE:
727  // Header
728  $this->ctrl->setParameter($this,'new_type','webr');
729  $this->form->setTitle($this->lng->txt('webr_new_link'));
730  $this->form->setTableWidth('600px');
731 
732  // Buttons
733  $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
734  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
735  break;
736 
737  case self::LINK_MOD_ADD:
738  // Header
739  $this->form->setTitle($this->lng->txt('webr_new_link'));
740 
741  // Buttons
742  $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
743  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
744  break;
745 
746  case self::LINK_MOD_EDIT:
747  // Header
748  $this->ctrl->setParameter($this,'link_id',(int) $_REQUEST['link_id']);
749  $this->form->setTitle($this->lng->txt('webr_edit'));
750 
751  // Buttons
752  $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
753  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
754  break;
755  }
756 
757 
758  $this->form->setFormAction($this->ctrl->getFormAction($this));
759 
760  if($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired())
761  {
762  ilUtil::sendInfo($this->lng->txt('webr_container_info'));
763 
764 
765  $this->form->setTitle($this->lng->txt('webr_edit_list'));
766 
767  // List Title
768  $title = new ilTextInputGUI($this->lng->txt('webr_list_title'),'lti');
769  $title->setRequired(true);
770  $title->setSize(40);
771  $title->setMaxLength(127);
772  $this->form->addItem($title);
773 
774  // List Description
775  $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'tde');
776  $desc->setRows(3);
777  $desc->setCols(40);
778  $this->form->addItem($desc);
779 
780  // Addtional section
781  $sect = new ilFormSectionHeaderGUI();
782  $sect->setTitle($this->lng->txt('webr_add'));
783  $this->form->addItem($sect);
784  }
785 
786  // Target
787  $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
788  $tar->setValue("http://");
789  $tar->setRequired(true);
790  $tar->setSize(40);
791  $tar->setMaxLength(500);
792  $this->form->addItem($tar);
793 
794  // Title
795  $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'),'tit');
796  $tit->setRequired(true);
797  $tit->setSize(40);
798  $tit->setMaxLength(127);
799  $this->form->addItem($tit);
800 
801  // Description
802  $des = new ilTextAreaInputGUI($this->lng->txt('description'),'des');
803  $des->setRows(3);
804  $des->setCols(40);
805  $this->form->addItem($des);
806 
807  // Active
808  $act = new ilCheckboxInputGUI($this->lng->txt('active'),'act');
809  $act->setChecked(true);
810  $act->setValue(1);
811  $this->form->addItem($act);
812 
813  // Check
814  $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'),'che');
815  $che->setValue(1);
816  $this->form->addItem($che);
817 
818  // Valid
819  if($a_mode == self::LINK_MOD_EDIT)
820  {
821  $val = new ilCheckboxInputGUI($this->lng->txt('valid'),'vali');
822  $this->form->addItem($val);
823  }
824 
826  {
827  $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
828  $dyn->setInfo($this->lng->txt('links_dynamic_info'));
829 
830 
831  if(count($links = ilParameterAppender::_getParams((int) $_GET['link_id'])))
832  {
833  $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'),'ex');
834  $dyn->addSubItem($ex);
835 
836  foreach($links as $id => $link)
837  {
838  $p = new ilCustomInputGUI();
839 
840  $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html',true,true,'Modules/WebResource');
841  $ptpl->setVariable('INFO_TXT',ilParameterAppender::parameterToInfo($link['name'], $link['value']));
842  $this->ctrl->setParameter($this,'param_id',$id);
843  $ptpl->setVariable('LINK_DEL',$this->ctrl->getLinkTarget($this,'deleteParameterForm'));
844  $ptpl->setVariable('LINK_TXT',$this->lng->txt('delete'));
845  $p->setHtml($ptpl->get());
846  $dyn->addSubItem($p);
847  }
848  }
849 
850  // Existing parameters
851 
852  // New parameter
853  if($a_mode == self::LINK_MOD_EDIT)
854  {
855  #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
856  #$dyn->addSubItem($new);
857  }
858 
859  // Dynyamic name
860  $nam = new ilTextInputGUI($this->lng->txt('links_name'),'nam');
861  $nam->setSize(12);
862  $nam->setMaxLength(128);
863  $dyn->addSubItem($nam);
864 
865  // Dynamic value
866  $val = new ilSelectInputGUI($this->lng->txt('links_value'),'val');
868  $val->setValue(0);
869  $dyn->addSubItem($val);
870 
871  $this->form->addItem($dyn);
872  }
873  }
874 
880  protected function isContainerMetaDataRequired()
881  {
882  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
883  return ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) == 1;
884  }
885 
890  protected function switchViewModeObject()
891  {
892  global $ilCtrl;
893 
894  $_REQUEST['view_mode'] = $_GET['view_mode'] = (int) $_GET['switch_mode'];
895  $this->viewObject();
896  }
897 
902  protected function editLinksObject()
903  {
904  $_GET['switch_mode'] = self::VIEW_MODE_MANAGE;
905  $this->switchViewModeObject();
906  }
907 
908 
913  public function viewObject()
914  {
915  global $ilAccess, $ilErr, $ilTabs;
916 
917  $ilTabs->activateTab("id_content");
918 
919  $this->checkPermission('read');
920 
921  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
922  {
924  return true;
925  }
926  else
927  {
928  switch((int) $_REQUEST['view_mode'])
929  {
930  case self::VIEW_MODE_MANAGE:
931  $this->manageObject();
932  break;
933 
934  case self::VIEW_MODE_SORT:
935  $this->sortObject();
936  break;
937 
938  default:
939  $this->showLinksObject();
940  break;
941  }
942  }
943  return true;
944  }
945 
950  protected function manageObject()
951  {
952  $this->checkPermission('write');
953  $this->activateTabs('content','id_content_manage');
954 
955  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
956  $this->showToolbar('ACTION_BUTTONS');
957 
958  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
959  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
960  $table->parse();
961 
962  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML());
963  }
964 
969  protected function showLinksObject()
970  {
971  $this->checkPermission('read');
972  $this->activateTabs('content','id_content_view');
973 
974  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
975  $table = new ilWebResourceLinkTableGUI($this,'showLinks');
976  $table->parse();
977 
978  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
979  $this->showToolbar('ACTION_BUTTONS');
980  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
981  }
982 
987  protected function sortObject()
988  {
989  $this->checkPermission('write');
990  $this->activateTabs('content','id_content_ordering');
991 
992  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
993  $table = new ilWebResourceLinkTableGUI($this,'sort',true);
994  $table->parse();
995 
996  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
997  $this->showToolbar('ACTION_BUTTONS');
998  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
999  }
1000 
1005  protected function saveSortingObject()
1006  {
1007  $this->checkPermission('write');
1008 
1009  include_once './Services/Container/classes/class.ilContainerSorting.php';
1010  $sort = ilContainerSorting::_getInstance($this->object->getId());
1011  $sort->savePost((array) $_POST['position']);
1012 
1013  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
1014  $this->viewObject();
1015  }
1016 
1017 
1023  protected function showToolbar($a_tpl_var)
1024  {
1025  global $ilAccess;
1026 
1027  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1028  {
1029  return;
1030  }
1031 
1032  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1033  $tool = new ilToolbarGUI();
1034  $tool->setFormAction($this->ctrl->getFormAction($this));
1035  $tool->addButton(
1036  $this->lng->txt('webr_add'),
1037  $this->ctrl->getLinkTarget($this,'addLink')
1038  );
1039 
1040  $this->tpl->setVariable($a_tpl_var,$tool->getHTML());
1041  return;
1042  }
1043 
1048  protected function confirmDeleteLinkObject()
1049  {
1050  $this->checkPermission('write');
1051  $this->activateTabs('content','id_content_view');
1052 
1053  $link_ids = is_array($_POST['link_ids']) ?
1054  $_POST['link_ids'] :
1055  array($_GET['link_id']);
1056 
1057  if(!$link_ids)
1058  {
1059  ilUtil::sendFailure($this->lng->txt('select_one'));
1060  $this->viewObject();
1061  return false;
1062  }
1063 
1064  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1065  $links = new ilLinkResourceItems($this->object->getId());
1066 
1067  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1068  $confirm = new ilConfirmationGUI();
1069  $confirm->setFormAction($this->ctrl->getFormAction($this,'view'));
1070  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1071  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1072  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1073 
1074  foreach($link_ids as $link_id)
1075  {
1076  $link = $links->getItem($link_id);
1077  $confirm->addItem('link_ids[]', $link_id,$link['title']);
1078  }
1079  $this->tpl->setContent($confirm->getHTML());
1080  }
1081 
1086  protected function deleteLinksObject()
1087  {
1088  global $ilCtrl;
1089 
1090  $this->checkPermission('write');
1091 
1092  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1093  $links = new ilLinkResourceItems($this->object->getId());
1094 
1095  foreach($_POST['link_ids'] as $link_id)
1096  {
1097  $links->delete($link_id);
1098  }
1099  ilUtil::sendSuccess($this->lng->txt('webr_deleted_items'),true);
1100  $ilCtrl->redirect($this,'view');
1101  }
1102 
1107  protected function deactivateLinkObject()
1108  {
1109  global $ilCtrl;
1110 
1111  $this->checkPermission('write');
1112 
1113  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1114  $links = new ilLinkResourceItems($this->object->getId());
1115 
1116  if(!$_GET['link_id'])
1117  {
1118  ilUtil::sendFailure($this->lng->txt('select_one'),true);
1119  $ilCtrl->redirect($this,'view');
1120  }
1121 
1122  $links->setLinkId((int) $_GET['link_id']);
1123  $links->updateActive(false);
1124 
1125  ilUtil::sendSuccess($this->lng->txt('webr_inactive_success'),true);
1126  $ilCtrl->redirect($this,'view');
1127  }
1128 
1129 
1135  function infoScreenObject()
1136  {
1137  $this->ctrl->setCmd("showSummary");
1138  $this->ctrl->setCmdClass("ilinfoscreengui");
1139  $this->infoScreen();
1140  }
1141 
1145  function infoScreen()
1146  {
1147  global $ilAccess, $ilTabs;
1148 
1149  $this->checkPermission('visible');
1150  $ilTabs->activateTab('id_info');
1151 
1152  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1153  $info = new ilInfoScreenGUI($this);
1154 
1155  $info->enablePrivateNotes();
1156 
1157  // standard meta data
1158  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1159 
1160  // forward the command
1161  $this->ctrl->forwardCommand($info);
1162  }
1163 
1164 
1165  function historyObject()
1166  {
1167  global $ilTabs;
1168 
1169  $this->checkPermission('write');
1170  $ilTabs->activateTab('id_history');
1171 
1172  include_once("classes/class.ilHistoryGUI.php");
1173 
1174  $hist_gui =& new ilHistoryGUI($this->object->getId());
1175 
1176  $hist_html = $hist_gui->getHistoryTable(array("ref_id" => $_GET["ref_id"],
1177  "cmd" => "history",
1178  "cmdClass" =>$_GET["cmdClass"],
1179  "cmdNode" =>$_GET["cmdNode"]));
1180 
1181  $this->tpl->setVariable("ADM_CONTENT", $hist_html);
1182  }
1183 
1192  public function formatInvalidLinkArray(Array $row)
1193  {
1194  $this->object->items_obj->readItem($row['page_id']);
1195  $row['title'] = $this->object->items_obj->getTitle();
1196 
1197  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
1199  $actions->setSelectionHeaderClass('small');
1200  $actions->setItemLinkClass('xsmall');
1201  $actions->setListTitle($this->lng->txt('actions'));
1202  $actions->setId($row['page_id']);
1203  $this->ctrl->setParameter($this, 'link_id', $row['page_id']);
1204  $actions->addItem(
1205  $this->lng->txt('edit'),
1206  '',
1207  $this->ctrl->getLinkTarget($this, 'editLink')
1208  );
1209  $this->ctrl->clearParameters($this);
1210  $row['action_html'] = $actions->getHTML();
1211 
1212  return $row;
1213  }
1214 
1219  protected function linkCheckerObject()
1220  {
1221  global $ilias, $ilUser, $tpl, $ilTabs;
1222 
1223  $this->checkPermission('write');
1224  $ilTabs->activateTab('id_link_check');
1225 
1226  $this->__initLinkChecker();
1227  $this->object->initLinkResourceItemsObject();
1228 
1229  require_once 'Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
1230 
1231  $toolbar = new ilToolbarGUI();
1232 
1233  if((bool)$ilias->getSetting('cron_web_resource_check'))
1234  {
1235  include_once 'classes/class.ilLinkCheckNotify.php';
1236  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1237 
1238  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
1239  $chb->setValue(1);
1240  $chb->setChecked((bool)ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
1241  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
1242 
1243  $toolbar->addInputItem($chb);
1244  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
1245  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
1246  }
1247 
1248  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
1249  $tgui->setLinkChecker($this->link_checker_obj)
1250  ->setRowHandler($this)
1251  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
1252 
1253  return $tpl->setContent($tgui->prepareHTML()->getHTML().$toolbar->getHTML());
1254  }
1255 
1257  {
1258  global $ilDB,$ilUser;
1259 
1260  include_once './classes/class.ilLinkCheckNotify.php';
1261 
1262  $link_check_notify =& new ilLinkCheckNotify($ilDB);
1263  $link_check_notify->setUserId($ilUser->getId());
1264  $link_check_notify->setObjId($this->object->getId());
1265 
1266  if($_POST['link_check_message'])
1267  {
1268  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
1269  $link_check_notify->addNotifier();
1270  }
1271  else
1272  {
1273  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
1274  $link_check_notify->deleteNotifier();
1275  }
1276  $this->linkCheckerObject();
1277 
1278  return true;
1279  }
1280 
1281 
1282 
1284  {
1285  $this->__initLinkChecker();
1286 
1287  if(!$this->link_checker_obj->checkPear())
1288  {
1289  ilUtil::sendFailure($this->lng->txt('missing_pear_library'));
1290  $this->linkCheckerObject();
1291 
1292  return false;
1293  }
1294 
1295 
1296  $this->object->initLinkResourceItemsObject();
1297 
1298  // Set all link to valid. After check invalid links will be set to invalid
1299  $this->object->items_obj->updateValidByCheck();
1300 
1301  foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
1302  {
1303  $this->object->items_obj->readItem($invalid['page_id']);
1304  $this->object->items_obj->setActiveStatus(false);
1305  $this->object->items_obj->setValidStatus(false);
1306  $this->object->items_obj->update(false);
1307  }
1308 
1309  $this->object->items_obj->updateLastCheck();
1310  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
1311 
1312  $this->linkCheckerObject();
1313 
1314  return true;
1315  }
1316 
1318  {
1319  global $ilDB;
1320 
1321  include_once './classes/class.ilLinkChecker.php';
1322 
1323  $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
1324  $this->link_checker_obj->setObjId($this->object->getId());
1325 
1326  return true;
1327  }
1328 
1329 
1336  protected function activateTabs($a_active_tab,$a_active_subtab = '')
1337  {
1338  global $ilAccess, $ilCtrl, $ilTabs, $lng;
1339 
1340  switch($a_active_tab)
1341  {
1342  case 'content':
1343  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1344  {
1345  $this->lng->loadLanguageModule('cntr');
1346 
1347  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_VIEW);
1348  $ilTabs->addSubTab('id_content_view',
1349  $lng->txt('view'),
1350  $this->ctrl->getLinkTarget($this,'switchViewMode')
1351  );
1352  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_MANAGE);
1353  $ilTabs->addSubTab('id_content_manage',
1354  $lng->txt('cntr_manage'),
1355  $this->ctrl->getLinkTarget($this,'switchViewMode')
1356  );
1357  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1358  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
1359  include_once './Services/Container/classes/class.ilContainer.php';
1360  if((ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1362  {
1363  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_SORT);
1364  $ilTabs->addSubTab('id_content_ordering',
1365  $this->lng->txt('cntr_ordering'),
1366  $this->ctrl->getLinkTarget($this,'switchViewMode')
1367  );
1368  }
1369 
1370  $ilCtrl->clearParameters($this);
1371  $ilTabs->activateSubTab($a_active_subtab);
1372  }
1373  }
1374 
1375  $ilTabs->activateTab('id_content');
1376  }
1377 
1378 
1383  function setTabs()
1384  {
1385  global $ilAccess, $ilTabs, $lng;
1386 
1387  if ($ilAccess->checkAccess('read','',$this->object->getRefId()))
1388  {
1389  $ilTabs->addTab("id_content",
1390  $lng->txt("content"),
1391  $this->ctrl->getLinkTarget($this, "view"));
1392  }
1393 
1394  if ($ilAccess->checkAccess('visible','',$this->ref_id))
1395  {
1396  $ilTabs->addTab("id_info",
1397  $lng->txt("info_short"),
1398  $this->ctrl->getLinkTarget($this, "infoScreen"));
1399  }
1400 
1401  if($ilAccess->checkAccess('write','',$this->object->getRefId()) and !$this->getCreationMode())
1402  {
1403  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1404  if(ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1405  {
1406  $ilTabs->addTab("id_settings",
1407  $lng->txt("settings"),
1408  $this->ctrl->getLinkTarget($this, "settings"));
1409  }
1410 
1411  }
1412 
1413  if ($ilAccess->checkAccess('write','',$this->object->getRefId()))
1414  {
1415  $ilTabs->addTab("id_history",
1416  $lng->txt("history"),
1417  $this->ctrl->getLinkTarget($this, "history"));
1418  }
1419 
1420  if ($ilAccess->checkAccess('write','',$this->object->getRefId()))
1421  {
1422  // Check if pear library is available
1423  if(@include_once('HTTP/Request.php'))
1424  {
1425  $ilTabs->addTab("id_link_check",
1426  $lng->txt("link_check"),
1427  $this->ctrl->getLinkTarget($this, "linkChecker"));
1428  }
1429  }
1430 
1431  if ($ilAccess->checkAccess('write','',$this->object->getRefId()))
1432  {
1433  $ilTabs->addTab("id_meta_data",
1434  $lng->txt("meta_data"),
1435  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'));
1436  }
1437 
1438  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1439  {
1440  $ilTabs->addTab(
1441  'export',
1442  $this->lng->txt('export'),
1443  $this->ctrl->getLinkTargetByClass('ilexportgui','')
1444  );
1445  }
1446 
1447  if ($ilAccess->checkAccess('edit_permission','',$this->object->getRefId()))
1448  {
1449  $ilTabs->addTab("id_permissions",
1450  $lng->txt("perm_settings"),
1451  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
1452  }
1453 
1454  }
1455 
1456  // PRIVATE
1457  function __prepareOutput()
1458  {
1459  // output objects
1460  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1461  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1462 
1463  // output locator
1464  $this->__setLocator();
1465 
1466  // output message
1467  if ($this->message)
1468  {
1469  ilUtil::sendInfo($this->message);
1470  }
1471 
1472  // display infopanel if something happened
1474 
1475  // set header
1476  $this->__setHeader();
1477  }
1478 
1479  function __setHeader()
1480  {
1481  include_once './classes/class.ilTabsGUI.php';
1482 
1483  $this->tpl->setCurrentBlock("header_image");
1484  $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_webr_b.gif"));
1485  $this->tpl->parseCurrentBlock();
1486  $this->tpl->setVariable("HEADER",$this->object->getTitle());
1487  $this->tpl->setVariable("H_DESCRIPTION",$this->object->getDescription());
1488 
1489  $this->setTabs();
1490  }
1491 
1492  function __setLocator()
1493  {
1494  global $tree;
1495  global $ilias_locator, $lng;
1496 
1497  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
1498 
1499  $counter = 0;
1500 
1501  //$this->tpl->touchBlock('locator_separator');
1502  //$this->tpl->touchBlock('locator_item');
1503 
1504  foreach ($tree->getPathFull($this->object->getRefId()) as $key => $row)
1505  {
1506 
1507  //if ($row["child"] == $tree->getRootId())
1508  //{
1509  // continue;
1510  //}
1511 
1512  if($counter++)
1513  {
1514  $this->tpl->touchBlock('locator_separator_prefix');
1515  }
1516 
1517  if ($row["child"] > 0)
1518  {
1519  $this->tpl->setCurrentBlock("locator_img");
1520  $this->tpl->setVariable("IMG_SRC",
1521  ilUtil::getImagePath("icon_".$row["type"]."_s.gif"));
1522  $this->tpl->setVariable("IMG_ALT",
1523  $lng->txt("obj_".$type));
1524  $this->tpl->parseCurrentBlock();
1525  }
1526 
1527  $this->tpl->setCurrentBlock("locator_item");
1528 
1529  if($row["type"] == 'webr')
1530  {
1531  $this->tpl->setVariable("ITEM",$this->object->getTitle());
1532  $this->tpl->setVariable("LINK_ITEM",$this->ctrl->getLinkTarget($this));
1533  }
1534  elseif ($row["child"] != $tree->getRootId())
1535  {
1536  $this->tpl->setVariable("ITEM", $row["title"]);
1537  $this->tpl->setVariable("LINK_ITEM","./repository.php?ref_id=".$row["child"]);
1538  }
1539  else
1540  {
1541  $this->tpl->setVariable("ITEM", $this->lng->txt("repository"));
1542  $this->tpl->setVariable("LINK_ITEM","./repository.php?ref_id=".$row["child"]);
1543  }
1544 
1545  $this->tpl->parseCurrentBlock();
1546  }
1547 
1548  $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
1549  $this->tpl->parseCurrentBlock();
1550  }
1551 
1552  function _goto($a_target)
1553  {
1554  global $ilAccess, $ilErr, $lng;
1555 
1556  // Will be replaced in future releases by ilAccess::checkAccess()
1557  if ($ilAccess->checkAccess("read", "", $a_target))
1558  {
1559  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1560  }
1561  else
1562  {
1563  // to do: force flat view
1564  if ($ilAccess->checkAccess("visible", "", $a_target))
1565  {
1566  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$a_target."&cmd=infoScreen");
1567  }
1568  else
1569  {
1570  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1571  {
1572  $_GET["cmd"] = "frameset";
1573  $_GET["target"] = "";
1574  $_GET["ref_id"] = ROOT_FOLDER_ID;
1575  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1576  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1577  include("repository.php");
1578  exit;
1579  }
1580  }
1581  }
1582 
1583  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1584  }
1585 } // END class.ilObjLinkResource
1586 ?>