3 declare(strict_types=1);
37 public function _checkAccess(
string $cmd,
string $permission,
int $ref_id,
int $obj_id, ?
int $user_id = null): bool
41 $ilUser = $DIC[
'ilUser'];
43 $ilAccess = $DIC[
'ilAccess'];
45 if (is_null($user_id)) {
46 $user_id = $ilUser->getId();
61 if (!self::_registrationEnabled($obj_id)) {
76 if ($permission ==
'leave') {
79 $ilAccess->addInfoItem(
94 if ($permission ==
'join') {
102 switch ($permission) {
115 $commands[] = array(
"permission" =>
"grp_linked",
"cmd" =>
"",
"lang_var" =>
"show",
"default" =>
true);
117 $commands[] = array(
"permission" =>
"join",
"cmd" =>
"join",
"lang_var" =>
"join");
120 $commands[] = array(
'permission' =>
"join",
"cmd" =>
"leaveWaitList",
"lang_var" =>
"leave_waiting_list");
123 $commands[] = array(
'permission' =>
"leave",
"cmd" =>
"leave",
"lang_var" =>
"grp_btn_unsubscribe");
127 $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
130 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"enableAdministrationPanel",
"lang_var" =>
"edit_content");
131 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"edit",
"lang_var" =>
"settings");
143 $ilAccess = $DIC->access();
144 $ilUser = $DIC->user();
146 $t_arr = explode(
"_", $target);
148 if (substr((
string) ($t_arr[2] ??
""), 0, 5) ===
'rcode' and $ilUser->getId() !=
ANONYMOUS_USER_ID) {
149 self::$using_code =
true;
153 if ($t_arr[0] !=
"grp" || ((
int) $t_arr[1]) <= 0) {
157 if ($ilAccess->checkAccess(
"read",
"", (
int) $t_arr[1]) ||
158 $ilAccess->checkAccess(
"visible",
"", (
int) $t_arr[1])) {
168 $ilDB = $DIC->database();
169 $query =
"SELECT * FROM grp_settings " .
170 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
177 $enabled = $row->registration_enabled;
178 $unlimited = $row->registration_unlimited;
179 $start = $row->registration_start;
180 $end = $row->registration_end;
199 public static function _preloadData(array $obj_ids, array $ref_ids): void
203 $ilDB = $DIC->database();
204 $ilUser = $DIC->user();
213 $ilDB = $DIC->database();
214 $lng = $DIC->language();
216 $query =
'SELECT registration_type, registration_enabled, registration_unlimited, registration_start, ' .
217 'registration_end, registration_mem_limit, registration_max_members FROM grp_settings ' .
225 $info[
'reg_info_type'] = $row->registration_type;
226 $info[
'reg_info_mem_limit'] = $row->registration_mem_limit;
227 $info[
'reg_info_unlimited'] = $row->registration_unlimited;
229 $info[
'reg_info_max_members'] = 0;
230 if ($info[
'reg_info_mem_limit']) {
231 $info[
'reg_info_max_members'] = $row->registration_max_members;
234 $info[
'reg_info_enabled'] = $row->registration_enabled;
237 $registration_possible = $info[
'reg_info_enabled'];
240 if (!$info[
'reg_info_unlimited'] && $registration_possible) {
243 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_start');
246 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_end');
249 $registration_possible =
false;
250 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_period');
251 $info[
'reg_info_list_prop'][
'value'] =
$lng->txt(
'grp_list_reg_noreg');
255 if (!$registration_possible) {
256 $registration_possible =
false;
257 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg');
258 $info[
'reg_info_list_prop'][
'value'] =
$lng->txt(
'grp_list_reg_noreg');
262 if ($info[
'reg_info_mem_limit'] && $info[
'reg_info_max_members'] && $registration_possible) {
267 if ($info[
'reg_info_list_size']) {
268 $info[
'reg_info_free_places'] = 0;
270 $info[
'reg_info_free_places'] = max(0, $info[
'reg_info_max_members'] - $part->getCountMembers());
273 if ($info[
'reg_info_free_places']) {
274 $info[
'reg_info_list_prop_limit'][
'property'] =
$lng->txt(
'grp_list_reg_limit_places');
275 $info[
'reg_info_list_prop_limit'][
'value'] = $info[
'reg_info_free_places'];
277 $info[
'reg_info_list_prop_limit'][
'property'] =
'';
278 $info[
'reg_info_list_prop_limit'][
'value'] =
$lng->txt(
'grp_list_reg_limit_full');
294 $ilDB = $DIC->database();
295 $lng = $DIC->language();
297 $start = $end = null;
298 $query =
'SELECT period_start, period_end, period_time_indication FROM grp_settings ' .
303 if (!$row->period_time_indication) {
304 $start = ($row->period_start
307 $end = ($row->period_end
311 $start = ($row->period_start
314 $end = ($row->period_end
319 if ($start && $end) {
320 $lng->loadLanguageModule(
'grp');
324 'property' =>
$lng->txt(
'grp_period'),
333 return self::$using_code;
static lookupRegistrationInfo(int $a_obj_id)
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
static _preloadOnListInfo(array $a_usr_ids, array $a_obj_ids)
Preload on list info.
static lookupPeriodInfo(int $a_obj_id)
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 mayLeave(int $a_group_id, int $a_user_id=null, ?ilDate &$a_date=null)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _registrationEnabled(int $a_obj_id)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
static _checkGoto(string $target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _usingRegistrationCode()
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
static lookupListSize(int $a_obj_id)
static _isOnList(int $a_usr_id, int $a_obj_id)
static _preloadData(array $obj_ids, array $ref_ids)