25 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
61 $ilTabs->activateTab(
'leave');
66 $this->ctrl->returnToParent($this);
70 $next_class = $this->ctrl->getNextClass($this);
74 $cmd = $this->ctrl->getCmd(
"show");
93 return $this->lng->txt(
'member_status');
95 return $this->lng->txt(
'crs_registration');
107 if($this->container->getImportantInformation())
111 $imp->setValue($value);
112 $this->form->addItem($imp);
115 if($this->container->getSyllabus())
119 $syl->setValue($value);
120 $this->form->addItem($syl);
131 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
134 if($this->container->getSubscriptionUnlimitedStatus())
137 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
138 $this->form->addItem($reg);
151 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
152 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
155 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
158 $warning = $this->lng->txt(
'mem_reg_not_started');
162 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
163 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
166 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
170 $warning = $this->lng->txt(
'mem_reg_expired');
174 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
175 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
186 #$reg->setAlert($warning);
188 $this->form->addItem($reg);
204 if(!$this->container->isSubscriptionMembershipLimited())
208 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
209 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
210 $tpl->setVariable(
'NUM_MAX',$this->container->getSubscriptionMaxMembers());
212 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
213 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
216 $tpl->setVariable(
'NUM_FREE',$free);
218 $tpl->setVariable(
'WARN_FREE',$free);
221 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
224 $this->container->isSubscriptionMembershipLimited() and
225 $this->container->enabledWaitingList() and
230 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
236 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
247 !$this->container->enabledWaitingList())
252 #$alert = $this->lng->txt('mem_alert_no_places');
255 $this->container->enabledWaitingList() and
256 $this->container->isSubscriptionMembershipLimited() and
265 $this->container->enabledWaitingList() and
266 $this->container->isSubscriptionMembershipLimited())
270 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
274 $this->container->enabledWaitingList() and
275 $this->container->isSubscriptionMembershipLimited() and
279 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
286 $max->setAlert($alert);
288 $this->form->addItem($max);
305 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
306 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
307 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
308 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
309 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
310 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
311 $this->form->addItem($reg);
318 switch($this->container->getSubscriptionType())
327 $txt->
setValue($this->lng->txt(
'crs_info_reg_direct'));
329 $this->form->addItem($txt);
334 $txt->
setValue($this->lng->txt(
'crs_subscription_options_password'));
338 $pass->setInputType(
'password');
340 $pass->setMaxLength(32);
341 #$pass->setRequired(true);
342 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
344 $txt->addSubItem(
$pass);
345 $this->form->addItem($txt);
355 $txt->
setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
359 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
362 if($this->participants->isSubscriber($ilUser->getId()))
364 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
365 $sub->setValue($sub_data[
'subject']);
370 $txt->addSubItem($sub);
371 $this->form->addItem($txt);
393 switch($this->container->getSubscriptionType())
396 if($this->participants->isSubscriber($ilUser->getId()))
398 $this->form->clearCommandButtons();
399 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
400 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
404 $this->form->clearCommandButtons();
405 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
406 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
429 if($ilUser->getId() == ANONYMOUS_USER_ID)
431 $this->join_error = $this->lng->txt(
'permission_denied');
440 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
447 $this->join_error = $this->lng->txt(
'crs_password_required');
450 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
452 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
458 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
463 $this->join_error = $this->lng->txt(
'crs_agreement_required');
486 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
487 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
489 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
491 $waiting_list->
addToList($ilUser->getId());
492 $info = sprintf($this->lng->txt(
'crs_added_to_list'),
493 $waiting_list->getPosition($ilUser->getId()));
496 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
497 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
498 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
499 $tree->getParentId($this->container->getRefId()));
500 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
503 switch($this->container->getSubscriptionType())
506 $this->participants->addSubscriber($ilUser->getId());
507 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
509 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
512 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
513 $tree->getParentId($this->container->getRefId()));
514 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
519 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
520 $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
522 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
525 if($this->container->getType() ==
"crs")
527 $this->container->checkLPStatusSync($ilUser->getId());
533 $this->ctrl->returnToParent($this);
555 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
566 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
576 static $active = null;
582 if(!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited())
584 return $active =
false;
586 if(!$this->container->getSubscriptionMaxMembers())
588 return $active =
false;
591 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
592 return $active = (!$free or $this->
getWaitingList()->getCountUsers());