ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjCourseListGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Object/classes/class.ilObjectListGUI.php";
6 
16 {
21  function ilObjCourseListGUI()
22  {
23  $this->ilObjectListGUI();
24  }
25 
29  function init()
30  {
31  $this->static_link_enabled = true;
32  $this->delete_enabled = true;
33  $this->cut_enabled = true;
34  $this->copy_enabled = true;
35  $this->subscribe_enabled = true;
36  $this->link_enabled = false;
37  $this->payment_enabled = true;
38  $this->info_screen_enabled = true;
39  $this->type = "crs";
40  $this->gui_class_name = "ilobjcoursegui";
41 
42  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
43  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
44  if($this->substitutions->isActive())
45  {
46  $this->substitutions_enabled = true;
47  }
48 
49  // general commands array
50  include_once('Modules/Course/classes/class.ilObjCourseAccess.php');
51  $this->commands = ilObjCourseAccess::_getCommands();
52  }
53 
62  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
63  {
64  global $ilBench;
65 
66  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
67 
68  $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id,$this->obj_id);
69  }
70 
71 
80  function getProperties()
81  {
82  global $lng, $ilUser;
83 
84  $props = parent::getProperties();
85 
86  // offline
87  include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
88  if(ilObjCourseAccess::_isOffline($this->obj_id))
89  {
90  $showRegistrationInfo = false;
91  $props[] = array("alert" => true, "property" => $lng->txt("status"),
92  "value" => $lng->txt("offline"));
93  }
94 
95  // blocked
96  include_once 'Modules/Course/classes/class.ilCourseParticipant.php';
97  $members = ilCourseParticipant::_getInstanceByObjId($this->obj_id,$ilUser->getId());
98  if($members->isBlocked($ilUser->getId()) and $members->isAssigned($ilUser->getId()))
99  {
100  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
101  "value" => $lng->txt("crs_status_blocked"));
102  }
103 
104  // pending subscription
105  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
106  if (ilCourseParticipants::_isSubscriber($this->obj_id,$ilUser->getId()))
107  {
108  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
109  "value" => $lng->txt("crs_status_pending"));
110  }
111 
112  include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
113  $info = ilObjCourseAccess::lookupRegistrationInfo($this->obj_id);
114  if($info['reg_info_list_prop'])
115  {
116  $props[] = array(
117  'alert' => false,
118  'newline' => true,
119  'property' => $info['reg_info_list_prop']['property'],
120  'value' => $info['reg_info_list_prop']['value']
121  );
122  }
123  if($info['reg_info_list_prop_limit'])
124  {
125 
126  $props[] = array(
127  'alert' => false,
128  'newline' => false,
129  'property' => $info['reg_info_list_prop_limit']['property'],
130  'propertyNameVisible' => strlen($info['reg_info_list_prop_limit']['property']) ? true : false,
131  'value' => $info['reg_info_list_prop_limit']['value']
132  );
133  }
134 
135 
136  // waiting list
137  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
138  if(ilCourseWaitingList::_isOnList($ilUser->getId(),$this->obj_id))
139  {
140  $props[] = array(
141  "alert" => true,
142  "property" => $lng->txt('member_status'),
143  "value" => $lng->txt('on_waiting_list')
144  );
145  }
146 
147  // check for certificates
148  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
149  if(ilCourseCertificateAdapter::_hasUserCertificate($ilUser->getId(), $this->obj_id))
150  {
151  $lng->loadLanguageModule('certificate');
152  $cmd_link = "ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=".$this->ref_id.
153  "&amp;cmd=deliverCertificate";
154  $props[] = array("alert" => false, "property" => $lng->txt("passed"),
155  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
156  }
157 
158  return $props;
159  }
160 
161 
171  public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
172  {
173  // Only check cmd access for cmd 'register' and 'unregister'
174  if($a_cmd != 'view' and $a_cmd != 'leave' and $a_cmd != 'join')
175  {
176  $a_cmd = '';
177  }
178 
179  if($a_permission == 'crs_linked')
180  {
181  return
182  parent::checkCommandAccess('read', $a_cmd, $a_ref_id, $a_type, $a_obj_id) ||
183  parent::checkCommandAccess('join', $a_cmd, $a_ref_id, $a_type, $a_obj_id);
184  }
185  return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
186  }
187 } // END class.ilObjCategoryGUI
188 ?>