ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
49  }
50 
51  public function getIconImageType()
52  {
53  return 'crsr';
54  }
55 
63  public function getCommandId()
64  {
66  }
67 
71  function init()
72  {
73  $this->copy_enabled = false;
74  $this->static_link_enabled = false;
75  $this->delete_enabled = true;
76  $this->cut_enabled = true;
77  $this->subscribe_enabled = true;
78  $this->link_enabled = false;
79  $this->payment_enabled = true;
80  $this->info_screen_enabled = true;
81  $this->type = "crs";
82  $this->gui_class_name = "ilobjcoursegui";
83 
84  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
85  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
86  if($this->substitutions->isActive())
87  {
88  $this->substitutions_enabled = true;
89  }
90  }
91 
92 
93 
103  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
104  {
105  global $ilBench,$ilAccess,$tree;
106 
107  $this->reference_ref_id = $a_ref_id;
108  $this->reference_obj_id = $a_obj_id;
109 
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 = ilObject::_lookupTitle($target_obj_id);
117  $target_description = ilObject::_lookupDescription($target_obj_id);
118 
119  $this->deleted = $tree->isDeleted($target_ref_id);
120 
121  $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions");
122  $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id,$target_obj_id);
123  $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions");
124 
125 
126  parent::initItem($target_ref_id, $target_obj_id,$target_title,$target_description);
127 
128  // general commands array
129  include_once('./Modules/CourseReference/classes/class.ilObjCourseReferenceAccess.php');
130  $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id);
131 
132  if($ilAccess->checkAccess('write','',$this->reference_ref_id) or $this->deleted)
133  {
134  $this->info_screen_enabled = false;
135  }
136  else
137  {
138  $this->info_screen_enabled = true;
139  }
140  }
141 
142  function getProperties()
143  {
144  global $lng,$ilUser,$tree;
145 
146  $props = parent::getProperties();
147 
148  // offline
149  if($this->deleted)
150  {
151  $props[] = array("alert" => true, "property" => $lng->txt("status"),
152  "value" => $lng->txt("reference_deleted"));
153  }
154 
155  return $props ? $props : array();
156  }
157 
163  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type)
164  {
165  global $ilAccess;
166 
167  switch($a_cmd)
168  {
169  case 'edit':
170  case 'cut':
171  case 'delete':
172  case 'link':
173  return $ilAccess->checkAccess($a_permission,$a_cmd,$this->getCommandId());
174 
175  default:
176  return $ilAccess->checkAccess($a_permission,$a_cmd,$a_ref_id,$a_type);
177 
178  }
179  }
180 
188  public function getCommandLink($a_cmd)
189  {
190  switch($a_cmd)
191  {
192  case '':
193  case 'view':
194  case 'join':
195  case 'infoScreen':
196  return 'repository.php?ref_id='.$this->ref_id.'&cmd='.$a_cmd;
197 
198  default:
199  return 'repository.php?ref_id='.$this->getCommandId().'&cmd='.$a_cmd;
200  }
201  }
202 
203 
204 }
205 ?>