24 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
25 include_once
'./Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
56 global $ilUser,$ilTabs;
58 $next_class = $this->ctrl->getNextClass($this);
62 $ilTabs->activateTab(
'leave');
68 $cmd = $this->ctrl->getCmd(
"show");
88 return $this->lng->txt(
'member_status');
90 return $this->lng->txt(
'grp_registration');
102 if($this->container->getInformation())
106 $imp->setValue($value);
107 $this->form->addItem($imp);
118 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
121 if($this->container->isRegistrationUnlimited())
124 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
125 $this->form->addItem($reg);
129 $start = $this->container->getRegistrationStart();
130 $end = $this->container->getRegistrationEnd();
135 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
136 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
139 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
142 $warning = $this->lng->txt(
'mem_reg_not_started');
146 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
147 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
150 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
153 $warning = $this->lng->txt(
'mem_reg_expired');
157 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
158 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
168 #$reg->setAlert($warning);
171 $this->form->addItem($reg);
185 if(!$this->container->isMembershipLimited())
189 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
190 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
191 $tpl->setVariable(
'NUM_MAX',$this->container->getMaxMembers());
193 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
194 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
197 $tpl->setVariable(
'NUM_FREE',$free);
199 $tpl->setVariable(
'WARN_FREE',$free);
202 include_once(
'./Modules/Group/classes/class.ilGroupWaitingList.php');
206 $this->container->isWaitingListEnabled() and
207 $this->container->isMembershipLimited() and
212 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
218 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
230 !$this->container->isWaitingListEnabled())
234 $alert = $this->lng->txt(
'mem_alert_no_places');
237 $this->container->isWaitingListEnabled() and
238 $this->container->isMembershipLimited() and
246 $this->container->isWaitingListEnabled() and
247 $this->container->isMembershipLimited())
249 $alert = $this->lng->txt(
'grp_warn_no_max_set_on_waiting_list');
253 $this->container->isWaitingListEnabled() and
254 $this->container->isMembershipLimited() and
257 $alert = $this->lng->txt(
'grp_warn_wl_set_on_waiting_list');
264 #$max->setAlert($alert);
267 $this->form->addItem($max);
286 switch($this->container->getRegistrationType())
290 $reg->
setValue($this->lng->txt(
'grp_reg_disabled'));
291 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
292 $this->form->addItem($reg);
301 $txt->
setValue($this->lng->txt(
'grp_pass_request'));
305 $pass->setInputType(
'password');
307 $pass->setMaxLength(32);
308 #$pass->setRequired(true);
309 $pass->setInfo($this->lng->txt(
'group_password_registration_msg'));
311 $txt->addSubItem(
$pass);
312 $this->form->addItem($txt);
322 $txt->
setValue($this->lng->txt(
'grp_reg_request'));
326 $sub->setInfo($this->lng->txt(
'group_req_registration_msg'));
329 if($this->participants->isSubscriber($ilUser->getId()))
331 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
332 $sub->setValue($sub_data[
'subject']);
337 $txt->addSubItem($sub);
338 $this->form->addItem($txt);
348 $txt->
setValue($this->lng->txt(
'group_req_direct'));
350 $this->form->addItem($txt);
371 switch($this->container->getRegistrationType())
374 if($this->participants->isSubscriber($ilUser->getId()))
376 $this->form->clearCommandButtons();
377 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'grp_update_subscr_request'));
378 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'grp_cancel_subscr_request'));
386 $this->form->clearCommandButtons();
387 $this->form->addCommandButton(
'join', $this->lng->txt(
'grp_join_request'));
388 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
406 if($ilUser->getId() == ANONYMOUS_USER_ID)
408 $this->join_error = $this->lng->txt(
'permission_denied');
414 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
421 $this->join_error = $this->lng->txt(
'err_wrong_password');
424 if(strcmp(
$pass,$this->container->getPassword()) !== 0)
426 $this->join_error = $this->lng->txt(
'err_wrong_password');
432 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
437 $this->join_error = $this->lng->txt($this->type.
'_agreement_required');
453 global $ilUser,$tree, $rbacreview,
$lng;
458 include_once(
'./Modules/Group/classes/class.ilGroupWaitingList.php');
459 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
462 $this->container->isMembershipLimited() and
463 $this->container->isWaitingListEnabled() and
464 (!$free or $waiting_list->getCountUsers()))
466 $waiting_list->
addToList($ilUser->getId());
467 $info = sprintf($this->lng->txt(
'grp_added_to_list'),
468 $this->container->getTitle(),
469 $waiting_list->getPosition($ilUser->getId()));
471 $this->participants->sendNotification(
476 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
480 switch($this->container->getRegistrationType())
484 $this->participants->addSubscriber($ilUser->getId());
485 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
488 $this->participants->sendNotification(
494 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
500 $this->participants->sendNotification(
504 $this->participants->sendNotification(
509 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
513 $this->ctrl->returnToParent($this);
526 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
536 include_once
'./Modules/Group/classes/class.ilGroupWaitingList.php';
546 static $active = null;
552 if(!$this->container->getMaxMembers())
554 return $active =
false;
557 !$this->container->isWaitingListEnabled() or
558 !$this->container->isMembershipLimited())
560 return $active =
false;
563 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
564 return $active = (!$free or $this->
getWaitingList()->getCountUsers());