ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilGroupRegistrationGUI Class Reference

GUI class for group registrations. More...

+ Inheritance diagram for ilGroupRegistrationGUI:
+ Collaboration diagram for ilGroupRegistrationGUI:

Public Member Functions

 __construct ($a_container)
 Constructor.
 executeCommand ()
 Execute command.
- Public Member Functions inherited from ilRegistrationGUI
 cancel ()
 cancel subscription
 show ()
 show registration form
 join ()
 join
 ilRegistrationGUI ()
 login ()
 displayForm ()
 showUserDefinedFields ()
 checkUserDefinedRequiredFields ()
 saveForm ()
 __validateRole ()
 __assignRole ()
 __showRoleSelection ()
 __distributeMails ()

Protected Member Functions

 getFormTitle ()
 get form title
 fillInformations ()
 fill informations
 fillRegistrationPeriod ()
 show informations about the registration period
 fillMaxMembers ()
 fill max member informations
 fillRegistrationType ()
 fill registration procedure
 validate ()
 validate join request
 add ()
 add user
 initParticipants ()
 Init course participants.
- Protected Member Functions inherited from ilRegistrationGUI
 isRegistrationPossible ()
 check if registration is possible
 enableRegistration ($a_status)
 set registration disabled
 fillMembershipLimitation ()
 Show membership limitations.
 fillAgreement ()
 Show user agreement.
 initForm ()
 init registration form

Additional Inherited Members

- Protected Attributes inherited from ilRegistrationGUI
 $container = null
 $ref_id
 $obj_id
 $participants
 $form
 $registration_possible = true
 $join_error = ''
 $tpl
 $lng
 $ctrl

Detailed Description

GUI class for group registrations.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 35 of file class.ilGroupRegistrationGUI.php.

Constructor & Destructor Documentation

ilGroupRegistrationGUI::__construct (   $a_container)

Constructor.

public

Parameters
objectcontainer object

Reimplemented from ilRegistrationGUI.

Definition at line 43 of file class.ilGroupRegistrationGUI.php.

{
parent::__construct($a_container);
}

Member Function Documentation

ilGroupRegistrationGUI::add ( )
protected

add user

protected

Parameters
@return

Definition at line 346 of file class.ilGroupRegistrationGUI.php.

