ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 

Static Public Member Functions

static getConditionOperators ()
 Get operators. More...
 
static checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id)
 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 ilDB $ilDB ilObjUser $ilUser 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 _usingRegistrationCode ()
 Using Registration code. More...
 
static lookupPeriodInfo ($a_obj_id)
 Lookup course period info. More...
 
- Static Public Member Functions inherited from ilObjectAccess
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. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Protected Member Functions

static _isOnline ($a_obj_id)
 Check if online setting is active. More...
 

Static Protected Attributes

static $using_code = false
 

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

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

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

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

◆ _checkGoto()

static ilObjCourseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $ilUser.

254  {
255  global $ilAccess,$ilUser;
256 
257  $t_arr = explode("_", $a_target);
258 
259  // registration codes
260  if(substr($t_arr[2],0,5) == 'rcode' and $ilUser->getId() != ANONYMOUS_USER_ID)
261  {
262  self::$using_code = true;
263  return true;
264  }
265 
266 
267  if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0)
268  {
269  return false;
270  }
271 
272  // checking for read results in endless loop, if read is given
273  // but visible is not given (-> see bug 5323)
274  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
275  $ilAccess->checkAccess("visible", "", $t_arr[1]))
276  //if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
277  {
278  return true;
279  }
280  return false;
281  }
$ilUser
Definition: imgupload.php:18

◆ _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"), );

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

References ilDAVActivationChecker\_isActive(), array, ilFMSettings\getInstance(), and ilDAVUtils\getInstance().

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

208  {
209  $commands = array();
210  $commands[] = array("permission" => "crs_linked", "cmd" => "", "lang_var" => "view", "default" => true);
211 
212  include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
213  if(ilFMSettings::getInstance()->isEnabled())
214  {
215  $commands[] = array(
216  'permission' => 'read',
217  'cmd' => 'fileManagerLaunch',
218  'lang_var' => 'fm_start',
219  'enable_anonymous' => false
220  );
221  }
222 
223  $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
224 
225  // on waiting list
226  $commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
227 
228  // regualar users
229  $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
230 
231  include_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
233  {
234  include_once './Services/WebDAV/classes/class.ilDAVUtils.php';
235  if(ilDAVUtils::getInstance()->isLocalPasswordInstructionRequired())
236  {
237  $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
238  }
239  else
240  {
241  $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
242  }
243  }
244 
245  $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
246  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
247  return $commands;
248  }
static _isActive()
Static getter.
Create styles array
The data for the language used.
static getInstance()
Get singleton instance.
static getInstance()
Get singleton instance.
+ 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 328 of file class.ilObjCourseAccess.php.

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

Referenced by ilObjCourse\_isActivated(), and ilPortfolioPageGUI\getCoursesOfUser().

329  {
330  // #7669
331  if($a_mind_member_view)
332  {
333  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
334  if(ilMemberViewSettings::getInstance()->isActive())
335  {
336  $a_visible_flag = true;
337  return true;
338  }
339  }
340 
341  // offline?
342  if(!self::_isOnline($a_obj_id))
343  {
344  $a_visible_flag = false;
345  return false;
346  }
347 
349  $ref_id = array_pop($ref_id);
350 
351  $a_visible_flag = true;
352 
353  include_once './Services/Object/classes/class.ilObjectActivation.php';
355  switch($item['timing_type'])
356  {
358  if(time() < $item['timing_start'] or
359  time() > $item['timing_end'])
360  {
361  $a_visible_flag = $item['visible'];
362  return false;
363  }
364  // fallthrough
365 
366  default:
367  return true;
368  }
369  }
static getItem($a_ref_id)
Get item data.
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39
static getInstance()
Get instance.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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

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

Referenced by ilObjCourseListGUI\getProperties().

512  {
513  $dummy = null;
514  return !self::_isActivated($a_obj_id, $dummy, false);
515  }
+ Here is the caller graph for this function:

◆ _isOnline()

static ilObjCourseAccess::_isOnline (   $a_obj_id)
staticprotected

Check if online setting is active.

Parameters
int$a_obj_id
Returns
bool

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

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

309  {
310  global $ilDB;
311 
312  $query = "SELECT * FROM crs_settings ".
313  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
314  $res = $ilDB->query($query);
316  return (bool)$row->activation_type;
317  }
global $ilDB

◆ _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 289 of file class.ilObjCourseAccess.php.

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

Referenced by ilObjFolder\getViewMode().

290  {
291  global $ilDB;
292 
293  $query = "SELECT view_mode FROM crs_settings WHERE obj_id = ".$ilDB->quote($a_id ,'integer')." ";
294  $res = $ilDB->query($query);
295  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
296  {
297  return $row->view_mode;
298  }
299  return false;
300  }
global $ilDB
+ 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

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

References $ilUser, $lng, ilCourseCertificateAdapter\_preloadListData(), and ilWaitingList\_preloadOnListInfo().

523  {
524  global $ilUser, $lng;
525 
526  $lng->loadLanguageModule("crs");
527 
528  include_once("./Modules/Course/classes/class.ilCourseWaitingList.php");
529  ilCourseWaitingList::_preloadOnListInfo($ilUser->getId(), $a_obj_ids);
530 
531  include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
532  ilCourseCertificateAdapter::_preloadListData($ilUser->getId(), $a_obj_ids);
533  }
static _preloadOnListInfo($a_usr_ids, $a_obj_ids)
Preload on list info.
static _preloadListData($a_usr_ids, $a_obj_ids)
Get certificate/passed status for all given objects and users.
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ 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 376 of file class.ilObjCourseAccess.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, IL_CRS_SUBSCRIPTION_DEACTIVATED, IL_CRS_SUBSCRIPTION_LIMITED, IL_CRS_SUBSCRIPTION_UNLIMITED, and time.

Referenced by ilObjCourse\_registrationEnabled().

377  {
378  global $ilDB;
379 
380  $query = "SELECT * FROM crs_settings ".
381  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
382 
383  $res = $ilDB->query($query);
384  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
385  {
386  $type = $row->sub_limitation_type;
387  $reg_start = $row->sub_start;
388  $reg_end = $row->sub_end;
389  }
390 
391  switch($type)
392  {
394  return true;
395 
397  return false;
398 
400  if(time() > $reg_start and
401  time() < $reg_end)
402  {
403  return true;
404  }
405  default:
406  return false;
407  }
408  return false;
409  }
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_SUBSCRIPTION_UNLIMITED
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
const IL_CRS_SUBSCRIPTION_DEACTIVATED
+ Here is the caller graph for this function:

◆ _usingRegistrationCode()

static ilObjCourseAccess::_usingRegistrationCode ( )
static

Using Registration code.

Returns
bool

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

Referenced by ilObjCourse\register().

541  {
542  return self::$using_code;
543  }
+ Here is the caller graph for this function:

◆ checkCondition()

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

ilObjUser $ilUser

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

Implements ilConditionHandling.

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

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

45  {
46  include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
47  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
48 
49  switch($a_operator)
50  {
52  return ilCourseParticipants::_hasPassed($a_obj_id,$a_usr_id);
53  }
54  return FALSE;
55  }
static _hasPassed($a_obj_id, $a_usr_id)
Check if user has passed course.
+ Here is the call graph for this function:

◆ getConditionOperators()

static ilObjCourseAccess::getConditionOperators ( )
static

Get operators.

Implements ilConditionHandling.

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

References array, and ilConditionHandler\OPERATOR_PASSED.

28  {
29  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
30  return array(
32  );
33  }
Create styles array
The data for the language used.

◆ lookupPeriodInfo()

static ilObjCourseAccess::lookupPeriodInfo (   $a_obj_id)
static

Lookup course period info.

Parameters
int$a_obj_id
Returns
array

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

References $ilDB, $lng, $query, $row, $start, array, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

Referenced by ilObjCourseListGUI\getProperties().

