25 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
26 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
62 global $ilTabs,$ilUser;
66 $ilTabs->activateTab(
'leave');
69 $next_class = $this->ctrl->getNextClass($this);
73 $cmd = $this->ctrl->getCmd(
"show");
92 return $this->lng->txt(
'member_status');
94 return $this->lng->txt(
'crs_registration');
106 if($this->container->getImportantInformation())
110 $imp->setValue($value);
111 $this->form->addItem($imp);
114 if($this->container->getSyllabus())
118 $syl->setValue($value);
119 $this->form->addItem($syl);
130 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
133 if($this->container->getSubscriptionUnlimitedStatus())
136 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
137 $this->form->addItem($reg);
150 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
151 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
154 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
157 $warning = $this->lng->txt(
'mem_reg_not_started');
161 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
162 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
165 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
169 $warning = $this->lng->txt(
'mem_reg_expired');
173 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
174 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
185 #$reg->setAlert($warning);
187 $this->form->addItem($reg);
203 if(!$this->container->isSubscriptionMembershipLimited())
207 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
208 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
209 $tpl->setVariable(
'NUM_MAX',$this->container->getSubscriptionMaxMembers());
211 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
212 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
215 $tpl->setVariable(
'NUM_FREE',$free);
217 $tpl->setVariable(
'WARN_FREE',$free);
220 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
222 if($this->container->enabledWaitingList() and (!$free or
$waiting_list->getCountUsers()))
226 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
232 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
241 if(!$free and !$this->container->enabledWaitingList())
246 #$alert = $this->lng->txt('mem_alert_no_places');
248 elseif($this->container->enabledWaitingList() and
$waiting_list->isOnList($ilUser->getId()))
253 elseif(!$free and $this->container->enabledWaitingList())
256 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
258 elseif($free and $this->container->enabledWaitingList() and $this->
getWaitingList()->getCountUsers())
261 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
268 $max->setAlert($alert);
270 $this->form->addItem($max);
287 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
288 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
289 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
290 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
291 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
292 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
293 $this->form->addItem($reg);
300 switch($this->container->getSubscriptionType())
309 $txt->
setValue($this->lng->txt(
'crs_info_reg_direct'));
311 $this->form->addItem($txt);
316 $txt->
setValue($this->lng->txt(
'crs_subscription_options_password'));
320 $pass->setInputType(
'password');
322 $pass->setMaxLength(32);
323 #$pass->setRequired(true);
324 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
326 $txt->addSubItem(
$pass);
327 $this->form->addItem($txt);
337 $txt->
setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
341 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
344 if($this->participants->isSubscriber($ilUser->getId()))
346 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
347 $sub->setValue($sub_data[
'subject']);
352 $txt->addSubItem($sub);
353 $this->form->addItem($txt);
379 switch($this->container->getSubscriptionType())
382 if($this->participants->isSubscriber($ilUser->getId()))
384 $this->form->clearCommandButtons();
385 $this->form->addCommandButton(
'updateSubscriptionRequest', $this->lng->txt(
'crs_update_subscr_request'));
386 $this->form->addCommandButton(
'cancelSubscriptionRequest', $this->lng->txt(
'crs_cancel_subscr_request'));
390 $this->form->clearCommandButtons();
391 $this->form->addCommandButton(
'join', $this->lng->txt(
'crs_join_request'));
392 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
416 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
422 $this->lng->loadLanguageModule(
'ps');
424 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
427 if(!count($fields_info->getExportableFields()))
433 $section->setTitle($this->lng->txt(
'usr_agreement'));
437 $tpl =
new ilTemplate(
'tpl.agreement_form.html',
true,
true,
'Services/Membership');
438 $tpl->setVariable(
'TXT_INFO_AGREEMENT',$this->lng->txt(
'crs_info_agreement'));
439 foreach($fields_info->getExportableFields() as $field)
441 $tpl->setCurrentBlock(
'field_item');
442 $tpl->setVariable(
'FIELD_NAME',$this->lng->txt($field));
443 $tpl->parseCurrentBlock();
446 $this->form->addItem($fields);
453 $agreement->setOptionTitle($this->lng->txt(
'crs_info_agree'));
454 $agreement->setValue(1);
455 $this->form->addItem($agreement);
470 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
471 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
479 $cdf->
setValue($this->lng->txt(
'ps_cdf_info'));
480 $cdf->setRequired(
true);
482 foreach($cdf_fields as $field_obj)
484 $course_user_data =
new ilCourseUserData($ilUser->getId(),$field_obj->getId());
486 switch($field_obj->getType())
489 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf['.$field_obj->getId().
']');
491 $select->setOptions($field_obj->prepareSelectBox());
492 if($field_obj->isRequired())
494 $select->setRequired(
true);
497 $cdf->addSubItem($select);
503 $text =
new ilTextInputGUI($field_obj->getName(),
'cdf['.$field_obj->getId().
']');
506 $text->setMaxLength(255);
507 if($field_obj->isRequired())
509 $text->setRequired(
true);
511 $cdf->addSubItem($text);
515 $this->form->addItem($cdf);
532 if($ilUser->getId() == ANONYMOUS_USER_ID)
534 $this->join_error = $this->lng->txt(
'permission_denied');
543 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
550 $this->join_error = $this->lng->txt(
'crs_password_required');
553 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
555 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
561 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
566 $this->join_error = $this->lng->txt(
'crs_agreement_required');
587 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
605 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
606 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
608 $all_required =
true;
611 switch($field_obj->getType())
616 foreach((array) $field_obj->getValues() as $v)
630 $course_user_data =
new ilCourseUserData($ilUser->getId(),$field_obj->getId());
631 $course_user_data->
setValue($value);
632 $course_user_data->update();
634 if($field_obj->isRequired() and (!strlen($value) or $value == -1))
636 $all_required =
false;
639 return $all_required;
653 global $ilUser,$tree;
660 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
661 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
663 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
665 $waiting_list->
addToList($ilUser->getId());
666 $info = sprintf($this->lng->txt(
'crs_added_to_list'),
667 $waiting_list->getPosition($ilUser->getId()));
670 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
671 $this->participants->sendNotification($this->participants->NOTIFY_WAITING_LIST,$ilUser->getId());
672 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
676 switch($this->container->getSubscriptionType())
679 $this->participants->addSubscriber($ilUser->getId());
680 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
682 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
685 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
690 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
691 $this->participants->sendNotification($this->participants->NOTIFY_REGISTERED,$ilUser->getId());
693 $this->ctrl->returnToParent($this);
708 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
714 include_once(
'Modules/Course/classes/class.ilCourseAgreement.php');
715 $this->agreement =
new ilCourseAgreement($ilUser->getId(),$this->container->getId());
717 $this->agreement->setAcceptanceTime(time());
718 $this->agreement->save();
730 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
741 include_once
'./Modules/Course/classes/class.ilCourseWaitingList.php';
751 static $active = null;
757 if(!$this->container->enabledWaitingList())
759 return $active =
false;
761 if(!$this->container->getSubscriptionMaxMembers())
763 return $active =
false;
766 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
767 return $active = (!$free or $this->
getWaitingList()->getCountUsers());