ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 

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 getBookingInfoRepo ()
 Get booking info repo. 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 if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. 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

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

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

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)
Get singleton instance.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
$lng
$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)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjCourseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $DIC, and $ilUser.

239  {
240  global $DIC;
241 
242  $ilAccess = $DIC['ilAccess'];
243  $ilUser = $DIC['ilUser'];
244 
245  $t_arr = explode("_", $a_target);
246 
247  // registration codes
248  if (substr($t_arr[2], 0, 5) == 'rcode' and $ilUser->getId() != ANONYMOUS_USER_ID) {
249  self::$using_code = true;
250  return true;
251  }
252 
253 
254  if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0) {
255  return false;
256  }
257 
258  // checking for read results in endless loop, if read is given
259  // but visible is not given (-> see bug 5323)
260  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
261  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
262  //if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
263  return true;
264  }
265  return false;
266  }
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

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

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

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

198  {
199  $commands = array();
200  $commands[] = array("permission" => "crs_linked", "cmd" => "", "lang_var" => "view", "default" => true);
201 
202  include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
203  if (ilFMSettings::getInstance()->isEnabled()) {
204  $commands[] = array(
205  'permission' => 'read',
206  'cmd' => 'fileManagerLaunch',
207  'lang_var' => 'fm_start',
208  'enable_anonymous' => false
209  );
210  }
211 
212  $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
213 
214  // on waiting list
215  $commands[] = array('permission' => "join", "cmd" => "leave", "lang_var" => "leave_waiting_list");
216 
217  // regualar users
218  $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
219 
220  include_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
222  include_once './Services/WebDAV/classes/class.ilWebDAVUtil.php';
223  if (ilWebDAVUtil::getInstance()->isLocalPasswordInstructionRequired()) {
224  $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
225  } else {
226  $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
227  }
228  }
229 
230  $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
231  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
232  return $commands;
233  }
static _isActive()
Static getter.
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 297 of file class.ilObjCourseAccess.php.

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

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

298  {
299  // #7669
300  if ($a_mind_member_view) {
301  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
302  if (ilMemberViewSettings::getInstance()->isActive()) {
303  $a_visible_flag = true;
304  return true;
305  }
306  }
307 
308  $ref_id = ilObject::_getAllReferences($a_obj_id);
309  $ref_id = array_pop($ref_id);
310 
311  $a_visible_flag = true;
312 
313  include_once './Services/Object/classes/class.ilObjectActivation.php';
314  $item = ilObjectActivation::getItem($ref_id);
315  switch ($item['timing_type']) {
317  if (time() < $item['timing_start'] or
318  time() > $item['timing_end']) {
319  $a_visible_flag = $item['visible'];
320  return false;
321  }
322  // fallthrough
323 
324  // no break
325  default:
326  return true;
327  }
328  }
static getItem($a_ref_id)
Get item data.
static _getAllReferences($a_id)
get all reference ids of object
+ 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 456 of file class.ilObjCourseAccess.php.

Referenced by ilObjCourse\register().

457  {
458  $dummy = null;
459  return !self::_isActivated($a_obj_id, $dummy, false);
460  }
+ 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 274 of file class.ilObjCourseAccess.php.

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

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

275  {
276  global $DIC;
277 
278  $ilDB = $DIC['ilDB'];
279 
280  $query = "SELECT view_mode FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
281  $res = $ilDB->query($query);
282  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
283  return $row->view_mode;
284  }
285  return false;
286  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 467 of file class.ilObjCourseAccess.php.

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

468  {
469  global $DIC;
470 
471  $ilUser = $DIC['ilUser'];
472  $lng = $DIC['lng'];
473 
474  $lng->loadLanguageModule("crs");
475 
476  ilCourseWaitingList::_preloadOnListInfo($ilUser->getId(), $a_obj_ids);
477 
478  $repository = new ilUserCertificateRepository();
479  $coursePreload = new ilCertificateObjectsForUserPreloader($repository);
480  $coursePreload->preLoad($ilUser->getId(), $a_obj_ids);
481 
483  self::$booking_repo = $f->getRepoWithContextObjCache($a_obj_ids);
484  }
static _preloadOnListInfo($a_usr_ids, $a_obj_ids)
Preload on list info.
$lng
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ 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 335 of file class.ilObjCourseAccess.php.

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().

336  {
337  global $DIC;
338 
339  $ilDB = $DIC['ilDB'];
340 
341  $query = "SELECT * FROM crs_settings " .
342  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
343 
344  $res = $ilDB->query($query);
345  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
346  $type = $row->sub_limitation_type;
347  $reg_start = $row->sub_start;
348  $reg_end = $row->sub_end;
349  }
350 
351  switch ($type) {
353  return true;
354 
356  return false;
357 
359  if (time() > $reg_start and
360  time() < $reg_end) {
361  return true;
362  }
363  // no break
364  default:
365  return false;
366  }
367  return false;
368  }
const IL_CRS_SUBSCRIPTION_LIMITED
$type
foreach($_POST as $key=> $value) $res
const IL_CRS_SUBSCRIPTION_UNLIMITED
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
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 501 of file class.ilObjCourseAccess.php.

