ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjCourseReferenceListGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once "./Modules/Course/classes/class.ilObjCourseListGUI.php";
25
35{
36 protected $reference_obj_id = null;
37 protected $reference_ref_id = null;
38 protected $deleted = false;
39
46 public function __construct()
47 {
48 parent::__construct();
49 }
50
51 public function getIconImageType()
52 {
53 return 'crsr';
54 }
55
59 public function getTypeIcon()
60 {
62 return ilObject::_getIcon(
64 'small'
65 );
66 }
67
68
76 public function getCommandId()
77 {
79 }
80
85 public function insertTimingsCommand()
86 {
87 return;
88 }
89
93 public function init()
94 {
95 $this->copy_enabled = true;
96 $this->static_link_enabled = false;
97 $this->delete_enabled = true;
98 $this->cut_enabled = true;
99 $this->subscribe_enabled = true;
100 $this->link_enabled = false;
101 $this->info_screen_enabled = true;
102 $this->type = "crs";
103 $this->gui_class_name = "ilobjcoursegui";
104
105 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
106 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
107 if ($this->substitutions->isActive()) {
108 $this->substitutions_enabled = true;
109 }
110 }
111
112
113
123 public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
124 {
125 global $ilBench,$ilAccess,$tree;
126
127 $this->reference_ref_id = $a_ref_id;
128 $this->reference_obj_id = $a_obj_id;
129
130
131 include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
132 $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
133
134 $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
135 $target_ref_id = current($target_ref_ids);
136 $target_title = ilContainerReference::_lookupTitle($a_obj_id);
137 $target_description = ilObject::_lookupDescription($target_obj_id);
138
139 $this->deleted = $tree->isDeleted($target_ref_id);
140
141 $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions");
142 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id);
143 $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions");
144
145
146 parent::initItem($target_ref_id, $target_obj_id, $target_title, $target_description);
147
148 // general commands array
149 include_once('./Modules/CourseReference/classes/class.ilObjCourseReferenceAccess.php');
150 $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id);
151
152 if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) {
153 $this->info_screen_enabled = false;
154 } else {
155 $this->info_screen_enabled = true;
156 }
157 }
158
159 public function getProperties()
160 {
161 global $lng,$ilUser,$tree;
162
163 $props = parent::getProperties();
164
165 // offline
166 if ($this->deleted) {
167 $props[] = array("alert" => true, "property" => $lng->txt("status"),
168 "value" => $lng->txt("reference_deleted"));
169 }
170
171 return $props ? $props : array();
172 }
173
179 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
180 {
181 // Check edit reference against reference edit permission
182 switch ($a_cmd) {
183 case 'editReference':
184 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
185 }
186
187 switch ($a_permission) {
188 case 'copy':
189 case 'delete':
190 // check against target ref_id
191 return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
192
193 default:
194 // check against reference
195 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
196 }
197 }
198
206 public function getCommandLink($a_cmd)
207 {
208 global $ilCtrl;
209
210 switch ($a_cmd) {
211 case 'editReference':
212 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
213 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
214 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
215 return $cmd_link;
216
217 default:
218 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
219 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
220 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
221 return $cmd_link;
222 }
223 }
224}
$_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 ilObjCourseListGUI.
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item Course reference inits the course item
getIconImageType()
Returns the icon image type.
getTypeIcon()
Get object type specific type icon.string
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
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 $ilBench
Definition: ilias.php:18
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92