ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
29 }
30
34 public function getIconImageType()
35 {
36 return 'grpr';
37 }
38
42 public function getTypeIcon()
43 {
45 return ilObject::_getIcon(
47 'small'
48 );
49 }
50
51
58 public function getCommandId()
59 {
61 }
62
67 public function insertTimingsCommand()
68 {
69 return;
70 }
71
72
73
77 public function init()
78 {
79 $this->copy_enabled = true;
80 $this->static_link_enabled = false;
81 $this->delete_enabled = true;
82 $this->cut_enabled = true;
83 $this->subscribe_enabled = true;
84 $this->link_enabled = false;
85 $this->info_screen_enabled = true;
86 $this->type = "grp";
87 $this->gui_class_name = "ilobjgroupgui";
88
89 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
90 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
91 if ($this->substitutions->isActive()) {
92 $this->substitutions_enabled = true;
93 }
94 }
95
96
97
101 public function initItem($a_ref_id, $a_obj_id, $type, $a_title = "", $a_description = "")
102 {
103 global $DIC;
104
105 $ilAccess = $DIC['ilAccess'];
106 $tree = $DIC['tree'];
107
108 $this->reference_ref_id = $a_ref_id;
109 $this->reference_obj_id = $a_obj_id;
110
111
112 include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
113 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
114
115 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
116 $target_ref_id = current($target_ref_ids);
117 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
118 $target_description = ilObject::_lookupDescription($target_obj_id);
119
120 $this->deleted = $tree->isDeleted($target_ref_id);
121
122 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id);
123
124
125 parent::initItem($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()
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($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
163 {
164 // Check edit reference against reference edit permission
165 switch ($a_cmd) {
166 case 'editReference':
167 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
168 }
169
170 switch ($a_permission) {
171 case 'copy':
172 case 'delete':
173 // check against target ref_id
174 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
175
176 default:
177 // check against reference
178 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
179 }
180 }
181
189 public function getCommandLink($a_cmd)
190 {
191 global $DIC;
192
193 $ilCtrl = $DIC['ilCtrl'];
194
195 switch ($a_cmd) {
196 case 'editReference':
197 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
198 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
199 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
200 return $cmd_link;
201
202 default:
203 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
204 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
205 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
206 return $cmd_link;
207 }
208 }
209}
$_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.
getTypeIcon()
Get object type specific type icon.string
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
initItem($a_ref_id, $a_obj_id, $type, $a_title="", $a_description="")
inititialize new item (is called by getItemHTML())
static _getCommands()
get commands
static _lookupObjId($a_id)
static _lookupDescription($a_id)
lookup object description
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46