ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjCourseListGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
35 include_once "Services/Object/classes/class.ilObjectListGUI.php";
36 
38 {
43  function ilObjCourseListGUI()
44  {
45  $this->ilObjectListGUI();
46  }
47 
51  function init()
52  {
53  $this->static_link_enabled = true;
54  $this->delete_enabled = true;
55  $this->cut_enabled = true;
56  $this->copy_enabled = true;
57  $this->subscribe_enabled = true;
58  $this->link_enabled = false;
59  $this->payment_enabled = true;
60  $this->info_screen_enabled = true;
61  $this->type = "crs";
62  $this->gui_class_name = "ilobjcoursegui";
63 
64  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
65  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
66  if($this->substitutions->isActive())
67  {
68  $this->substitutions_enabled = true;
69  }
70 
71  // general commands array
72  include_once('class.ilObjCourseAccess.php');
73  $this->commands = ilObjCourseAccess::_getCommands();
74  }
75 
85  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
86  {
87  if($a_cmd != 'view' and $a_cmd != 'leave')
88  {
89  $a_cmd = '';
90  }
91  return parent::checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
92  }
93 
94 
103  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
104  {
105  global $ilBench;
106 
107  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
108 
109 //echo "A-".memory_get_usage();echo "-".$full_class;
110  $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions");
111  $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id,$this->obj_id);
112  $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions");
113 //echo "B-".memory_get_usage();echo "-".$full_class;
114  }
115 
116 
125  function getProperties()
126  {
127  global $lng, $ilUser;
128 
129  // BEGIN WebDAV: Get parent properties
130  // BEGIN ChangeEvent: Get parent properties
131  $props = parent::getProperties();
132  // END ChangeEvent: Get parent properties
133  // END WebDAV: Get parent properties
134 
135  // offline
136  include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
137  if(!ilObjCourseAccess::_isActivated($this->obj_id))
138  {
139  $props[] = array("alert" => true, "property" => $lng->txt("status"),
140  "value" => $lng->txt("offline"));
141  }
142 
143  // blocked
144  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
145  $members = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
146  if($members->isBlocked($ilUser->getId()) and $members->isAssigned($ilUser->getId()))
147  {
148  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
149  "value" => $lng->txt("crs_status_blocked"));
150  }
151 
152  // pending subscription
153  if (ilCourseParticipants::_isSubscriber($this->obj_id,$ilUser->getId()))
154  {
155  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
156  "value" => $lng->txt("crs_status_pending"));
157  }
158  // waiting list
159  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
160  if(ilCourseWaitingList::_isOnList($ilUser->getId(),$this->obj_id))
161  {
162  $props[] = array(
163  "alert" => true,
164  "property" => $lng->txt('member_status'),
165  "value" => $lng->txt('on_waiting_list')
166  );
167  }
168 
169  return $props;
170  }
171 } // END class.ilObjCategoryGUI
172 ?>