ILIAS  release_7 Revision v7.30-3-g800a261c036
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->static_link_enabled = false;
77 $this->delete_enabled = true;
78 $this->cut_enabled = false;
79 $this->info_screen_enabled = true;
80 $this->copy_enabled = true;
81 $this->subscribe_enabled = false;
82 $this->link_enabled = false;
83
84 $this->type = "prgr";
85 $this->gui_class_name = "ilobjstudyprogrammegui";
86
87 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
88 if ($this->substitutions->isActive()) {
89 $this->substitutions_enabled = true;
90 }
91 }
92
93
94
104 public function initItem($a_ref_id, $a_obj_id, $type, $a_title = "", $a_description = "")
105 {
106 $this->reference_ref_id = $a_ref_id;
107 $this->reference_obj_id = $a_obj_id;
108
109 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
110
111 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
112 $target_ref_id = current($target_ref_ids);
113 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
114 $target_description = ilObject::_lookupDescription($target_obj_id);
115
116 $this->deleted = $this->tree->isDeleted($target_ref_id);
117
118 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id);
119
120 parent::initItem($target_ref_id, $target_obj_id, 'prg', $target_title, $target_description);
121 $this->setTitle($target_title);
122 $this->commands = ilObjStudyProgrammeReferenceAccess::_getCommands($this->reference_ref_id);
123
124 if ($this->ilAccess->checkAccess('write', '', $this->reference_ref_id) || $this->deleted) {
125 $this->info_screen_enabled = false;
126 } else {
127 $this->info_screen_enabled = true;
128 }
129 }
130
131 public function getProperties()
132 {
133 $props = parent::getProperties();
134
135 // offline
136 if ($this->deleted) {
137 $props[] = array("alert" => true, "property" => $this->lng->txt("status"),
138 "value" => $lng->txt("reference_deleted"));
139 }
140
141 return $props ? $props : array();
142 }
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 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), 'prgr', "");
159 }
160
168 public function getCommandLink($a_cmd)
169 {
170 switch ($a_cmd) {
171 case 'editReference':
172 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
173 $cmd_link = $this->ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
174 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
175 return $cmd_link;
176
177 default:
178 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
179 $cmd_link = $this->ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
180 $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
181 return $cmd_link;
182 }
183 }
184
185 public function getListItemHTML(
186 $a_ref_id,
187 $a_obj_id,
188 $a_title,
189 $a_description,
190 $a_use_asynch = false,
191 $a_get_asynch_commands = false,
192 $a_asynch_url = "",
193 $a_context = self::CONTEXT_REPOSITORY
194 ) {
195 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
196 $target_ref_id = current(ilObject::_getAllReferences($target_obj_id));
197 $prg = new ilObjStudyProgramme($target_ref_id);
198 $assignments = $prg->getAssignments();
199 if ($this->getCheckboxStatus() && count($assignments) > 0) {
200 $this->setAdditionalInformation($this->lng->txt("prg_can_not_manage_in_repo"));
201 $this->enableCheckbox(false);
202 } else {
203 $this->setAdditionalInformation(null);
204 }
206 $a_ref_id,
207 $a_obj_id,
208 $a_title,
209 $a_description,
210 $a_use_asynch,
211 $a_get_asynch_commands,
212 $a_asynch_url,
213 $a_context
214 );
215 }
216}
$_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 _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc