ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjGroupReferenceListGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 protected ?int $reference_obj_id = null;
28 protected int $reference_ref_id;
29 protected bool $deleted = false;
30
36 public function __construct()
37 {
39 }
40
44 public function getIconImageType(): string
45 {
46 return 'grpr';
47 }
48
52 public function getTypeIcon(): string
53 {
55 return ilObject::_getIcon(
56 $reference_obj_id,
57 'small'
58 );
59 }
60
61
67 public function getCommandId(): int
68 {
70 }
71
75 public function insertTimingsCommand(): void
76 {
77 return;
78 }
79
80
81
85 public function init(): void
86 {
87 $this->copy_enabled = true;
88 $this->static_link_enabled = false;
89 $this->delete_enabled = true;
90 $this->cut_enabled = true;
91 $this->subscribe_enabled = true;
92 $this->link_enabled = false;
93 $this->info_screen_enabled = true;
94 $this->type = 'grpr';
95 $this->gui_class_name = "ilobjgroupgui";
96
97 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
98 if ($this->substitutions->isActive()) {
99 $this->substitutions_enabled = true;
100 }
101 }
102
103
104
108 public function initItem(
109 int $ref_id,
110 int $obj_id,
111 string $type,
112 string $title = "",
113 string $description = ""
114 ): void {
115 global $DIC;
116
117 $ilAccess = $DIC['ilAccess'];
118 $tree = $DIC['tree'];
119
120 $this->reference_ref_id = $ref_id;
121 $this->reference_obj_id = $obj_id;
122
123
125
126 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
127 $target_ref_id = current($target_ref_ids);
129 $target_description = ilObject::_lookupDescription($target_obj_id);
130
131 $this->deleted = !$target_ref_id || $tree->isDeleted($target_ref_id);
132
133 parent::initItem((int) $target_ref_id, $target_obj_id, $type, $target_title, $target_description);
134
135 // general commands array
136 $this->commands = ilObjGroupReferenceAccess::_getCommands($this->reference_ref_id);
137
138 if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) {
139 $this->info_screen_enabled = false;
140 } else {
141 $this->info_screen_enabled = true;
142 }
143 }
144
145 public function getProperties(): array
146 {
147 global $DIC;
148
149 $lng = $DIC['lng'];
150 $ilUser = $DIC['ilUser'];
151 $tree = $DIC['tree'];
152
153 $props = parent::getProperties();
154
155 // offline
156 if ($this->deleted) {
157 $props[] = array("alert" => true, "property" => $lng->txt("status"),
158 "value" => $lng->txt("reference_deleted"));
159 }
160
161 return $props ? $props : array();
162 }
163
169 public function checkCommandAccess(
170 string $permission,
171 string $cmd,
172 int $ref_id,
173 string $type,
174 ?int $obj_id = null
175 ): bool {
176 // Check edit reference against reference edit permission
177 switch ($cmd) {
178 case 'editReference':
179 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
180 }
181
182 switch ($permission) {
183 case 'copy':
184 case 'delete':
185 // check against target ref_id
186 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
187
188 default:
189 // check against reference
190 return parent::checkCommandAccess($permission, $cmd, $ref_id, $type, $obj_id);
191 }
192 }
193
199 public function getCommandLink(string $cmd): string
200 {
201 global $DIC;
202
203 $ilCtrl = $DIC['ilCtrl'];
204
205 switch ($cmd) {
206 case 'editReference':
207 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
208 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
209 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"] ?? 0);
210 return $cmd_link;
211
212 default:
213 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
214 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
215 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"] ?? 0);
216 return $cmd_link;
217 }
218 }
219}
static _getInstanceByObjectType(string $a_type)
static _lookupTitle(int $obj_id)
static _lookupTargetId(int $a_obj_id)
Class ilObjGroupListGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypeIcon()
Get object type specific type icon.
initItem(int $ref_id, int $obj_id, string $type, string $title="", string $description="")
initialize new item (is called by getItemHTML())
checkCommandAccess(string $permission, string $cmd, int $ref_id, string $type, ?int $obj_id=null)
getCommandLink(string $cmd)
get command link
static _getCommands()
get commands
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupDescription(int $obj_id)
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
$_GET['cmd']
Definition: lti.php:26
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26