ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public 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  $_GET['view_mode'] = isset($_GET['switch_mode']) ? $_GET['switch_mode'] : $_GET['view_mode'];
45  $ilCtrl->saveParameter($this, 'view_mode');
46  $this->__prepareOutput();
47  }
48 
49  $this->lng->loadLanguageModule("webr");
50 
51  $next_class = $this->ctrl->getNextClass($this);
52  $cmd = $this->ctrl->getCmd();
53 
54  switch ($next_class) {
55  case "ilinfoscreengui":
56  $this->prepareOutput();
57  $this->infoScreenForward(); // forwards command
58  break;
59 
60  case 'ilobjectmetadatagui':
61  $this->checkPermission('write'); // #18563
62  $this->prepareOutput();
63  $ilTabs->activateTab('id_meta_data');
64  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
65  $md_gui = new ilObjectMetaDataGUI($this->object);
66  $this->ctrl->forwardCommand($md_gui);
67  break;
68 
69  case 'ilpermissiongui':
70  $this->prepareOutput();
71  $ilTabs->activateTab('id_permissions');
72  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
73  $perm_gui = new ilPermissionGUI($this);
74  $ret =&$this->ctrl->forwardCommand($perm_gui);
75  break;
76 
77  case 'ilobjectcopygui':
78  $this->prepareOutput();
79  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
80  $cp = new ilObjectCopyGUI($this);
81  $cp->setType('webr');
82  $this->ctrl->forwardCommand($cp);
83  break;
84 
85  case 'ilexportgui':
86  $this->prepareOutput();
87  $this->tabs_gui->setTabActive('export');
88  include_once './Services/Export/classes/class.ilExportGUI.php';
89  $exp = new ilExportGUI($this);
90  $exp->addFormat('xml');
91  $this->ctrl->forwardCommand($exp);
92  break;
93 
94  case "ilcommonactiondispatchergui":
95  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
97  $this->ctrl->forwardCommand($gui);
98  break;
99 
100  case "ilpropertyformgui":
101  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
102  $this->initFormLink(self::LINK_MOD_EDIT);
103  $this->ctrl->forwardCommand($this->form);
104  break;
105 
106  case "ilinternallinkgui":
107  $this->lng->loadLanguageModule("content");
108  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
109  $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
110  $link_gui->filterLinkType("PageObject");
111  $link_gui->filterLinkType("GlossaryItem");
112  $link_gui->filterLinkType("RepositoryItem");
113  $link_gui->setFilterWhiteList(true);
114  $ilCtrl->forwardCommand($link_gui);
115  break;
116 
117  default:
118  if (!$cmd) {
119  $this->ctrl->setCmd("view");
120  }
121  parent::executeCommand();
122  }
123 
124  if (!$this->getCreationMode()) {
125  // Fill meta header tags
126  include_once('Services/MetaData/classes/class.ilMDUtils.php');
127  ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'webr');
128 
129  $this->addHeaderAction();
130  }
131  return true;
132  }
133 
134  protected function initCreateForm($a_new_type)
135  {
136  $this->initFormLink(self::LINK_MOD_CREATE);
137  return $this->form;
138  }
139 
144  public function save()
145  {
146  global $ilCtrl;
147 
148  $this->initFormLink(self::LINK_MOD_CREATE);
149  if ($this->checkLinkInput(self::LINK_MOD_CREATE, 0, 0)) {
150  // Save new object
151  $_POST['title'] = $_POST['tit'];
152  $_POST['desc'] = $_POST['des'];
153  parent::save();
154  } else {
155  // Data incomplete or invalid
156  ilUtil::sendFailure($this->lng->txt('err_check_input'));
157  $this->form->setValuesByPost();
158  $this->tpl->setContent($this->form->getHTML());
159  }
160  }
161 
162  protected function afterSave(ilObject $a_new_object)
163  {
164  // Save link
165  $this->link->setLinkResourceId($a_new_object->getId());
166  $link_id = $this->link->add();
167  $this->link->updateValid(true);
168 
169  ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
170 
171  // personal workspace
172  if ($this->id_type == self::WORKSPACE_NODE_ID) {
173  $this->ctrl->redirect($this, "editLinks");
174  }
175  // repository
176  else {
177  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" .
178  $a_new_object->getRefId() . "&cmd=switchViewMode&switch_mode=2");
179  }
180  }
181 
187  protected function settings()
188  {
189  global $ilTabs;
190 
191  $this->checkPermission('write');
192  $ilTabs->activateTab('id_settings');
193 
194  $this->initFormSettings();
195  $this->tpl->setContent($this->form->getHTML());
196  }
197 
202  protected function saveSettings()
203  {
204  global $ilTabs;
205 
206  $this->checkPermission('write');
207  $ilTabs->activateTab('id_settings');
208 
209  $this->initFormSettings();
210  if ($this->form->checkInput()) {
211  $this->object->setTitle($this->form->getInput('tit'));
212  $this->object->setDescription($this->form->getInput('des'));
213  $this->object->update();
214 
215  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
216  $sort = new ilContainerSortingSettings($this->object->getId());
217  $sort->setSortMode($this->form->getInput('sor'));
218  $sort->update();
219 
220  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
221  $this->ctrl->redirect($this, 'settings');
222  }
223 
224  $this->form->setValuesByPost();
225  ilUtil::sendFailure($this->lng->txt('err_check_input'));
226  $this->tpl->setContent($this->form->getHTML());
227  }
228 
229 
234  protected function initFormSettings()
235  {
236  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
237  $this->form = new ilPropertyFormGUI();
238  $this->form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
239  $this->form->setTitle($this->lng->txt('webr_edit_settings'));
240 
241  // Title
242  $tit = new ilTextInputGUI($this->lng->txt('webr_list_title'), 'tit');
243  $tit->setValue($this->object->getTitle());
244  $tit->setRequired(true);
245  $tit->setSize(40);
246  $tit->setMaxLength(127);
247  $this->form->addItem($tit);
248 
249  // Description
250  $des = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'), 'des');
251  $des->setValue($this->object->getDescription());
252  $des->setCols(40);
253  $des->setRows(3);
254  $this->form->addItem($des);
255 
256  // Sorting
257  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
258  include_once './Services/Container/classes/class.ilContainer.php';
259 
260  $sor = new ilRadioGroupInputGUI($this->lng->txt('webr_sorting'), 'sor');
261  $sor->setRequired(true);
262  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
263  $sor->setValue(ilContainerSortingSettings::_lookupSortMode($this->object->getId()));
264 
265  $opt = new ilRadioOption(
266  $this->lng->txt('webr_sort_title'),
268  );
269  $sor->addOption($opt);
270 
271  $opm = new ilRadioOption(
272  $this->lng->txt('webr_sort_manual'),
274  );
275  $sor->addOption($opm);
276  $this->form->addItem($sor);
277 
278  $this->form->addCommandButton('saveSettings', $this->lng->txt('save'));
279  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
280  }
281 
282 
287  public function editLink()
288  {
289  global $ilCtrl;
290 
291  $this->checkPermission('write');
292  $this->activateTabs('content', 'id_content_view');
293 
294  if (!(int) $_GET['link_id']) {
295  ilUtil::sendFailure($this->lng->txt('select_one'), true);
296  $ilCtrl->redirect($this, 'view');
297  }
298 
299  $this->initFormLink(self::LINK_MOD_EDIT);
300  $this->setValuesFromLink((int) $_GET['link_id']);
301  $this->tpl->setContent($this->form->getHTML());
302  }
303 
308  public function updateLink()
309  {
310  global $ilCtrl;
311 
312  $this->initFormLink(self::LINK_MOD_EDIT);
313  if ($this->checkLinkInput(self::LINK_MOD_EDIT, $this->object->getId(), (int) $_REQUEST['link_id'])) {
314  $this->link->setLinkId((int) $_REQUEST['link_id']);
315  $this->link->update();
316  if (ilParameterAppender::_isEnabled() and is_object($this->dynamic)) {
317  $this->dynamic->add((int) $_REQUEST['link_id']);
318  }
319 
320  if ($this->isContainerMetaDataRequired()) {
321  $this->object->setTitle($this->form->getInput('tit'));
322  $this->object->setDescription($this->form->getInput('des'));
323  $this->object->update();
324  }
325 
326  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
327  $ilCtrl->redirect($this, 'view');
328  }
329  ilUtil::sendFailure($this->lng->txt('err_check_input'));
330  $this->form->setValuesByPost();
331  $this->tpl->setContent($this->form->getHTML());
332  }
333 
338  public function addLink()
339  {
340  $this->checkPermission('write');
341  $this->activateTabs('content', 'id_content_view');
342 
343  $this->initFormLink(self::LINK_MOD_ADD);
344  $this->tpl->setContent($this->form->getHTML());
345  }
346 
351  public function saveAddLink()
352  {
353  global $ilCtrl;
354 
355  $this->checkPermission('write');
356 
357  $this->initFormLink(self::LINK_MOD_ADD);
358  if ($this->checkLinkInput(self::LINK_MOD_ADD, $this->object->getId(), 0)) {
359  if ($this->isContainerMetaDataRequired()) {
360  // Save list data
361  $this->object->setTitle($this->form->getInput('lti'));
362  $this->object->setDescription($this->form->getInput('tde'));
363  $this->object->update();
364  }
365 
366  // Save Link
367  $link_id = $this->link->add();
368  $this->link->updateValid(true);
369 
370  // Dynamic parameters
371  if (ilParameterAppender::_isEnabled() and is_object($this->dynamic)) {
372  $this->dynamic->add($link_id);
373  }
374  ilUtil::sendSuccess($this->lng->txt('webr_link_added'), true);
375  $ilCtrl->redirect($this, 'view');
376  }
377  // Error handling
378  ilUtil::sendFailure($this->lng->txt('err_check_input'));
379  $this->form->setValuesByPost();
380 
381  $this->activateTabs('content', 'id_content_view');
382  $this->tpl->setContent($this->form->getHTML());
383  }
384 
389  protected function deleteParameter()
390  {
391  global $ilCtrl;
392 
393  $this->checkPermission('write');
394 
395  $this->ctrl->setParameter($this, 'link_id', (int) $_GET['link_id']);
396 
397  if (!isset($_GET['param_id'])) {
398  ilUtil::sendFailure($this->lng->txt('select_one'), true);
399  $ilCtrl->redirect($this, 'view');
400  }
401 
402  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
403  $param = new ilParameterAppender($this->object->getId());
404  $param->delete((int) $_GET['param_id']);
405 
406  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'), true);
407  $ilCtrl->redirect($this, 'editLinks');
408  }
409 
410  protected function deleteParameterForm()
411  {
412  global $ilCtrl;
413 
414  $this->checkPermission('write');
415 
416  if (!isset($_GET['param_id'])) {
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, 'view');
427  }
428 
429 
434  protected function updateLinks()
435  {
436  global $ilCtrl;
437 
438  $this->checkPermission('write');
439  $this->activateTabs('content', '');
440 
441  if (!is_array($_POST['ids'])) {
442  ilUtil::sendFailure($this->lng->txt('select_one'), true);
443  $ilCtrl->redirect($this, 'view');
444  }
445 
446  // Validate
447  $invalid = array();
448  foreach ($_POST['ids'] as $link_id) {
449  $data = $_POST['links'][$link_id];
450 
451  // handle internal links
452  if ($_POST['tar_' . $link_id . '_ajax_type'] &&
453  $_POST['tar_' . $link_id . '_ajax_id']) {
454  $data['tar'] = $_POST['links'][$link_id]['tar'] =
455  $_POST['tar_' . $link_id . '_ajax_type'] . '|' .
456  $_POST['tar_' . $link_id . '_ajax_id'];
457  }
458 
459 
460  if (!strlen($data['tit'])) {
461  $invalid[] = $link_id;
462  continue;
463  }
464  if (!strlen($data['tar'])) {
465  $invalid[] = $link_id;
466  continue;
467  }
468  if ($data['nam'] and !$data['val']) {
469  $invalid[] = $link_id;
470  continue;
471  }
472  if (!$data['nam'] and $data['val']) {
473  $invalid[] = $link_id;
474  continue;
475  }
476  }
477 
478  if (count($invalid)) {
479  ilUtil::sendFailure($this->lng->txt('err_check_input'));
480  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.webr_manage.html', 'Modules/WebResource');
481 
482  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
483  $table = new ilWebResourceEditableLinkTableGUI($this, 'view');
484  $table->setInvalidLinks($invalid);
485  $table->parseSelectedLinks($_POST['ids']);
486  $table->updateFromPost();
487  $this->tpl->setVariable('TABLE_LINKS', $table->getHTML());
488  return false;
489  }
490 
491  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
492  $links = new ilLinkResourceItems($this->object->getId());
493 
494  // Save Settings
495  include_once './Services/Form/classes/class.ilFormPropertyGUI.php';
496  include_once './Services/Form/classes/class.ilLinkInputGUI.php';
497  foreach ($_POST['ids'] as $link_id) {
498  $data = $_POST['links'][$link_id];
499 
500  $orig = ilLinkResourceItems::lookupItem($this->object->getId(), $link_id);
501 
502  $links->setLinkId($link_id);
503  $links->setTitle(ilUtil::stripSlashes($data['tit']));
504  $links->setDescription(ilUtil::stripSlashes($data['des']));
505  $links->setTarget(str_replace('"', '', ilUtil::stripSlashes($data['tar'])));
506  $links->setActiveStatus((int) $data['act']);
507  $links->setDisableCheckStatus((int) $data['che']);
508  $links->setLastCheckDate($orig['last_check']);
509  $links->setValidStatus((int) $data['vali']);
510  $links->setInternal(ilLinkInputGUI::isInternalLink($data['tar']));
511  $links->update();
512 
513  if (strlen($data['nam']) and $data['val']) {
514  $param = new ilParameterAppender($this->object->getId());
515  $param->setName(ilUtil::stripSlashes($data['nam']));
516  $param->setValue((int) $data['val']);
517  $param->add($link_id);
518  }
519 
520  if ($this->isContainerMetaDataRequired()) {
521  $this->object->setTitle(ilUtil::stripSlashes($data['tit']));
522  $this->object->setDescription(ilUtil::stripSlashes($data['des']));
523  $this->object->update();
524  }
525 
526  // TODO: Dynamic parameters
527  }
528 
529  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
530  $ilCtrl->redirect($this, 'view');
531  }
532 
538  protected function setValuesFromLink($a_link_id)
539  {
540  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
541  $link = new ilLinkResourceItems($this->object->getId());
542 
543  $values = $link->getItem($a_link_id);
544 
546  }
547 
548  $this->form->setValuesByArray(
549  array(
550  'tit' => $values['title'],
551  'tar' => $values['target'],
552  'des' => $values['description'],
553  'act' => (int) $values['active'],
554  'che' => (int) $values['disable_check'],
555  'vali' => (int) $values['valid']
556  )
557  );
558  }
559 
560 
568  protected function checkLinkInput($a_mode, $a_webr_id = 0, $a_link_id = 0)
569  {
570  $valid = $this->form->checkInput();
571 
572  $link_input = $this->form->getInput('tar');
573 
574  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
575  $this->link = new ilLinkResourceItems($a_webr_id);
576  $this->link->setTarget(str_replace('"', '', ilUtil::stripSlashes($link_input)));
577  $this->link->setTitle($this->form->getInput('tit'));
578  $this->link->setDescription($this->form->getInput('des'));
579  $this->link->setDisableCheckStatus($this->form->getInput('che'));
580  $this->link->setInternal(ilLinkInputGUI::isInternalLink($link_input));
581 
582  if ($a_mode == self::LINK_MOD_CREATE) {
583  $this->link->setActiveStatus(true);
584  } else {
585  $this->link->setActiveStatus($this->form->getInput('act'));
586  }
587 
588  if ($a_mode == self::LINK_MOD_EDIT) {
589  $this->link->setValidStatus($this->form->getInput('vali'));
590  } else {
591  $this->link->setValidStatus(true);
592  }
593 
595  return $valid;
596  }
597 
598  $this->dynamic = new ilParameterAppender($a_webr_id);
599  $this->dynamic->setName($this->form->getInput('nam'));
600  $this->dynamic->setValue($this->form->getInput('val'));
601  if (!$this->dynamic->validate()) {
602  switch ($this->dynamic->getErrorCode()) {
603  case LINKS_ERR_NO_NAME:
604  $this->form->getItemByPostVar('nam')->setAlert($this->lng->txt('links_no_name_given'));
605  return false;
606 
607  case LINKS_ERR_NO_VALUE:
608  $this->form->getItemByPostVar('val')->setAlert($this->lng->txt('links_no_value_given'));
609  return false;
610 
612  // Nothing entered => no error
613  return $valid;
614  }
615  $this->dynamic = null;
616  }
617  return $valid;
618  }
619 
620 
626  protected function initFormLink($a_mode)
627  {
628  global $ilTabs;
629 
630  $ilTabs->activateTab("id_content");
631 
632  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
633  $this->form = new ilPropertyFormGUI();
634 
635  switch ($a_mode) {
636  case self::LINK_MOD_CREATE:
637  // Header
638  $this->ctrl->setParameter($this, 'new_type', 'webr');
639  $this->form->setTitle($this->lng->txt('webr_new_link'));
640  $this->form->setTableWidth('600px');
641 
642  // Buttons
643  $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
644  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
645  break;
646 
647  case self::LINK_MOD_ADD:
648  // Header
649  $this->form->setTitle($this->lng->txt('webr_new_link'));
650 
651  // Buttons
652  $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
653  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
654  break;
655 
656  case self::LINK_MOD_EDIT:
657  // Header
658  $this->ctrl->setParameter($this, 'link_id', (int) $_REQUEST['link_id']);
659  $this->form->setTitle($this->lng->txt('webr_edit'));
660 
661  // Buttons
662  $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
663  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
664  break;
665  }
666 
667 
668  $this->form->setFormAction($this->ctrl->getFormAction($this));
669 
670  if ($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired()) {
671  ilUtil::sendInfo($this->lng->txt('webr_container_info'));
672 
673 
674  $this->form->setTitle($this->lng->txt('webr_edit_list'));
675 
676  // List Title
677  $title = new ilTextInputGUI($this->lng->txt('webr_list_title'), 'lti');
678  $title->setRequired(true);
679  $title->setSize(40);
680  $title->setMaxLength(127);
681  $this->form->addItem($title);
682 
683  // List Description
684  $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'), 'tde');
685  $desc->setRows(3);
686  $desc->setCols(40);
687  $this->form->addItem($desc);
688 
689  // Addtional section
690  $sect = new ilFormSectionHeaderGUI();
691  $sect->setTitle($this->lng->txt('webr_add'));
692  $this->form->addItem($sect);
693  }
694 
695  // Target
696  /*
697  $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
698  $tar->setValue("http://");
699 
700  $tar->setSize(40);
701  $tar->setMaxLength(500);
702  */
703  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
704  $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'), 'tar');
706  array(
707  "PageObject",
708  "GlossaryItem",
709  "RepositoryItem",
710  'WikiPage'
711  )
712  );
713  $tar->setExternalLinkMaxLength(1000);
714  $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem"));
715  $tar->setRequired(true);
716  $this->form->addItem($tar);
717 
718  // Title
719  $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'), 'tit');
720  $tit->setRequired(true);
721  $tit->setSize(40);
722  $tit->setMaxLength(127);
723  $this->form->addItem($tit);
724 
725  // Description
726  $des = new ilTextAreaInputGUI($this->lng->txt('description'), 'des');
727  $des->setRows(3);
728  $des->setCols(40);
729  $this->form->addItem($des);
730 
731 
732  if ($a_mode != self::LINK_MOD_CREATE) {
733  // Active
734  $act = new ilCheckboxInputGUI($this->lng->txt('active'), 'act');
735  $act->setChecked(true);
736  $act->setValue(1);
737  $this->form->addItem($act);
738 
739  // Check
740  $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'), 'che');
741  $che->setValue(1);
742  $this->form->addItem($che);
743  }
744 
745  // Valid
746  if ($a_mode == self::LINK_MOD_EDIT) {
747  $val = new ilCheckboxInputGUI($this->lng->txt('valid'), 'vali');
748  $this->form->addItem($val);
749  }
750 
751  if (ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE) {
752  $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
753  $dyn->setInfo($this->lng->txt('links_dynamic_info'));
754 
755 
756  if (count($links = ilParameterAppender::_getParams((int) $_GET['link_id']))) {
757  $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'), 'ex');
758  $dyn->addSubItem($ex);
759 
760  foreach ($links as $id => $link) {
761  $p = new ilCustomInputGUI();
762 
763  $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html', true, true, 'Modules/WebResource');
764  $ptpl->setVariable('INFO_TXT', ilParameterAppender::parameterToInfo($link['name'], $link['value']));
765  $this->ctrl->setParameter($this, 'param_id', $id);
766  $ptpl->setVariable('LINK_DEL', $this->ctrl->getLinkTarget($this, 'deleteParameterForm'));
767  $ptpl->setVariable('LINK_TXT', $this->lng->txt('delete'));
768  $p->setHtml($ptpl->get());
769  $dyn->addSubItem($p);
770  }
771  }
772 
773  // Existing parameters
774 
775  // New parameter
776  if ($a_mode != self::LINK_MOD_CREATE) {
777  #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
778  #$dyn->addSubItem($new);
779  }
780 
781  // Dynyamic name
782  $nam = new ilTextInputGUI($this->lng->txt('links_name'), 'nam');
783  $nam->setSize(12);
784  $nam->setMaxLength(128);
785  $dyn->addSubItem($nam);
786 
787  // Dynamic value
788  $val = new ilSelectInputGUI($this->lng->txt('links_value'), 'val');
790  $val->setValue(0);
791  $dyn->addSubItem($val);
792 
793  $this->form->addItem($dyn);
794  }
795  }
796 
802  protected function isContainerMetaDataRequired()
803  {
804  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
805  return ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) == 1;
806  }
807 
812  protected function switchViewMode()
813  {
814  global $ilCtrl;
815 
816  $_REQUEST['view_mode'] = $_GET['view_mode'] = (int) $_GET['switch_mode'];
817  $this->view();
818  }
819 
824  protected function editLinks()
825  {
826  $_GET['switch_mode'] = self::VIEW_MODE_MANAGE;
827  $this->switchViewMode();
828  }
829 
830 
835  public function view()
836  {
837  global $ilErr, $ilTabs;
838 
839  $ilTabs->activateTab("id_content");
840 
841  $this->checkPermission('read');
842 
843  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
844  parent::view();
845  return true;
846  } else {
847  switch ((int) $_REQUEST['view_mode']) {
848  case self::VIEW_MODE_MANAGE:
849  $this->manage();
850  break;
851 
852  case self::VIEW_MODE_SORT:
853  // #14638
854  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
856  $this->sort();
857  break;
858  }
859  // fallthrough
860 
861  // no break
862  default:
863  $this->showLinks();
864  break;
865  }
866  }
867  $GLOBALS['tpl']->setPermanentLink($this->object->getType(), $this->object->getRefId());
868  return true;
869  }
870 
875  protected function manage()
876  {
877  $this->checkPermission('write');
878  $this->activateTabs('content', 'id_content_manage');
879 
880  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.webr_manage.html', 'Modules/WebResource');
881  $this->showToolbar('ACTION_BUTTONS');
882 
883  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
884  $table = new ilWebResourceEditableLinkTableGUI($this, 'view');
885  $table->parse();
886 
887  include_once './Services/Link/classes/class.ilInternalLinkGUI.php';
889 
890  $this->tpl->addJavaScript("Modules/WebResource/js/intLink.js");
891  $this->tpl->addJavascript("Services/Form/js/Form.js");
892 
893  $this->tpl->setVariable('TABLE_LINKS', $table->getHTML() . $js);
894  }
895 
900  protected function showLinks()
901  {
902  $this->checkPermission('read');
903  $this->activateTabs('content', 'id_content_view');
904 
905  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
906  $table = new ilWebResourceLinkTableGUI($this, 'showLinks');
907  $table->parse();
908 
909  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.webr_view.html', 'Modules/WebResource');
910  $this->showToolbar('ACTION_BUTTONS');
911  $this->tpl->setVariable('LINK_TABLE', $table->getHTML());
912  }
913 
918  protected function sort()
919  {
920  $this->checkPermission('write');
921  $this->activateTabs('content', 'id_content_ordering');
922 
923  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
924  $table = new ilWebResourceLinkTableGUI($this, 'sort', true);
925  $table->parse();
926 
927  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.webr_view.html', 'Modules/WebResource');
928  $this->showToolbar('ACTION_BUTTONS');
929  $this->tpl->setVariable('LINK_TABLE', $table->getHTML());
930  }
931 
936  protected function saveSorting()
937  {
938  $this->checkPermission('write');
939 
940  include_once './Services/Container/classes/class.ilContainerSorting.php';
941  $sort = ilContainerSorting::_getInstance($this->object->getId());
942  $sort->savePost((array) $_POST['position']);
943 
944  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
945  $this->view();
946  }
947 
948 
954  protected function showToolbar($a_tpl_var)
955  {
956  if (!$this->checkPermissionBool('write')) {
957  return;
958  }
959 
960  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
961  $tool = new ilToolbarGUI();
962  $tool->setFormAction($this->ctrl->getFormAction($this));
963  $tool->addButton(
964  $this->lng->txt('webr_add'),
965  $this->ctrl->getLinkTarget($this, 'addLink')
966  );
967 
968  $this->tpl->setVariable($a_tpl_var, $tool->getHTML());
969  return;
970  }
971 
976  protected function confirmDeleteLink()
977  {
978  $this->checkPermission('write');
979  $this->activateTabs('content', 'id_content_view');
980 
981  $link_ids = array();
982 
983  if (is_array($_POST['link_ids'])) {
984  $link_ids =$_POST['link_ids'];
985  } elseif (isset($_GET['link_id'])) {
986  $link_ids = array($_GET['link_id']);
987  }
988 
989  if (!count($link_ids) > 0) {
990  ilUtil::sendFailure($this->lng->txt('select_one'));
991  $this->view();
992  return false;
993  }
994 
995  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
996  $links = new ilLinkResourceItems($this->object->getId());
997 
998  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
999  $confirm = new ilConfirmationGUI();
1000  $confirm->setFormAction($this->ctrl->getFormAction($this, 'view'));
1001  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1002  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1003  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1004 
1005  foreach ($link_ids as $link_id) {
1006  $link = $links->getItem($link_id);
1007  $confirm->addItem('link_ids[]', $link_id, $link['title']);
1008  }
1009  $this->tpl->setContent($confirm->getHTML());
1010  }
1011 
1016  protected function deleteLinks()
1017  {
1018  global $ilCtrl;
1019 
1020  $this->checkPermission('write');
1021 
1022  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1023  $links = new ilLinkResourceItems($this->object->getId());
1024 
1025  foreach ($_POST['link_ids'] as $link_id) {
1026  $links->delete($link_id);
1027  }
1028  ilUtil::sendSuccess($this->lng->txt('webr_deleted_items'), true);
1029  $ilCtrl->redirect($this, 'view');
1030  }
1031 
1036  protected function deactivateLink()
1037  {
1038  global $ilCtrl;
1039 
1040  $this->checkPermission('write');
1041 
1042  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1043  $links = new ilLinkResourceItems($this->object->getId());
1044 
1045  if (!$_GET['link_id']) {
1046  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1047  $ilCtrl->redirect($this, 'view');
1048  }
1049 
1050  $links->setLinkId((int) $_GET['link_id']);
1051  $links->updateActive(false);
1052 
1053  ilUtil::sendSuccess($this->lng->txt('webr_inactive_success'), true);
1054  $ilCtrl->redirect($this, 'view');
1055  }
1056 
1057 
1063  public function infoScreen()
1064  {
1065  $this->ctrl->setCmd("showSummary");
1066  $this->ctrl->setCmdClass("ilinfoscreengui");
1067  $this->infoScreenForward();
1068  }
1069 
1073  public function infoScreenForward()
1074  {
1075  global $ilTabs;
1076 
1077  if (!$this->checkPermissionBool('visible')) {
1078  $this->checkPermission('read');
1079  }
1080  $ilTabs->activateTab('id_info');
1081 
1082  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1083  $info = new ilInfoScreenGUI($this);
1084 
1085  $info->enablePrivateNotes();
1086 
1087  // standard meta data
1088  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1089 
1090  if ($this->id_type == self::WORKSPACE_NODE_ID) {
1091  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
1092  }
1093 
1094  // forward the command
1095  $this->ctrl->forwardCommand($info);
1096  }
1097 
1098 
1099  public function history()
1100  {
1101  global $ilTabs;
1102 
1103  $this->checkPermission('write');
1104  $ilTabs->activateTab('id_history');
1105 
1106  include_once("./Services/History/classes/class.ilHistoryTableGUI.php");
1107  $hist_gui = new ilHistoryTableGUI($this, "history", $this->object->getId(), $this->object->getType);
1108  $hist_gui->initTable();
1109  $this->tpl->setContent($hist_gui->getHTML());
1110  }
1111 
1121  {
1122  $this->object->items_obj->readItem($row['page_id']);
1123  $row['title'] = $this->object->items_obj->getTitle();
1124 
1125  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
1127  $actions->setSelectionHeaderClass('small');
1128  $actions->setItemLinkClass('xsmall');
1129  $actions->setListTitle($this->lng->txt('actions'));
1130  $actions->setId($row['page_id']);
1131  $this->ctrl->setParameter($this, 'link_id', $row['page_id']);
1132  $actions->addItem(
1133  $this->lng->txt('edit'),
1134  '',
1135  $this->ctrl->getLinkTarget($this, 'editLink')
1136  );
1137  $this->ctrl->clearParameters($this);
1138  $row['action_html'] = $actions->getHTML();
1139 
1140  return $row;
1141  }
1142 
1147  protected function linkChecker()
1148  {
1149  global $ilias, $ilUser, $tpl, $ilTabs;
1150 
1151  $this->checkPermission('write');
1152  $ilTabs->activateTab('id_link_check');
1153 
1154  $this->__initLinkChecker();
1155  $this->object->initLinkResourceItemsObject();
1156 
1157  require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
1158 
1159  $toolbar = new ilToolbarGUI();
1160 
1161  if ((bool) $ilias->getSetting('cron_web_resource_check')) {
1162  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1163  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1164 
1165  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
1166  $chb->setValue(1);
1167  $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
1168  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
1169 
1170  $toolbar->addInputItem($chb);
1171  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
1172  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
1173  }
1174 
1175  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
1176  $tgui->setLinkChecker($this->link_checker_obj)
1177  ->setRowHandler($this)
1178  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
1179 
1180  return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
1181  }
1182 
1183  public function saveLinkCheck()
1184  {
1185  global $ilDB,$ilUser;
1186 
1187  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1188 
1189  $link_check_notify = new ilLinkCheckNotify($ilDB);
1190  $link_check_notify->setUserId($ilUser->getId());
1191  $link_check_notify->setObjId($this->object->getId());
1192 
1193  if ($_POST['link_check_message']) {
1194  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
1195  $link_check_notify->addNotifier();
1196  } else {
1197  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
1198  $link_check_notify->deleteNotifier();
1199  }
1200  $this->linkChecker();
1201 
1202  return true;
1203  }
1204 
1205 
1206 
1207  public function refreshLinkCheck()
1208  {
1209  $this->__initLinkChecker();
1210  $this->object->initLinkResourceItemsObject();
1211 
1212  // Set all link to valid. After check invalid links will be set to invalid
1213  $this->object->items_obj->updateValidByCheck();
1214 
1215  foreach ($this->link_checker_obj->checkWebResourceLinks() as $invalid) {
1216  $this->object->items_obj->readItem($invalid['page_id']);
1217  $this->object->items_obj->setActiveStatus(false);
1218  $this->object->items_obj->setValidStatus(false);
1219  $this->object->items_obj->update(false);
1220  }
1221 
1222  $this->object->items_obj->updateLastCheck();
1223  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
1224 
1225  $this->linkChecker();
1226 
1227  return true;
1228  }
1229 
1230  public function __initLinkChecker()
1231  {
1232  global $ilDB;
1233 
1234  include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
1235 
1236  $this->link_checker_obj = new ilLinkChecker($ilDB, false);
1237  $this->link_checker_obj->setObjId($this->object->getId());
1238 
1239  return true;
1240  }
1241 
1242 
1249  protected function activateTabs($a_active_tab, $a_active_subtab = '')
1250  {
1251  global $ilCtrl, $ilTabs, $lng;
1252 
1253  switch ($a_active_tab) {
1254  case 'content':
1255  if ($this->checkPermissionBool('write')) {
1256  $this->lng->loadLanguageModule('cntr');
1257 
1258  $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_VIEW);
1259  $ilTabs->addSubTab(
1260  'id_content_view',
1261  $lng->txt('view'),
1262  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1263  );
1264  $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_MANAGE);
1265  $ilTabs->addSubTab(
1266  'id_content_manage',
1267  $lng->txt('cntr_manage'),
1268  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1269  );
1270  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1271  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
1272  include_once './Services/Container/classes/class.ilContainer.php';
1273  if ((ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1275  $this->ctrl->setParameter($this, 'switch_mode', self::VIEW_MODE_SORT);
1276  $ilTabs->addSubTab(
1277  'id_content_ordering',
1278  $this->lng->txt('cntr_ordering'),
1279  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1280  );
1281  }
1282 
1283  $ilCtrl->clearParameters($this);
1284  $ilTabs->activateSubTab($a_active_subtab);
1285  }
1286  }
1287 
1288  $ilTabs->activateTab('id_content');
1289  }
1290 
1291 
1296  public function setTabs()
1297  {
1298  global $ilTabs, $lng, $ilHelp;
1299 
1300  $ilHelp->setScreenIdComponent("webr");
1301 
1302  if ($this->checkPermissionBool('read')) {
1303  $ilTabs->addTab(
1304  "id_content",
1305  $lng->txt("content"),
1306  $this->ctrl->getLinkTarget($this, "view")
1307  );
1308  }
1309 
1310  if (
1311  $this->checkPermissionBool('visible') ||
1312  $this->checkPermissionBool('read')
1313  ) {
1314  $ilTabs->addTab(
1315  "id_info",
1316  $lng->txt("info_short"),
1317  $this->ctrl->getLinkTarget($this, "infoScreen")
1318  );
1319  }
1320 
1321  if ($this->checkPermissionBool('write') and !$this->getCreationMode()) {
1322  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1323  if (ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1) {
1324  $ilTabs->addTab(
1325  "id_settings",
1326  $lng->txt("settings"),
1327  $this->ctrl->getLinkTarget($this, "settings")
1328  );
1329  }
1330  }
1331 
1332  if ($this->checkPermissionBool('write')) {
1333  $ilTabs->addTab(
1334  "id_history",
1335  $lng->txt("history"),
1336  $this->ctrl->getLinkTarget($this, "history")
1337  );
1338  }
1339 
1340  if ($this->checkPermissionBool('write')) {
1341  // Check if pear library is available
1342  $ilTabs->addTab(
1343  "id_link_check",
1344  $lng->txt("link_check"),
1345  $this->ctrl->getLinkTarget($this, "linkChecker")
1346  );
1347  }
1348 
1349  if ($this->checkPermissionBool('write')) {
1350  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1351  $mdgui = new ilObjectMetaDataGUI($this->object);
1352  $mdtab = $mdgui->getTab();
1353  if ($mdtab) {
1354  $ilTabs->addTab(
1355  "id_meta_data",
1356  $lng->txt("meta_data"),
1357  $mdtab
1358  );
1359  }
1360  }
1361 
1362  if ($this->checkPermissionBool('write')) {
1363  $ilTabs->addTab(
1364  'export',
1365  $this->lng->txt('export'),
1366  $this->ctrl->getLinkTargetByClass('ilexportgui', '')
1367  );
1368  }
1369 
1370  // will add permission tab if needed
1371  parent::setTabs();
1372  }
1373 
1374  // PRIVATE
1375  public function __prepareOutput()
1376  {
1377  // output objects
1378  // $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1379  // $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1380 
1381  $this->tpl->setLocator();
1382 
1383  // output message
1384  if ($this->message) {
1385  ilUtil::sendInfo($this->message);
1386  }
1387 
1388  // display infopanel if something happened
1390  ;
1391  }
1392 
1393  public function addLocatorItems()
1394  {
1395  global $ilLocator;
1396 
1397  if (is_object($this->object)) {
1398  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this), "", $this->object->getRefId(), "webr");
1399  }
1400  }
1401 
1402  protected function handleSubItemLinks($a_target)
1403  {
1404  // #15647 - handle internal links
1405  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
1406  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
1407 
1408  if (ilLinkInputGUI::isInternalLink($a_target)) {
1409  include_once("./Services/Link/classes/class.ilLink.php");
1410 
1411  // #10612
1412  $parts = explode("|", $a_target);
1413 
1414  if ($parts[0] == 'wpage') {
1415  return ilLink::_getStaticLink(
1416  0,
1417  'wiki',
1418  true,
1419  '&target=wiki_wpage_' . $parts[1]
1420  );
1421  }
1422 
1423  if ($parts[0] == "term") {
1424  // #16894
1425  return ilLink::_getStaticLink(
1426  0,
1427  "git",
1428  true,
1429  "&target=git_" . $parts[1]
1430  );
1431  }
1432 
1433  if ($parts[0] == "page") {
1434  $parts[0] = "pg";
1435  }
1436 
1437  $a_target = ilLink::_getStaticLink($parts[1], $parts[0]);
1438  }
1439 
1440  return $a_target;
1441  }
1442 
1443  public function callDirectLink()
1444  {
1445  $obj_id = $this->object->getId();
1446 
1447  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1450  if ($url["target"]) {
1451  $url["target"] = $this->handleSubItemLinks($url["target"]);
1452 
1453  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1456  }
1457 
1458  $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
1459  }
1460  }
1461  }
1462 
1463  public function callLink()
1464  {
1465  if ($_REQUEST["link_id"]) {
1466  $obj_id = $this->object->getId();
1467 
1468  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1469  $items = new ilLinkResourceItems($obj_id);
1470  $item = $items->getItem($_REQUEST["link_id"]);
1471  if ($item["target"]) {
1472  $item["target"] = $this->handleSubItemLinks($item["target"]);
1473 
1474  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1476  $item = ilParameterAppender::_append($item);
1477  }
1478  ilLoggerFactory::getLogger('webr')->debug('Redirecting to: ' . $item['target']);
1479  $this->redirectToLink($this->ref_id, $obj_id, $item["target"]);
1480  }
1481  }
1482  }
1483 
1484  protected function redirectToLink($a_ref_id, $a_obj_id, $a_url)
1485  {
1486  global $ilUser;
1487 
1488  if ($a_url) {
1489  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1491  "webr",
1492  $a_ref_id,
1493  $a_obj_id,
1494  $ilUser->getId()
1495  );
1496 
1497  ilUtil::redirect($a_url);
1498  }
1499  }
1500 
1501  public function exportHTML()
1502  {
1503  global $ilSetting;
1504 
1505  $tpl = new ilTemplate("tpl.export_html.html", true, true, "Modules/WebResource");
1506 
1507  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1508  $items = new ilLinkResourceItems($this->object->getId());
1509  foreach ($items->getAllItems() as $item) {
1510  if (!$item["active"]) {
1511  continue;
1512  }
1513 
1514  $target = $this->handleSubItemLinks($item["target"]);
1515 
1516  $tpl->setCurrentBlock("link_bl");
1517  $tpl->setVariable("LINK_URL", $target);
1518  $tpl->setVariable("LINK_TITLE", $item["title"]);
1519  $tpl->setVariable("LINK_DESC", $item["description"]);
1520  $tpl->setVariable("LINK_CREATE", $item["create_date"]);
1521  $tpl->setVariable("LINK_UPDATE", $item["last_update"]);
1522  $tpl->parseCurrentBlock();
1523  }
1524 
1525  $tpl->setVariable("CREATE_DATE", $this->object->getCreateDate());
1526  $tpl->setVariable("LAST_UPDATE", $this->object->getLastUpdateDate());
1527  $tpl->setVariable("TXT_TITLE", $this->object->getTitle());
1528  $tpl->setVariable("TXT_DESC", $this->object->getLongDescription());
1529 
1530  $tpl->setVariable("INST_ID", ($ilSetting->get('short_inst_name') != "")
1531  ? $ilSetting->get('short_inst_name')
1532  : "ILIAS");
1533 
1534  ilUtil::deliverData($tpl->get(), "bookmarks.html");
1535  }
1536 
1537  public static function _goto($a_target, $a_additional = null)
1538  {
1539  global $ilAccess, $ilErr, $lng;
1540 
1541  if ($a_additional && substr($a_additional, -3) == "wsp") {
1542  $_GET["baseClass"] = "ilsharedresourceGUI";
1543  $_GET["wsp_id"] = $a_target;
1544  include("ilias.php");
1545  exit;
1546  }
1547 
1548  // Will be replaced in future releases by ilAccess::checkAccess()
1549  if ($ilAccess->checkAccess("read", "", $a_target)) {
1550  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1551  } else {
1552  // to do: force flat view
1553  if ($ilAccess->checkAccess("visible", "", $a_target)) {
1554  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $a_target . "&cmd=infoScreen");
1555  } else {
1556  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1557  ilUtil::sendFailure(sprintf(
1558  $lng->txt("msg_no_perm_read_item"),
1560  ), true);
1562  }
1563  }
1564  }
1565 
1566  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1567  }
1568 } // END class.ilObjLinkResource
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _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.
This class represents an option in a radio group.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
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.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
TableGUI class for search results.
Class ilInfoScreenGUI.
settings()
Edit settings Title, Description, Sorting.
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.
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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
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...
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.
This class represents a property in a property form.
static parameterToInfo($a_name, $a_value)
Get info text describing an existing dynamic link.
if(isset($_POST['submit'])) $form
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)
$ilUser
Definition: imgupload.php:18
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.
Create styles array
The data for the language used.
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.
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 _getNotifyStatus($a_usr_id, $a_obj_id)
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.
Create new PHPExcel object
obj_idprivate
global $ilSetting
Definition: privfeed.php:17
This class represents a text area property in a property form.
global $ilDB
$ret
Definition: parser.php:6
Class ilObjLinkResourceGUI.
getRefId()
get reference id public
prepareOutput($a_show_subobjects=true)
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.
$url
static _lookupSortMode($a_obj_id)
lookup sort mode
redirectToLink($a_ref_id, $a_obj_id, $a_url)
static _getInstance($a_obj_id)
get instance by obj_id
$links
if(empty($password)) $table
Definition: pwgen.php:24
initFormLink($a_mode)
Show create/edit single link.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
$info
Definition: index.php:5
setValue($a_value)
Set Value.
static redirect($a_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.
$_POST["username"]
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.