3 declare(strict_types=1);
37 public function _checkAccess(
string $cmd,
string $permission,
int $ref_id,
int $obj_id, ?
int $user_id = null): bool
43 $ilAccess = $DIC[
'ilAccess'];
45 if (is_null($user_id)) {
61 if (!self::_registrationEnabled($obj_id)) {
76 if ($permission ==
'leave') {
79 $ilAccess->addInfoItem(
94 if ($permission ==
'join') {
103 switch ($permission) {
116 $commands[] = array(
"permission" =>
"grp_linked",
"cmd" =>
"",
"lang_var" =>
"show",
"default" =>
true);
118 $commands[] = array(
"permission" =>
"join",
"cmd" =>
"join",
"lang_var" =>
"join");
121 $commands[] = array(
'permission' =>
"join",
"cmd" =>
"leaveWaitList",
"lang_var" =>
"leave_waiting_list");
124 $commands[] = array(
'permission' =>
"leave",
"cmd" =>
"leave",
"lang_var" =>
"grp_btn_unsubscribe");
128 $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
131 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"enableAdministrationPanel",
"lang_var" =>
"edit_content");
132 $commands[] = array(
"permission" =>
"write",
"cmd" =>
"edit",
"lang_var" =>
"settings");
144 $ilAccess = $DIC->access();
147 $t_arr = explode(
"_", $target);
150 self::$using_code =
true;
154 if ($t_arr[0] !=
"grp" || ((
int) $t_arr[1]) <= 0) {
158 if ($ilAccess->checkAccess(
"read",
"", (
int) $t_arr[1]) ||
159 $ilAccess->checkAccess(
"visible",
"", (
int) $t_arr[1])) {
169 $ilDB = $DIC->database();
170 $query =
"SELECT * FROM grp_settings " .
171 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
178 $enabled = $row->registration_enabled;
179 $unlimited = $row->registration_unlimited;
180 $start = $row->registration_start;
181 $end = $row->registration_end;
200 public static function _preloadData(array $obj_ids, array $ref_ids): void
204 $ilDB = $DIC->database();
214 $ilDB = $DIC->database();
215 $lng = $DIC->language();
217 $query =
'SELECT registration_type, registration_enabled, registration_unlimited, registration_start, ' .
218 'registration_end, registration_mem_limit, registration_max_members FROM grp_settings ' .
226 $info[
'reg_info_type'] = $row->registration_type;
227 $info[
'reg_info_mem_limit'] = $row->registration_mem_limit;
228 $info[
'reg_info_unlimited'] = $row->registration_unlimited;
230 $info[
'reg_info_max_members'] = 0;
231 if ($info[
'reg_info_mem_limit']) {
232 $info[
'reg_info_max_members'] = $row->registration_max_members;
235 $info[
'reg_info_enabled'] = $row->registration_enabled;
238 $registration_possible = $info[
'reg_info_enabled'];
241 if (!$info[
'reg_info_unlimited'] && $registration_possible) {
244 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_start');
247 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_end');
250 $registration_possible =
false;
251 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg_period');
252 $info[
'reg_info_list_prop'][
'value'] =
$lng->txt(
'grp_list_reg_noreg');
256 if (!$registration_possible) {
257 $registration_possible =
false;
258 $info[
'reg_info_list_prop'][
'property'] =
$lng->txt(
'grp_list_reg');
259 $info[
'reg_info_list_prop'][
'value'] =
$lng->txt(
'grp_list_reg_noreg');
263 if ($info[
'reg_info_mem_limit'] && $info[
'reg_info_max_members'] && $registration_possible) {
268 if ($info[
'reg_info_list_size']) {
269 $info[
'reg_info_free_places'] = 0;
271 $info[
'reg_info_free_places'] = max(0, $info[
'reg_info_max_members'] - $part->getCountMembers());
274 if ($info[
'reg_info_free_places']) {
275 $info[
'reg_info_list_prop_limit'][
'property'] =
$lng->txt(
'grp_list_reg_limit_places');
276 $info[
'reg_info_list_prop_limit'][
'value'] = $info[
'reg_info_free_places'];
278 $info[
'reg_info_list_prop_limit'][
'property'] =
'';
279 $info[
'reg_info_list_prop_limit'][
'value'] =
$lng->txt(
'grp_list_reg_limit_full');
295 $ilDB = $DIC->database();
296 $lng = $DIC->language();
298 $start = $end = null;
299 $query =
'SELECT period_start, period_end, period_time_indication FROM grp_settings ' .
304 if (!$row->period_time_indication) {
305 $start = ($row->period_start
308 $end = ($row->period_end
312 $start = ($row->period_start
315 $end = ($row->period_end
320 if ($start && $end) {
321 $lng->loadLanguageModule(
'grp');
325 'property' =>
$lng->txt(
'grp_period'),
334 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)