ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjLinkResourceListGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
6 include_once "Services/Object/classes/class.ilObjectListGUI.php";
7 include_once('./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php');
8 
18 {
19  public $link_data = array();
20 
24  public function getTitle()
25  {
26  if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) {
27  $this->__readLink();
28 
29  return $this->link_data['title'];
30  }
31  return parent::getTitle();
32  }
36  public function getDescription()
37  {
38  global $ilSetting;
39 
40  if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) {
41  $this->__readLink();
42 
43  $desc = $this->link_data['description'];
44 
45  // #10682
46  if ($ilSetting->get("rep_shorten_description")) {
47  $desc = ilUtil::shortenText(
48  $desc,
49  $ilSetting->get("rep_shorten_description_length"),
50  true
51  );
52  }
53 
54  return $desc;
55  }
56  return parent::getDescription();
57  }
58 
62  public function init()
63  {
64  $this->delete_enabled = true;
65  $this->cut_enabled = true;
66  $this->copy_enabled = true;
67  $this->subscribe_enabled = true;
68  $this->link_enabled = true;
69  $this->type = "webr";
70  $this->gui_class_name = "ilobjlinkresourcegui";
71  $this->info_screen_enabled = true;
72 
73  // general commands array
74  $this->commands = ilObjLinkResourceAccess::_getCommands();
75  }
76 
84  public function getCommandFrame($a_cmd)
85  {
86  // #16820 / #18419 / #18622
87  if ($a_cmd == "" &&
89  $link = ilObjLinkResourceAccess::_getFirstLink($this->obj_id);
90 
91  // we could use the "internal" flag, but it would not work for "old" links
92  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
93  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
94  if (!ilLinkInputGUI::isInternalLink($link["target"])) {
95  return '_blank';
96  }
97  }
98  }
99 
108  public function getProperties()
109  {
110  global $lng, $ilUser;
111 
112  $props = array();
113 
114  return $props;
115  }
116 
117 
125  public function getCommandLink($a_cmd)
126  {
127  if ($_REQUEST["wsp_id"] || $_REQUEST["cmdClass"] == "ilpersonalworkspacegui") {
128  if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id) && $a_cmd == '') {
129  $a_cmd = "calldirectlink";
130  }
131  $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
132  $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
133  return $this->ctrl->getLinkTargetByClass(array("ilpersonalworkspacegui", $this->gui_class_name), $a_cmd);
134  } else {
135  // separate method for this line
136  switch ($a_cmd) {
137  case '':
138  if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) {
139  $this->__readLink();
140  // $cmd_link = $this->link_data['target'];
141  $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=calldirectlink";
142  } else {
143  $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
144  }
145  break;
146 
147  default:
148  $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
149  }
150  }
151  return $cmd_link;
152  }
153 
159  public function __readLink()
160  {
161  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
162  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
163 
165  return $this->link_data = ilParameterAppender::_append($tmp =&ilLinkResourceItems::_getFirstLink($this->obj_id));
166  }
167  return $this->link_data = ilLinkResourceItems::_getFirstLink($this->obj_id);
168  }
169 } // END class.ilObjTestListGUI
__readLink()
Get data of first active link resource.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
getCommandFrame($a_cmd)
Get command target frame.
static _checkDirectLink($a_obj_id)
Check whether there is only one active link in the web resource.
static _append($a_link_data)
Class ilObjectListGUI.
static isInternalLink($a_value)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
getDescription()
overwritten from base class
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
global $ilSetting
Definition: privfeed.php:17
Class ilObjLinkResourceListGUI.
getCommandLink($a_cmd)
Get command link url.
static _isEnabled()
Check if dynamic parameters are enabled.
getTitle()
overwritten from base class