Referenced by ilObjCourse\register().

502  {
503  return self::$using_code;
504  }
+ 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 48 of file class.ilObjCourseAccess.php.

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

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.
+ Here is the call graph for this function:

◆ getBookingInfoRepo()

static ilObjCourseAccess::getBookingInfoRepo ( )
static

Get booking info repo.

Returns
ilBookingReservationDBRepository

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

Referenced by ilObjCourseListGUI\getProperties().

491  {
492  return self::$booking_repo;
493  }
+ 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.

References ilConditionHandler\OPERATOR_PASSED.

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

◆ lookupPeriodInfo()

static ilObjCourseAccess::lookupPeriodInfo (   $a_obj_id)
static

Lookup course period info.

Parameters
int$a_obj_id
Returns
array

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

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().

513  {
514  global $DIC;
515 
516  $ilDB = $DIC['ilDB'];
517  $lng = $DIC['lng'];
518 
519  $start = $end = null;
520  $query = 'SELECT period_start, period_end, period_time_indication FROM crs_settings ' .
521  'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
522 
523  $res = $ilDB->query($query);
524  while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
525  if (!$row->period_time_indication) {
526  $start = ($row->period_start
527  ? new \ilDate($row->period_start, IL_CAL_DATETIME)
528  : null);
529  $end = ($row->period_end
530  ? new \ilDate($row->period_end, IL_CAL_DATETIME)
531  : null);
532  } else {
533  $start = ($row->period_start
534  ? new \ilDateTime($row->period_start, IL_CAL_DATETIME, \ilTimeZone::UTC)
535  : null);
536  $end = ($row->period_end
537  ? new \ilDateTime($row->period_end, IL_CAL_DATETIME, \ilTimeZone::UTC)
538  : null);
539  }
540  }
541  if ($start && $end) {
542  $lng->loadLanguageModule('crs');
543 
544  return
545  [
546  'crs_start' => $start,
547  'crs_end' => $end,
548  'property' => $lng->txt('crs_period'),
549  'value' => ilDatePresentation::formatPeriod($start, $end)
550  ];
551  }
552  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
$lng
$query
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 378 of file class.ilObjCourseAccess.php.

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().

379  {
380  global $DIC;
381 
382  $ilDB = $DIC['ilDB'];
383  $ilUser = $DIC['ilUser'];
384  $lng = $DIC['lng'];
385 
386  $query = 'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings ' .
387  'WHERE obj_id = ' . $ilDB->quote($a_obj_id);
388  $res = $ilDB->query($query);
389 
390  $info = array();
391  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
392  $info['reg_info_start'] = new ilDateTime($row->sub_start, IL_CAL_UNIX);
393  $info['reg_info_end'] = new ilDateTime($row->sub_end, IL_CAL_UNIX);
394  $info['reg_info_type'] = $row->sub_limitation_type;
395  $info['reg_info_max_members'] = $row->sub_max_members;
396  $info['reg_info_mem_limit'] = $row->sub_mem_limit;
397  }
398 
399  $registration_possible = true;
400 
401  // Limited registration
402  if ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_LIMITED) {
403  $dt = new ilDateTime(time(), IL_CAL_UNIX);
404  if (ilDateTime::_before($dt, $info['reg_info_start'])) {
405  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_start');
406  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
407  } elseif (ilDateTime::_before($dt, $info['reg_info_end'])) {
408  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_end');
409  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
410  } else {
411  $registration_possible = false;
412  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
413  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
414  }
415  } elseif ($info['reg_info_type'] == ilCourseConstants::SUBSCRIPTION_UNLIMITED) {
416  $registration_possible = true;
417  } else {
418  $registration_possible = false;
419  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg');
420  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
421  }
422 
423  if ($info['reg_info_mem_limit'] && $info['reg_info_max_members'] && $registration_possible) {
424  // Check for free places
425  include_once './Modules/Course/classes/class.ilCourseParticipant.php';
426  $part = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $ilUser->getId());
427 
428  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
429  $info['reg_info_list_size'] = ilCourseWaitingList::lookupListSize($a_obj_id);
430  if ($info['reg_info_list_size']) {
431  $info['reg_info_free_places'] = 0;
432  } else {
433  $info['reg_info_free_places'] = max(0, $info['reg_info_max_members'] - $part->getNumberOfMembers());
434  }
435 
436  if ($info['reg_info_free_places']) {
437  $info['reg_info_list_prop_limit']['property'] = $lng->txt('crs_list_reg_limit_places');
438  $info['reg_info_list_prop_limit']['value'] = $info['reg_info_free_places'];
439  } else {
440  $info['reg_info_list_prop_limit']['property'] = '';
441  $info['reg_info_list_prop_limit']['value'] = $lng->txt('crs_list_reg_limit_full');
442  }
443  }
444 
445  return $info;
446  }
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
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
foreach($_POST as $key=> $value) $res
$lng
$ilUser
Definition: imgupload.php:18
$query
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static lookupListSize($a_obj_id)
Lookup waiting lit size.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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.

◆ $using_code

ilObjCourseAccess::$using_code = false
staticprotected

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


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