References $_SESSION, $ilIliasIniFile, ilRegistrationGUI\$lng, ilObjUser\_lookupLogin(), ilWaitingList\addToList(), GRP_REGISTRATION_REQUEST, IL_GRP_MEMBER, ilUtil\redirect(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

{
global $ilUser,$tree, $rbacreview, $lng;
include_once('./Modules/Group/classes/class.ilGroupWaitingList.php');
$free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
$waiting_list = new ilGroupWaitingList($this->container->getId());
if($this->container->isMembershipLimited() and $this->container->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers()))
{
$waiting_list->addToList($ilUser->getId());
$info = sprintf($this->lng->txt('grp_added_to_list'),$waiting_list->getPosition($ilUser->getId()));
ilUtil::sendInfo($info,true);
ilUtil::redirect("repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
}
switch($this->container->getRegistrationType())
{
$this->participants->addSubscriber($ilUser->getId());
$this->participants->updateSubscriptionTime($ilUser->getId(),time());
$this->participants->updateSubject($ilUser->getId(),ilUtil::stripSlashes($_POST['grp_subject']));
foreach($this->participants->getNotificationRecipients() as $rcp)
{
$mail = new ilMail($_SESSION["AccountId"]);
// XXX - The message should be sent in the language of the receiver,
// instead of in the language of the current user
$mail->sendMail($rcp,"","",
sprintf($lng->txt('grp_membership_request_subject'), $ilUser->getFirstname(), $ilUser->getLastname(), $this->container->getTitle()),
sprintf(str_replace('\n',"\n",$lng->txt('grp_membership_request_body')), $ilUser->getFirstname(), $ilUser->getLastname(), $ilUser->getLogin(), $ilUser->getEmail(),
$this->container->getTitle(), $ilIliasIniFile->readVariable('server','http_path').'/goto.php?client_id='.CLIENT_ID.'&target=grp_'.$this->container->getRefId(), $_POST["grp_subject"]),
array(),array('system'));
}
ilUtil::sendInfo($this->lng->txt("application_completed"),true);
ilUtil::redirect("repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
break;
default:
$this->participants->add($ilUser->getId(),IL_GRP_MEMBER);
ilUtil::sendInfo($this->lng->txt("grp_registration_completed"),true);
$this->ctrl->returnToParent($this);
break;
}
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::executeCommand ( )

Execute command.

public

Reimplemented from ilRegistrationGUI.

Definition at line 53 of file class.ilGroupRegistrationGUI.php.

References $cmd.

{
$next_class = $this->ctrl->getNextClass($this);
switch($next_class)
{
default:
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
break;
}
return true;
}
ilGroupRegistrationGUI::fillInformations ( )
protected

fill informations

protected

Parameters
@return

Reimplemented from ilRegistrationGUI.

Definition at line 86 of file class.ilGroupRegistrationGUI.php.

References ilUtil\makeClickable().

{
if($this->container->getInformation())
{
$imp = new ilNonEditableValueGUI($this->lng->txt('crs_important_info'));
$value = nl2br(ilUtil::makeClickable($this->container->getInformation(), true));
$imp->setValue($value);
$this->form->addItem($imp);
}
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::fillMaxMembers ( )
protected

fill max member informations

protected

Returns

Reimplemented from ilRegistrationGUI.

Definition at line 166 of file class.ilGroupRegistrationGUI.php.

References ilRegistrationGUI\$tpl, ilRegistrationGUI\enableRegistration(), and ilCustomInputGUI\setHtml().

{
global $ilUser;
if(!$this->container->isMembershipLimited())
{
return true;
}
$tpl = new ilTemplate('tpl.max_members_form.html',true,true,'Services/Membership');
$tpl->setVariable('TXT_MAX',$this->lng->txt('mem_max_users'));
$tpl->setVariable('NUM_MAX',$this->container->getMaxMembers());
$tpl->setVariable('TXT_FREE',$this->lng->txt('mem_free_places').":");
$free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
$tpl->setVariable('NUM_FREE',$free);
include_once('./Modules/Group/classes/class.ilGroupWaitingList.php');
$waiting_list = new ilGroupWaitingList($this->container->getId());
if($this->container->isWaitingListEnabled() and (!$free or $waiting_list->getCountUsers()))
{
if($waiting_list->isOnList($ilUser->getId()))
{
$tpl->setVariable('TXT_WAIT',$this->lng->txt('mem_waiting_list_position'));
$tpl->setVariable('NUM_WAIT',$waiting_list->getPosition($ilUser->getId()));
}
else
{
$tpl->setVariable('TXT_WAIT',$this->lng->txt('mem_waiting_list'));
$tpl->setVariable('NUM_WAIT',$waiting_list->getCountUsers());
}
}
$alert = '';
if(!$free and !$this->container->isWaitingListEnabled())
{
// Disable registration
$this->enableRegistration(false);
$alert = $this->lng->txt('mem_alert_no_places');
}
elseif($this->container->isWaitingListEnabled() and $waiting_list->isOnList($ilUser->getId()))
{
// Disable registration
$this->enableRegistration(false);
$alert = $this->lng->txt('mem_already_on_list');
}
elseif(!$free and $this->container->isWaitingListEnabled())
{
$alert = $this->lng->txt('grp_set_on_waiting_list');
}
elseif($waiting_list->getCountUsers() and $this->container->isWaitingListEnabled())
{
$alert = $this->lng->txt('grp_set_on_waiting_list');
}
$max = new ilCustomInputGUI($this->lng->txt('mem_participants'));
$max->setHtml($tpl->get());
if(strlen($alert))
{
$max->setAlert($alert);
}
$this->form->addItem($max);
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::fillRegistrationPeriod ( )
protected

show informations about the registration period

protected

Reimplemented from ilRegistrationGUI.

Definition at line 102 of file class.ilGroupRegistrationGUI.php.

References ilRegistrationGUI\$tpl, ilDateTime\_after(), ilDateTime\_before(), ilRegistrationGUI\enableRegistration(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ilCustomInputGUI\setHtml(), and ilNonEditableValueGUI\setValue().

{
include_once('./Services/Calendar/classes/class.ilDateTime.php');
$now = new ilDateTime(time(),IL_CAL_UNIX,'UTC');
if($this->container->isRegistrationUnlimited())
{
$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_period'));
$reg->setValue($this->lng->txt('mem_unlimited'));
$this->form->addItem($reg);
return true;
}
$start = $this->container->getRegistrationStart();
$end = $this->container->getRegistrationEnd();
if(ilDateTime::_before($now,$start))
{
$tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
$tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_start'));
$tpl->setVariable('FIRST',ilDatePresentation::formatDate($start));
$tpl->setVariable('TXT_END',$this->lng->txt('mem_end'));
$tpl->setVariable('END',ilDatePresentation::formatDate($end));
$warning = $this->lng->txt('mem_reg_not_started');
}
elseif(ilDateTime::_after($now,$end))
{
$tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
$tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_start'));
$tpl->setVariable('FIRST',ilDatePresentation::formatDate($start));
$tpl->setVariable('TXT_END',$this->lng->txt('mem_end'));
$tpl->setVariable('END',ilDatePresentation::formatDate($end));
$warning = $this->lng->txt('mem_reg_expired');
}
else
{
$tpl = new ilTemplate('tpl.registration_period_form.html',true,true,'Services/Membership');
$tpl->setVariable('TXT_FIRST',$this->lng->txt('mem_end'));
$tpl->setVariable('FIRST',ilDatePresentation::formatDate($end));
}
$reg = new ilCustomInputGUI($this->lng->txt('mem_reg_period'));
$reg->setHtml($tpl->get());
if(strlen($warning))
{
// Disable registration
$this->enableRegistration(false);
$reg->setAlert($warning);
}
$this->form->addItem($reg);
return true;
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::fillRegistrationType ( )
protected

fill registration procedure

protected

Parameters
@return

Reimplemented from ilRegistrationGUI.

Definition at line 237 of file class.ilGroupRegistrationGUI.php.

References $pass, ilRegistrationGUI\enableRegistration(), GRP_REGISTRATION_DEACTIVATED, GRP_REGISTRATION_DIRECT, GRP_REGISTRATION_PASSWORD, GRP_REGISTRATION_REQUEST, ilTextAreaInputGUI\setValue(), and ilNonEditableValueGUI\setValue().

{
global $ilUser;
switch($this->container->getRegistrationType())
{
$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
$reg->setValue($this->lng->txt('grp_reg_disabled'));
#$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
$this->form->addItem($reg);
// Disable registration
$this->enableRegistration(false);
break;
$txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
$txt->setValue($this->lng->txt('grp_pass_request'));
$pass = new ilTextInputGUI($this->lng->txt('passwd'),'grp_passw');
$pass->setInputType('password');
$pass->setSize(12);
$pass->setMaxLength(32);
#$pass->setRequired(true);
$pass->setInfo($this->lng->txt('group_password_registration_msg'));
$txt->addSubItem($pass);
$this->form->addItem($txt);
break;
$txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
$txt->setValue($this->lng->txt('grp_reg_request'));
$sub = new ilTextAreaInputGUI($this->lng->txt('subject'),'grp_subject');
$sub->setValue($_POST['grp_subject']);
$sub->setInfo($this->lng->txt('group_req_registration_msg'));
$sub->setCols(40);
$sub->setRows(5);
if($this->participants->isSubscriber($ilUser->getId()))
{
$sub->setAlert($this->lng->txt('grp_already_applied'));
$this->enableRegistration(false);
}
$txt->addSubItem($sub);
$this->form->addItem($txt);
break;
$txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
$txt->setValue($this->lng->txt('group_req_direct'));
$this->form->addItem($txt);
break;
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::getFormTitle ( )
protected

get form title

protected

Returns
string title

Reimplemented from ilRegistrationGUI.

Definition at line 74 of file class.ilGroupRegistrationGUI.php.

{
return $this->lng->txt('grp_registration');
}
ilGroupRegistrationGUI::initParticipants ( )
protected

Init course participants.

protected

Reimplemented from ilRegistrationGUI.

Definition at line 404 of file class.ilGroupRegistrationGUI.php.

References ilGroupParticipants\_getInstanceByObjId().

{
include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
$this->participants = ilGroupParticipants::_getInstanceByObjId($this->obj_id);
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::validate ( )
protected

validate join request

protected

Returns

Reimplemented from ilRegistrationGUI.

Definition at line 308 of file class.ilGroupRegistrationGUI.php.

References $pass, GRP_REGISTRATION_PASSWORD, ilRegistrationGUI\isRegistrationPossible(), and ilUtil\stripSlashes().

{
global $ilUser;
if($ilUser->getId() == ANONYMOUS_USER_ID)
{
$this->join_error = $this->lng->txt('permission_denied');
return false;
}
if(!$this->isRegistrationPossible())
{
$this->join_error = $this->lng->txt('mem_error_preconditions');
return false;
}
if($this->container->getRegistrationType() == GRP_REGISTRATION_PASSWORD)
{
if(!strlen($pass = ilUtil::stripSlashes($_POST['grp_passw'])))
{
$this->join_error = $this->lng->txt('err_wrong_password');
return false;
}
if(strcmp($pass,$this->container->getPassword()) !== 0)
{
$this->join_error = $this->lng->txt('err_wrong_password');
return false;
}
}
return true;
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: