ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 require_once "./Services/Object/classes/class.ilObject2GUI.php";
6 include_once('./Modules/WebResource/classes/class.ilParameterAppender.php');
7 require_once 'Services/LinkChecker/interfaces/interface.ilLinkCheckerGUIRowHandling.php';
8 
23 {
24  const VIEW_MODE_VIEW = 1;
25  const VIEW_MODE_MANAGE = 2;
26  const VIEW_MODE_SORT = 3;
27 
28  const LINK_MOD_CREATE = 1;
29  const LINK_MOD_EDIT = 2;
30  const LINK_MOD_ADD = 3;
31 
32  function getType()
33  {
34  return "webr";
35  }
36 
37  public function executeCommand()
38  {
39  global $ilCtrl, $ilTabs, $ilErr, $ilAccess;
40 
41 
42  //if($this->ctrl->getTargetScript() == 'link_resources.php')
43  if($_GET["baseClass"] == 'ilLinkResourceHandlerGUI')
44  {
45  $_GET['view_mode'] = isset($_GET['switch_mode']) ? $_GET['switch_mode'] : $_GET['view_mode'];
46  $ilCtrl->saveParameter($this, 'view_mode');
47  $this->__prepareOutput();
48  }
49 
50  $this->lng->loadLanguageModule("webr");
51 
52  $next_class = $this->ctrl->getNextClass($this);
53  $cmd = $this->ctrl->getCmd();
54 
55  switch($next_class)
56  {
57  case "ilinfoscreengui":
58  $this->prepareOutput();
59  $this->infoScreenForward(); // forwards command
60  break;
61 
62  case 'ilobjectmetadatagui':
63  $this->checkPermission('write'); // #18563
64  $this->prepareOutput();
65  $ilTabs->activateTab('id_meta_data');
66  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
67  $md_gui = new ilObjectMetaDataGUI($this->object);
68  $this->ctrl->forwardCommand($md_gui);
69  break;
70 
71  case 'ilpermissiongui':
72  $this->prepareOutput();
73  $ilTabs->activateTab('id_permissions');
74  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
75  $perm_gui =& new ilPermissionGUI($this);
76  $ret =& $this->ctrl->forwardCommand($perm_gui);
77  break;
78 
79  case 'ilobjectcopygui':
80  $this->prepareOutput();
81  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
82  $cp = new ilObjectCopyGUI($this);
83  $cp->setType('webr');
84  $this->ctrl->forwardCommand($cp);
85  break;
86 
87  case 'ilexportgui':
88  $this->prepareOutput();
89  $this->tabs_gui->setTabActive('export');
90  include_once './Services/Export/classes/class.ilExportGUI.php';
91  $exp = new ilExportGUI($this);
92  $exp->addFormat('xml');
93  $this->ctrl->forwardCommand($exp);
94  break;
95 
96  case "ilcommonactiondispatchergui":
97  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
99  $this->ctrl->forwardCommand($gui);
100  break;
101 
102  case "ilpropertyformgui":
103  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
104  $this->initFormLink(self::LINK_MOD_EDIT);
105  $this->ctrl->forwardCommand($this->form);
106  break;
107 
108  case "ilinternallinkgui":
109  $this->lng->loadLanguageModule("content");
110  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
111  $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
112  $link_gui->filterLinkType("PageObject");
113  $link_gui->filterLinkType("GlossaryItem");
114  $link_gui->filterLinkType("RepositoryItem");
115  $link_gui->setFilterWhiteList(true);
116  $link_gui->setMode("asynch");
117  $ilCtrl->forwardCommand($link_gui);
118  break;
119 
120  default:
121  if(!$cmd)
122  {
123  $this->ctrl->setCmd("view");
124  }
125  parent::executeCommand();
126  }
127 
128  if(!$this->getCreationMode())
129  {
130  // Fill meta header tags
131  include_once('Services/MetaData/classes/class.ilMDUtils.php');
132  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'webr');
133 
134  $this->addHeaderAction();
135  }
136  return true;
137  }
138 
139  protected function initCreateForm($a_new_type)
140  {
141  $this->initFormLink(self::LINK_MOD_CREATE);
142  return $this->form;
143  }
144 
149  public function save()
150  {
151  global $ilCtrl;
152 
153  $this->initFormLink(self::LINK_MOD_CREATE);
154  if($this->checkLinkInput(self::LINK_MOD_CREATE,0,0))
155  {
156  // Save new object
157  $_POST['title'] = $_POST['tit'];
158  $_POST['desc'] = $_POST['des'];
159  parent::save();
160  }
161  else
162  {
163  // Data incomplete or invalid
164  ilUtil::sendFailure($this->lng->txt('err_check_input'));
165  $this->form->setValuesByPost();
166  $this->tpl->setContent($this->form->getHTML());
167  }
168  }
169 
170  protected function afterSave(ilObject $a_new_object)
171  {
172  // Save link
173  $this->link->setLinkResourceId($a_new_object->getId());
174  $link_id = $this->link->add();
175  $this->link->updateValid(true);
176 
177  ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
178 
179  // personal workspace
180  if($this->id_type == self::WORKSPACE_NODE_ID)
181  {
182  $this->ctrl->redirect($this, "editLinks");
183  }
184  // repository
185  else
186  {
187  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".
188  $a_new_object->getRefId()."&cmd=switchViewMode&switch_mode=2");
189  }
190  }
191 
197  protected function settings()
198  {
199  global $ilTabs;
200 
201  $this->checkPermission('write');
202  $ilTabs->activateTab('id_settings');
203 
204  $this->initFormSettings();
205  $this->tpl->setContent($this->form->getHTML());
206  }
207 
212  protected function saveSettings()
213  {
214  global $ilTabs;
215 
216  $this->checkPermission('write');
217  $ilTabs->activateTab('id_settings');
218 
219  $this->initFormSettings();
220  if($this->form->checkInput())
221  {
222  $this->object->setTitle($this->form->getInput('tit'));
223  $this->object->setDescription($this->form->getInput('des'));
224  $this->object->update();
225 
226  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
227  $sort = new ilContainerSortingSettings($this->object->getId());
228  $sort->setSortMode($this->form->getInput('sor'));
229  $sort->update();
230 
231  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
232  $this->ctrl->redirect($this,'settings');
233  }
234 
235  $this->form->setValuesByPost();
236  ilUtil::sendFailure($this->lng->txt('err_check_input'));
237  $this->tpl->setContent($this->form->getHTML());
238  }
239 
240 
245  protected function initFormSettings()
246  {
247  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
248  $this->form = new ilPropertyFormGUI();
249  $this->form->setFormAction($this->ctrl->getFormAction($this,'saveSettings'));
250  $this->form->setTitle($this->lng->txt('webr_edit_settings'));
251 
252  // Title
253  $tit = new ilTextInputGUI($this->lng->txt('webr_list_title'),'tit');
254  $tit->setValue($this->object->getTitle());
255  $tit->setRequired(true);
256  $tit->setSize(40);
257  $tit->setMaxLength(127);
258  $this->form->addItem($tit);
259 
260  // Description
261  $des = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'des');
262  $des->setValue($this->object->getDescription());
263  $des->setCols(40);
264  $des->setRows(3);
265  $this->form->addItem($des);
266 
267  // Sorting
268  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
269  include_once './Services/Container/classes/class.ilContainer.php';
270 
271  $sor = new ilRadioGroupInputGUI($this->lng->txt('webr_sorting'),'sor');
272  $sor->setRequired(true);
273  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
274  $sor->setValue(ilContainerSortingSettings::_lookupSortMode($this->object->getId()));
275 
276  $opt = new ilRadioOption(
277  $this->lng->txt('webr_sort_title'),
279  );
280  $sor->addOption($opt);
281 
282  $opm = new ilRadioOption(
283  $this->lng->txt('webr_sort_manual'),
285  );
286  $sor->addOption($opm);
287  $this->form->addItem($sor);
288 
289  $this->form->addCommandButton('saveSettings', $this->lng->txt('save'));
290  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
291  }
292 
293 
298  public function editLink()
299  {
300  global $ilCtrl;
301 
302  $this->checkPermission('write');
303  $this->activateTabs('content','id_content_view');
304 
305  if(!(int) $_GET['link_id'])
306  {
307  ilUtil::sendFailure($this->lng->txt('select_one'),true);
308  $ilCtrl->redirect($this,'view');
309  }
310 
311  $this->initFormLink(self::LINK_MOD_EDIT);
312  $this->setValuesFromLink((int) $_GET['link_id']);
313  $this->tpl->setContent($this->form->getHTML());
314  }
315 
320  public function updateLink()
321  {
322  global $ilCtrl;
323 
324  $this->initFormLink(self::LINK_MOD_EDIT);
325  if($this->checkLinkInput(self::LINK_MOD_EDIT,$this->object->getId(),(int) $_REQUEST['link_id']))
326  {
327  $this->link->setLinkId((int) $_REQUEST['link_id']);
328  $this->link->update();
329  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
330  {
331  $this->dynamic->add((int) $_REQUEST['link_id']);
332  }
333 
334  if($this->isContainerMetaDataRequired())
335  {
336  $this->object->setTitle($this->form->getInput('tit'));
337  $this->object->setDescription($this->form->getInput('des'));
338  $this->object->update();
339  }
340 
341  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
342  $ilCtrl->redirect($this,'view');
343  }
344  ilUtil::sendFailure($this->lng->txt('err_check_input'));
345  $this->form->setValuesByPost();
346  $this->tpl->setContent($this->form->getHTML());
347  }
348 
353  public function addLink()
354  {
355  $this->checkPermission('write');
356  $this->activateTabs('content','id_content_view');
357 
358  $this->initFormLink(self::LINK_MOD_ADD);
359  $this->tpl->setContent($this->form->getHTML());
360  }
361 
366  public function saveAddLink()
367  {
368  global $ilCtrl;
369 
370  $this->checkPermission('write');
371 
372  $this->initFormLink(self::LINK_MOD_ADD);
373  if($this->checkLinkInput(self::LINK_MOD_ADD,$this->object->getId(),0))
374  {
375  if($this->isContainerMetaDataRequired())
376  {
377  // Save list data
378  $this->object->setTitle($this->form->getInput('lti'));
379  $this->object->setDescription($this->form->getInput('tde'));
380  $this->object->update();
381  }
382 
383  // Save Link
384  $link_id = $this->link->add();
385  $this->link->updateValid(true);
386 
387  // Dynamic parameters
388  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
389  {
390  $this->dynamic->add($link_id);
391  }
392  ilUtil::sendSuccess($this->lng->txt('webr_link_added'),true);
393  $ilCtrl->redirect($this,'view');
394  }
395  // Error handling
396  ilUtil::sendFailure($this->lng->txt('err_check_input'));
397  $this->form->setValuesByPost();
398 
399  $this->activateTabs('content','id_content_view');
400  $this->tpl->setContent($this->form->getHTML());
401  }
402 
407  protected function deleteParameter()
408  {
409  global $ilCtrl;
410 
411  $this->checkPermission('write');
412 
413  $this->ctrl->setParameter($this,'link_id',(int) $_GET['link_id']);
414 
415  if(!isset($_GET['param_id']))
416  {
417  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
418  $ilCtrl->redirect($this,'view');
419  }
420 
421  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
422  $param = new ilParameterAppender($this->object->getId());
423  $param->delete((int) $_GET['param_id']);
424 
425  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
426  $ilCtrl->redirect($this,'editLinks');
427  }
428 
429  protected function deleteParameterForm()
430  {
431  global $ilCtrl;
432 
433  $this->checkPermission('write');
434 
435  if(!isset($_GET['param_id']))
436  {
437  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
438  $ilCtrl->redirect($this,'view');
439  }
440 
441  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
442  $param = new ilParameterAppender($this->object->getId());
443  $param->delete((int) $_GET['param_id']);
444 
445  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
446  $ilCtrl->redirect($this,'view');
447 
448  }
449 
450 
455  protected function updateLinks()
456  {
457  global $ilCtrl;
458 
459  $this->checkPermission('write');
460  $this->activateTabs('content','');
461 
462  if(!is_array($_POST['ids']))
463  {
464  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
465  $ilCtrl->redirect($this,'view');
466  }
467 
468  // Validate
469  $invalid = array();
470  foreach($_POST['ids'] as $link_id)
471  {
472  $data = $_POST['links'][$link_id];
473 
474  // handle internal links
475  if($_POST['tar_'.$link_id.'_ajax_type'] &&
476  $_POST['tar_'.$link_id.'_ajax_id'])
477  {
478  $data['tar'] = $_POST['links'][$link_id]['tar'] =
479  $_POST['tar_'.$link_id.'_ajax_type'].'|'.
480  $_POST['tar_'.$link_id.'_ajax_id'];
481  }
482 
483 
484  if(!strlen($data['tit']))
485  {
486  $invalid[] = $link_id;
487  continue;
488  }
489  if(!strlen($data['tar']))
490  {
491  $invalid[] = $link_id;
492  continue;
493  }
494  if($data['nam'] and !$data['val'])
495  {
496  $invalid[] = $link_id;
497  continue;
498  }
499  if(!$data['nam'] and $data['val'])
500  {
501  $invalid[] = $link_id;
502  continue;
503  }
504  }
505 
506  if(count($invalid))
507  {
508  ilUtil::sendFailure($this->lng->txt('err_check_input'));
509  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
510 
511  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
512  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
513  $table->setInvalidLinks($invalid);
514  $table->parseSelectedLinks($_POST['ids']);
515  $table->updateFromPost();
516  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML());
517  return false;
518  }
519 
520  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
521  $links = new ilLinkResourceItems($this->object->getId());
522 
523  // Save Settings
524  foreach($_POST['ids'] as $link_id)
525  {
526  $data = $_POST['links'][$link_id];
527 
528  $orig = ilLinkResourceItems::lookupItem($this->object->getId(),$link_id);
529 
530  $links->setLinkId($link_id);
531  $links->setTitle(ilUtil::stripSlashes($data['tit']));
532  $links->setDescription(ilUtil::stripSlashes($data['des']));
533  $links->setTarget(str_replace('"', '', ilUtil::stripSlashes($data['tar'])));
534  $links->setActiveStatus((int) $data['act']);
535  $links->setDisableCheckStatus((int) $data['che']);
536  $links->setLastCheckDate($orig['last_check']);
537  $links->setValidStatus((int) $data['vali']);
538  $links->update();
539 
540  if(strlen($data['nam']) and $data['val'])
541  {
542  $param = new ilParameterAppender($this->object->getId());
543  $param->setName(ilUtil::stripSlashes($data['nam']));
544  $param->setValue((int) $data['val']);
545  $param->add($link_id);
546  }
547 
548  if($this->isContainerMetaDataRequired())
549  {
550  $this->object->setTitle(ilUtil::stripSlashes($data['tit']));
551  $this->object->setDescription(ilUtil::stripSlashes($data['des']));
552  $this->object->update();
553  }
554 
555  // TODO: Dynamic parameters
556  }
557 
558  ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
559  $ilCtrl->redirect($this,'view');
560  }
561 
567  protected function setValuesFromLink($a_link_id)
568  {
569  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
570  $link = new ilLinkResourceItems($this->object->getId());
571 
572  $values = $link->getItem($a_link_id);
573 
575  {
576  }
577 
578  $this->form->setValuesByArray(
579  array(
580  'tit' => $values['title'],
581  'tar' => $values['target'],
582  'des' => $values['description'],
583  'act' => (int) $values['active'],
584  'che' => (int) $values['disable_check'],
585  'vali' => (int) $values['valid']
586  )
587  );
588  }
589 
590 
598  protected function checkLinkInput($a_mode,$a_webr_id = 0,$a_link_id = 0)
599  {
600  $valid = $this->form->checkInput();
601 
602  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
603  $this->link = new ilLinkResourceItems($a_webr_id);
604  $this->link->setTarget(str_replace('"', '', ilUtil::stripSlashes($this->form->getInput('tar'))));
605  $this->link->setTitle($this->form->getInput('tit'));
606  $this->link->setDescription($this->form->getInput('des'));
607  $this->link->setDisableCheckStatus($this->form->getInput('che'));
608 
609  if($a_mode == self::LINK_MOD_CREATE)
610  {
611  $this->link->setActiveStatus(true);
612  }
613  else
614  {
615  $this->link->setActiveStatus($this->form->getInput('act'));
616  }
617 
618  if($a_mode == self::LINK_MOD_EDIT)
619  {
620  $this->link->setValidStatus($this->form->getInput('vali'));
621  }
622  else
623  {
624  $this->link->setValidStatus(true);
625  }
626 
628  {
629  return $valid;
630  }
631 
632  $this->dynamic = new ilParameterAppender($a_webr_id);
633  $this->dynamic->setName($this->form->getInput('nam'));
634  $this->dynamic->setValue($this->form->getInput('val'));
635  if(!$this->dynamic->validate())
636  {
637  switch($this->dynamic->getErrorCode())
638  {
639  case LINKS_ERR_NO_NAME:
640  $this->form->getItemByPostVar('nam')->setAlert($this->lng->txt('links_no_name_given'));
641  return false;
642 
643  case LINKS_ERR_NO_VALUE:
644  $this->form->getItemByPostVar('val')->setAlert($this->lng->txt('links_no_value_given'));
645  return false;
646 
648  // Nothing entered => no error
649  return $valid;
650  }
651  $this->dynamic = null;
652  }
653  return $valid;
654  }
655 
656 
662  protected function initFormLink($a_mode)
663  {
664  global $ilTabs;
665 
666  $ilTabs->activateTab("id_content");
667 
668  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
669  $this->form = new ilPropertyFormGUI();
670 
671  switch($a_mode)
672  {
673  case self::LINK_MOD_CREATE:
674  // Header
675  $this->ctrl->setParameter($this,'new_type','webr');
676  $this->form->setTitle($this->lng->txt('webr_new_link'));
677  $this->form->setTableWidth('600px');
678 
679  // Buttons
680  $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
681  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
682  break;
683 
684  case self::LINK_MOD_ADD:
685  // Header
686  $this->form->setTitle($this->lng->txt('webr_new_link'));
687 
688  // Buttons
689  $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
690  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
691  break;
692 
693  case self::LINK_MOD_EDIT:
694  // Header
695  $this->ctrl->setParameter($this,'link_id',(int) $_REQUEST['link_id']);
696  $this->form->setTitle($this->lng->txt('webr_edit'));
697 
698  // Buttons
699  $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
700  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
701  break;
702  }
703 
704 
705  $this->form->setFormAction($this->ctrl->getFormAction($this));
706 
707  if($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired())
708  {
709  ilUtil::sendInfo($this->lng->txt('webr_container_info'));
710 
711 
712  $this->form->setTitle($this->lng->txt('webr_edit_list'));
713 
714  // List Title
715  $title = new ilTextInputGUI($this->lng->txt('webr_list_title'),'lti');
716  $title->setRequired(true);
717  $title->setSize(40);
718  $title->setMaxLength(127);
719  $this->form->addItem($title);
720 
721  // List Description
722  $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'tde');
723  $desc->setRows(3);
724  $desc->setCols(40);
725  $this->form->addItem($desc);
726 
727  // Addtional section
728  $sect = new ilFormSectionHeaderGUI();
729  $sect->setTitle($this->lng->txt('webr_add'));
730  $this->form->addItem($sect);
731  }
732 
733  // Target
734  /*
735  $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
736  $tar->setValue("http://");
737 
738  $tar->setSize(40);
739  $tar->setMaxLength(500);
740  */
741  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
742  $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'),'tar');
743  $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem"));
744 
745  $tar->setRequired(true);
746  $this->form->addItem($tar);
747 
748  // Title
749  $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'),'tit');
750  $tit->setRequired(true);
751  $tit->setSize(40);
752  $tit->setMaxLength(127);
753  $this->form->addItem($tit);
754 
755  // Description
756  $des = new ilTextAreaInputGUI($this->lng->txt('description'),'des');
757  $des->setRows(3);
758  $des->setCols(40);
759  $this->form->addItem($des);
760 
761 
762  if($a_mode != self::LINK_MOD_CREATE)
763  {
764  // Active
765  $act = new ilCheckboxInputGUI($this->lng->txt('active'),'act');
766  $act->setChecked(true);
767  $act->setValue(1);
768  $this->form->addItem($act);
769 
770  // Check
771  $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'),'che');
772  $che->setValue(1);
773  $this->form->addItem($che);
774  }
775 
776  // Valid
777  if($a_mode == self::LINK_MOD_EDIT)
778  {
779  $val = new ilCheckboxInputGUI($this->lng->txt('valid'),'vali');
780  $this->form->addItem($val);
781  }
782 
783  if(ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE)
784  {
785  $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
786  $dyn->setInfo($this->lng->txt('links_dynamic_info'));
787 
788 
789  if(count($links = ilParameterAppender::_getParams((int) $_GET['link_id'])))
790  {
791  $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'),'ex');
792  $dyn->addSubItem($ex);
793 
794  foreach($links as $id => $link)
795  {
796  $p = new ilCustomInputGUI();
797 
798  $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html',true,true,'Modules/WebResource');
799  $ptpl->setVariable('INFO_TXT',ilParameterAppender::parameterToInfo($link['name'], $link['value']));
800  $this->ctrl->setParameter($this,'param_id',$id);
801  $ptpl->setVariable('LINK_DEL',$this->ctrl->getLinkTarget($this,'deleteParameterForm'));
802  $ptpl->setVariable('LINK_TXT',$this->lng->txt('delete'));
803  $p->setHtml($ptpl->get());
804  $dyn->addSubItem($p);
805  }
806  }
807 
808  // Existing parameters
809 
810  // New parameter
811  if($a_mode != self::LINK_MOD_CREATE)
812  {
813  #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
814  #$dyn->addSubItem($new);
815  }
816 
817  // Dynyamic name
818  $nam = new ilTextInputGUI($this->lng->txt('links_name'),'nam');
819  $nam->setSize(12);
820  $nam->setMaxLength(128);
821  $dyn->addSubItem($nam);
822 
823  // Dynamic value
824  $val = new ilSelectInputGUI($this->lng->txt('links_value'),'val');
826  $val->setValue(0);
827  $dyn->addSubItem($val);
828 
829  $this->form->addItem($dyn);
830  }
831  }
832 
838  protected function isContainerMetaDataRequired()
839  {
840  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
841  return ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) == 1;
842  }
843 
848  protected function switchViewMode()
849  {
850  global $ilCtrl;
851 
852  $_REQUEST['view_mode'] = $_GET['view_mode'] = (int) $_GET['switch_mode'];
853  $this->view();
854  }
855 
860  protected function editLinks()
861  {
862  $_GET['switch_mode'] = self::VIEW_MODE_MANAGE;
863  $this->switchViewMode();
864  }
865 
866 
871  public function view()
872  {
873  global $ilErr, $ilTabs;
874 
875  $ilTabs->activateTab("id_content");
876 
877  $this->checkPermission('read');
878 
879  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
880  {
881  parent::view();
882  return true;
883  }
884  else
885  {
886  switch((int) $_REQUEST['view_mode'])
887  {
888  case self::VIEW_MODE_MANAGE:
889  $this->manage();
890  break;
891 
892  case self::VIEW_MODE_SORT:
893  // #14638
894  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
896  {
897  $this->sort();
898  break;
899  }
900  // fallthrough
901 
902  default:
903  $this->showLinks();
904  break;
905  }
906  }
907  $GLOBALS['tpl']->setPermanentLink($this->object->getType(),$this->object->getRefId());
908  return true;
909  }
910 
915  protected function manage()
916  {
917  $this->checkPermission('write');
918  $this->activateTabs('content','id_content_manage');
919 
920  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
921  $this->showToolbar('ACTION_BUTTONS');
922 
923  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
924  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
925  $table->parse();
926 
927  include_once './Services/Link/classes/class.ilInternalLinkGUI.php';
929 
930  $this->tpl->addJavaScript("Modules/WebResource/js/intLink.js");
931  $this->tpl->addJavascript("Services/Form/js/Form.js");
932 
933  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML().$js);
934  }
935 
940  protected function showLinks()
941  {
942  $this->checkPermission('read');
943  $this->activateTabs('content','id_content_view');
944 
945  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
946  $table = new ilWebResourceLinkTableGUI($this,'showLinks');
947  $table->parse();
948 
949  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
950  $this->showToolbar('ACTION_BUTTONS');
951  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
952  }
953 
958  protected function sort()
959  {
960  $this->checkPermission('write');
961  $this->activateTabs('content','id_content_ordering');
962 
963  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
964  $table = new ilWebResourceLinkTableGUI($this,'sort',true);
965  $table->parse();
966 
967  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
968  $this->showToolbar('ACTION_BUTTONS');
969  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
970  }
971 
976  protected function saveSorting()
977  {
978  $this->checkPermission('write');
979 
980  include_once './Services/Container/classes/class.ilContainerSorting.php';
981  $sort = ilContainerSorting::_getInstance($this->object->getId());
982  $sort->savePost((array) $_POST['position']);
983 
984  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
985  $this->view();
986  }
987 
988 
994  protected function showToolbar($a_tpl_var)
995  {
996  if(!$this->checkPermissionBool('write'))
997  {
998  return;
999  }
1000 
1001  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1002  $tool = new ilToolbarGUI();
1003  $tool->setFormAction($this->ctrl->getFormAction($this));
1004  $tool->addButton(
1005  $this->lng->txt('webr_add'),
1006  $this->ctrl->getLinkTarget($this,'addLink')
1007  );
1008 
1009  $this->tpl->setVariable($a_tpl_var,$tool->getHTML());
1010  return;
1011  }
1012 
1017  protected function confirmDeleteLink()
1018  {
1019  $this->checkPermission('write');
1020  $this->activateTabs('content','id_content_view');
1021 
1022  $link_ids = array();
1023 
1024  if(is_array($_POST['link_ids']))
1025  {
1026  $link_ids =$_POST['link_ids'];
1027  }
1028  elseif(isset($_GET['link_id']))
1029  {
1030  $link_ids = array($_GET['link_id']);
1031  }
1032 
1033  if(!count($link_ids) > 0)
1034  {
1035  ilUtil::sendFailure($this->lng->txt('select_one'));
1036  $this->view();
1037  return false;
1038  }
1039 
1040  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1041  $links = new ilLinkResourceItems($this->object->getId());
1042 
1043  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1044  $confirm = new ilConfirmationGUI();
1045  $confirm->setFormAction($this->ctrl->getFormAction($this,'view'));
1046  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1047  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1048  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1049 
1050  foreach($link_ids as $link_id)
1051  {
1052  $link = $links->getItem($link_id);
1053  $confirm->addItem('link_ids[]', $link_id,$link['title']);
1054  }
1055  $this->tpl->setContent($confirm->getHTML());
1056  }
1057 
1062  protected function deleteLinks()
1063  {
1064  global $ilCtrl;
1065 
1066  $this->checkPermission('write');
1067 
1068  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1069  $links = new ilLinkResourceItems($this->object->getId());
1070 
1071  foreach($_POST['link_ids'] as $link_id)
1072  {
1073  $links->delete($link_id);
1074  }
1075  ilUtil::sendSuccess($this->lng->txt('webr_deleted_items'),true);
1076  $ilCtrl->redirect($this,'view');
1077  }
1078 
1083  protected function deactivateLink()
1084  {
1085  global $ilCtrl;
1086 
1087  $this->checkPermission('write');
1088 
1089  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1090  $links = new ilLinkResourceItems($this->object->getId());
1091 
1092  if(!$_GET['link_id'])
1093  {
1094  ilUtil::sendFailure($this->lng->txt('select_one'),true);
1095  $ilCtrl->redirect($this,'view');
1096  }
1097 
1098  $links->setLinkId((int) $_GET['link_id']);
1099  $links->updateActive(false);
1100 
1101  ilUtil::sendSuccess($this->lng->txt('webr_inactive_success'),true);
1102  $ilCtrl->redirect($this,'view');
1103  }
1104 
1105 
1111  function infoScreen()
1112  {
1113  $this->ctrl->setCmd("showSummary");
1114  $this->ctrl->setCmdClass("ilinfoscreengui");
1115  $this->infoScreenForward();
1116  }
1117 
1122  {
1123  global $ilTabs;
1124 
1125  $this->checkPermission('visible');
1126  $ilTabs->activateTab('id_info');
1127 
1128  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1129  $info = new ilInfoScreenGUI($this);
1130 
1131  $info->enablePrivateNotes();
1132 
1133  // standard meta data
1134  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1135 
1136  if($this->id_type == self::WORKSPACE_NODE_ID)
1137  {
1138  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
1139  }
1140 
1141  // forward the command
1142  $this->ctrl->forwardCommand($info);
1143  }
1144 
1145 
1146  function history()
1147  {
1148  global $ilTabs;
1149 
1150  $this->checkPermission('write');
1151  $ilTabs->activateTab('id_history');
1152 
1153  include_once("./Services/History/classes/class.ilHistoryTableGUI.php");
1154  $hist_gui = new ilHistoryTableGUI($this, "history", $this->object->getId(), $this->object->getType);
1155  $hist_gui->initTable();
1156  $this->tpl->setContent($hist_gui->getHTML());
1157  }
1158 
1167  public function formatInvalidLinkArray(Array $row)
1168  {
1169  $this->object->items_obj->readItem($row['page_id']);
1170  $row['title'] = $this->object->items_obj->getTitle();
1171 
1172  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
1174  $actions->setSelectionHeaderClass('small');
1175  $actions->setItemLinkClass('xsmall');
1176  $actions->setListTitle($this->lng->txt('actions'));
1177  $actions->setId($row['page_id']);
1178  $this->ctrl->setParameter($this, 'link_id', $row['page_id']);
1179  $actions->addItem(
1180  $this->lng->txt('edit'),
1181  '',
1182  $this->ctrl->getLinkTarget($this, 'editLink')
1183  );
1184  $this->ctrl->clearParameters($this);
1185  $row['action_html'] = $actions->getHTML();
1186 
1187  return $row;
1188  }
1189 
1194  protected function linkChecker()
1195  {
1196  global $ilias, $ilUser, $tpl, $ilTabs;
1197 
1198  $this->checkPermission('write');
1199  $ilTabs->activateTab('id_link_check');
1200 
1201  $this->__initLinkChecker();
1202  $this->object->initLinkResourceItemsObject();
1203 
1204  require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
1205 
1206  $toolbar = new ilToolbarGUI();
1207 
1208  if((bool)$ilias->getSetting('cron_web_resource_check'))
1209  {
1210  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1211  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1212 
1213  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
1214  $chb->setValue(1);
1215  $chb->setChecked((bool)ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
1216  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
1217 
1218  $toolbar->addInputItem($chb);
1219  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
1220  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
1221  }
1222 
1223  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
1224  $tgui->setLinkChecker($this->link_checker_obj)
1225  ->setRowHandler($this)
1226  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
1227 
1228  return $tpl->setContent($tgui->prepareHTML()->getHTML().$toolbar->getHTML());
1229  }
1230 
1231  function saveLinkCheck()
1232  {
1233  global $ilDB,$ilUser;
1234 
1235  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1236 
1237  $link_check_notify =& new ilLinkCheckNotify($ilDB);
1238  $link_check_notify->setUserId($ilUser->getId());
1239  $link_check_notify->setObjId($this->object->getId());
1240 
1241  if($_POST['link_check_message'])
1242  {
1243  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
1244  $link_check_notify->addNotifier();
1245  }
1246  else
1247  {
1248  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
1249  $link_check_notify->deleteNotifier();
1250  }
1251  $this->linkChecker();
1252 
1253  return true;
1254  }
1255 
1256 
1257 
1258  function refreshLinkCheck()
1259  {
1260  $this->__initLinkChecker();
1261 
1262  if(!$this->link_checker_obj->checkPear())
1263  {
1264  ilUtil::sendFailure($this->lng->txt('missing_pear_library'));
1265  $this->linkChecker();
1266 
1267  return false;
1268  }
1269 
1270 
1271  $this->object->initLinkResourceItemsObject();
1272 
1273  // Set all link to valid. After check invalid links will be set to invalid
1274  $this->object->items_obj->updateValidByCheck();
1275 
1276  foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
1277  {
1278  $this->object->items_obj->readItem($invalid['page_id']);
1279  $this->object->items_obj->setActiveStatus(false);
1280  $this->object->items_obj->setValidStatus(false);
1281  $this->object->items_obj->update(false);
1282  }
1283 
1284  $this->object->items_obj->updateLastCheck();
1285  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
1286 
1287  $this->linkChecker();
1288 
1289  return true;
1290  }
1291 
1293  {
1294  global $ilDB;
1295 
1296  include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
1297 
1298  $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
1299  $this->link_checker_obj->setObjId($this->object->getId());
1300 
1301  return true;
1302  }
1303 
1304 
1311  protected function activateTabs($a_active_tab,$a_active_subtab = '')
1312  {
1313  global $ilCtrl, $ilTabs, $lng;
1314 
1315  switch($a_active_tab)
1316  {
1317  case 'content':
1318  if($this->checkPermissionBool('write'))
1319  {
1320  $this->lng->loadLanguageModule('cntr');
1321 
1322  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_VIEW);
1323  $ilTabs->addSubTab('id_content_view',
1324  $lng->txt('view'),
1325  $this->ctrl->getLinkTarget($this,'switchViewMode')
1326  );
1327  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_MANAGE);
1328  $ilTabs->addSubTab('id_content_manage',
1329  $lng->txt('cntr_manage'),
1330  $this->ctrl->getLinkTarget($this,'switchViewMode')
1331  );
1332  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1333  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
1334  include_once './Services/Container/classes/class.ilContainer.php';
1335  if((ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1337  {
1338  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_SORT);
1339  $ilTabs->addSubTab('id_content_ordering',
1340  $this->lng->txt('cntr_ordering'),
1341  $this->ctrl->getLinkTarget($this,'switchViewMode')
1342  );
1343  }
1344 
1345  $ilCtrl->clearParameters($this);
1346  $ilTabs->activateSubTab($a_active_subtab);
1347  }
1348  }
1349 
1350  $ilTabs->activateTab('id_content');
1351  }
1352 
1353 
1358  function setTabs()
1359  {
1360  global $ilTabs, $lng, $ilHelp;
1361 
1362  $ilHelp->setScreenIdComponent("webr");
1363 
1364  if ($this->checkPermissionBool('read'))
1365  {
1366  $ilTabs->addTab("id_content",
1367  $lng->txt("content"),
1368  $this->ctrl->getLinkTarget($this, "view"));
1369  }
1370 
1371  if ($this->checkPermissionBool('visible'))
1372  {
1373  $ilTabs->addTab("id_info",
1374  $lng->txt("info_short"),
1375  $this->ctrl->getLinkTarget($this, "infoScreen"));
1376  }
1377 
1378  if($this->checkPermissionBool('write') and !$this->getCreationMode())
1379  {
1380  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1381  if(ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1382  {
1383  $ilTabs->addTab("id_settings",
1384  $lng->txt("settings"),
1385  $this->ctrl->getLinkTarget($this, "settings"));
1386  }
1387 
1388  }
1389 
1390  if ($this->checkPermissionBool('write'))
1391  {
1392  $ilTabs->addTab("id_history",
1393  $lng->txt("history"),
1394  $this->ctrl->getLinkTarget($this, "history"));
1395  }
1396 
1397  if ($this->checkPermissionBool('write'))
1398  {
1399  // Check if pear library is available
1400  if(@include_once('HTTP/Request.php'))
1401  {
1402  $ilTabs->addTab("id_link_check",
1403  $lng->txt("link_check"),
1404  $this->ctrl->getLinkTarget($this, "linkChecker"));
1405  }
1406  }
1407 
1408  if ($this->checkPermissionBool('write'))
1409  {
1410  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1411  $mdgui = new ilObjectMetaDataGUI($this->object);
1412  $mdtab = $mdgui->getTab();
1413  if($mdtab)
1414  {
1415  $ilTabs->addTab("id_meta_data",
1416  $lng->txt("meta_data"),
1417  $mdtab);
1418  }
1419  }
1420 
1421  if($this->checkPermissionBool('write'))
1422  {
1423  $ilTabs->addTab(
1424  'export',
1425  $this->lng->txt('export'),
1426  $this->ctrl->getLinkTargetByClass('ilexportgui','')
1427  );
1428  }
1429 
1430  // will add permission tab if needed
1431  parent::setTabs();
1432  }
1433 
1434  // PRIVATE
1435  function __prepareOutput()
1436  {
1437  // output objects
1438  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1439  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1440 
1441  $this->tpl->setLocator();
1442 
1443  // output message
1444  if ($this->message)
1445  {
1446  ilUtil::sendInfo($this->message);
1447  }
1448 
1449  // display infopanel if something happened
1450  ilUtil::infoPanel();;
1451  }
1452 
1453  function addLocatorItems()
1454  {
1455  global $ilLocator;
1456 
1457  if (is_object($this->object))
1458  {
1459  $ilLocator->addItem($this->object->getTitle(),$this->ctrl->getLinkTarget($this),"",$this->object->getRefId(), "webr");
1460  }
1461  }
1462 
1463  protected function handleSubItemLinks($a_target)
1464  {
1465  // #15647 - handle internal links
1466  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
1467  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
1468  if(ilLinkInputGUI::isInternalLink($a_target))
1469  {
1470  include_once("./Services/Link/classes/class.ilLink.php");
1471 
1472  // #10612
1473  $parts = explode("|", $a_target);
1474 
1475  if ($parts[0] == "term")
1476  {
1477  // #16894
1478  return ilLink::_getStaticLink(
1479  0,
1480  "git",
1481  true,
1482  "&target=git_".$parts[1]
1483  );
1484  }
1485 
1486  if ($parts[0] == "page")
1487  {
1488  $parts[0] = "pg";
1489  }
1490 
1491  $a_target = ilLink::_getStaticLink($parts[1], $parts[0]);
1492  }
1493 
1494  return $a_target;
1495  }
1496 
1497  function callDirectLink()
1498  {
1499  $obj_id = $this->object->getId();
1500 
1501  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1503  {
1505  if($url["target"])
1506  {
1507  $url["target"] = $this->handleSubItemLinks($url["target"]);
1508 
1509  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1511  {
1513  }
1514 
1515  $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
1516  }
1517  }
1518  }
1519 
1520  function callLink()
1521  {
1522  if($_REQUEST["link_id"])
1523  {
1524  $obj_id = $this->object->getId();
1525 
1526  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1527  $items = new ilLinkResourceItems($obj_id);
1528  $item = $items->getItem($_REQUEST["link_id"]);
1529  if($item["target"])
1530  {
1531  $item["target"] = $this->handleSubItemLinks($item["target"]);
1532 
1533  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1535  {
1536  $item = ilParameterAppender::_append($item);
1537  }
1538  ilLoggerFactory::getLogger('webr')->debug('Redirecting to: '. $item['target']);
1539  $this->redirectToLink($this->ref_id, $obj_id, $item["target"]);
1540  }
1541  }
1542  }
1543 
1544  protected function redirectToLink($a_ref_id, $a_obj_id, $a_url)
1545  {
1546  global $ilUser;
1547 
1548  if($a_url)
1549  {
1550  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1551  ilChangeEvent::_recordReadEvent("webr", $a_ref_id, $a_obj_id,
1552  $ilUser->getId());
1553 
1554  ilUtil::redirect($a_url);
1555  }
1556  }
1557 
1558  public static function _goto($a_target, $a_additional = null)
1559  {
1560  global $ilAccess, $ilErr, $lng;
1561 
1562  if($a_additional && substr($a_additional, -3) == "wsp")
1563  {
1564  $_GET["baseClass"] = "ilsharedresourceGUI";
1565  $_GET["wsp_id"] = $a_target;
1566  include("ilias.php");
1567  exit;
1568  }
1569 
1570  // Will be replaced in future releases by ilAccess::checkAccess()
1571  if ($ilAccess->checkAccess("read", "", $a_target))
1572  {
1573  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1574  }
1575  else
1576  {
1577  // to do: force flat view
1578  if ($ilAccess->checkAccess("visible", "", $a_target))
1579  {
1580  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$a_target."&cmd=infoScreen");
1581  }
1582  else
1583  {
1584  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1585  {
1586  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1587  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1589  }
1590  }
1591  }
1592 
1593  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1594  }
1595 } // END class.ilObjLinkResource
1596 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.
Class ilObjectMetaDataGUI.
exit
Definition: login.php:54
TableGUI class for search results.
Class ilInfoScreenGUI.
settings()
Edit settings Title, Description, Sorting.
$_POST['username']
Definition: cron.php:12
updateLink()
Save after editing.
$js
This class represents a selection list property in a property form.
This class represents a property form user interface.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
$_GET["client_id"]
saveSorting()
Save nmanual sorting.
This class represents a section header in a property form.
Class ilObject Basic functions for all objects.
static _getOptionSelect()
Get options as array.
setInfo($a_info)
Set Information Text.
checkLinkInput($a_mode, $a_webr_id=0, $a_link_id=0)
Check input after creating a new link.
$valid
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
getPermanentLinkWidget($a_append=null, $a_center=false)
$cmd
Definition: sahs_server.php:35
setValue($a_value)
Set Value.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
Class ilObjLinkResourceGUI.
setInternalLinkFilterTypes(array $a_val)
Set internal link filter types.
This class represents a checkbox property in a property form.
addLink()
Add an additional link.
static _lookupTitle($a_id)
lookup object title
class for checking external links in page objects Normally used in Cron jobs, but should be extensibl...
$url
Definition: shib_logout.php:72
Class ilInternalLinkGUI.
infoScreenForward()
show information screen
class for checking external links in page objects.
initFormSettings()
Show settings form.
linkChecker()
Show link validation.
afterSave(ilObject $a_new_object)
showLinks()
Show all active links.
global $ilCtrl
Definition: ilias.php:18
class ilLinkCheckerTableGUI
static _append($a_link_data)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setChecked($a_checked)
Set Checked.
Export User Interface Class.
checkPermission($a_perm, $a_cmd="")
$info
Definition: example_052.php:80
This class represents a property in a property form.
static parameterToInfo($a_name, $a_value)
Get info text describing an existing dynamic link.
getId()
get object id public
switchViewMode()
Switch between "View" "Manage" and "Sort".
editLinks()
Start with manage mode.
static _lookupObjId($a_id)
setValue($a_value)
Set Value.
special template class to simplify handling of ITX/PEAR
static isInternalLink($a_value)
setSize($a_size)
Set Size.
This class represents a text property in a property form.
static lookupItem($a_webr_id, $a_link_id)
static infoPanel($a_keep=true)
const LINKS_ERR_NO_VALUE
editLink()
Edit a single link.
interface ilLinkCheckerGUIRowHandling
deleteParameter()
Delete a dynamic parameter.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
isContainerMetaDataRequired()
Check if a new container title is required Necessary if there is more than one link.
setOptions($a_options)
Set Options.
const LINKS_ERR_NO_NAME
setValuesFromLink($a_link_id)
Set form values from link.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
saveSettings()
Save container settings.
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
User interface class for advanced drop-down selection lists.
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE Date: 24.10.14 Time: 10:35.
This class represents a custom property in a property form.
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
This class represents a text area property in a property form.
global $ilDB
Class ilObjLinkResourceGUI.
getRefId()
get reference id public
_getNotifyStatus($a_usr_id, $a_obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilParameterAppender.
const LINKS_ERR_NO_NAME_VALUE
static _goto($a_target, $a_additional=null)
static getLogger($a_component_id)
Get component logger.
static _lookupSortMode($a_obj_id)
lookup sort mode
delete($a_item_id, $a_update_history=true)
redirectToLink($a_ref_id, $a_obj_id, $a_url)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static _getInstance($a_obj_id)
get instance by obj_id
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
initFormLink($a_mode)
Show create/edit single link.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
setValue($a_value)
Set Value.
static redirect($a_script)
http redirect to other script
updateLinks()
Update all visible links.
save()
Save new object public.
static _getParams($a_link_id)
Get dynamic parameter definitions.
static _isEnabled()
Check if dynamic parameters are enabled.
addHeaderAction()
Add header action menu.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
setRequired($a_required)
Set Required.
This class represents a external and/or internal link in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
showToolbar($a_tpl_var)
Show toolbar.
Confirmation screen class.
confirmDeleteLink()
Show delete confirmation screen.