ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
6include_once "Services/Object/classes/class.ilObjectListGUI.php";
7include_once('./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php');
8
18{
19 public $link_data = array();
20
24 public function getTitle()
25 {
27 $this->__readLink();
28
29 return $this->link_data['title'];
30 }
31 return parent::getTitle();
32 }
36 public function getDescription()
37 {
38 global $DIC;
39
40 $ilSetting = $DIC['ilSetting'];
41
43 $this->__readLink();
44
45 $desc = $this->link_data['description'];
46
47 // #10682
48 if ($ilSetting->get("rep_shorten_description")) {
49 $desc = ilUtil::shortenText(
50 $desc,
51 $ilSetting->get("rep_shorten_description_length"),
52 true
53 );
54 }
55
56 return $desc;
57 }
59 }
60
64 public function init()
65 {
66 $this->delete_enabled = true;
67 $this->cut_enabled = true;
68 $this->copy_enabled = true;
69 $this->subscribe_enabled = true;
70 $this->link_enabled = true;
71 $this->type = "webr";
72 $this->gui_class_name = "ilobjlinkresourcegui";
73 $this->info_screen_enabled = true;
74
75 // general commands array
76 $this->commands = ilObjLinkResourceAccess::_getCommands();
77 }
78
86 public function getCommandFrame($a_cmd)
87 {
88 // #16820 / #18419 / #18622
89 if ($a_cmd == "" &&
91 $link = ilObjLinkResourceAccess::_getFirstLink($this->obj_id);
92
93 // we could use the "internal" flag, but it would not work for "old" links
94 include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
95 include_once "Services/Form/classes/class.ilLinkInputGUI.php";
96 if (!ilLinkInputGUI::isInternalLink($link["target"])) {
97 return '_blank';
98 }
99 }
100 }
101
110 public function getProperties()
111 {
112 global $DIC;
113
114 $lng = $DIC['lng'];
115 $ilUser = $DIC['ilUser'];
116
117 $props = array();
118
119 return $props;
120 }
121
122
130 public function getCommandLink($a_cmd)
131 {
132 if ($_REQUEST["wsp_id"] || $_REQUEST["cmdClass"] == "ilpersonalworkspacegui") {
133 if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id) && $a_cmd == '') {
134 $a_cmd = "calldirectlink";
135 }
136 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
137 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
138 return $this->ctrl->getLinkTargetByClass(array("ilpersonalworkspacegui", $this->gui_class_name), $a_cmd);
139 } else {
140 // separate method for this line
141 switch ($a_cmd) {
142 case '':
144 $this->__readLink();
145 // $cmd_link = $this->link_data['target'];
146 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=calldirectlink";
147 } else {
148 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
149 }
150 break;
151
152 default:
153 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
154 }
155 }
156 return $cmd_link;
157 }
158
164 public function __readLink()
165 {
166 include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
167 include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
168
170 return $this->link_data = ilParameterAppender::_append($tmp = &ilLinkResourceItems::_getFirstLink($this->obj_id));
171 }
172 return $this->link_data = ilLinkResourceItems::_getFirstLink($this->obj_id);
173 }
174} // END class.ilObjTestListGUI
An exception for terminatinating execution or to throw for unit testing.
static isInternalLink($a_value)
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
static _checkDirectLink($a_obj_id)
Check whether there is only one active link in the web resource.
Class ilObjLinkResourceListGUI.
getCommandFrame($a_cmd)
Get command target frame.
getDescription()
overwritten from base class
__readLink()
Get data of first active link resource.
getCommandLink($a_cmd)
Get command link url.
getTitle()
overwritten from base class
Class ilObjectListGUI.
static _append($a_link_data)
static _isEnabled()
Check if dynamic parameters are enabled.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getDescription()
Definition: Php.php:51
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18