25 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
57 global $ilTabs,$ilUser;
61 $ilTabs->activateTab(
'leave');
64 $next_class = $this->ctrl->getNextClass($this);
68 $cmd = $this->ctrl->getCmd(
"show");
87 return $this->lng->txt(
'member_status');
89 return $this->lng->txt(
'crs_registration');
101 if($this->container->getImportantInformation())
105 $imp->setValue($value);
106 $this->form->addItem($imp);
109 if($this->container->getSyllabus())
113 $syl->setValue($value);
114 $this->form->addItem($syl);
125 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
128 if($this->container->getSubscriptionUnlimitedStatus())
131 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
132 $this->form->addItem($reg);
145 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
146 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
149 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
152 $warning = $this->lng->txt(
'mem_reg_not_started');
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'));
164 $warning = $this->lng->txt(
'mem_reg_expired');
168 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
169 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
180 #$reg->setAlert($warning);
182 $this->form->addItem($reg);
198 if(!$this->container->isSubscriptionMembershipLimited())
202 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
203 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
204 $tpl->setVariable(
'NUM_MAX',$this->container->getSubscriptionMaxMembers());
206 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
207 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
210 $tpl->setVariable(
'NUM_FREE',$free);
212 $tpl->setVariable(
'WARN_FREE',$free);
215 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
218 $this->container->isSubscriptionMembershipLimited() and
219 $this->container->enabledWaitingList() and
224 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
230 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
241 !$this->container->enabledWaitingList())
246 #$alert = $this->lng->txt('mem_alert_no_places');
249 $this->container->enabledWaitingList() and
250 $this->container->isSubscriptionMembershipLimited() and
259 $this->container->enabledWaitingList() and
260 $this->container->isSubscriptionMembershipLimited())
264 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
268 $this->container->enabledWaitingList() and
269 $this->container->isSubscriptionMembershipLimited() and
273 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
280 $max->setAlert($alert);
282 $this->form->addItem($max);
299 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
300 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
301 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
302 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
303 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
304 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
305 $this->form->addItem($reg);
312 switch($this->container->getSubscriptionType())
321 $txt->
setValue($this->lng->txt(
'crs_info_reg_direct'));
323 $this->form->addItem($txt);
328 $txt->
setValue($this->lng->txt(
'crs_subscription_options_password'));
332 $pass->setInputType(
'password');
334 $pass->setMaxLength(32);
335 #$pass->setRequired(true);
336 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
338 $txt->addSubItem(
$pass);
339 $this->form->addItem($txt);
349 $txt->
setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
353 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
356 if($this->participants->isSubscriber($ilUser->getId()))
358 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
359 $sub->setValue($sub_data[
'subject']);
364 $txt->addSubItem($sub);
365 $this->form->addItem($txt);
387 switch($this->container->getSubscriptionType())
390 if($this->participants->isSubscriber($ilUser->getId()))
392 $this->form->clearCommandButtons();
393 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
394 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
398 $this->form->clearCommandButtons();
399 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
400 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
423 if($ilUser->getId() == ANONYMOUS_USER_ID)
425 $this->join_error = $this->lng->txt(
'permission_denied');
434 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
441 $this->join_error = $this->lng->txt(
'crs_password_required');
444 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
446 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
452 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
457 $this->join_error = $this->lng->txt(
'crs_agreement_required');
473 global $ilUser,$tree;
480 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
481 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
483 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
485 $waiting_list->
addToList($ilUser->getId());
486 $info = sprintf($this->lng->txt(
'crs_added_to_list'),
487 $waiting_list->getPosition($ilUser->getId()));
490 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
491 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
492 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
495 switch($this->container->getSubscriptionType())
498 $this->participants->addSubscriber($ilUser->getId());
499 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
501 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
504 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
509 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
510 $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
512 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
516 $this->ctrl->returnToParent($this);
531 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
542 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
552 static $active = null;
558 if(!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited())
560 return $active =
false;
562 if(!$this->container->getSubscriptionMaxMembers())
564 return $active =
false;
567 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
568 return $active = (!$free or $this->
getWaitingList()->getCountUsers());