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');
205 if($this->container->isWaitingListEnabled() and (!$free or
$waiting_list->getCountUsers()))
209 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
215 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
225 if(!$free and !$this->container->isWaitingListEnabled())
229 $alert = $this->lng->txt(
'mem_alert_no_places');
231 elseif($this->container->isWaitingListEnabled() and
$waiting_list->isOnList($ilUser->getId()))
236 elseif(!$free and $this->container->isWaitingListEnabled())
238 $alert = $this->lng->txt(
'grp_warn_no_max_set_on_waiting_list');
240 elseif($free and $this->container->isWaitingListEnabled() and $this->
getWaitingList()->getCountUsers())
242 $alert = $this->lng->txt(
'grp_warn_wl_set_on_waiting_list');
249 #$max->setAlert($alert);
252 $this->form->addItem($max);
271 switch($this->container->getRegistrationType())
275 $reg->
setValue($this->lng->txt(
'grp_reg_disabled'));
276 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
277 $this->form->addItem($reg);
286 $txt->
setValue($this->lng->txt(
'grp_pass_request'));
290 $pass->setInputType(
'password');
292 $pass->setMaxLength(32);
293 #$pass->setRequired(true);
294 $pass->setInfo($this->lng->txt(
'group_password_registration_msg'));
296 $txt->addSubItem(
$pass);
297 $this->form->addItem($txt);
307 $txt->
setValue($this->lng->txt(
'grp_reg_request'));
311 $sub->setInfo($this->lng->txt(
'group_req_registration_msg'));
314 if($this->participants->isSubscriber($ilUser->getId()))
316 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
317 $sub->setValue($sub_data[
'subject']);
322 $txt->addSubItem($sub);
323 $this->form->addItem($txt);
333 $txt->
setValue($this->lng->txt(
'group_req_direct'));
335 $this->form->addItem($txt);
356 switch($this->container->getRegistrationType())
359 if($this->participants->isSubscriber($ilUser->getId()))
361 $this->form->clearCommandButtons();
362 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'grp_update_subscr_request'));
363 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'grp_cancel_subscr_request'));
371 $this->form->clearCommandButtons();
372 $this->form->addCommandButton(
'join', $this->lng->txt(
'grp_join_request'));
373 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
391 if($ilUser->getId() == ANONYMOUS_USER_ID)
393 $this->join_error = $this->lng->txt(
'permission_denied');
399 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
406 $this->join_error = $this->lng->txt(
'err_wrong_password');
409 if(strcmp(
$pass,$this->container->getPassword()) !== 0)
411 $this->join_error = $this->lng->txt(
'err_wrong_password');
427 global $ilUser,$tree, $rbacreview,
$lng;
429 include_once(
'./Modules/Group/classes/class.ilGroupWaitingList.php');
430 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
432 if($this->container->isMembershipLimited() and $this->container->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers()))
434 $waiting_list->
addToList($ilUser->getId());
435 $info = sprintf($this->lng->txt(
'grp_added_to_list'),
436 $this->container->getTitle(),
437 $waiting_list->getPosition($ilUser->getId()));
439 $this->participants->sendNotification(
444 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
448 switch($this->container->getRegistrationType())
452 $this->participants->addSubscriber($ilUser->getId());
453 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
456 $this->participants->sendNotification(
462 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
468 $this->participants->sendNotification(
472 $this->participants->sendNotification(
477 $this->ctrl->returnToParent($this);
490 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
500 include_once
'./Modules/Group/classes/class.ilGroupWaitingList.php';
510 static $active = null;
516 if(!$this->container->getMaxMembers())
518 return $active =
false;
520 if(!$this->container->isWaitingListEnabled())
522 return $active =
false;
525 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
526 return $active = (!$free or $this->
getWaitingList()->getCountUsers());