ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjCourseAccess Class Reference

Class ilObjCourseAccess. More...

+ Inheritance diagram for ilObjCourseAccess:
+ Collaboration diagram for ilObjCourseAccess:

Public Member Functions

 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static getConditionOperators ()
 Get operators. More...
 
static checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 @global ilObjUser $ilUser More...
 
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _lookupViewMode ($a_id)
 Lookup view mode. More...
 
static _isActivated ($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
 Is activated? More...
 
static _registrationEnabled ($a_obj_id)
 
static lookupRegistrationInfo ($a_obj_id)
 Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng. More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
static getBookingInfoRepo ()
 Get booking info repo. More...
 
static _usingRegistrationCode ()
 Using Registration code. More...
 
static lookupPeriodInfo ($a_obj_id)
 Lookup course period info. More...
 
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
static getConditionOperators ()
 Returns an array with valid operators for the specific object type. More...
 
static checkCondition ($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition for a specific user and object More...
 

Static Protected Attributes

static $using_code = false
 
static $booking_repo = null
 

Detailed Description

Class ilObjCourseAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 19 of file class.ilObjCourseAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjCourseAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

Definition at line 72 of file class.ilObjCourseAccess.php.

73 {
74 global $DIC;
75
76 $ilUser = $DIC['ilUser'];
77 $lng = $DIC['lng'];
78 $rbacsystem = $DIC['rbacsystem'];
79 $ilAccess = $DIC['ilAccess'];
80 $ilias = $DIC['ilias'];
81
82 if ($a_user_id == "") {
83 $a_user_id = $ilUser->getId();
84 }
85
86 if ($ilUser->getId() == $a_user_id) {
87 $participants = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $a_user_id);
88 } else {
89 $participants = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
90 }
91
92
93 switch ($a_cmd) {
94 case "view":
95 if ($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id)) {
96 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
97 return false;
98 }
99 break;
100
101 case 'leave':
102
103 // Regular member
104 if ($a_permission == 'leave') {
105 include_once './Modules/Course/classes/class.ilObjCourse.php';
106 $limit = null;
107 if (!ilObjCourse::mayLeave($a_obj_id, $a_user_id, $limit)) {
108 $ilAccess->addInfoItem(
110 sprintf($lng->txt("crs_cancellation_end_rbac_info"), ilDatePresentation::formatDate($limit))
111 );
112 return false;
113 }
114
115 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
116 if (!$participants->isAssigned($a_user_id)) {
117 return false;
118 }
119 }
120 // Waiting list
121 if ($a_permission == 'join') {
122 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
123 if (!ilCourseWaitingList::_isOnList($a_user_id, $a_obj_id)) {
124 return false;
125 }
126 return true;
127 }
128 break;
129
130 case 'join':
131
132 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
133 if (ilCourseWaitingList::_isOnList($a_user_id, $a_obj_id)) {
134 return false;
135 }
136 break;
137 }
138
139 switch ($a_permission) {
140 case 'visible':
141 $visible = null;
142 $active = self::_isActivated($a_obj_id, $visible);
143 $tutor = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
144 if (!$active) {
145 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
146 }
147 if (!$tutor && !$active && !$visible) {
148 return false;
149 }
150 break;
151
152 case 'read':
153 $tutor = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
154 if ($tutor) {
155 return true;
156 }
157 $active = self::_isActivated($a_obj_id);
158 if (!$active) {
159 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
160 return false;
161 }
162 if ($participants->isBlocked($a_user_id) and $participants->isAssigned($a_user_id)) {
163 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("crs_status_blocked"));
164 return false;
165 }
166 break;
167
168 case 'join':
169 if (!self::_registrationEnabled($a_obj_id)) {
170 return false;
171 }
172
173 if ($participants->isAssigned($a_user_id)) {
174 return false;
175 }
176 break;
177
178 case 'leave':
179 include_once './Modules/Course/classes/class.ilObjCourse.php';
180 return ilObjCourse::mayLeave($a_obj_id, $a_user_id);
181 }
182 return true;
183 }
const IL_NO_OBJECT_ACCESS
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static _isActivated($a_obj_id, &$a_visible_flag=null, $a_mind_member_view=true)
Is activated?
static mayLeave($a_course_id, $a_user_id=null, &$a_date=null)
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
$lng

References $DIC, $ilUser, $lng, ilCourseParticipants\_getInstanceByObjId(), ilCourseParticipant\_getInstanceByObjId(), _isActivated(), ilWaitingList\_isOnList(), ilDatePresentation\formatDate(), IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_INFO, and ilObjCourse\mayLeave().

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjCourseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 228 of file class.ilObjCourseAccess.php.

229 {
230 global $DIC;
231
232 $ilAccess = $DIC['ilAccess'];
233 $ilUser = $DIC['ilUser'];
234
235 $t_arr = explode("_", $a_target);
236
237 // registration codes
238 if (substr($t_arr[2], 0, 5) == 'rcode' and $ilUser->getId() != ANONYMOUS_USER_ID) {
239 self::$using_code = true;
240 return true;
241 }
242
243
244 if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0) {
245 return false;
246 }
247
248 // checking for read results in endless loop, if read is given
249 // but visible is not given (-> see bug 5323)
250 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
251 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
252 //if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
253 return true;
254 }
255 return false;
256 }
const ANONYMOUS_USER_ID
Definition: constants.php:25

References $DIC, $ilUser, and ANONYMOUS_USER_ID.

◆ _getCommands()

static ilObjCourseAccess::_getCommands ( )
static

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Reimplemented from ilObjectAccess.

Definition at line 197 of file class.ilObjCourseAccess.php.

198 {
199 $commands = array();
200 $commands[] = array("permission" => "crs_linked", "cmd" => "", "lang_var" => "view", "default" => true);
201
202 $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
203
204 // on waiting list
205 $commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
206
207 // regualar users
208 $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
209
210 include_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
212 include_once './Services/WebDAV/classes/class.ilWebDAVUtil.php';
213 if (ilWebDAVUtil::getInstance()->isLocalPasswordInstructionRequired()) {
214 $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
215 } else {
216 $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
217 }
218 }
219
220 $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
221 $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
222 return $commands;
223 }
static getInstance()
Get singleton instance.

References ilDAVActivationChecker\_isActive(), and ilWebDAVUtil\getInstance().

Referenced by ilObjCourseReferenceAccess\_getCommands(), and ilObjCourseListGUI\init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isActivated()

static ilObjCourseAccess::_isActivated (   $a_obj_id,
$a_visible_flag = null,
  $a_mind_member_view = true 
)
static

Is activated?

See also
ilStartupGUI
Parameters
int$a_obj_id
bool&$a_visible_flag
bool$a_mind_member_view
Returns
boolean

Definition at line 287 of file class.ilObjCourseAccess.php.

288 {
289 // #7669
290 if ($a_mind_member_view) {
291 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
292 if (ilMemberViewSettings::getInstance()->isActive()) {
293 $a_visible_flag = true;
294 return true;
295 }
296 }
297
298 $ref_id = ilObject::_getAllReferences($a_obj_id);
299 $ref_id = array_pop($ref_id);
300
301 $a_visible_flag = true;
302
303 include_once './Services/Object/classes/class.ilObjectActivation.php';
304 $item = ilObjectActivation::getItem($ref_id);
305 switch ($item['timing_type']) {
307 if (time() < $item['timing_start'] or
308 time() > $item['timing_end']) {
309 $a_visible_flag = $item['visible'];
310 return false;
311 }
312 // fallthrough
313
314 // no break
315 default:
316 return true;
317 }
318 }
static getItem($a_ref_id)
Get item data.
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), ilMemberViewSettings\getInstance(), ilObjectActivation\getItem(), and ilObjectActivation\TIMINGS_ACTIVATION.

Referenced by _checkAccess(), ilObjCourse\_isActivated(), _isOffline(), ilPortfolioPageGUI\getCoursesOfUser(), ilObjCourseListGUI\getProperties(), and ilObjCourse\register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isOffline()

static ilObjCourseAccess::_isOffline (   $a_obj_id)
static

Type-specific implementation of general status.

Used in ListGUI and Learning Progress

Parameters
int$a_obj_id
Returns
bool

Reimplemented from ilObjectAccess.

Definition at line 446 of file class.ilObjCourseAccess.php.

447 {
448 $dummy = null;
449 return !self::_isActivated($a_obj_id, $dummy, false);
450 }

References _isActivated().

Referenced by ilObjCourse\register().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupViewMode()

static ilObjCourseAccess::_lookupViewMode (   $a_id)
static

Lookup view mode.

This is placed here to the need that ilObjFolder must always instantiate a Course object.

Returns
Parameters
object$a_id

Definition at line 264 of file class.ilObjCourseAccess.php.

265 {
266 global $DIC;
267
268 $ilDB = $DIC['ilDB'];
269
270 $query = "SELECT view_mode FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
271 $res = $ilDB->query($query);
272 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
273 return $row->view_mode;
274 }
275 return false;
276 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjFolder\getViewMode(), ilObjGroup\getViewMode(), and ilObjGroupGUI\initForm().

+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjCourseAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)
static

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 457 of file class.ilObjCourseAccess.php.

