ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
24 include_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 
63  public function getCommandId()
64  {
66  }
67 
72  public function insertTimingsCommand()
73  {
74  return;
75  }
76 
80  function init()
81  {
82  $this->copy_enabled = false;
83  $this->static_link_enabled = false;
84  $this->delete_enabled = true;
85  $this->cut_enabled = true;
86  $this->subscribe_enabled = true;
87  $this->link_enabled = false;
88  $this->info_screen_enabled = true;
89  $this->type = "crs";
90  $this->gui_class_name = "ilobjcoursegui";
91 
92  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
93  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
94  if($this->substitutions->isActive())
95  {
96  $this->substitutions_enabled = true;
97  }
98  }
99 
100 
101 
111  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
112  {
113  global $ilBench,$ilAccess,$tree;
114 
115  $this->reference_ref_id = $a_ref_id;
116  $this->reference_obj_id = $a_obj_id;
117 
118 
119  include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
120  $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
121 
122  $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
123  $target_ref_id = current($target_ref_ids);
124  $target_title = ilContainerReference::_lookupTitle($a_obj_id);
125  $target_description = ilObject::_lookupDescription($target_obj_id);
126 
127  $this->deleted = $tree->isDeleted($target_ref_id);
128 
129  $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions");
130  $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id,$target_obj_id);
131  $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions");
132 
133 
134  parent::initItem($target_ref_id, $target_obj_id,$target_title,$target_description);
135 
136  // general commands array
137  include_once('./Modules/CourseReference/classes/class.ilObjCourseReferenceAccess.php');
138  $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id);
139 
140  if($ilAccess->checkAccess('write','',$this->reference_ref_id) or $this->deleted)
141  {
142  $this->info_screen_enabled = false;
143  }
144  else
145  {
146  $this->info_screen_enabled = true;
147  }
148  }
149 
150  function getProperties()
151  {
152  global $lng,$ilUser,$tree;
153 
154  $props = parent::getProperties();
155 
156  // offline
157  if($this->deleted)
158  {
159  $props[] = array("alert" => true, "property" => $lng->txt("status"),
160  "value" => $lng->txt("reference_deleted"));
161  }
162 
163  return $props ? $props : array();
164  }
165 
171  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
172  {
173  // Check edit reference against reference edit permission
174  switch($a_cmd)
175  {
176  case 'editReference':
177  return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
178  }
179 
180  switch($a_permission)
181  {
182  case 'copy':
183  case 'delete':
184  // check against target ref_id
185  return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type, $a_obj_id);
186 
187  default:
188  // check against reference
189  return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
190  }
191  }
192 
200  public function getCommandLink($a_cmd)
201  {
202  global $ilCtrl;
203 
204  switch($a_cmd)
205  {
206  case 'editReference':
207  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
208  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
209  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
210  return $cmd_link;
211 
212  default:
213  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
214  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
215  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
216  return $cmd_link;
217  }
218  }
219 }
220 ?>
$_GET["client_id"]
static _getAllReferences($a_id)
get all reference ids of object
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
global $ilCtrl
Definition: ilias.php:18
$a_type
Definition: workflow.php:93
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item Course reference inits the course item
static _getCommands()
get commands
static _lookupTitle($a_obj_id)
Overwitten from base class.
static _lookupDescription($a_id)
lookup object description
Class ilObjCourseListGUI.
$ilUser
Definition: imgupload.php:18
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
Create styles array
The data for the language used.
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
global $lng
Definition: privfeed.php:17
global $ilBench
Definition: ilias.php:18
static _lookupTargetId($a_obj_id)
lookup target id