19declare(strict_types=0);
40 $this->
access = $DIC->access();
41 $this->
user = $DIC->user();
42 $this->
lng = $DIC->language();
43 $this->rbacSystem =
$DIC->rbac()->system();
62 int $a_trigger_obj_id,
67 switch ($a_operator) {
73 return $self->isObjectiveResultRangeAchieved($a_usr_id, $a_trigger_obj_id, $a_value);
80 $value_arr = unserialize($a_value);
81 if ($value_arr ===
false) {
84 $min_percentage = $value_arr[
'min_percentage'] ?? 0;
85 $max_percentage = $value_arr[
'max_percentage'] ?? 0;
86 $objective = $value_arr[
'objective'] ?? 0;
94 $result_percentage = $user_result[
'result_perc'] ?? 0;
96 ($result_percentage >= $min_percentage) &&
97 ($result_percentage <= $max_percentage);
116 if ($participants->isBlocked(
$user_id) && $participants->isAssigned(
$user_id)) {
117 $this->
access->addInfoItem(
119 $this->
lng->txt(
"crs_status_blocked")
127 if ($permission ==
'leave') {
130 $this->
access->addInfoItem(
133 $this->
lng->txt(
"crs_cancellation_end_rbac_info"),
140 if (!$participants->isAssigned(
$user_id)) {
146 case 'leaveWaitList':
148 if ($permission ==
'join') {
164 switch ($permission) {
167 $active = self::_isActivated($obj_id, $visible);
168 $tutor = $this->rbacSystem->checkAccessOfUser(
$user_id,
'write',
$ref_id);
172 if (!$tutor && !$active && !$visible) {
178 $tutor = $this->rbacSystem->checkAccessOfUser(
$user_id,
'write',
$ref_id);
182 $active = self::_isActivated($obj_id);
187 if ($participants->isBlocked(
$user_id) && $participants->isAssigned(
$user_id)) {
188 $this->
access->addInfoItem(
190 $this->
lng->txt(
"crs_status_blocked")
197 if (!self::_registrationEnabled($obj_id)) {
201 if ($participants->isAssigned(
$user_id)) {
218 $commands[] = array(
"permission" =>
"crs_linked",
"cmd" =>
"",
"lang_var" =>
"view",
"default" =>
true);
220 $commands[] = array(
"permission" =>
"join",
"cmd" =>
"join",
"lang_var" =>
"join");
223 $commands[] = array(
'permission' =>
"join",
"cmd" =>
"leaveWaitList",
"lang_var" =>
"leave_waiting_list");
226 $commands[] = array(
'permission' =>
"leave",
"cmd" =>
"leave",
"lang_var" =>
"crs_unsubscribe");
230 $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
233 $commands[] = array(
"permission" =>
"write",
234 "cmd" =>
"enableAdministrationPanel",
235 "lang_var" =>
"edit_content"
237 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"edit",
"lang_var" =>
"settings");
248 $ilAccess =
$DIC[
'ilAccess'];
249 $ilUser =
$DIC[
'ilUser'];
251 $t_arr = explode(
"_", $target);
254 if (isset($t_arr[2]) && substr($t_arr[2], 0, 5) ==
'rcode' && $ilUser->getId() !=
ANONYMOUS_USER_ID) {
255 self::$using_code =
true;
259 if ($t_arr[0] !=
"crs" || ((
int) $t_arr[1]) <= 0) {
265 if ($ilAccess->checkAccess(
"read",
"", (
int) $t_arr[1]) ||
266 $ilAccess->checkAccess(
"visible",
"", (
int) $t_arr[1])) {
279 $query =
"SELECT view_mode FROM crs_settings WHERE obj_id = " .
$ilDB->quote($a_id,
'integer') .
" ";
282 return $row->view_mode;
287 public static function _isActivated(
int $a_obj_id, ?
bool &$a_visible_flag =
null,
bool $a_mind_member_view =
true): bool
290 if ($a_mind_member_view) {
292 $a_visible_flag =
true;
298 $a_visible_flag =
true;
301 switch ($item[
'timing_type']) {
303 if (time() < $item[
'timing_start'] || time() > $item[
'timing_end']) {
304 $a_visible_flag = $item[
'visible'];
322 $query =
"SELECT * FROM crs_settings " .
323 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
325 $reg_start = $reg_end = 0;
328 $type = $row->sub_limitation_type;
329 $reg_start = $row->sub_start;
330 $reg_end = $row->sub_end;
341 if (time() > $reg_start && time() < $reg_end) {
355 $ilUser =
$DIC->user();
358 $query =
'SELECT sub_limitation_type, sub_start, sub_end, sub_mem_limit, sub_max_members FROM crs_settings ' .
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;
371 $registration_possible =
true;
377 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'crs_list_reg_start');
380 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'crs_list_reg_end');
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');
388 $registration_possible =
true;
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');
395 if ((
$info[
'reg_info_mem_limit'] ??
false) &&
$info[
'reg_info_max_members'] && $registration_possible) {
400 if (
$info[
'reg_info_list_size']) {
401 $info[
'reg_info_free_places'] = 0;
403 $info[
'reg_info_free_places'] = max(0,
$info[
'reg_info_max_members'] - $part->getNumberOfMembers());
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'];
410 $info[
'reg_info_list_prop_limit'][
'property'] =
'';
411 $info[
'reg_info_list_prop_limit'][
'value'] =
$lng->txt(
'crs_list_reg_limit_full');
420 return !self::_isActivated($obj_id, $dummy,
false);
426 public static function _preloadData(array $obj_ids, array $ref_ids): void
430 $ilUser =
$DIC[
'ilUser'];
433 $lng->loadLanguageModule(
"crs");
439 $coursePreload->preLoad($ilUser->getId(), $obj_ids);
441 self::$booking_repo =
$DIC->bookingManager()->internal()->repo()->reservationWithContextObjCache($obj_ids);
446 return self::$booking_repo;
451 return self::$using_code;
461 $start = $end =
null;
462 $query =
'SELECT period_start, period_end, period_time_indication FROM crs_settings ' .
467 if (!$row->period_time_indication) {
468 $start = ($row->period_start
471 $end = ($row->period_end
475 $start = ($row->period_start
478 $end = ($row->period_end
483 if ($start && $end) {
484 $lng->loadLanguageModule(
'crs');
488 'crs_start' => $start,
490 'property' =>
$lng->txt(
'crs_period'),
Repo class for reservations Acts on tables booking_reservation (rw), booking_reservation_group (rw) a...
const IL_NO_OBJECT_ACCESS
const string OPERATOR_RESULT_RANGE_PERCENTAGE
const string OPERATOR_PASSED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_SUBSCRIPTION_UNLIMITED
const SUBSCRIPTION_LIMITED
const SUBSCRIPTION_UNLIMITED
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
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 formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
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.
const TYPE_TEST_QUALIFIED
static lookupResult(int $a_course_obj_id, int $a_user_id, int $a_objective_id, int $a_tst_type)
static lookupRegistrationInfo(int $a_obj_id)
static _registrationEnabled(int $a_obj_id)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
@inheritDoc
static getConditionOperators()
Get operators.
static _preloadData(array $obj_ids, array $ref_ids)
Preload data.
static ILIAS BookingManager Reservations ReservationDBRepository $booking_repo
static _checkGoto(string $target)
@inheritDoc
static _lookupViewMode(int $a_id)
static _usingRegistrationCode()
static lookupPeriodInfo(int $a_obj_id)
static _getCommands()
@inheritDoc
static _isActivated(int $a_obj_id, ?bool &$a_visible_flag=null, bool $a_mind_member_view=true)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
@inheritDoc
isObjectiveResultRangeAchieved(int $user_id, int $trigger_obj_id, string $a_value)
static getBookingInfoRepo()
static _isOffline(int $obj_id)
Type-specific implementation of general status, has to be overwritten if object type does not support...
static mayLeave(int $a_course_id, int $a_user_id=0, &$a_date=null)
static getItem(int $ref_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _hasPassed(int $a_obj_id, int $a_usr_id)
Check if user has passed course.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static lookupListSize(int $a_obj_id)
static _isOnList(int $a_usr_id, int $a_obj_id)
static _preloadOnListInfo(array $a_usr_ids, array $a_obj_ids)
Preload on list info.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Interface for condition handling.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.