ILIAS  release_8 Revision v8.24
class.ilObjLinkResourceListGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
27 protected function getWebLinkRepo(): ilWebLinkRepository
28 {
29 return new ilWebLinkDatabaseRepository($this->obj_id);
30 }
31
32 public function getTitle(): string
33 {
35 !$this->getWebLinkRepo()->doesListExist()) {
36 return ilObjLinkResourceAccess::_getFirstLink($this->obj_id)
37 ->getTitle();
38 }
39 return parent::getTitle();
40 }
41
42 public function getDescription(): string
43 {
45 !$this->getWebLinkRepo()->doesListExist()) {
46 $desc = ilObjLinkResourceAccess::_getFirstLink($this->obj_id)
47 ->getDescription() ?? '';
48
49 // #10682
50 if ($this->settings->get("rep_shorten_description")) {
52 $desc,
53 (int) $this->settings->get(
54 "rep_shorten_description_length"
55 ),
56 true
57 );
58 }
59
60 return $desc;
61 }
62 return parent::getDescription();
63 }
64
65 public function init(): void
66 {
67 $this->delete_enabled = true;
68 $this->cut_enabled = true;
69 $this->copy_enabled = true;
70 $this->subscribe_enabled = true;
71 $this->link_enabled = true;
72 $this->type = "webr";
73 $this->gui_class_name = "ilobjlinkresourcegui";
74 $this->info_screen_enabled = true;
75
76 // general commands array
77 $this->commands = ilObjLinkResourceAccess::_getCommands();
78 }
79
80 public function getCommandFrame(string $cmd): string
81 {
82 // #16820 / #18419 / #18622
83 if ($cmd == "" &&
85 !$this->getWebLinkRepo()->doesListExist()) {
86 $link = ilObjLinkResourceAccess::_getFirstLink($this->obj_id);
87
88 // we could use the "internal" flag, but it would not work for "old" links
89 if (!ilLinkInputGUI::isInternalLink($link->getTarget())) {
90 return '_blank';
91 }
92 }
93 return "";
94 }
95
96 public function getProperties(): array
97 {
98 return [];
99 }
100
101 public function getCommandLink(string $cmd): string
102 {
103 $cmd_class = '';
104 if ($this->request_wrapper->has('cmdClass')) {
105 $cmd_class = $this->request_wrapper->retrieve(
106 'cmdClass',
107 $this->refinery->kindlyTo()->string()
108 );
109 }
110 if (
111 $this->request_wrapper->has('wsp_id') ||
112 strcasecmp($cmd_class, ilPersonalWorkspaceGUI::class) === 0
113 ) {
114 if (
116 !$this->getWebLinkRepo()->doesListExist() &&
117 $cmd == ''
118 ) {
119 $cmd = "calldirectlink";
120 }
121 $this->ctrl->setParameterByClass(
122 $this->gui_class_name,
123 "ref_id",
124 ""
125 );
126 $this->ctrl->setParameterByClass(
127 $this->gui_class_name,
128 "wsp_id",
129 $this->ref_id
130 );
131 return $this->ctrl->getLinkTargetByClass(
132 array("ilpersonalworkspacegui", $this->gui_class_name),
133 $cmd
134 );
135 } else {
136 // separate method for this line
137 switch ($cmd) {
138 case '':
140 $this->obj_id
141 ) &&
142 !$this->getWebLinkRepo()->doesListExist()) {
143 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=calldirectlink";
144 } else {
145 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$cmd";
146 }
147 break;
148
149 default:
150 $cmd_link = "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $this->ref_id . "&cmd=$cmd";
151 }
152 }
153 return $cmd_link;
154 }
155}
static isInternalLink(string $a_value)
static _checkDirectLink($a_obj_id)
Check whether there is only one active link in the web resource.
static _getFirstLink(int $a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCommandFrame(string $cmd)
Get command target frame.
getDescription()
getDescription overwritten in class.ilObjLinkResourceList.php
getCommandLink(string $cmd)
Get command link url.
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...