ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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{
17
21 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 {
37 $this->substitutions_enabled = true;
38 }
39
40 // general commands array
41 include_once('Modules/Course/classes/class.ilObjCourseAccess.php');
42 $this->commands = ilObjCourseAccess::_getCommands();
43 }
44
53 function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
54 {
55 parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
56
57 $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id,$this->obj_id);
58 }
59
60
69 function getProperties()
70 {
71 global $lng, $ilUser;
72
73 $props = parent::getProperties();
74
75 // offline
76 include_once 'Modules/Course/classes/class.ilObjCourseAccess.php';
77 if(ilObjCourseAccess::_isOffline($this->obj_id))
78 {
79 $showRegistrationInfo = false;
80 $props[] = array("alert" => true, "property" => $lng->txt("status"),
81 "value" => $lng->txt("offline"));
82 }
83
84 // blocked
85 include_once 'Modules/Course/classes/class.ilCourseParticipant.php';
86 $members = ilCourseParticipant::_getInstanceByObjId($this->obj_id,$ilUser->getId());
87 if($members->isBlocked($ilUser->getId()) and $members->isAssigned($ilUser->getId()))
88 {
89 $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
90 "value" => $lng->txt("crs_status_blocked"));
91 }
92
93 // pending subscription
94 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
95 if (ilCourseParticipants::_isSubscriber($this->obj_id,$ilUser->getId()))
96 {
97 $props[] = array("alert" => true, "property" => $lng->txt("member_status"),
98 "value" => $lng->txt("crs_status_pending"));
99 }
100
101 include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
103 if($info['reg_info_list_prop'])
104 {
105 $props[] = array(
106 'alert' => false,
107 'newline' => true,
108 'property' => $info['reg_info_list_prop']['property'],
109 'value' => $info['reg_info_list_prop']['value']
110 );
111 }
112 if($info['reg_info_list_prop_limit'])
113 {
114
115 $props[] = array(
116 'alert' => false,
117 'newline' => false,
118 'property' => $info['reg_info_list_prop_limit']['property'],
119 'propertyNameVisible' => strlen($info['reg_info_list_prop_limit']['property']) ? true : false,
120 'value' => $info['reg_info_list_prop_limit']['value']
121 );
122 }
123
124 // waiting list
125 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
126 if(ilCourseWaitingList::_isOnList($ilUser->getId(),$this->obj_id))
127 {
128 $props[] = array(
129 "alert" => true,
130 "property" => $lng->txt('member_status'),
131 "value" => $lng->txt('on_waiting_list')
132 );
133 }
134
135 // course period
137 if(is_array($info))
138 {
139 $props[] = array(
140 'alert' => false,
141 'newline' => true,
142 'property' => $info['property'],
143 'value' => $info['value']
144 );
145 }
146
147 // check for certificates
148 include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
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?>
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 _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 _getCommands()
get commands
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.
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 $lng
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:93