ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 {
17 
21  public function init()
22  {
23  $this->static_link_enabled = true;
24  $this->delete_enabled = true;
25  $this->cut_enabled = true;
26  $this->copy_enabled = true;
27  $this->subscribe_enabled = true;
28  $this->link_enabled = false;
29  $this->info_screen_enabled = true;
30  $this->type = "crs";
31  $this->gui_class_name = "ilobjcoursegui";
32 
33  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
34  $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
35  if ($this->substitutions->isActive()) {
36  $this->substitutions_enabled = true;
37  }
38 
39  // general commands array
40  include_once('Modules/Course/classes/class.ilObjCourseAccess.php');
41  $this->commands = ilObjCourseAccess::_getCommands();
42  }
43 
52  public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
53  {
54  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
55 
56  $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $this->obj_id);
57  }
58 
59 
68  public function getProperties()
69  {
70  global $lng, $ilUser;
71 
72  $props = parent::getProperties();
73 
74  // offline
75  include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
76  if (ilObjCourseAccess::_isOffline($this->obj_id)) {
77  $showRegistrationInfo = false;
78  $props[] = array("alert" => true, "property" => $lng->txt("status"),
79  "value" => $lng->txt("offline"));
80  }
81 
82  // blocked
83  include_once 'Modules/Course/classes/class.ilCourseParticipant.php';
84  $members = ilCourseParticipant::_getInstanceByObjId($this->obj_id, $ilUser->getId());
85  if ($members->isBlocked($ilUser->getId()) and $members->isAssigned($ilUser->getId())) {
86  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
87  "value" => $lng->txt("crs_status_blocked"));
88  }
89 
90  // pending subscription
91  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
92  if (ilCourseParticipants::_isSubscriber($this->obj_id, $ilUser->getId())) {
93  $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
94  "value" => $lng->txt("crs_status_pending"));
95  }
96 
97  include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
99  if ($info['reg_info_list_prop']) {
100  $props[] = array(
101  'alert' => false,
102  'newline' => true,
103  'property' => $info['reg_info_list_prop']['property'],
104  'value' => $info['reg_info_list_prop']['value']
105  );
106  }
107  if ($info['reg_info_list_prop_limit']) {
108  $props[] = array(
109  'alert' => false,
110  'newline' => false,
111  'property' => $info['reg_info_list_prop_limit']['property'],
112  'propertyNameVisible' => strlen($info['reg_info_list_prop_limit']['property']) ? true : false,
113  'value' => $info['reg_info_list_prop_limit']['value']
114  );
115  }
116 
117  // waiting list
118  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
119  if (ilCourseWaitingList::_isOnList($ilUser->getId(), $this->obj_id)) {
120  $props[] = array(
121  "alert" => true,
122  "property" => $lng->txt('member_status'),
123  "value" => $lng->txt('on_waiting_list')
124  );
125  }
126 
127  // course period
129  if (is_array($info)) {
130  $props[] = array(
131  'alert' => false,
132  'newline' => true,
133  'property' => $info['property'],
134  'value' => $info['value']
135  );
136  }
137 
138  // check for certificates
139  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
141  $lng->loadLanguageModule('certificate');
142  $cmd_link = "ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=" . $this->ref_id .
143  "&amp;cmd=deliverCertificate";
144  $props[] = array("alert" => false, "property" => $lng->txt("passed"),
145  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
146  }
147 
148  return $props;
149  }
150 
151 
161  public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
162  {
163  // Only check cmd access for cmd 'register' and 'unregister'
164  if ($a_cmd != 'view' and $a_cmd != 'leave' and $a_cmd != 'join') {
165  $a_cmd = '';
166  }
167 
168  if ($a_permission == 'crs_linked') {
169  return
170  parent::checkCommandAccess('read', $a_cmd, $a_ref_id, $a_type, $a_obj_id) ||
171  parent::checkCommandAccess('join', $a_cmd, $a_ref_id, $a_type, $a_obj_id);
172  }
173  return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
174  }
175 } // END class.ilObjCategoryGUI
static lookupPeriodInfo($a_obj_id)
Lookup course period info.
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
Workaround for course titles (linked if join or read permission is granted)
static _isSubscriber($a_obj_id, $a_usr_id)
check if user is subscriber
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
getProperties()
Get item properties.
$a_type
Definition: workflow.php:92
static _isOffline($a_obj_id)
Type-specific implementation of general status.
Class ilObjCourseListGUI.
Class ilObjectListGUI.
static _hasUserCertificate($a_usr_id, $a_obj_id)
Check if user has certificate for course.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.
$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
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
Create styles array
The data for the language used.
$info
Definition: index.php:5
static _getCommands()
get commands