25 include_once(
'Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
26 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
62 $next_class = $this->ctrl->getNextClass($this);
66 $cmd = $this->ctrl->getCmd(
"show");
81 return $this->lng->txt(
'crs_registration');
93 if($this->container->getImportantInformation())
97 $imp->setValue($value);
98 $this->form->addItem($imp);
101 if($this->container->getSyllabus())
105 $syl->setValue($value);
106 $this->form->addItem($syl);
117 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
120 if($this->container->getSubscriptionUnlimitedStatus())
123 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
124 $this->form->addItem($reg);
137 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
138 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
141 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
144 $warning = $this->lng->txt(
'mem_reg_not_started');
148 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
149 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
152 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
156 $warning = $this->lng->txt(
'mem_reg_expired');
160 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
161 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
171 $reg->setAlert($warning);
173 $this->form->addItem($reg);
189 if(!$this->container->isSubscriptionMembershipLimited())
193 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
194 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
195 $tpl->setVariable(
'NUM_MAX',$this->container->getSubscriptionMaxMembers());
197 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
198 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
199 $tpl->setVariable(
'NUM_FREE',$free);
201 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
203 if($this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
205 if($waiting_list->isOnList($ilUser->getId()))
207 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
208 $tpl->setVariable(
'NUM_WAIT',$waiting_list->getPosition($ilUser->getId()));
213 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
214 $tpl->setVariable(
'NUM_WAIT',$waiting_list->getCountUsers());
219 if(!$free and !$this->container->enabledWaitingList())
223 $alert = $this->lng->txt(
'mem_alert_no_places');
225 elseif($this->container->enabledWaitingList() and $waiting_list->isOnList($ilUser->getId()))
229 $alert = $this->lng->txt(
'mem_already_on_list');
231 elseif(!$free and $this->container->enabledWaitingList())
233 $alert = $this->lng->txt(
'crs_set_on_waiting_list');
235 elseif($waiting_list->getCountUsers() and $this->container->enabledWaitingList())
237 $alert = $this->lng->txt(
'crs_set_on_waiting_list');
244 $max->setAlert($alert);
246 $this->form->addItem($max);
263 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
264 $reg->
setAlert($this->lng->txt(
'crs_info_reg_deactivated'));
266 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
267 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
268 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
269 $this->form->addItem($reg);
276 switch($this->container->getSubscriptionType())
280 $txt->
setValue($this->lng->txt(
'crs_info_reg_direct'));
282 $this->form->addItem($txt);
287 $txt->
setValue($this->lng->txt(
'crs_subscription_options_password'));
291 $pass->setInputType(
'password');
293 $pass->setMaxLength(32);
294 #$pass->setRequired(true);
295 $pass->setInfo($this->lng->txt(
'crs_info_reg_password'));
297 $txt->addSubItem(
$pass);
298 $this->form->addItem($txt);
303 $txt->
setValue($this->lng->txt(
'crs_subscription_options_confirmation'));
306 $sub->
setValue($_POST[
'grp_subject']);
307 $sub->setInfo($this->lng->txt(
'crs_info_reg_confirmation'));
310 if($this->participants->isSubscriber($ilUser->getId()))
312 $sub->setAlert($this->lng->txt(
'crs_reg_user_already_subscribed'));
315 $txt->addSubItem($sub);
316 $this->form->addItem($txt);
344 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
350 $this->lng->loadLanguageModule(
'ps');
352 include_once(
'Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
355 if(!count($fields_info->getExportableFields()))
361 $section->setTitle($this->lng->txt(
'usr_agreement'));
365 $tpl =
new ilTemplate(
'tpl.agreement_form.html',
true,
true,
'Services/Membership');
366 $tpl->setVariable(
'TXT_INFO_AGREEMENT',$this->lng->txt(
'crs_info_agreement'));
367 foreach($fields_info->getExportableFields() as $field)
369 $tpl->setCurrentBlock(
'field_item');
370 $tpl->setVariable(
'FIELD_NAME',$this->lng->txt($field));
371 $tpl->parseCurrentBlock();
374 $this->form->addItem($fields);
381 $agreement->setOptionTitle($this->lng->txt(
'crs_info_agree'));
382 $agreement->setValue(1);
383 $this->form->addItem($agreement);
398 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
399 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
407 $cdf->
setValue($this->lng->txt(
'ps_cdf_info'));
408 $cdf->setRequired(
true);
410 foreach($cdf_fields as $field_obj)
412 $course_user_data =
new ilCourseUserData($ilUser->getId(),$field_obj->getId());
414 switch($field_obj->getType())
417 $select =
new ilSelectInputGUI($field_obj->getName(),
'cdf['.$field_obj->getId().
']');
419 $select->setOptions($field_obj->prepareSelectBox());
420 if($field_obj->isRequired())
422 $select->setRequired(
true);
425 $cdf->addSubItem($select);
431 $text =
new ilTextInputGUI($field_obj->getName(),
'cdf['.$field_obj->getId().
']');
434 $text->setMaxLength(255);
435 if($field_obj->isRequired())
437 $text->setRequired(
true);
439 $cdf->addSubItem($text);
443 $this->form->addItem($cdf);
460 if($ilUser->getId() == ANONYMOUS_USER_ID)
462 $this->join_error = $this->lng->txt(
'permission_denied');
471 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
478 $this->join_error = $this->lng->txt(
'crs_password_required');
481 if(strcmp(
$pass,$this->container->getSubscriptionPassword()) !== 0)
483 $this->join_error = $this->lng->txt(
'crs_password_not_valid');
489 $this->join_error = $this->lng->txt(
'fill_out_all_required_fields');
494 $this->join_error = $this->lng->txt(
'crs_agreement_required');
511 if($_POST[
'agreement'])
515 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
533 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
534 include_once(
'Modules/Course/classes/Export/class.ilCourseUserData.php');
536 $all_required =
true;
539 switch($field_obj->getType())
549 $course_user_data =
new ilCourseUserData($ilUser->getId(),$field_obj->getId());
550 $course_user_data->
setValue($value);
551 $course_user_data->update();
553 if($field_obj->isRequired() and (!strlen($value) or $value == -1))
555 $all_required =
false;
558 return $all_required;
572 global $ilUser,$tree;
579 include_once(
'./Modules/Course/classes/class.ilCourseWaitingList.php');
580 $free = max(0,$this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
582 if($this->container->isSubscriptionMembershipLimited() and $this->container->enabledWaitingList() and (!$free or $waiting_list->getCountUsers()))
584 $waiting_list->
addToList($ilUser->getId());
585 $info = sprintf($this->lng->txt(
'crs_added_to_list'),$waiting_list->getPosition($ilUser->getId()));
586 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
588 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
591 switch($this->container->getSubscriptionType())
594 $this->participants->addSubscriber($ilUser->getId());
595 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
596 $this->participants->updateSubject($ilUser->getId(),
ilUtil::stripSlashes($_POST[
'grp_subject']));
597 $this->participants->sendNotification($this->participants->NOTIFY_SUBSCRIPTION_REQUEST,$ilUser->getId());
600 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
605 $this->participants->sendNotification($this->participants->NOTIFY_ADMINS,$ilUser->getId());
607 $this->ctrl->returnToParent($this);
622 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
628 include_once(
'Modules/Course/classes/class.ilCourseAgreement.php');
629 $this->agreement =
new ilCourseAgreement($ilUser->getId(),$this->container->getId());
631 $this->agreement->setAcceptanceTime(time());
632 $this->agreement->save();
644 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');