24 include_once(
'./Services/Membership/classes/class.ilRegistrationGUI.php');
55 $next_class = $this->ctrl->getNextClass($this);
60 $cmd = $this->ctrl->getCmd(
"show");
76 return $this->lng->txt(
'grp_registration');
88 if($this->container->getInformation())
92 $imp->setValue($value);
93 $this->form->addItem($imp);
104 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
107 if($this->container->isRegistrationUnlimited())
110 $reg->
setValue($this->lng->txt(
'mem_unlimited'));
111 $this->form->addItem($reg);
115 $start = $this->container->getRegistrationStart();
116 $end = $this->container->getRegistrationEnd();
121 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
122 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
125 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
128 $warning = $this->lng->txt(
'mem_reg_not_started');
132 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
133 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_start'));
136 $tpl->setVariable(
'TXT_END',$this->lng->txt(
'mem_end'));
139 $warning = $this->lng->txt(
'mem_reg_expired');
143 $tpl =
new ilTemplate(
'tpl.registration_period_form.html',
true,
true,
'Services/Membership');
144 $tpl->setVariable(
'TXT_FIRST',$this->lng->txt(
'mem_end'));
154 $reg->setAlert($warning);
156 $this->form->addItem($reg);
170 if(!$this->container->isMembershipLimited())
174 $tpl =
new ilTemplate(
'tpl.max_members_form.html',
true,
true,
'Services/Membership');
175 $tpl->setVariable(
'TXT_MAX',$this->lng->txt(
'mem_max_users'));
176 $tpl->setVariable(
'NUM_MAX',$this->container->getMaxMembers());
178 $tpl->setVariable(
'TXT_FREE',$this->lng->txt(
'mem_free_places').
":");
179 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
180 $tpl->setVariable(
'NUM_FREE',$free);
182 include_once(
'./Modules/Group/classes/class.ilGroupWaitingList.php');
184 if($this->container->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers()))
186 if($waiting_list->isOnList($ilUser->getId()))
188 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list_position'));
189 $tpl->setVariable(
'NUM_WAIT',$waiting_list->getPosition($ilUser->getId()));
194 $tpl->setVariable(
'TXT_WAIT',$this->lng->txt(
'mem_waiting_list'));
195 $tpl->setVariable(
'NUM_WAIT',$waiting_list->getCountUsers());
200 if(!$free and !$this->container->isWaitingListEnabled())
204 $alert = $this->lng->txt(
'mem_alert_no_places');
206 elseif($this->container->isWaitingListEnabled() and $waiting_list->isOnList($ilUser->getId()))
210 $alert = $this->lng->txt(
'mem_already_on_list');
212 elseif(!$free and $this->container->isWaitingListEnabled())
214 $alert = $this->lng->txt(
'grp_set_on_waiting_list');
216 elseif($waiting_list->getCountUsers() and $this->container->isWaitingListEnabled())
218 $alert = $this->lng->txt(
'grp_set_on_waiting_list');
225 $max->setAlert($alert);
227 $this->form->addItem($max);
241 switch($this->container->getRegistrationType())
245 $reg->
setValue($this->lng->txt(
'grp_reg_disabled'));
246 #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
247 $this->form->addItem($reg);
256 $txt->
setValue($this->lng->txt(
'grp_pass_request'));
260 $pass->setInputType(
'password');
262 $pass->setMaxLength(32);
263 #$pass->setRequired(true);
264 $pass->setInfo($this->lng->txt(
'group_password_registration_msg'));
266 $txt->addSubItem(
$pass);
267 $this->form->addItem($txt);
272 $txt->
setValue($this->lng->txt(
'grp_reg_request'));
275 $sub->
setValue($_POST[
'grp_subject']);
276 $sub->setInfo($this->lng->txt(
'group_req_registration_msg'));
279 if($this->participants->isSubscriber($ilUser->getId()))
281 $sub->setAlert($this->lng->txt(
'grp_already_applied'));
284 $txt->addSubItem($sub);
285 $this->form->addItem($txt);
290 $txt->
setValue($this->lng->txt(
'group_req_direct'));
292 $this->form->addItem($txt);
312 if($ilUser->getId() == ANONYMOUS_USER_ID)
314 $this->join_error = $this->lng->txt(
'permission_denied');
320 $this->join_error = $this->lng->txt(
'mem_error_preconditions');
327 $this->join_error = $this->lng->txt(
'err_wrong_password');
330 if(strcmp(
$pass,$this->container->getPassword()) !== 0)
332 $this->join_error = $this->lng->txt(
'err_wrong_password');
348 global $ilUser,$tree, $rbacreview,
$lng;
350 include_once(
'./Modules/Group/classes/class.ilGroupWaitingList.php');
351 $free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
353 if($this->container->isMembershipLimited() and $this->container->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers()))
355 $waiting_list->
addToList($ilUser->getId());
356 $info = sprintf($this->lng->txt(
'grp_added_to_list'),$waiting_list->getPosition($ilUser->getId()));
358 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
362 switch($this->container->getRegistrationType())
365 $this->participants->addSubscriber($ilUser->getId());
366 $this->participants->updateSubscriptionTime($ilUser->getId(),time());
367 $this->participants->updateSubject($ilUser->getId(),
ilUtil::stripSlashes($_POST[
'grp_subject']));
370 foreach($this->participants->getNotificationRecipients() as $rcp)
379 $mail->sendMail($rcp,
"",
"",
380 sprintf($lng->txt(
'grp_membership_request_subject'), $ilUser->getFirstname(), $ilUser->getLastname(), $this->container->getTitle()),
381 sprintf(str_replace(
'\n',
"\n",$lng->txt(
'grp_membership_request_body')), $ilUser->getFirstname(), $ilUser->getLastname(), $ilUser->getLogin(), $ilUser->getEmail(),
382 $this->container->getTitle(), $ilIliasIniFile->readVariable(
'server',
'http_path').
'/goto.php?client_id='.CLIENT_ID.
'&target=grp_'.$this->container->getRefId(), $_POST[
"grp_subject"]),
383 array(),array(
'system'));
387 ilUtil::redirect(
"repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
393 $this->ctrl->returnToParent($this);
406 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');