ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjCourseAccess Class Reference

Class ilObjCourseAccess. More...

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

Public Member Functions

 __construct ()
 
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static getConditionOperators ()
 Get operators. More...
 
static checkCondition (int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
 
static _getCommands ()
 
static _checkGoto (string $target)
 
static _lookupViewMode (int $a_id)
 
static _isActivated (int $a_obj_id, ?bool &$a_visible_flag=null, bool $a_mind_member_view=true)
 
static _registrationEnabled (int $a_obj_id)
 
static lookupRegistrationInfo (int $a_obj_id)
 
static _isOffline (int $obj_id)
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 
static getBookingInfoRepo ()
 
static _usingRegistrationCode ()
 
static lookupPeriodInfo (int $a_obj_id)
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Protected Member Functions

 isObjectiveResultRangeAchieved (int $user_id, int $trigger_obj_id, string $a_value)
 

Protected Attributes

ilAccessHandler $access
 
ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacSystem
 

Static Protected Attributes

static bool $using_code = false
 
static ILIAS BookingManager Reservations ReservationDBRepository $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 26 of file class.ilObjCourseAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjCourseAccess::__construct ( )

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

37  {
38  global $DIC;
39 
40  $this->access = $DIC->access();
41  $this->user = $DIC->user();
42  $this->lng = $DIC->language();
43  $this->rbacSystem = $DIC->rbac()->system();
44  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjCourseAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

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

References $user_id, ilCourseParticipants\_getInstanceByObjId(), ilCourseParticipant\_getInstanceByObjId(), ilWaitingList\_isOnList(), ILIAS\Repository\access(), ilDatePresentation\formatDate(), ilAccessInfo\IL_NO_OBJECT_ACCESS, ilAccessInfo\IL_STATUS_INFO, ILIAS\Repository\lng(), ilObjCourse\mayLeave(), null, and ILIAS\Repository\user().

103  : bool
104  {
105  if (is_null($user_id)) {
106  $user_id = $this->user->getId();
107  }
108  if ($this->user->getId() === $user_id) {
109  $participants = ilCourseParticipant::_getInstanceByObjId($obj_id, $user_id);
110  } else {
111  $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
112  }
113 
114  switch ($cmd) {
115  case "view":
116  if ($participants->isBlocked($user_id) && $participants->isAssigned($user_id)) {
117  $this->access->addInfoItem(
119  $this->lng->txt("crs_status_blocked")
120  );
121  return false;
122  }
123  break;
124 
125  case 'leave':
126  // Regular member
127  if ($permission == 'leave') {
128  $limit = null;
129  if (!ilObjCourse::mayLeave($obj_id, $user_id, $limit)) {
130  $this->access->addInfoItem(
132  sprintf(
133  $this->lng->txt("crs_cancellation_end_rbac_info"),
135  )
136  );
137  return false;
138  }
139 
140  if (!$participants->isAssigned($user_id)) {
141  return false;
142  }
143  }
144  break;
145 
146  case 'leaveWaitList':
147  // Waiting list
148  if ($permission == 'join') {
149  if (!ilCourseWaitingList::_isOnList($user_id, $obj_id)) {
150  return false;
151  }
152  return true;
153  }
154  break;
155 
156  case 'join':
157 
159  return false;
160  }
161  break;
162  }
163 
164  switch ($permission) {
165  case 'visible':
166  $visible = null;
167  $active = self::_isActivated($obj_id, $visible);
168  $tutor = $this->rbacSystem->checkAccessOfUser($user_id, 'write', $ref_id);
169  if (!$active) {
170  $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
171  }
172  if (!$tutor && !$active && !$visible) {
173  return false;
174  }
175  break;
176 
177  case 'read':
178  $tutor = $this->rbacSystem->checkAccessOfUser($user_id, 'write', $ref_id);
179  if ($tutor) {
180  return true;
181  }
182  $active = self::_isActivated($obj_id);
183  if (!$active) {
184  $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
185  return false;
186  }
187  if ($participants->isBlocked($user_id) && $participants->isAssigned($user_id)) {
188  $this->access->addInfoItem(
190  $this->lng->txt("crs_status_blocked")
191  );
192  return false;
193  }
194  break;
195 
196  case 'join':
197  if (!self::_registrationEnabled($obj_id)) {
198  return false;
199  }
200 
201  if ($participants->isAssigned($user_id)) {
202  return false;
203  }
204  break;
205 
206  case 'leave':
207  return ilObjCourse::mayLeave($obj_id, $user_id);
208  }
209  return true;
210  }
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
static mayLeave(int $a_course_id, int $a_user_id=0, &$a_date=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
static _getInstanceByObjId(int $a_obj_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _isOnList(int $a_usr_id, int $a_obj_id)
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjCourseAccess::_checkGoto ( string  $target)
static

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

References $DIC, and ANONYMOUS_USER_ID.

244  : bool
245  {
246  global $DIC;
247 
248  $ilAccess = $DIC['ilAccess'];
249  $ilUser = $DIC['ilUser'];
250 
251  $t_arr = explode("_", $target);
252 
253  // registration codes
254  if (isset($t_arr[2]) && substr($t_arr[2], 0, 5) == 'rcode' && $ilUser->getId() != ANONYMOUS_USER_ID) {
255  self::$using_code = true;
256  return true;
257  }
258 
259  if ($t_arr[0] != "crs" || ((int) $t_arr[1]) <= 0) {
260  return false;
261  }
262 
263  // checking for read results in endless loop, if read is given
264  // but visible is not given (-> see bug 5323)
265  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
266  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
267  //if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
268  return true;
269  }
270  return false;
271  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: shib_login.php:22

◆ _getCommands()

static ilObjCourseAccess::_getCommands ( )
static

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

References ilDAVActivationChecker\_isActive().

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

215  : array
216  {
217  $commands = array();
218  $commands[] = array("permission" => "crs_linked", "cmd" => "", "lang_var" => "view", "default" => true);
219 
220  $commands[] = array("permission" => "join", "cmd" => "join", "lang_var" => "join");
221 
222  // on waiting list
223  $commands[] = array('permission' => "join", "cmd" => "leaveWaitList", "lang_var" => "leave_waiting_list");
224 
225  // regualar users
226  $commands[] = array('permission' => "leave", "cmd" => "leave", "lang_var" => "crs_unsubscribe");
227 
229  $webdav_obj = new ilObjWebDAV();
230  $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
231  }
232 
233  $commands[] = array("permission" => "write",
234  "cmd" => "enableAdministrationPanel",
235  "lang_var" => "edit_content"
236  );
237  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
238  return $commands;
239  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isActivated()

static ilObjCourseAccess::_isActivated ( int  $a_obj_id,
?bool &  $a_visible_flag = null,
bool  $a_mind_member_view = true 
)
static

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

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

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

287  : bool
288  {
289  // #7669
290  if ($a_mind_member_view) {
291  if (ilMemberViewSettings::getInstance()->isActive()) {
292  $a_visible_flag = true;
293  return true;
294  }
295  }
297  $ref_id = array_pop($ref_id);
298  $a_visible_flag = true;
299 
301  switch ($item['timing_type']) {
303  if (time() < $item['timing_start'] || time() > $item['timing_end']) {
304  $a_visible_flag = $item['visible'];
305  return false;
306  }
307  // fallthrough
308 
309  // no break
310  default:
311  return true;
312  }
313  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
static getItem(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isOffline()

static ilObjCourseAccess::_isOffline ( int  $obj_id)
static

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

References null.

Referenced by ilObjCourse\register().

417  : bool
418  {
419  $dummy = null;
420  return !self::_isActivated($obj_id, $dummy, false);
421  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ _lookupViewMode()

static ilObjCourseAccess::_lookupViewMode ( int  $a_id)
static

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

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ilContainer\VIEW_DEFAULT.

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

273  : int
274  {
275  global $DIC;
276 
277  $ilDB = $DIC->database();
278 
279  $query = "SELECT view_mode FROM crs_settings WHERE obj_id = " . $ilDB->quote($a_id, 'integer') . " ";
280  $res = $ilDB->query($query);
281  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
282  return $row->view_mode;
283  }
285  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjCourseAccess::_preloadData ( array  $obj_ids,
array  $ref_ids 
)
static

Preload data.

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

References $DIC, ilWaitingList\_preloadOnListInfo(), and ilLanguage\loadLanguageModule().

426  : void
427  {
428  global $DIC;
429 
430  $ilUser = $DIC['ilUser'];
431  $lng = $DIC['lng'];
432 
433  $lng->loadLanguageModule("crs");
434 
435  ilCourseWaitingList::_preloadOnListInfo([$ilUser->getId()], $obj_ids);
436 
437  $repository = new ilUserCertificateRepository();
438  $coursePreload = new ilCertificateObjectsForUserPreloader($repository);
439  $coursePreload->preLoad($ilUser->getId(), $obj_ids);
440 
441  self::$booking_repo = $DIC->bookingManager()->internal()->repo()->reservationWithContextObjCache($obj_ids);
442  }
static _preloadOnListInfo(array $a_usr_ids, array $a_obj_ids)
Preload on list info.
loadLanguageModule(string $a_module)
Load language module.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ _registrationEnabled()

static ilObjCourseAccess::_registrationEnabled ( int  $a_obj_id)
static

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

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, ilCourseConstants\IL_CRS_SUBSCRIPTION_DEACTIVATED, ilCourseConstants\IL_CRS_SUBSCRIPTION_LIMITED, ilCourseConstants\IL_CRS_SUBSCRIPTION_UNLIMITED, and null.

Referenced by ilObjCourse\_registrationEnabled().

315  : bool
316  {
317  global $DIC;
318 
319  $ilDB = $DIC->database();
320  $type = null;
321 
322  $query = "SELECT * FROM crs_settings " .
323  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
324 
325  $reg_start = $reg_end = 0;
326  $res = $ilDB->query($query);
327  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
328  $type = $row->sub_limitation_type;
329  $reg_start = $row->sub_start;
330  $reg_end = $row->sub_end;
331  }
332 
333  switch ($type) {
335  return true;
336 
338  return false;
339 
341  if (time() > $reg_start && time() < $reg_end) {
342  return true;
343  }
344  // no break
345  default:
346  return false;
347  }
348  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _usingRegistrationCode()

static ilObjCourseAccess::_usingRegistrationCode ( )
static

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

Referenced by ilObjCourse\register().

449  : bool
450  {
451  return self::$using_code;
452  }
+ Here is the caller graph for this function:

◆ checkCondition()

static ilObjCourseAccess::checkCondition ( int  $a_trigger_obj_id,
string  $a_operator,
string  $a_value,
int  $a_usr_id 
)
static

Implements ilConditionHandling.

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

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

66  : bool {
67  switch ($a_operator) {
69  return ilCourseParticipants::_hasPassed($a_trigger_obj_id, $a_usr_id);
70 
72  $self = new self();
73  return $self->isObjectiveResultRangeAchieved($a_usr_id, $a_trigger_obj_id, $a_value);
74  }
75  return false;
76  }
static _hasPassed(int $a_obj_id, int $a_usr_id)
Check if user has passed course.
+ Here is the call graph for this function:

◆ getBookingInfoRepo()

static ilObjCourseAccess::getBookingInfoRepo ( )
static

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

Referenced by ilObjCourseListGUI\getProperties().

445  {
446  return self::$booking_repo;
447  }
Repo class for reservations Acts on tables booking_reservation (rw), booking_reservation_group (rw) a...
+ Here is the caller graph for this function:

◆ getConditionOperators()

static ilObjCourseAccess::getConditionOperators ( )
static

Get operators.

Returns
string[]

Implements ilConditionHandling.

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

References ilConditionHandler\OPERATOR_PASSED, and ilConditionHandler\OPERATOR_RESULT_RANGE_PERCENTAGE.

◆ isObjectiveResultRangeAchieved()

ilObjCourseAccess::isObjectiveResultRangeAchieved ( int  $user_id,
int  $trigger_obj_id,
string  $a_value 
)
protected

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

References ilLOUserResults\lookupResult(), and ilLOSettings\TYPE_TEST_QUALIFIED.

78  : bool
79  {
80  $value_arr = unserialize($a_value);
81  if ($value_arr === false) {
82  return false;
83  }
84  $min_percentage = $value_arr['min_percentage'] ?? 0;
85  $max_percentage = $value_arr['max_percentage'] ?? 0;
86  $objective = $value_arr['objective'] ?? 0;
87 
88  $user_result = ilLOUserResults::lookupResult(
89  $trigger_obj_id,
90  $user_id,
91  $objective,
93  );
94  $result_percentage = $user_result['result_perc'] ?? 0;
95  return
96  ($result_percentage >= $min_percentage) &&
97  ($result_percentage <= $max_percentage);
98  }
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
+ Here is the call graph for this function:

◆ lookupPeriodInfo()

static ilObjCourseAccess::lookupPeriodInfo ( int  $a_obj_id)
static

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

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, ilDatePresentation\formatPeriod(), IL_CAL_DATETIME, ilLanguage\loadLanguageModule(), null, ilDBConstants\T_INTEGER, ilLanguage\txt(), and ilTimeZone\UTC.

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

454  : array
455  {
456  global $DIC;
457 
458  $ilDB = $DIC->database();
459  $lng = $DIC->language();
460 
461  $start = $end = null;
462  $query = 'SELECT period_start, period_end, period_time_indication FROM crs_settings ' .
463  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, ilDBConstants::T_INTEGER);
464 
465  $res = $ilDB->query($query);
466  while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
467  if (!$row->period_time_indication) {
468  $start = ($row->period_start
469  ? new \ilDate($row->period_start, IL_CAL_DATETIME)
470  : null);
471  $end = ($row->period_end
472  ? new \ilDate($row->period_end, IL_CAL_DATETIME)
473  : null);
474  } else {
475  $start = ($row->period_start
476  ? new \ilDateTime($row->period_start, IL_CAL_DATETIME, \ilTimeZone::UTC)
477  : null);
478  $end = ($row->period_end
479  ? new \ilDateTime($row->period_end, IL_CAL_DATETIME, \ilTimeZone::UTC)
480  : null);
481  }
482  }
483  if ($start && $end) {
484  $lng->loadLanguageModule('crs');
485 
486  return
487  [
488  'crs_start' => $start,
489  'crs_end' => $end,
490  'property' => $lng->txt('crs_period'),
491  'value' => ilDatePresentation::formatPeriod($start, $end)
492  ];
493  }
494  return [];
495  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupRegistrationInfo()

static ilObjCourseAccess::lookupRegistrationInfo ( int  $a_obj_id)
static

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

References $DIC, $ilDB, $res, ilDateTime\_before(), ilCourseParticipant\_getInstanceByObjId(), ilDBConstants\FETCHMODE_OBJECT, ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\int(), ilWaitingList\lookupListSize(), ilCourseConstants\SUBSCRIPTION_LIMITED, ilCourseConstants\SUBSCRIPTION_UNLIMITED, ilDBConstants\T_INTEGER, and ilLanguage\txt().

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

350  : array
351  {
352  global $DIC;
353 
354  $ilDB = $DIC->database();
355  $ilUser = $DIC->user();
356  $lng = $DIC->language();
357 
358  $query = 'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings ' .
359  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, ilDBConstants::T_INTEGER);
360  $res = $ilDB->query($query);
361 
362  $info = array();
363  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
364  $info['reg_info_start'] = new ilDateTime($row->sub_start, IL_CAL_UNIX);
365  $info['reg_info_end'] = new ilDateTime($row->sub_end, IL_CAL_UNIX);
366  $info['reg_info_type'] = (int) $row->sub_limitation_type;
367  $info['reg_info_max_members'] = (int) $row->sub_max_members;
368  $info['reg_info_mem_limit'] = (int) $row->sub_mem_limit;
369  }
370 
371  $registration_possible = true;
372 
373  // Limited registration
374  if (($info['reg_info_type'] ?? 0) == ilCourseConstants::SUBSCRIPTION_LIMITED) {
375  $dt = new ilDateTime(time(), IL_CAL_UNIX);
376  if (ilDateTime::_before($dt, $info['reg_info_start'])) {
377  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_start');
378  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_start']);
379  } elseif (ilDateTime::_before($dt, $info['reg_info_end'])) {
380  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_end');
381  $info['reg_info_list_prop']['value'] = ilDatePresentation::formatDate($info['reg_info_end']);
382  } else {
383  $registration_possible = false;
384  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg_period');
385  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
386  }
387  } elseif (($info['reg_info_type'] ?? 0) == ilCourseConstants::SUBSCRIPTION_UNLIMITED) {
388  $registration_possible = true;
389  } else {
390  $registration_possible = false;
391  $info['reg_info_list_prop']['property'] = $lng->txt('crs_list_reg');
392  $info['reg_info_list_prop']['value'] = $lng->txt('crs_list_reg_noreg');
393  }
394 
395  if (($info['reg_info_mem_limit'] ?? false) && $info['reg_info_max_members'] && $registration_possible) {
396  // Check for free places
397  $part = ilCourseParticipant::_getInstanceByObjId($a_obj_id, $ilUser->getId());
398 
399  $info['reg_info_list_size'] = ilCourseWaitingList::lookupListSize($a_obj_id);
400  if ($info['reg_info_list_size']) {
401  $info['reg_info_free_places'] = 0;
402  } else {
403  $info['reg_info_free_places'] = max(0, $info['reg_info_max_members'] - $part->getNumberOfMembers());
404  }
405 
406  if ($info['reg_info_free_places']) {
407  $info['reg_info_list_prop_limit']['property'] = $lng->txt('crs_list_reg_limit_places');
408  $info['reg_info_list_prop_limit']['value'] = $info['reg_info_free_places'];
409  } else {
410  $info['reg_info_list_prop_limit']['property'] = '';
411  $info['reg_info_list_prop_limit']['value'] = $lng->txt('crs_list_reg_limit_full');
412  }
413  }
414  return $info;
415  }
$res
Definition: ltiservices.php:66
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
const IL_CAL_UNIX
global $DIC
Definition: shib_login.php:22
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static lookupListSize(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjCourseAccess::$access
protected

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

◆ $booking_repo

ILIAS BookingManager Reservations ReservationDBRepository ilObjCourseAccess::$booking_repo = null
staticprotected

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

◆ $lng

ilLanguage ilObjCourseAccess::$lng
protected

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

◆ $rbacSystem

ilRbacSystem ilObjCourseAccess::$rbacSystem
protected

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

◆ $user

ilObjUser ilObjCourseAccess::$user
protected

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

◆ $using_code

bool ilObjCourseAccess::$using_code = false
staticprotected

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


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