ILIAS  release_8 Revision v8.24
class.ilObjGroupReferenceListGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once "./Modules/Group/classes/class.ilObjGroupListGUI.php";
6
14{
15 protected ?int $reference_obj_id = null;
16 protected int $reference_ref_id;
17 protected bool $deleted = false;
18
24 public function __construct()
25 {
27 }
28
32 public function getIconImageType(): string
33 {
34 return 'grpr';
35 }
36
40 public function getTypeIcon(): string
41 {
43 return ilObject::_getIcon(
44 $reference_obj_id,
45 'small'
46 );
47 }
48
49
55 public function getCommandId(): int
56 {
58 }
59
63 public function insertTimingsCommand(): void
64 {
65 return;
66 }
67
68
69
73 public function init(): void
74 {
75 $this->copy_enabled = true;
76 $this->static_link_enabled = false;
77 $this->delete_enabled = true;
78 $this->cut_enabled = true;
79 $this->subscribe_enabled = true;
80 $this->link_enabled = false;
81 $this->info_screen_enabled = true;
82 $this->type = "grp";
83 $this->gui_class_name = "ilobjgroupgui";
84
85 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
86 if ($this->substitutions->isActive()) {
87 $this->substitutions_enabled = true;
88 }
89 }
90
91
92
96 public function initItem(
97 int $ref_id,
98 int $obj_id,
99 string $type,
100 string $title = "",
101 string $description = ""
102 ): void {
103 global $DIC;
104
105 $ilAccess = $DIC['ilAccess'];
106 $tree = $DIC['tree'];
107
108 $this->reference_ref_id = $ref_id;
109 $this->reference_obj_id = $obj_id;
110
111
112 include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
114
115 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
116 $target_ref_id = current($target_ref_ids);
118 $target_description = ilObject::_lookupDescription($target_obj_id);
119
120 $this->deleted = !$target_ref_id || $tree->isDeleted($target_ref_id);
121
122 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget((int) $target_ref_id, (int) $target_obj_id);
123
124
125 parent::initItem((int) $target_ref_id, $target_obj_id, $type, $target_title, $target_description);
126
127 // general commands array
128 include_once('./Modules/GroupReference/classes/class.ilObjGroupReferenceAccess.php');
129 $this->commands = ilObjGroupReferenceAccess::_getCommands($this->reference_ref_id);
130
131 if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) {
132 $this->info_screen_enabled = false;
133 } else {
134 $this->info_screen_enabled = true;
135 }
136 }
137
138 public function getProperties(): array
139 {
140 global $DIC;
141
142 $lng = $DIC['lng'];
143 $ilUser = $DIC['ilUser'];
144 $tree = $DIC['tree'];
145
146 $props = parent::getProperties();
147
148 // offline
149 if ($this->deleted) {
150 $props[] = array("alert" => true, "property" => $lng->txt("status"),
151 "value" => $lng->txt("reference_deleted"));
152 }
153
154 return $props ? $props : array();
155 }
156
162 public function checkCommandAccess(
163 string $permission,
164 string $cmd,
165 int $ref_id,
166 string $type,
167 ?int $obj_id = null
168 ): bool {
169 // Check edit reference against reference edit permission
170 switch ($cmd) {
171 case 'editReference':
172 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
173 }
174
175 switch ($permission) {
176 case 'copy':
177 case 'delete':
178 // check against target ref_id
179 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
180
181 default:
182 // check against reference
183 return parent::checkCommandAccess($permission, $cmd, $ref_id, $type, $obj_id);
184 }
185 }
186
192 public function getCommandLink(string $cmd): string
193 {
194 global $DIC;
195
196 $ilCtrl = $DIC['ilCtrl'];
197
198 switch ($cmd) {
199 case 'editReference':
200 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
201 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
202 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
203 return $cmd_link;
204
205 default:
206 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
207 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
208 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
209 return $cmd_link;
210 }
211 }
212}
static _getInstanceByObjectType(string $a_type)
static _checkAllConditionsOfTarget(int $a_target_ref_id, int $a_target_id, string $a_target_type="", int $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
static _lookupTitle(int $obj_id)
static _lookupTargetId(int $a_obj_id)
Class ilObjGroupListGUI.
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.
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type
$_GET['client_id']
Definition: saml1-acs.php:21
$lng