552  {
553  global $ilDB, $lng;
554 
555  $start = $end = null;
556 
557  $query = 'SELECT crs_start, crs_end FROM crs_settings'.
558  ' WHERE obj_id = '.$ilDB->quote($a_obj_id);
559  $set = $ilDB->query($query);
560  while($row = $ilDB->fetchAssoc($set))
561  {
562  $start = $row['crs_start']
563  ? new ilDate($row['crs_start'], IL_CAL_UNIX)
564  : null;
565  $end = $row['crs_end']
566  ? new ilDate($row['crs_end'], IL_CAL_UNIX)
567  : null;
568  }
569 
570  if($start && $end)
571  {
572  $lng->loadLanguageModule('crs');
573 
574  return array(
575  'property' => $lng->txt('crs_period'),
576  'value' => ilDatePresentation::formatPeriod($start, $end)
577  );
578  }
579  }
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
const IL_CAL_UNIX
Class for single dates.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $ilDB
+ 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 ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.

Parameters
int$a_obj_id
Returns
array

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

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

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

420  {
421  global $ilDB, $ilUser, $lng;
422 
423  $query = 'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings '.
424  'WHERE obj_id = '.$ilDB->quote($a_obj_id);
425  $res = $ilDB->query($query);
426 
427  $info = array();
428  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
429  {
430  $info['reg_info_start'] = new ilDateTime($row->sub_start, IL_CAL_UNIX);
431  $info['reg_info_end'] = new ilDateTime($row->sub_end, IL_CAL_UNIX);
432  $info['reg_info_type'] = $row->sub_limitation_type;
433  $info['reg_info_max_members'] = $row->sub_max_members;
434  $info['reg_info_mem_limit'] = $row->sub_mem_limit;
435  }
436 
437  $registration_possible = true;
438 
439  // Limited registration
440  if($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_LIMITED)
441  {
442  $dt = new ilDateTime(time(),IL_CAL_UNIX);
443  if(ilDateTime::_before($dt, $info['reg_info_start']))
444  {
445  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_start');
446  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
447  }
448  elseif(ilDateTime::_before($dt, $info['reg_info_end']))
449  {
450  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_end');
451  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
452  }
453  else
454  {
455  $registration_possible = false;
456  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
457  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
458  }
459  }
460  else if($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_UNLIMITED)
461  {
462  $registration_possible = true;
463  }
464  else
465  {
466  $registration_possible = false;
467  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
468  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
469  }
470 
471  if($info['reg_info_mem_limit'] && $info['reg_info_max_members'] && $registration_possible)
472  {
473  // Check for free places
474  include_once './Modules/Course/classes/class.ilCourseParticipant.php';
475  $part = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $ilUser->getId());
476 
477  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
478  $info['reg_info_list_size'] = ilCourseWaitingList::lookupListSize($a_obj_id);
479  if($info['reg_info_list_size'])
480  {
481  $info['reg_info_free_places'] = 0;
482  }
483  else
484  {
485  $info['reg_info_free_places'] = max(0,$info['reg_info_max_members'] - $part->getNumberOfMembers());
486  }
487 
488  if($info['reg_info_free_places'])
489  {
490  $info['reg_info_list_prop_limit']['property'] = $lng->txt('crs_list_reg_limit_places');
491  $info['reg_info_list_prop_limit']['value'] = $info['reg_info_free_places'];
492  }
493  else
494  {
495  $info['reg_info_list_prop_limit']['property'] = '';
496  $info['reg_info_list_prop_limit']['value'] = $lng->txt('crs_list_reg_limit_full');
497  }
498  }
499 
500  return $info;
501  }
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.
const IL_CAL_UNIX
$info
Definition: example_052.php:80
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
$ilUser
Definition: imgupload.php:18
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
Create styles array
The data for the language used.
static lookupListSize($a_obj_id)
Lookup waiting lit size.
global $lng
Definition: privfeed.php:17
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $using_code

ilObjCourseAccess::$using_code = false
staticprotected

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


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