458 {
459 global $DIC;
460
461 $ilUser = $DIC['ilUser'];
462 $lng = $DIC['lng'];
463
464 $lng->loadLanguageModule("crs");
465
467
468 $repository = new ilUserCertificateRepository();
469 $coursePreload = new ilCertificateObjectsForUserPreloader($repository);
470 $coursePreload->preLoad($ilUser->getId(), $a_obj_ids);
471
473 self::$booking_repo = $f->getRepoWithContextObjCache($a_obj_ids);
474 }
static _preloadOnListInfo($a_usr_ids, $a_obj_ids)
Preload on list info.

References $DIC, Vendor\Package\$f, $ilUser, $lng, and ilWaitingList\_preloadOnListInfo().

+ Here is the call graph for this function:

◆ _registrationEnabled()

static ilObjCourseAccess::_registrationEnabled (   $a_obj_id)
static
Returns
Parameters
object$a_obj_id

Definition at line 325 of file class.ilObjCourseAccess.php.

326 {
327 global $DIC;
328
329 $ilDB = $DIC['ilDB'];
330
331 $query = "SELECT * FROM crs_settings " .
332 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
333
334 $res = $ilDB->query($query);
335 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
336 $type = $row->sub_limitation_type;
337 $reg_start = $row->sub_start;
338 $reg_end = $row->sub_end;
339 }
340
341 switch ($type) {
343 return true;
344
346 return false;
347
349 if (time() > $reg_start and
350 time() < $reg_end) {
351 return true;
352 }
353 // no break
354 default:
355 return false;
356 }
357 return false;
358 }
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_SUBSCRIPTION_UNLIMITED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
$type

References $DIC, $ilDB, $query, $res, $type, ilDBConstants\FETCHMODE_OBJECT, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_LIMITED, and IL_CRS_SUBSCRIPTION_UNLIMITED.

Referenced by ilObjCourse\_registrationEnabled().

+ Here is the caller graph for this function:

◆ _usingRegistrationCode()

static ilObjCourseAccess::_usingRegistrationCode ( )
static

Using Registration code.

Returns
bool

Definition at line 491 of file class.ilObjCourseAccess.php.

492 {
493 return self::$using_code;
494 }

References $using_code.

Referenced by ilObjCourse\register().

+ Here is the caller graph for this function:

◆ checkCondition()

static ilObjCourseAccess::checkCondition (   $a_obj_id,
  $a_operator,
  $a_value,
  $a_usr_id 
)
static

@global ilObjUser $ilUser

Parameters
type$a_obj_id
type$a_operator
type$a_value
type$a_usr_id
Returns
boolean

Implements ilConditionHandling.

Definition at line 48 of file class.ilObjCourseAccess.php.

49 {
50 include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
51 include_once './Services/Conditions/classes/class.ilConditionHandler.php';
52
53 switch ($a_operator) {
55 return ilCourseParticipants::_hasPassed($a_obj_id, $a_usr_id);
56 }
57 return false;
58 }
static _hasPassed($a_obj_id, $a_usr_id)
Check if user has passed course.

References ilParticipants\_hasPassed(), and ilConditionHandler\OPERATOR_PASSED.

+ Here is the call graph for this function:

◆ getBookingInfoRepo()

static ilObjCourseAccess::getBookingInfoRepo ( )
static

Get booking info repo.

Returns
ilBookingReservationDBRepository

Definition at line 480 of file class.ilObjCourseAccess.php.

481 {
482 return self::$booking_repo;
483 }

References $booking_repo.

Referenced by ilObjCourseListGUI\getProperties().

+ Here is the caller graph for this function:

◆ getConditionOperators()

static ilObjCourseAccess::getConditionOperators ( )
static

Get operators.

Implements ilConditionHandling.

Definition at line 31 of file class.ilObjCourseAccess.php.

32 {
33 include_once './Services/Conditions/classes/class.ilConditionHandler.php';
34 return array(
36 );
37 }

References ilConditionHandler\OPERATOR_PASSED.

◆ lookupPeriodInfo()

static ilObjCourseAccess::lookupPeriodInfo (   $a_obj_id)
static

Lookup course period info.

Parameters
int$a_obj_id
Returns
array

Definition at line 502 of file class.ilObjCourseAccess.php.

503 {
504 global $DIC;
505
506 $ilDB = $DIC['ilDB'];
507 $lng = $DIC['lng'];
508
509 $start = $end = null;
510 $query = 'SELECT period_start, period_end, period_time_indication FROM crs_settings ' .
511 'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
512
513 $res = $ilDB->query($query);
514 while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
515 if (!$row->period_time_indication) {
516 $start = ($row->period_start
517 ? new \ilDate($row->period_start, IL_CAL_DATETIME)
518 : null);
519 $end = ($row->period_end
520 ? new \ilDate($row->period_end, IL_CAL_DATETIME)
521 : null);
522 } else {
523 $start = ($row->period_start
524 ? new \ilDateTime($row->period_start, IL_CAL_DATETIME, \ilTimeZone::UTC)
525 : null);
526 $end = ($row->period_end
527 ? new \ilDateTime($row->period_end, IL_CAL_DATETIME, \ilTimeZone::UTC)
528 : null);
529 }
530 }
531 if ($start && $end) {
532 $lng->loadLanguageModule('crs');
533
534 return
535 [
536 'crs_start' => $start,
537 'crs_end' => $end,
538 'property' => $lng->txt('crs_period'),
539 'value' => ilDatePresentation::formatPeriod($start, $end)
540 ];
541 }
542 }
const IL_CAL_DATETIME
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.

References $DIC, $ilDB, $lng, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilDatePresentation\formatPeriod(), IL_CAL_DATETIME, and ilTimeZone\UTC.

Referenced by ilCourseMailTemplateMemberContext\getCachedPeriodByObjId(), ilCourseMailTemplateTutorContext\getCachedPeriodByObjId(), and ilObjCourseListGUI\getProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupRegistrationInfo()

static ilObjCourseAccess::lookupRegistrationInfo (   $a_obj_id)
static

Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.

Parameters
int$a_obj_id
Returns
array

Definition at line 368 of file class.ilObjCourseAccess.php.

369 {
370 global $DIC;
371
372 $ilDB = $DIC['ilDB'];
373 $ilUser = $DIC['ilUser'];
374 $lng = $DIC['lng'];
375
376 $query = 'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings ' .
377 'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
378 $res = $ilDB->query($query);
379
380 $info = array();
381 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
382 $info['reg_info_start'] = new ilDateTime($row->sub_start, IL_CAL_UNIX);
383 $info['reg_info_end'] = new ilDateTime($row->sub_end, IL_CAL_UNIX);
384 $info['reg_info_type'] = $row->sub_limitation_type;
385 $info['reg_info_max_members'] = $row->sub_max_members;
386 $info['reg_info_mem_limit'] = $row->sub_mem_limit;
387 }
388
389 $registration_possible = true;
390
391 // Limited registration
392 if ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_LIMITED) {
393 $dt = new ilDateTime(time(), IL_CAL_UNIX);
394 if (ilDateTime::_before($dt, $info['reg_info_start'])) {
395 $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_start');
396 $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
397 } elseif (ilDateTime::_before($dt, $info['reg_info_end'])) {
398 $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_end');
399 $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
400 } else {
401 $registration_possible = false;
402 $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
403 $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
404 }
405 } elseif ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_UNLIMITED) {
406 $registration_possible = true;
407 } else {
408 $registration_possible = false;
409 $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg');
410 $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
411 }
412
413 if ($info['reg_info_mem_limit'] && $info['reg_info_max_members'] && $registration_possible) {
414 // Check for free places
415 include_once './Modules/Course/classes/class.ilCourseParticipant.php';
416 $part = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $ilUser->getId());
417
418 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
419 $info['reg_info_list_size'] = ilCourseWaitingList::lookupListSize($a_obj_id);
420 if ($info['reg_info_list_size']) {
421 $info['reg_info_free_places'] = 0;
422 } else {
423 $info['reg_info_free_places'] = max(0, $info['reg_info_max_members'] - $part->getNumberOfMembers());
424 }
425
426 if ($info['reg_info_free_places']) {
427 $info['reg_info_list_prop_limit']['property'] = $lng->txt('crs_list_reg_limit_places');
428 $info['reg_info_list_prop_limit']['value'] = $info['reg_info_free_places'];
429 } else {
430 $info['reg_info_list_prop_limit']['property'] = '';
431 $info['reg_info_list_prop_limit']['value'] = $lng->txt('crs_list_reg_limit_full');
432 }
433 }
434
435 return $info;
436 }
const IL_CAL_UNIX
@classDescription Date and time handling
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static lookupListSize($a_obj_id)
Lookup waiting lit size.

References $DIC, $ilDB, $ilUser, $lng, $query, $res, ilDateTime\_before(), ilCourseParticipant\_getInstanceByObjId(), ilDBConstants\FETCHMODE_OBJECT, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilWaitingList\lookupListSize(), ilCourseConstants\SUBSCRIPTION_LIMITED, and ilCourseConstants\SUBSCRIPTION_UNLIMITED.

Referenced by ilCourseRegistrationGUI\fillMaxMembers(), ilObjCourseListGUI\getProperties(), and ilObjCourseGUI\infoScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $booking_repo

ilObjCourseAccess::$booking_repo = null
staticprotected

Definition at line 26 of file class.ilObjCourseAccess.php.

Referenced by getBookingInfoRepo().

◆ $using_code

ilObjCourseAccess::$using_code = false
staticprotected

Definition at line 21 of file class.ilObjCourseAccess.php.

Referenced by _usingRegistrationCode().


The documentation for this class was generated from the following file: