ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
5include_once "Services/Object/classes/class.ilObjectListGUI.php";
6
16{
21
25 public function init()
26 {
27 $this->static_link_enabled = true;
28 $this->delete_enabled = true;
29 $this->cut_enabled = true;
30 $this->copy_enabled = true;
31 $this->subscribe_enabled = true;
32 $this->link_enabled = false;
33 $this->info_screen_enabled = true;
34 $this->type = "crs";
35 $this->gui_class_name = "ilobjcoursegui";
36
37 $this->substitutions = ilAdvancedMDSubstitution::_getInstanceByObjectType($this->type);
38 if ($this->substitutions->isActive()) {
39 $this->substitutions_enabled = true;
40 }
41
42 // general commands array
43 $this->commands = ilObjCourseAccess::_getCommands();
44 }
45
54 public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
55 {
56 parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
57
58 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $this->obj_id);
59 }
60
65 {
66 if (null === $this->certificatePreloader) {
67 $repository = new ilUserCertificateRepository();
68 $this->certificatePreloader = new ilCertificateObjectsForUserPreloader($repository);
69 }
70
72 }
73
82 public function getProperties()
83 {
84 global $DIC;
85
86 $lng = $DIC['lng'];
87 $ilUser = $DIC['ilUser'];
88
89 $props = parent::getProperties();
90
91 // check activation
92 if (
93 !ilObjCourseAccess::_isActivated($this->obj_id) &&
94 !ilObject::lookupOfflineStatus($this->obj_id)
95 ) {
96 $showRegistrationInfo = false;
97 $props[] = array(
98 "alert" => true,
99 "property" => $lng->txt("status"),
100 "value" => $lng->txt("offline")
101 );
102 }
103
104 // blocked
105 include_once 'Modules/Course/classes/class.ilCourseParticipant.php';
106 $members = ilCourseParticipant::_getInstanceByObjId($this->obj_id, $ilUser->getId());
107 if ($members->isBlocked($ilUser->getId()) and $members->isAssigned($ilUser->getId())) {
108 $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
109 "value" => $lng->txt("crs_status_blocked"));
110 }
111
112 // pending subscription
113 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
114 if (ilCourseParticipants::_isSubscriber($this->obj_id, $ilUser->getId())) {
115 $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
116 "value" => $lng->txt("crs_status_pending"));
117 }
118
119 include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
121 if ($info['reg_info_list_prop']) {
122 $props[] = array(
123 'alert' => false,
124 'newline' => true,
125 'property' => $info['reg_info_list_prop']['property'],
126 'value' => $info['reg_info_list_prop']['value']
127 );
128 }
129 if ($info['reg_info_list_prop_limit']) {
130 $props[] = array(
131 'alert' => false,
132 'newline' => false,
133 'property' => $info['reg_info_list_prop_limit']['property'],
134 'propertyNameVisible' => strlen($info['reg_info_list_prop_limit']['property']) ? true : false,
135 'value' => $info['reg_info_list_prop_limit']['value']
136 );
137 }
138
139 // waiting list
140 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
141 if (ilCourseWaitingList::_isOnList($ilUser->getId(), $this->obj_id)) {
142 $props[] = array(
143 "alert" => true,
144 "property" => $lng->txt('member_status'),
145 "value" => $lng->txt('on_waiting_list')
146 );
147 }
148
149 // course period
151 if (is_array($info)) {
152 $props[] = array(
153 'alert' => false,
154 'newline' => true,
155 'property' => $info['property'],
156 'value' => $info['value']
157 );
158 }
159
160 // check for certificates
161 $hasCertificate = $this->getCertificatePreloader()->isPreloaded($ilUser->getId(), $this->obj_id);
162 if (true === $hasCertificate) {
163 $lng->loadLanguageModule('certificate');
164 $cmd_link = "ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=" . $this->ref_id .
165 "&amp;cmd=deliverCertificate";
166 $props[] = array("alert" => false,
167 "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
168 }
169
170 return $props;
171 }
172
173
183 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
184 {
185 // Only check cmd access for cmd 'register' and 'unregister'
186 if ($a_cmd != 'view' and $a_cmd != 'leave' and $a_cmd != 'join') {
187 $a_cmd = '';
188 }
189
190 if ($a_permission == 'crs_linked') {
191 return
192 parent::checkCommandAccess('read', $a_cmd, $a_ref_id, $a_type, $a_obj_id) ||
193 parent::checkCommandAccess('join', $a_cmd, $a_ref_id, $a_type, $a_obj_id);
194 }
195 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
196 }
197} // END class.ilObjCategoryGUI
An exception for terminatinating execution or to throw for unit testing.
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
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 lookupPeriodInfo($a_obj_id)
Lookup course period info.
static _isActivated($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
Is activated?
static _getCommands()
get commands
static lookupRegistrationInfo($a_obj_id)
Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.
Class ilObjCourseListGUI.
getProperties()
Get item properties.
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)
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item
Class ilObjectListGUI.
static lookupOfflineStatus($a_obj_id)
Lookup offline status using objectDataCache.
static _isSubscriber($a_obj_id, $a_usr_id)
check if user is subscriber
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
$info
Definition: index.php:5
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92