4include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
30 $this->parent_gui = $a_parent_gui;
42 $ilTabs =
$DIC[
'ilTabs'];
46 $ilTabs->activateTab(
'leave');
49 if (!
$GLOBALS[
'DIC'][
'ilAccess']->checkAccess(
'join',
'', $this->
getRefId())) {
50 $this->ctrl->setReturn($this->parent_gui,
'infoScreen');
51 $this->ctrl->returnToParent($this);
55 $next_class = $this->ctrl->getNextClass($this);
56 switch ($next_class) {
58 $cmd = $this->ctrl->getCmd(
"show");
78 return $this->lng->txt(
'member_status');
80 return $this->lng->txt(
'crs_registration');
92 if ($this->container->getImportantInformation()) {
95 $imp->setValue($value);
96 $this->form->addItem($imp);
99 if ($this->container->getSyllabus()) {
102 $syl->setValue($value);
103 $this->form->addItem($syl);
114 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
117 if ($this->container->getSubscriptionUnlimitedStatus()) {
119 $reg->setValue($this->lng->txt(
'mem_unlimited'));
120 $this->form->addItem($reg);
130 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
131 $tpl->setVariable(
'TXT_FIRST', $this->lng->txt(
'mem_start'));
134 $tpl->setVariable(
'TXT_END', $this->lng->txt(
'mem_end'));
137 $warning = $this->lng->txt(
'mem_reg_not_started');
139 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
140 $tpl->setVariable(
'TXT_FIRST', $this->lng->txt(
'mem_start'));
143 $tpl->setVariable(
'TXT_END', $this->lng->txt(
'mem_end'));
147 $warning = $this->lng->txt(
'mem_reg_expired');
149 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
150 $tpl->setVariable(
'TXT_FIRST', $this->lng->txt(
'mem_end'));
155 $reg->setHtml(
$tpl->get());
156 if (strlen($warning)) {
160 #$reg->setAlert($warning);
162 $this->form->addItem($reg);
180 if (!$this->container->isSubscriptionMembershipLimited()) {
183 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
185 if ($this->container->getSubscriptionMinMembers()) {
186 $tpl->setVariable(
'TXT_MIN', $this->lng->txt(
'mem_min_users') .
':');
187 $tpl->setVariable(
'NUM_MIN', $this->container->getSubscriptionMinMembers());
190 if ($this->container->getSubscriptionMaxMembers()) {
191 $tpl->setVariable(
'TXT_MAX', $this->lng->txt(
'mem_max_users'));
192 $tpl->setVariable(
'NUM_MAX', $this->container->getSubscriptionMaxMembers());
194 $tpl->setVariable(
'TXT_FREE', $this->lng->txt(
'mem_free_places') .
":");
195 include_once
'./Modules/Course/classes/class.ilObjCourseAccess.php';
197 $free = $reg_info[
'reg_info_free_places'];
200 $tpl->setVariable(
'NUM_FREE', $free);
202 $tpl->setVariable(
'WARN_FREE', $free);
205 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
208 $this->container->isSubscriptionMembershipLimited() and
209 $this->container->enabledWaitingList() and
212 $tpl->setVariable(
'TXT_WAIT', $this->lng->txt(
'mem_waiting_list_position'));
215 $tpl->setVariable(
'TXT_WAIT', $this->lng->txt(
'mem_waiting_list'));
227 !$this->container->enabledWaitingList()) {
231 #$alert = $this->lng->txt('mem_alert_no_places');
233 $this->container->enabledWaitingList() and
234 $this->container->isSubscriptionMembershipLimited() and
241 $this->container->enabledWaitingList() and
242 $this->container->isSubscriptionMembershipLimited()) {
244 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
247 $this->container->enabledWaitingList() and
248 $this->container->isSubscriptionMembershipLimited() and
249 $this->getWaitingList()->getCountUsers()) {
251 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
256 $max->setHtml(
$tpl->get());
257 if (strlen($alert)) {
258 $max->setAlert($alert);
260 $this->form->addItem($max);
278 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
279 $reg->setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
280 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
281 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
282 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
283 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
284 $this->form->addItem($reg);
291 switch ($this->container->getSubscriptionType()) {
300 $txt->setValue($this->lng->txt(
'crs_info_reg_direct'));
302 $this->form->addItem(
$txt);
307 $txt->setValue($this->lng->txt(
'crs_subscription_options_password'));
311 $pass->setInputType(
'password');
313 $pass->setMaxLength(32);
314 #$pass->setRequired(true);
315 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
318 $this->form->addItem(
$txt);
329 $txt->setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
332 $sub->setValue(
$_POST[
'subject']);
333 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
336 if ($this->participants->isSubscriber(
$ilUser->getId())) {
337 $sub_data = $this->participants->getSubscriberData(
$ilUser->getId());
338 $sub->setValue($sub_data[
'subject']);
343 $txt->addSubItem($sub);
344 $this->form->addItem(
$txt);
365 parent::addCommandButtons();
368 switch ($this->container->getSubscriptionType()) {
370 if ($this->participants->isSubscriber(
$ilUser->getId())) {
371 $this->form->clearCommandButtons();
372 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
373 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
375 $this->form->clearCommandButtons();
376 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
377 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
401 if (
$ilUser->getId() == ANONYMOUS_USER_ID) {
402 $this->join_error = $this->lng->txt(
'permission_denied');
410 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
415 $this->join_error = $this->lng->txt(
'crs_password_required');
418 if (strcmp(
$pass, $this->container->getSubscriptionPassword()) !== 0) {
419 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
424 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
428 $this->join_error = $this->lng->txt(
'crs_agreement_required');
447 $tree =
$DIC[
'tree'];
455 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
456 $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
458 if ($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or
$waiting_list->getCountUsers())) {
461 $this->lng->txt(
'crs_added_to_list'),
464 ilUtil::sendSuccess($info,
true);
466 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,
$ilUser->getId());
467 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,
$ilUser->getId());
471 $tree->getParentId($this->container->getRefId())
473 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
476 switch ($this->container->getSubscriptionType()) {
478 $this->participants->addSubscriber(
$ilUser->getId());
479 $this->participants->updateSubscriptionTime(
$ilUser->getId(), time());
481 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,
$ilUser->getId());
483 ilUtil::sendSuccess($this->lng->txt(
"application_completed"),
true);
487 $tree->getParentId($this->container->getRefId())
489 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
494 if ($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers()) {
498 $this->container->getSubscriptionMaxMembers(),
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';
515 if ($this->container->getType() ==
"crs") {
516 $this->container->checkLPStatusSync(
$ilUser->getId());
520 ilUtil::sendSuccess($this->lng->txt(
"crs_subscription_successful"),
true);
521 $this->ctrl->returnToParent($this);
541 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
552 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
564 static $active =
null;
566 if ($active !==
null) {
569 if (!$this->container->enabledWaitingList() or !$this->container->isSubscriptionMembershipLimited()) {
570 return $active =
false;
572 if (!$this->container->getSubscriptionMaxMembers()) {
573 return $active =
false;
576 $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
577 return $active = (!$free or $this->
getWaitingList()->getCountUsers());
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_SUBSCRIPTION_CONFIRMATION
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_DIRECT
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
GUI class for course registrations.
getFormTitle()
get form title
initParticipants()
Init course participants.
fillInformations()
fill informations
fillRegistrationPeriod()
show informations about the registration period
validate()
Validate subscription request.
addCommandButtons()
Add group specific command buttons.
__construct($a_container, $a_parent_gui)
Constructor.
executeCommand()
Execute command.
fillMaxMembers()
fill max members
fillRegistrationType()
fill registration type
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static checkForumsExistsInsert($ref_id, $user_id=0)
This class represents a non editable value in a property form.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.
static getDefaultMemberRole($a_ref_id)
Base class for Course and Group registration.
getContainer()
Parent object.
validateAgreement()
Check Agreement.
setAccepted($a_status)
Set Agreement accepted.
validateCustomFields()
Check required course fields.
enableRegistration($a_status)
set registration disabled
getWaitingList()
Get waiting list object.
show(ilPropertyFormGUI $form=null)
show registration form
isRegistrationPossible()
check if registration is possible
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc