ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 var $link_data = array();
20
24 function getTitle()
25 {
27 {
28 $this->__readLink();
29
30 return $this->link_data['title'];
31 }
32 return parent::getTitle();
33 }
37 function getDescription()
38 {
39 global $ilSetting;
40
42 {
43 $this->__readLink();
44
45 $desc = $this->link_data['description'];
46
47 // #10682
48 if($ilSetting->get("rep_shorten_description"))
49 {
50 $desc = ilUtil::shortenText($desc,
51 $ilSetting->get("rep_shorten_description_length"), true);
52 }
53
54 return $desc;
55 }
56 return parent::getDescription();
57 }
58
62 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 function getCommandFrame($a_cmd)
85 {
86 // #16820 / #18419 / #18622
87 if($a_cmd == "" &&
89 {
90 $link = ilObjLinkResourceAccess::_getFirstLink($this->obj_id);
91
92 // we could use the "internal" flag, but it would not work for "old" links
93 include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
94 include_once "Services/Form/classes/class.ilLinkInputGUI.php";
95 if(!ilLinkInputGUI::isInternalLink($link["target"]))
96 {
97 return '_blank';
98 }
99 }
100 }
101
110 function getProperties()
111 {
112 global $lng, $ilUser;
113
114 $props = array();
115
116 return $props;
117 }
118
119
127 function getCommandLink($a_cmd)
128 {
129 if($_REQUEST["wsp_id"] || $_REQUEST["cmdClass"] == "ilpersonalworkspacegui")
130 {
131 if(ilObjLinkResourceAccess::_checkDirectLink($this->obj_id) && $a_cmd == '')
132 {
133 $a_cmd = "calldirectlink";
134 }
135 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
136 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
137 return $this->ctrl->getLinkTargetByClass(array("ilpersonalworkspacegui", $this->gui_class_name), $a_cmd);
138 }
139 else
140 {
141 // separate method for this line
142 switch($a_cmd)
143 {
144 case '':
146 {
147 $this->__readLink();
148 // $cmd_link = $this->link_data['target'];
149 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$this->ref_id."&cmd=calldirectlink";
150 }
151 else
152 {
153 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$this->ref_id."&cmd=$a_cmd";
154 }
155 break;
156
157 default:
158 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$this->ref_id."&cmd=$a_cmd";
159 }
160 }
161 return $cmd_link;
162 }
163
169 function __readLink()
170 {
171 include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
172 include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
173
175 {
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
181?>
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.
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18