ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjStudyProgrammeReferenceListGUI.php
Go to the documentation of this file.
1<?php
2
4{
6 protected $reference_obj_id = null;
8 protected $reference_ref_id = null;
10 protected $deleted = false;
11
12 protected $ilAccess;
13 protected $tree;
14 protected $lng;
15
16 public function __construct()
17 {
18 global $DIC;
19
20 $this->ilAccess = $DIC['ilAccess'];
21 $this->tree = $DIC['tree'];
22 $this->lng = $DIC['lng'];
23 $this->ilCtrl = $DIC['ilCtrl'];
25 }
26
27
31 public function getIconImageType()
32 {
33 return 'prgr';
34 }
35
39 public function getTypeIcon()
40 {
42 return ilObject::_getIcon(
44 'small'
45 );
46 }
47
48
55 public function getCommandId()
56 {
58 }
59
64 public function insertTimingsCommand()
65 {
66 return;
67 }
68
69
70
74 public function init()
75 {
76 $this->copy_enabled = true;
77 $this->static_link_enabled = false;
78 $this->delete_enabled = true;
79 $this->cut_enabled = true;
80 $this->subscribe_enabled = true;
81 $this->link_enabled = false;
82 $this->info_screen_enabled = true;
83 $this->type = "prg";
84 $this->gui_class_name = "ilobjstudyprogrammegui";
85
86 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
87 if ($this->substitutions->isActive()) {
88 $this->substitutions_enabled = true;
89 }
90 }
91
92
93
103 public function initItem($a_ref_id, $a_obj_id, $type, $a_title = "", $a_description = "")
104 {
105 $this->reference_ref_id = $a_ref_id;
106 $this->reference_obj_id = $a_obj_id;
107
108 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
109
110 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
111 $target_ref_id = current($target_ref_ids);
112 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
113 $target_description = ilObject::_lookupDescription($target_obj_id);
114
115 $this->deleted = $this->tree->isDeleted($target_ref_id);
116
117 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id);
118
119 parent::initItem($target_ref_id, $target_obj_id, 'prg', $target_title, $target_description);
120 $this->setTitle($target_title);
121 $this->commands = ilObjStudyProgrammeReferenceAccess::_getCommands($this->reference_ref_id);
122
123 if ($this->ilAccess->checkAccess('write', '', $this->reference_ref_id) || $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 $props = parent::getProperties();
133
134 // offline
135 if ($this->deleted) {
136 $props[] = array("alert" => true, "property" => $this->lng->txt("status"),
137 "value" => $lng->txt("reference_deleted"));
138 }
139
140 return $props ? $props : array();
141 }
142
143
149 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
150 {
151 // Check edit reference against reference edit permission
152 switch ($a_cmd) {
153 case 'editReference':
154 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
155 }
156
157 switch ($a_permission) {
158 case 'copy':
159 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, 'prg', $a_obj_id);
160 default:
161 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), 'prgr', "");
162 }
163 }
164
172 public function getCommandLink($a_cmd)
173 {
174 switch ($a_cmd) {
175 case 'editReference':
176 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
177 $cmd_link = $this->ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
178 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
179 return $cmd_link;
180
181 default:
182 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
183 $cmd_link = $this->ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
184 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
185 return $cmd_link;
186 }
187 }
188
189 public function getListItemHTML(
190 $a_ref_id,
191 $a_obj_id,
192 $a_title,
193 $a_description,
194 $a_use_asynch = false,
195 $a_get_asynch_commands = false,
196 $a_asynch_url = "",
197 $a_context = self::CONTEXT_REPOSITORY
198 ) {
199 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
200 $target_ref_id = current(ilObject::_getAllReferences($target_obj_id));
201 $prg = new ilObjStudyProgramme($target_ref_id);
202 $assignments = $prg->getAssignments();
203 if ($this->getCheckboxStatus() && count($assignments) > 0) {
204 $this->setAdditionalInformation($this->lng->txt("prg_can_not_manage_in_repo"));
205 $this->enableCheckbox(false);
206 } else {
207 $this->setAdditionalInformation(null);
208 }
210 $a_ref_id,
211 $a_obj_id,
212 $a_title,
213 $a_description,
214 $a_use_asynch,
215 $a_get_asynch_commands,
216 $a_asynch_url,
217 $a_context
218 );
219 }
220}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id="", $a_tree_id="")
check access for an object (provide $a_type and $a_obj_id if available for better performance)
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.
This class provides processing control methods.
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=false)
Get link target for command using gui class name.
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
Class ilObjStudyProgrammeListGUI.
getTypeIcon()
Get object type specific type icon.string
initItem($a_ref_id, $a_obj_id, $type, $a_title="", $a_description="")
inititialize new item Group reference inits the group item
getListItemHTML( $a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="", $a_context=self::CONTEXT_REPOSITORY)
Get all item information (title, commands, description) in HTML.
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
static _getCommands()
get commands
enableCheckbox($a_status)
En/Dis-able checkboxes.
getCheckboxStatus()
Are checkboxes enabled?
setAdditionalInformation($a_val)
Set additional information.
getListItemHTML( $a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="")
Get all item information (title, commands, description) in HTML.
static _lookupObjId($a_id)
static _lookupDescription($a_id)
lookup object description
static _getAllReferences($a_id)
get all reference ids of object
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46