ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilObjCategoryReferenceListGUI.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/Category/classes/class.ilObjCategoryListGUI.php";
25 
35 {
36  protected $reference_obj_id = null;
37  protected $reference_ref_id = null;
38 
39  protected $deleted = false;
40 
47  public function __construct()
48  {
49  parent::__construct();
50  }
51 
52  public function getIconImageType()
53  {
54  return 'catr';
55  }
56 
64  public function getCommandId()
65  {
67  }
68 
72  function init()
73  {
74  $this->copy_enabled = false;
75  $this->static_link_enabled = false;
76  $this->delete_enabled = true;
77  $this->cut_enabled = true;
78  $this->subscribe_enabled = true;
79  $this->link_enabled = false;
80  $this->payment_enabled = true;
81  $this->info_screen_enabled = true;
82  $this->type = "cat";
83  $this->gui_class_name = "ilobjcategorygui";
84 
85  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
86  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
87  if($this->substitutions->isActive())
88  {
89  $this->substitutions_enabled = true;
90  }
91  }
92 
93 
94 
104  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
105  {
106  global $ilBench,$ilAccess,$tree;
107 
108  $this->reference_ref_id = $a_ref_id;
109  $this->reference_obj_id = $a_obj_id;
110 
111  include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
112  $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id);
113 
114  $target_ref_ids = ilObject::_getAllReferences($target_obj_id);
115  $target_ref_id = current($target_ref_ids);
116  $target_title = ilContainerReference::_lookupTitle($a_obj_id);
117  $target_description = ilObject::_lookupDescription($target_obj_id);
118 
119  $this->deleted = $tree->isDeleted($target_ref_id);
120 
121 
122 
123  parent::initItem($target_ref_id, $target_obj_id,$target_title,$target_description);
124 
125  // general commands array
126  include_once('./Modules/CategoryReference/classes/class.ilObjCategoryReferenceAccess.php');
127  $this->commands = ilObjCategoryReferenceAccess::_getCommands($this->reference_ref_id);
128 
129  if($ilAccess->checkAccess('write','',$this->reference_ref_id) or $this->deleted)
130  {
131  $this->info_screen_enabled = false;
132  }
133  else
134  {
135  $this->info_screen_enabled = true;
136  }
137  }
138 
139 
140  function getProperties()
141  {
142  global $lng,$ilUser,$tree;
143 
144  $props = parent::getProperties();
145 
146  // offline
147  if($tree->isDeleted($this->ref_id))
148  {
149  $props[] = array("alert" => true, "property" => $lng->txt("status"),
150  "value" => $lng->txt("reference_deleted"));
151  }
152 
153  return $props ? $props : array();
154  }
155 
161  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type)
162  {
163 
164  // Check edit reference against reference edit permission
165  switch($a_cmd)
166  {
167  case 'editReference':
168  return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type);
169  }
170 
171  switch($a_permission)
172  {
173  case 'copy':
174  case 'delete':
175  // check against target ref_id
176  return parent::checkCommandAccess($a_permission, $a_cmd, $this->getCommandId(), $a_type);
177 
178  default:
179  // check against reference
180  return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type);
181  }
182  }
183 
191  public function getCommandLink($a_cmd)
192  {
193  global $ilCtrl;
194 
195  switch($a_cmd)
196  {
197  case 'editReference':
198  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
199  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
200  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
201  return $cmd_link;
202 
203  default:
204  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
205  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
206  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
207  return $cmd_link;
208  }
209  }
210 
211 
212 }
213 ?>
Class ilObjCategoryListGUI.
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type)
$_GET["client_id"]
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item Course reference inits the course item
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
static _lookupTitle($a_obj_id)
Overwitten from base class.
static _lookupDescription($a_id)
lookup object description
_getCommands()
get commands
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
global $ilBench
Definition: ilias.php:18
static _lookupTargetId($a_obj_id)
lookup target id