19declare(strict_types=0);
34 $this->parent_gui = $a_parent_gui;
40 $this->
tabs->activateTab(
'leave');
43 if (!$this->
access->checkAccess(
'join',
'', $this->getRefId())) {
44 $this->
ctrl->setReturn($this->parent_gui,
'infoScreen');
45 $this->
ctrl->returnToParent($this);
49 $next_class = $this->
ctrl->getNextClass($this);
50 switch ($next_class) {
52 $cmd = $this->
ctrl->getCmd(
"show");
61 return $this->
lng->txt(
'member_status');
63 return $this->
lng->txt(
'crs_registration');
68 if ($this->container->getImportantInformation()) {
71 $imp->setValue($value);
72 $this->
form->addItem($imp);
75 if ($this->container->getSyllabus()) {
78 $syl->setValue($value);
79 $this->
form->addItem($syl);
87 if ($this->container->getSubscriptionUnlimitedStatus()) {
89 $reg->setValue($this->
lng->txt(
'mem_unlimited'));
90 $this->
form->addItem($reg);
101 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'components/ILIAS/Membership');
108 $warning = $this->
lng->txt(
'mem_reg_not_started');
110 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'components/ILIAS/Membership');
117 $warning = $this->
lng->txt(
'mem_reg_expired');
119 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'components/ILIAS/Membership');
126 if (strlen($warning)) {
129 $this->tpl->setOnScreenMessage(
'failure', $warning);
130 #$reg->setAlert($warning);
132 $this->
form->addItem($reg);
137 if (!$this->container->isSubscriptionMembershipLimited()) {
140 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'components/ILIAS/Membership');
143 if ($this->container->getSubscriptionMinMembers()) {
145 $tpl->
setVariable(
'NUM_MIN', $this->container->getSubscriptionMinMembers());
148 if ($this->container->getSubscriptionMaxMembers()) {
150 $tpl->
setVariable(
'NUM_MAX', $this->container->getSubscriptionMaxMembers());
154 $free = $reg_info[
'reg_info_free_places'];
164 $this->container->isSubscriptionMembershipLimited() && $this->container->enabledWaitingList() && (!$free ||
$waiting_list->
getCountUsers())) {
178 !$free && !$this->container->enabledWaitingList()) {
181 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'mem_alert_no_places'));
182 #$alert = $this->lng->txt('mem_alert_no_places');
184 $this->container->enabledWaitingList() && $this->container->isSubscriptionMembershipLimited() &&
$waiting_list->
isOnList($this->user->getId())
189 !$free && $this->container->enabledWaitingList() && $this->container->isSubscriptionMembershipLimited()) {
190 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_warn_no_max_set_on_waiting_list'));
191 #$alert = $this->lng->txt('crs_warn_no_max_set_on_waiting_list');
193 $free && $this->container->enabledWaitingList() && $this->container->isSubscriptionMembershipLimited() && $this->getWaitingList()->getCountUsers()) {
194 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_warn_wl_set_on_waiting_list'));
195 #$alert = $this->lng->txt('crs_warn_wl_set_on_waiting_list');
201 if (strlen($alert)) {
202 $max->setAlert($alert);
204 $this->
form->addItem($max);
211 #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
212 $reg->setAlert($this->
lng->txt(
'crs_info_reg_deactivated'));
213 #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
214 #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
215 #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
216 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
217 $this->
form->addItem($reg);
224 switch ($this->container->getSubscriptionType()) {
233 $txt->setValue($this->
lng->txt(
'crs_info_reg_direct'));
240 $txt->setValue($this->
lng->txt(
'crs_subscription_options_password'));
243 $pass->setInputType(
'password');
245 $pass->setMaxLength(32);
246 #$pass->setRequired(true);
247 $pass->setInfo($this->
lng->txt(
'crs_info_reg_password'));
249 $txt->addSubItem($pass);
261 $txt->setValue($this->
lng->txt(
'crs_subscription_options_confirmation'));
264 $sub->setInfo($this->
lng->txt(
'crs_info_reg_confirmation'));
267 if ($this->participants->isSubscriber($this->user->getId())) {
268 $sub_data = $this->participants->getSubscriberData($this->
user->getId());
269 $sub->setValue($sub_data[
'subject']);
271 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_reg_user_already_subscribed'));
274 $txt->addSubItem($sub);
284 parent::addCommandButtons();
285 switch ($this->container->getSubscriptionType()) {
287 if ($this->participants->isSubscriber($this->user->getId())) {
288 $this->
form->clearCommandButtons();
289 $this->
form->addCommandButton(
290 'updateSubscriptionRequest',
291 $this->
lng->txt(
'crs_update_subscr_request')
293 $this->
form->addCommandButton(
294 'cancelSubscriptionRequest',
295 $this->
lng->txt(
'crs_cancel_subscr_request')
298 $this->
form->clearCommandButtons();
299 $this->
form->addCommandButton(
'join', $this->
lng->txt(
'crs_join_request'));
300 $this->
form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
311 $this->join_error = $this->
lng->txt(
'permission_denied');
319 $this->join_error = $this->
lng->txt(
'mem_error_preconditions');
323 $pass = $this->
http->wrapper()->post()->retrieve(
325 $this->
refinery->kindlyTo()->string()
327 if ((
string) $pass ===
'') {
328 $this->join_error = $this->
lng->txt(
'crs_password_required');
331 if (strcmp($pass, $this->container->getSubscriptionPassword()) !== 0) {
332 $this->join_error = $this->
lng->txt(
'crs_password_not_valid');
337 $this->join_error = $this->
lng->txt(
'fill_out_all_required_fields');
341 $this->join_error = $this->
lng->txt(
'crs_agreement_required');
353 $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
355 if ($this->container->isSubscriptionMembershipLimited() && $this->container->enabledWaitingList() && (!$free ||
$waiting_list->
getCountUsers())) {
358 $this->
lng->txt(
'crs_added_to_list'),
361 $this->tpl->setOnScreenMessage(
'success',
$info,
true);
363 $this->participants->sendNotification(
367 $this->participants->sendNotification(
371 $this->
ctrl->setParameterByClass(
374 $this->tree->getParentId($this->container->getRefId())
376 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
379 switch ($this->container->getSubscriptionType()) {
381 $this->participants->addSubscriber($this->
user->getId());
382 $this->participants->updateSubscriptionTime($this->
user->getId(), time());
384 $subject = $this->
http->wrapper()->post()->retrieve(
386 $this->
refinery->kindlyTo()->string()
388 $this->participants->updateSubject($this->
user->getId(), $subject);
389 $this->participants->sendNotification(
394 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"application_completed"),
true);
395 $this->
ctrl->setParameterByClass(
398 $this->tree->getParentId($this->container->getRefId())
400 $this->
ctrl->redirectByClass(
"ilrepositorygui",
"");
405 if ($this->container->isSubscriptionMembershipLimited() && $this->container->getSubscriptionMaxMembers()) {
406 $success =
$GLOBALS[
'DIC'][
'rbacadmin']->assignUserLimited(
408 $this->user->getId(),
409 $this->container->getSubscriptionMaxMembers(),
413 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_subscription_failed_limit'));
425 if ($this->container->getType() ==
"crs") {
426 $this->container->checkLPStatusSync($this->
user->getId());
429 if (!$pending_goto) {
430 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"crs_subscription_successful"),
true);
431 $this->
ctrl->returnToParent($this);
433 $tgt = $pending_goto;
455 static $active =
null;
457 if ($active !==
null) {
460 if (!$this->container->enabledWaitingList() || !$this->container->isSubscriptionMembershipLimited()) {
461 return $active =
false;
463 if (!$this->container->getSubscriptionMaxMembers()) {
464 return $active =
false;
467 $free = max(0, $this->container->getSubscriptionMaxMembers() - $this->participants->getCountMembers());
468 return $active = (!$free || $this->
getWaitingList()->getCountUsers());
const IL_CRS_SUBSCRIPTION_CONFIRMATION
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_SUBSCRIPTION_DIRECT
const TYPE_NOTIFICATION_ADMINS
const TYPE_WAITING_LIST_MEMBER
const TYPE_SUBSCRIBE_MEMBER
const TYPE_NOTIFICATION_ADMINS_REGISTRATION_REQUEST
static _getInstanceByObjId(int $a_obj_id)
GUI class for course registrations.
getFormTitle()
Get title for property form.
initParticipants()
Init participants object (course or group participants)
fillInformations()
fill informations
__construct(ilObject $a_container, object $a_parent_gui)
fillRegistrationPeriod()
show informations about the registration period
isWaitingListActive()
Check if the waiting list is active Maximum of members exceeded or any user on the waiting list.
initWaitingList()
Init waiting list (course or group waiting list)
fillMaxMembers()
show informations about the maximum number of user.
fillRegistrationType()
show informations about registration procedure
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static checkForumsExistsInsert(int $ref_id, int $user_id)
This class represents a non editable value in a property form.
static lookupRegistrationInfo(int $a_obj_id)
Class ilObject Basic functions for all objects.
Base class for course and group participants.
static getDefaultMemberRole(int $a_ref_id)
Base class for Course and Group registration.
ilWaitingList $waiting_list
ilGlobalTemplateInterface $tpl
setAccepted(bool $a_status)
ilParticipants $participants
show(?ilPropertyFormGUI $form=null)
getWaitingList()
Get waiting list object.
enableRegistration(bool $a_status)
static get(string $a_var)
static clear(string $a_var)
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 makeClickable(string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)
static redirect(string $a_script)
Base class for course and group waiting lists.
getPosition(int $a_usr_id)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")