ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
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';
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 // waiting list
136 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
137 if(ilCourseWaitingList::_isOnList($ilUser->getId(),$this->obj_id))
138 {
139 $props[] = array(
140 "alert" => true,
141 "property" => $lng->txt('member_status'),
142 "value" => $lng->txt('on_waiting_list')
143 );
144 }
145
146 // course period
148 if(is_array($info))
149 {
150 $props[] = array(
151 'alert' => false,
152 'newline' => true,
153 'property' => $info['property'],
154 'value' => $info['value']
155 );
156 }
157
158 // check for certificates
159 include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
161 {
162 $lng->loadLanguageModule('certificate');
163 $cmd_link = "ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=".$this->ref_id.
164 "&amp;cmd=deliverCertificate";
165 $props[] = array("alert" => false, "property" => $lng->txt("passed"),
166 "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
167 }
168
169 return $props;
170 }
171
172
182 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id = "")
183 {
184 // Only check cmd access for cmd 'register' and 'unregister'
185 if($a_cmd != 'view' and $a_cmd != 'leave' and $a_cmd != 'join')
186 {
187 $a_cmd = '';
188 }
189
190 if($a_permission == 'crs_linked')
191 {
192 return
193 parent::checkCommandAccess('read', $a_cmd, $a_ref_id, $a_type, $a_obj_id) ||
194 parent::checkCommandAccess('join', $a_cmd, $a_ref_id, $a_type, $a_obj_id);
195 }
196 return parent::checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
197 }
198} // END class.ilObjCategoryGUI
199?>
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
_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 _hasUserCertificate($a_usr_id, $a_obj_id)
Check if user has certificate for course.
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static lookupPeriodInfo($a_obj_id)
Lookup course period info.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.
static _isOffline($a_obj_id)
Type-specific implementation of general status.
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.
ilObjectListGUI()
constructor
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: example_052.php:80
global $ilBench
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15