3 declare(strict_types=1);
44 $next_class = $this->
ctrl->getNextClass($this);
46 if (!$this->
access->checkAccess(
'join',
'', $this->getRefId())) {
47 $this->
ctrl->redirectByClass(ilObjGroupGUI::class,
'infoScreen');
51 $this->
tabs->activateTab(
'leave');
54 switch ($next_class) {
56 $cmd = $this->
ctrl->getCmd(
"show");
66 return $this->
lng->txt(
'member_status');
68 return $this->
lng->txt(
'grp_registration');
73 if ($this->container->getInformation()) {
76 $imp->setValue($value);
77 $this->
form->addItem($imp);
88 if ($this->container->isRegistrationUnlimited()) {
91 $this->
form->addItem($reg);
95 $start = $this->container->getRegistrationStart();
96 $end = $this->container->getRegistrationEnd();
100 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
107 $warning = $this->
lng->txt(
'mem_reg_not_started');
109 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
116 $warning = $this->
lng->txt(
'mem_reg_expired');
118 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
125 if (strlen($warning)) {
128 #$reg->setAlert($warning); 129 $this->tpl->setOnScreenMessage(
'failure', $warning);
131 $this->
form->addItem($reg);
142 if (!$this->container->isMembershipLimited()) {
146 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
148 if ($this->container->getMinMembers()) {
153 if ($this->container->getMaxMembers()) {
159 $free = $reg_info[
'reg_info_free_places'];
171 $this->container->isWaitingListEnabled() and
172 $this->container->isMembershipLimited() and
189 !$this->container->isWaitingListEnabled()) {
192 $alert = $this->
lng->txt(
'mem_alert_no_places');
194 $this->container->isWaitingListEnabled() and
195 $this->container->isMembershipLimited() and
201 $this->container->isWaitingListEnabled() and
202 $this->container->isMembershipLimited()) {
203 $alert = $this->
lng->txt(
'grp_warn_no_max_set_on_waiting_list');
206 $this->container->isWaitingListEnabled() and
207 $this->container->isMembershipLimited() and
209 $alert = $this->
lng->txt(
'grp_warn_wl_set_on_waiting_list');
215 if (strlen($alert)) {
216 #$max->setAlert($alert); 217 $this->tpl->setOnScreenMessage(
'failure', $alert);
219 $this->
form->addItem($max);
228 switch ($this->container->getRegistrationType()) {
231 $reg->
setValue($this->
lng->txt(
'grp_reg_disabled'));
232 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert')); 233 $this->
form->addItem($reg);
242 $txt->setValue($this->
lng->txt(
'grp_pass_request'));
246 $pass->setInputType(
'password');
248 $pass->setMaxLength(32);
249 #$pass->setRequired(true); 250 $pass->setInfo($this->
lng->txt(
'group_password_registration_msg'));
252 $txt->addSubItem($pass);
264 $txt->setValue($this->
lng->txt(
'grp_reg_request'));
268 if ($this->
http->wrapper()->post()->has(
'subject')) {
269 $subject = $this->
http->wrapper()->post()->retrieve(
271 $this->
refinery->kindlyTo()->string()
274 $sub->setValue($subject);
275 $sub->setInfo($this->
lng->txt(
'group_req_registration_msg'));
278 if ($this->participants->isSubscriber($this->user->getId())) {
279 $sub_data = $this->participants->getSubscriberData($this->
user->getId());
280 $sub->setValue($sub_data[
'subject']);
282 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'grp_already_assigned'));
285 $txt->addSubItem($sub);
297 $txt->setValue($this->
lng->txt(
'group_req_direct'));
311 parent::addCommandButtons();
312 switch ($this->container->getRegistrationType()) {
314 if ($this->participants->isSubscriber($this->user->getId())) {
315 $this->
form->clearCommandButtons();
316 $this->
form->addCommandButton(
'updateSubscriptionRequest', $this->
lng->txt(
'grp_update_subscr_request'));
317 $this->
form->addCommandButton(
'cancelSubscriptionRequest', $this->
lng->txt(
'grp_cancel_subscr_request'));
322 $this->
form->clearCommandButtons();
323 $this->
form->addCommandButton(
'join', $this->
lng->txt(
'grp_join_request'));
324 $this->
form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
339 $this->join_error = $this->
lng->txt(
'permission_denied');
344 $this->join_error = $this->
lng->txt(
'mem_error_preconditions');
349 if ($this->
http->wrapper()->post()->has(
'grp_passw')) {
350 $password = $this->
http->wrapper()->post()->retrieve(
352 $this->
refinery->kindlyTo()->string()
355 if (!strlen($password)) {
356 $this->join_error = $this->
lng->txt(
'err_wrong_password');
359 if (strcmp($password, $this->container->getPassword()) !== 0) {
360 $this->join_error = $this->
lng->txt(
'err_wrong_password');
365 $this->join_error = $this->
lng->txt(
'fill_out_all_required_fields');
369 $this->join_error = $this->
lng->txt($this->type .
'_agreement_required');
379 protected function add(): void
384 $free = max(0, $this->container->getMaxMembers() - $this->participants->getCountMembers());
387 $this->container->isMembershipLimited() and
388 $this->container->isWaitingListEnabled() and
389 (!$free or $waiting_list->getCountUsers())) {
392 $this->
lng->txt(
'grp_added_to_list'),
393 $this->container->getTitle(),
394 $waiting_list->getPosition($this->
user->getId())
397 $this->participants->sendNotification(
401 $this->tpl->setOnScreenMessage(
'success', $info,
true);
402 $this->
ctrl->setParameterByClass(
405 $this->tree->getParentId($this->container->getRefId())
407 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
410 switch ($this->container->getRegistrationType()) {
413 $this->participants->addSubscriber($this->
user->getId());
414 $this->participants->updateSubscriptionTime($this->
user->getId(), time());
416 if ($this->
http->wrapper()->post()->has(
'subject')) {
417 $subject = $this->
http->wrapper()->post()->retrieve(
419 $this->
refinery->kindlyTo()->string()
422 $this->participants->updateSubject($this->
user->getId(), $subject);
423 $this->participants->sendNotification(
428 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"application_completed"),
true);
429 $this->
ctrl->setParameterByClass(
432 $this->tree->getParentId($this->container->getRefId())
434 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
440 $this->participants->sendNotification(
444 $this->participants->sendNotification(
452 if (!$pending_goto) {
453 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"grp_registration_completed"),
true);
454 $this->
ctrl->returnToParent($this);
456 $tgt = $pending_goto;
491 static $active = null;
493 if ($active !== null) {
496 if (!$this->container->getMaxMembers()) {
497 return $active =
false;
500 !$this->container->isWaitingListEnabled() or
501 !$this->container->isMembershipLimited()) {
502 return $active =
false;
505 $free = max(0, $this->container->getMaxMembers() - $this->participants->getCountMembers());
506 return $active = (!$free or $this->
getWaitingList()->getCountUsers());
static get(string $a_var)
static lookupRegistrationInfo(int $a_obj_id)
const TYPE_NOTIFICATION_REGISTRATION_REQUEST
getPosition(int $a_usr_id)
const GRP_REGISTRATION_DEACTIVATED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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_SUBSCRIBE_MEMBER
getWaitingList()
Get waiting list object.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
const GRP_REGISTRATION_REQUEST
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NOTIFICATION_REGISTRATION
setAccepted(bool $a_status)
const TYPE_WAITING_LIST_MEMBER
static http()
Fetches the global http state from ILIAS.
const GRP_REGISTRATION_PASSWORD
addCommandButtons()
Add group specific command buttons.
enableRegistration(bool $a_status)
ilGlobalTemplateInterface $tpl
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.
fillRegistrationPeriod()
show information about the registration period
ilWaitingList $waiting_list
const GRP_REGISTRATION_DIRECT
GUI class for group registrations.
initParticipants()
Init course participants.
form( $class_path, string $cmd)
ilParticipants $participants
static redirect(string $a_script)
fillMaxMembers()
fill max member information protected
Base class for course and group participants.
__construct(ilObject $a_container)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
validate()
validate join request protected
static makeClickable(string $a_text, bool $detectGotoLinks=false)
static clear(string $a_var)
static checkForumsExistsInsert(int $ref_id, int $user_id)