ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 function init()
65 {
66 $this->copy_enabled = false;
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 {
80 $this->substitutions_enabled = true;
81 }
82 }
83
84
85
95 function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
96 {
97 global $ilBench,$ilAccess,$tree;
98
99 $this->reference_ref_id = $a_ref_id;
100 $this->reference_obj_id = $a_obj_id;
101
102
103 include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
104 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
105
106 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
107 $target_ref_id = current($target_ref_ids);
108 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
109 $target_description = ilObject::_lookupDescription($target_obj_id);
110
111 $this->deleted = $tree->isDeleted($target_ref_id);
112
113 $ilBench->start("ilObjGroupListGUI", "1000_checkAllConditions");
114 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id,$target_obj_id);
115 $ilBench->stop("ilObjGroupListGUI", "1000_checkAllConditions");
116
117
118 parent::initItem($target_ref_id, $target_obj_id,$target_title,$target_description);
119
120 // general commands array
121 include_once('./Modules/GroupReference/classes/class.ilObjGroupReferenceAccess.php');
122 $this->commands = ilObjGroupReferenceAccess::_getCommands($this->reference_ref_id);
123
124 if($ilAccess->checkAccess('write','',$this->reference_ref_id) or $this->deleted)
125 {
126 $this->info_screen_enabled = false;
127 }
128 else
129 {
130 $this->info_screen_enabled = true;
131 }
132 }
133
134 function getProperties()
135 {
136 global $lng,$ilUser,$tree;
137
138 $props = parent::getProperties();
139
140 // offline
141 if($this->deleted)
142 {
143 $props[] = array("alert" => true, "property" => $lng->txt("status"),
144 "value" => $lng->txt("reference_deleted"));
145 }
146
147 return $props ? $props : array();
148 }
149
155 public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
156 {
157 // Check edit reference against reference edit permission
158 switch($a_cmd)
159 {
160 case 'editReference':
161 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
162 }
163
164 switch($a_permission)
165 {
166 case 'copy':
167 case 'delete':
168 // check against target ref_id
169 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
170
171 default:
172 // check against reference
173 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
174 }
175 }
176
184 public function getCommandLink($a_cmd)
185 {
186 global $ilCtrl;
187
188 switch($a_cmd)
189 {
190 case 'editReference':
191 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
192 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
193 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
194 return $cmd_link;
195
196 default:
197 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
198 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
199 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
200 return $cmd_link;
201 }
202 }
203}
204?>
$_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
global $lng
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:93