ILIAS  release_7 Revision v7.30-3-g800a261c036
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 {
28 $this->__readLink();
29
30 return $this->link_data['title'];
31 }
32 return parent::getTitle();
33 }
37 public function getDescription()
38 {
39 global $DIC;
40
41 $ilSetting = $DIC['ilSetting'];
42
45 $this->__readLink();
46
47 $desc = $this->link_data['description'];
48
49 // #10682
50 if ($ilSetting->get("rep_shorten_description")) {
51 $desc = ilUtil::shortenText(
52 $desc,
53 $ilSetting->get("rep_shorten_description_length"),
54 true
55 );
56 }
57
58 return $desc;
59 }
60 return parent::getDescription();
61 }
62
66 public function init()
67 {
68 $this->delete_enabled = true;
69 $this->cut_enabled = true;
70 $this->copy_enabled = true;
71 $this->subscribe_enabled = true;
72 $this->link_enabled = true;
73 $this->type = "webr";
74 $this->gui_class_name = "ilobjlinkresourcegui";
75 $this->info_screen_enabled = true;
76
77 // general commands array
78 $this->commands = ilObjLinkResourceAccess::_getCommands();
79 }
80
88 public function getCommandFrame($a_cmd)
89 {
90 // #16820 / #18419 / #18622
91 if ($a_cmd == "" &&
94 $link = ilObjLinkResourceAccess::_getFirstLink($this->obj_id);
95
96 // we could use the "internal" flag, but it would not work for "old" links
97 include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
98 include_once "Services/Form/classes/class.ilLinkInputGUI.php";
99 if (!ilLinkInputGUI::isInternalLink($link["target"])) {
100 return '_blank';
101 }
102 }
103 }
104
113 public function getProperties()
114 {
115 global $DIC;
116
117 $lng = $DIC['lng'];
118 $ilUser = $DIC['ilUser'];
119
120 $props = array();
121
122 return $props;
123 }
124
125
133 public function getCommandLink($a_cmd)
134 {
135 if ($_REQUEST["wsp_id"] || $_REQUEST["cmdClass"] == "ilpersonalworkspacegui") {
137 !ilLinkResourceList::checkListStatus($this->obj_id) &&
138 $a_cmd == '') {
139 $a_cmd = "calldirectlink";
140 }
141 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
142 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
143 return $this->ctrl->getLinkTargetByClass(array("ilpersonalworkspacegui", $this->gui_class_name), $a_cmd);
144 } else {
145 // separate method for this line
146 switch ($a_cmd) {
147 case '':
149 !ilLinkResourceList::checkListStatus($this->obj_id)) {
150 $this->__readLink();
151 // $cmd_link = $this->link_data['target'];
152 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=calldirectlink";
153 } else {
154 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
155 }
156 break;
157
158 default:
159 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$a_cmd";
160 }
161 }
162 return $cmd_link;
163 }
164
170 public function __readLink()
171 {
172 include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
173 include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
174
176 return $this->link_data = ilParameterAppender::_append($tmp = &ilLinkResourceItems::_getFirstLink($this->obj_id));
177 }
178 return $this->link_data = ilLinkResourceItems::_getFirstLink($this->obj_id);
179 }
180} // 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 checkListStatus(int $a_webr_id)
Check if a weblink list was already created or transformed from a single weblink.
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.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17