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');
217 if($this->container->enabledWaitingList() and (!$free or
$waiting_list->getCountUsers()))
221 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
227 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
236 if(!$free and !$this->container->enabledWaitingList())
241 #$alert = $this->lng->txt('mem_alert_no_places');
243 elseif($this->container->enabledWaitingList() and
$waiting_list->isOnList($ilUser->getId()))
248 elseif(!$free and $this->container->enabledWaitingList())
251 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
253 elseif($free and $this->container->enabledWaitingList() and $this->
getWaitingList()->getCountUsers())
256 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
263 $max->setAlert($alert);
265 $this->form->addItem($max);
282 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
283 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
284 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
285 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
286 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
287 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
288 $this->form->addItem($reg);
295 switch($this->container->getSubscriptionType())
304 $txt->
setValue($this->lng->txt(
'crs_info_reg_direct'));
306 $this->form->addItem($txt);
311 $txt->
setValue($this->lng->txt(
'crs_subscription_options_password'));
315 $pass->setInputType(
'password');
317 $pass->setMaxLength(32);
318 #$pass->setRequired(true);
319 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
321 $txt->addSubItem(
$pass);
322 $this->form->addItem($txt);
332 $txt->
setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
336 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
339 if($this->participants->isSubscriber($ilUser->getId()))
341 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
342 $sub->setValue($sub_data[
'subject']);
347 $txt->addSubItem($sub);
348 $this->form->addItem($txt);
374 switch($this->container->getSubscriptionType())
377 if($this->participants->isSubscriber($ilUser->getId()))
379 $this->form->clearCommandButtons();
380 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
381 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
385 $this->form->clearCommandButtons();
386 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
387 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
405 if($ilUser->getId() == ANONYMOUS_USER_ID)
407 $this->join_error = $this->lng->txt(
'permission_denied');
416 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
423 $this->join_error = $this->lng->txt(
'crs_password_required');
426 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
428 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
434 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
439 $this->join_error = $this->lng->txt(
'crs_agreement_required');
455 global $ilUser,$tree;
462 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
463 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
465 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
467 $waiting_list->
addToList($ilUser->getId());
468 $info = sprintf($this->lng->txt(
'crs_added_to_list'),
469 $waiting_list->getPosition($ilUser->getId()));
472 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
473 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
474 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
477 switch($this->container->getSubscriptionType())
480 $this->participants->addSubscriber($ilUser->getId());
481 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
483 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
486 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
491 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
492 $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
494 include_once
'./Modules/Forum/classes/class.ilForumNotification.php';
498 $this->ctrl->returnToParent($this);
513 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
524 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
534 static $active = null;
540 if(!$this->container->enabledWaitingList())
542 return $active =
false;
544 if(!$this->container->getSubscriptionMaxMembers())
546 return $active =
false;
549 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
550 return $active = (!$free or $this->
getWaitingList()->getCountUsers());