ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
class.ilObjCourseReferenceListGUI.php
Go to the documentation of this file.
1<?php
2
28{
29 protected ?int $reference_obj_id = null;
30 protected int $reference_ref_id;
31 protected bool $deleted = false;
32
39 public function __construct()
40 {
42 }
43
44 public function getIconImageType(): string
45 {
46 return 'crsr';
47 }
48
56 public function getCommandId(): int
57 {
59 }
60
64 public function insertTimingsCommand(): void
65 {
66 return;
67 }
68
72 public function init(): void
73 {
74 $this->copy_enabled = true;
75 $this->static_link_enabled = false;
76 $this->delete_enabled = true;
77 $this->cut_enabled = true;
78 $this->subscribe_enabled = true;
79 $this->link_enabled = false;
80 $this->info_screen_enabled = true;
81 $this->type = 'crsr';
82 $this->gui_class_name = "ilobjcoursegui";
83
84 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
85 if ($this->substitutions->isActive()) {
86 $this->substitutions_enabled = true;
87 }
88 }
89
90
91
95 public function initItem(
96 int $ref_id,
97 int $obj_id,
98 string $type,
99 string $title = "",
100 string $description = ""
101 ): void {
102 global $DIC;
103
104 $ilAccess = $DIC->access();
105 $tree = $DIC->repositoryTree();
106
107 $this->reference_ref_id = $ref_id;
108 $this->reference_obj_id = $obj_id;
109
110
112
113 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
114 $target_ref_id = current($target_ref_ids);
116 $target_description = ilObject::_lookupDescription($target_obj_id);
117
118 $this->deleted = !$target_ref_id || $tree->isDeleted($target_ref_id);
119
120 parent::initItem((int) $target_ref_id, $target_obj_id, $type, $target_title, $target_description);
121
122 // general commands array
123 $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id);
124
125 if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) {
126 $this->info_screen_enabled = false;
127 } else {
128 $this->info_screen_enabled = true;
129 }
130 }
131
132 public function getProperties(): array
133 {
134 global $lng,$ilUser,$tree;
135
136 $props = parent::getProperties();
137
138 // offline
139 if ($this->deleted) {
140 $props[] = array("alert" => true, "property" => $lng->txt("status"),
141 "value" => $lng->txt("reference_deleted"));
142 }
143
144 return $props ? $props : array();
145 }
146
152 public function checkCommandAccess(
153 string $permission,
154 string $cmd,
155 int $ref_id,
156 string $type,
157 ?int $obj_id = null
158 ): bool {
159 // Check edit reference against reference edit permission
160 switch ($cmd) {
161 case 'editReference':
162 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
163 }
164
165 switch ($permission) {
166 case 'copy':
167 case 'delete':
168 // check against target ref_id
169 return parent::checkCommandAccess($permission, $cmd, $this->getCommandId(), $type, $obj_id);
170
171 default:
172 // check against reference
173 return parent::checkCommandAccess($permission, $cmd, $ref_id, $type, $obj_id);
174 }
175 }
176
183 public function getCommandLink(string $cmd): string
184 {
185 global $ilCtrl;
186
187 switch ($cmd) {
188 case 'editReference':
189 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
190 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
191 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"] ?? null);
192 return $cmd_link;
193
194 default:
195 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
196 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $cmd);
197 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"] ?? null);
198 return $cmd_link;
199 }
200 }
201}
static _getInstanceByObjectType(string $a_type)
static _lookupTitle(int $obj_id)
static _lookupTargetId(int $a_obj_id)
Class ilObjCourseListGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getIconImageType()
Returns the icon image type.
checkCommandAccess(string $permission, string $cmd, int $ref_id, string $type, ?int $obj_id=null)
initItem(int $ref_id, int $obj_id, string $type, string $title="", string $description="")
initialize new item (is called by getItemHTML())
static _getCommands()
get commands
static _getAllReferences(int $id)
get all reference ids for object 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:26
global $DIC
Definition: shib_login.php:26