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()) {
90 $reg->setValue($this->
lng->txt(
'mem_unlimited'));
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'));
310 parent::addCommandButtons();
311 switch ($this->container->getRegistrationType()) {
313 if ($this->participants->isSubscriber($this->user->getId())) {
314 $this->
form->clearCommandButtons();
315 $this->
form->addCommandButton(
'updateSubscriptionRequest', $this->
lng->txt(
'grp_update_subscr_request'));
316 $this->
form->addCommandButton(
'cancelSubscriptionRequest', $this->
lng->txt(
'grp_cancel_subscr_request'));
321 $this->
form->clearCommandButtons();
322 $this->
form->addCommandButton(
'join', $this->
lng->txt(
'grp_join_request'));
323 $this->
form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
338 $this->join_error = $this->
lng->txt(
'permission_denied');
343 $this->join_error = $this->
lng->txt(
'mem_error_preconditions');
348 if ($this->
http->wrapper()->post()->has(
'grp_passw')) {
349 $password = $this->
http->wrapper()->post()->retrieve(
351 $this->
refinery->kindlyTo()->string()
354 if (!strlen($password)) {
355 $this->join_error = $this->
lng->txt(
'err_wrong_password');
358 if (strcmp($password, $this->container->getPassword()) !== 0) {
359 $this->join_error = $this->
lng->txt(
'err_wrong_password');
364 $this->join_error = $this->
lng->txt(
'fill_out_all_required_fields');
368 $this->join_error = $this->
lng->txt($this->type .
'_agreement_required');
378 protected function add(): void
383 $free = max(0, $this->container->getMaxMembers() - $this->participants->getCountMembers());
386 $this->container->isMembershipLimited() and
387 $this->container->isWaitingListEnabled() and
388 (!$free or $waiting_list->getCountUsers())) {
391 $this->
lng->txt(
'grp_added_to_list'),
392 $this->container->getTitle(),
393 $waiting_list->getPosition($this->
user->getId())
396 $this->participants->sendNotification(
400 $this->tpl->setOnScreenMessage(
'success', $info,
true);
401 $this->
ctrl->setParameterByClass(
404 $this->tree->getParentId($this->container->getRefId())
406 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
409 switch ($this->container->getRegistrationType()) {
412 $this->participants->addSubscriber($this->
user->getId());
413 $this->participants->updateSubscriptionTime($this->
user->getId(), time());
415 if ($this->
http->wrapper()->post()->has(
'subject')) {
416 $subject = $this->
http->wrapper()->post()->retrieve(
418 $this->
refinery->kindlyTo()->string()
421 $this->participants->updateSubject($this->
user->getId(), $subject);
422 $this->participants->sendNotification(
427 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"application_completed"),
true);
428 $this->
ctrl->setParameterByClass(
431 $this->tree->getParentId($this->container->getRefId())
433 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
439 $this->participants->sendNotification(
443 $this->participants->sendNotification(
451 if (!$pending_goto) {
452 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"grp_registration_completed"),
true);
453 $this->
ctrl->returnToParent($this);
455 $tgt = $pending_goto;
490 static $active = null;
492 if ($active !== null) {
495 if (!$this->container->getMaxMembers()) {
496 return $active =
false;
499 !$this->container->isWaitingListEnabled() or
500 !$this->container->isMembershipLimited()) {
501 return $active =
false;
504 $free = max(0, $this->container->getMaxMembers() - $this->participants->getCountMembers());
505 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.
ilParticipants $participants
static redirect(string $a_script)
fillMaxMembers()
fill max member information protected
Base class for course and group participants.
form( $class_path, string $cmd, string $submit_caption="")
__construct(ilObject $a_container)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
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)