ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjGroupReferenceListGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "./Modules/Group/classes/class.ilObjGroupListGUI.php";
5
13{
15 protected $reference_obj_id = null;
17 protected $reference_ref_id = null;
19 protected $deleted = false;
20
26 public function __construct()
27 {
28 parent::__construct();
29 }
30
34 public function getIconImageType()
35 {
36 return 'grpr';
37 }
38
45 public function getCommandId()
46 {
48 }
49
54 public function insertTimingsCommand()
55 {
56 return;
57 }
58
59
60
64 public function init()
65 {
66 $this->copy_enabled = true;
67 $this->static_link_enabled = false;
68 $this->delete_enabled = true;
69 $this->cut_enabled = true;
70 $this->subscribe_enabled = true;
71 $this->link_enabled = false;
72 $this->info_screen_enabled = true;
73 $this->type = "grp";
74 $this->gui_class_name = "ilobjgroupgui";
75
76 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
77 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
78 if ($this->substitutions->isActive()) {
79 $this->substitutions_enabled = true;
80 }
81 }
82
83
84
94 public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
95 {
96 global $ilBench,$ilAccess,$tree;
97
98 $this->reference_ref_id = $a_ref_id;
99 $this->reference_obj_id = $a_obj_id;
100
101
102 include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
103 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
104
105 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
106 $target_ref_id = current($target_ref_ids);
107 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
108 $target_description = ilObject::_lookupDescription($target_obj_id);
109
110 $this->deleted = $tree->isDeleted($target_ref_id);
111
112 $ilBench->start("ilObjGroupListGUI", "1000_checkAllConditions");
113 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id);
114 $ilBench->stop("ilObjGroupListGUI", "1000_checkAllConditions");
115
116
117 parent::initItem($target_ref_id, $target_obj_id, $target_title, $target_description);
118
119 // general commands array
120 include_once('./Modules/GroupReference/classes/class.ilObjGroupReferenceAccess.php');
121 $this->commands = ilObjGroupReferenceAccess::_getCommands($this->reference_ref_id);
122
123 if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) {
124 $this->info_screen_enabled = false;
125 } else {
126 $this->info_screen_enabled = true;
127 }
128 }
129
130 public function getProperties()
131 {
132 global $lng,$ilUser,$tree;
133
134 $props = parent::getProperties();
135
136 // offline
137 if ($this->deleted) {
138 $props[] = array("alert" => true, "property" => $lng->txt("status"),
139 "value" => $lng->txt("reference_deleted"));
140 }
141
142 return $props ? $props : array();
143 }
144
150 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
151 {
152 // Check edit reference against reference edit permission
153 switch ($a_cmd) {
154 case 'editReference':
155 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
156 }
157
158 switch ($a_permission) {
159 case 'copy':
160 case 'delete':
161 // check against target ref_id
162 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
163
164 default:
165 // check against reference
166 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
167 }
168 }
169
177 public function getCommandLink($a_cmd)
178 {
179 global $ilCtrl;
180
181 switch ($a_cmd) {
182 case 'editReference':
183 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
184 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
185 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
186 return $cmd_link;
187
188 default:
189 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
190 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
191 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
192 return $cmd_link;
193 }
194 }
195}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
static _lookupTargetId($a_obj_id)
lookup target id
static _lookupTitle($a_obj_id)
Overwitten from base class.
Class ilObjGroupListGUI.
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item Group reference inits the group item
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
static _getCommands()
get commands
static _lookupDescription($a_id)
lookup object description
static _getAllReferences($a_id)
get all reference ids of object
global $ilBench
Definition: ilias.php:18
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92