25 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
51 $this->parent_gui = $a_parent_gui;
65 $ilTabs->activateTab(
'leave');
70 $this->ctrl->setReturn($this->parent_gui,
'infoScreen');
71 $this->ctrl->returnToParent($this);
75 $next_class = $this->ctrl->getNextClass($this);
79 $cmd = $this->ctrl->getCmd(
"show");
98 return $this->lng->txt(
'member_status');
100 return $this->lng->txt(
'crs_registration');
112 if($this->container->getImportantInformation())
116 $imp->setValue($value);
117 $this->form->addItem($imp);
120 if($this->container->getSyllabus())
124 $syl->setValue($value);
125 $this->form->addItem($syl);
136 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
139 if($this->container->getSubscriptionUnlimitedStatus())
142 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
143 $this->form->addItem($reg);
156 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
157 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
160 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
163 $warning = $this->lng->txt(
'mem_reg_not_started');
167 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
168 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
171 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
175 $warning = $this->lng->txt(
'mem_reg_expired');
179 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
180 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
191 #$reg->setAlert($warning);
193 $this->form->addItem($reg);
209 if(!$this->container->isSubscriptionMembershipLimited())
213 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
214 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
215 $tpl->setVariable(
'NUM_MAX',$this->container->getSubscriptionMaxMembers());
217 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
218 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
221 $tpl->setVariable(
'NUM_FREE',$free);
223 $tpl->setVariable(
'WARN_FREE',$free);
226 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
229 $this->container->isSubscriptionMembershipLimited() and
230 $this->container->enabledWaitingList() and
235 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
241 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
252 !$this->container->enabledWaitingList())
257 #$alert = $this->lng->txt('mem_alert_no_places');
260 $this->container->enabledWaitingList() and
261 $this->container->isSubscriptionMembershipLimited() and
270 $this->container->enabledWaitingList() and
271 $this->container->isSubscriptionMembershipLimited())
275 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
279 $this->container->enabledWaitingList() and
280 $this->container->isSubscriptionMembershipLimited() and
284 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
291 $max->setAlert($alert);
293 $this->form->addItem($max);
310 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
311 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
312 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
313 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
314 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
315 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
316 $this->form->addItem($reg);
323 switch($this->container->getSubscriptionType())
332 $txt->setValue($this->lng->txt(
'crs_info_reg_direct'));
334 $this->form->addItem(
$txt);
339 $txt->setValue($this->lng->txt(
'crs_subscription_options_password'));
343 $pass->setInputType(
'password');
345 $pass->setMaxLength(32);
346 #$pass->setRequired(true);
347 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
350 $this->form->addItem(
$txt);
360 $txt->setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
364 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
367 if($this->participants->isSubscriber($ilUser->getId()))
369 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
370 $sub->setValue($sub_data[
'subject']);
375 $txt->addSubItem($sub);
376 $this->form->addItem(
$txt);
398 switch($this->container->getSubscriptionType())
401 if($this->participants->isSubscriber($ilUser->getId()))
403 $this->form->clearCommandButtons();
404 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
405 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
409 $this->form->clearCommandButtons();
410 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
411 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
434 if($ilUser->getId() == ANONYMOUS_USER_ID)
436 $this->join_error = $this->lng->txt(
'permission_denied');
445 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
452 $this->join_error = $this->lng->txt(
'crs_password_required');
455 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
457 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
463 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
468 $this->join_error = $this->lng->txt(
'crs_agreement_required');
491 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
492 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
494 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
496 $waiting_list->
addToList($ilUser->getId());
497 $info = sprintf($this->lng->txt(
'crs_added_to_list'),
498 $waiting_list->getPosition($ilUser->getId()));
501 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
502 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
503 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
504 $tree->getParentId($this->container->getRefId()));
505 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
508 switch($this->container->getSubscriptionType())
511 $this->participants->addSubscriber($ilUser->getId());
512 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
514 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
517 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
518 $tree->getParentId($this->container->getRefId()));
519 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
524 if($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers())
529 $this->container->getSubscriptionMaxMembers(),
541 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
542 $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
544 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
547 if($this->container->getType() ==
"crs")
549 $this->container->checkLPStatusSync($ilUser->getId());
555 $this->ctrl->returnToParent($this);
577 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
588 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
598 static $active = null;
604 if(!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited())
606 return $active =
false;
608 if(!$this->container->getSubscriptionMaxMembers())
610 return $active =
false;
613 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
614 return $active = (!$free or $this->
getWaitingList()->getCountUsers());