ILIAS  Release_4_1_x_branch Revision 61804
 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

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
 addCommandButtons ()
 Add group specific command buttons.
 validate ()
 validate join request
 add ()
 add user
 initParticipants ()
 Init course participants.
 initWaitingList ()
 isWaitingListActive ()
- Protected Member Functions inherited from ilRegistrationGUI
 isRegistrationPossible ()
 check if registration is possible
 enableRegistration ($a_status)
 set registration disabled
 getWaitingList ()
 Get waiting list object.
 leaveWaitingList ()
 fillMembershipLimitation ()
 Show membership limitations.
 fillAgreement ()
 Show user agreement.
 showCustomFields ()
 Show course defined fields.
 validateAgreement ()
 Check Agreement.
 validateCustomFields ()
 Check required course fields.
 setAccepted ($a_status)
 Set Agreement accepted.
 initForm ()
 init registration form
 updateSubscriptionRequest ()
 Update subscription message.
 cancelSubscriptionRequest ()

Additional Inherited Members

- Protected Attributes inherited from ilRegistrationGUI
 $privacy = null
 $container = null
 $ref_id
 $obj_id
 $participants
 $waiting_list = null
 $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 36 of file class.ilGroupRegistrationGUI.php.

Constructor & Destructor Documentation

ilGroupRegistrationGUI::__construct (   $a_container)

Constructor.

public

Parameters
objectcontainer object

Reimplemented from ilRegistrationGUI.

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

{
parent::__construct($a_container);
}

Member Function Documentation

ilGroupRegistrationGUI::add ( )
protected

add user

protected

Parameters
@return

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

References $_POST, ilRegistrationGUI\$lng, ilRegistrationGUI\$waiting_list, ilWaitingList\addToList(), ilForumNotification\checkForumsExistsInsert(), GRP_REGISTRATION_REQUEST, IL_GRP_MEMBER, ilUtil\redirect(), ilUtil\sendSuccess(), ilRegistrationGUI\setAccepted(), ilUtil\stripSlashes(), ilGroupMembershipMailNotification\TYPE_NOTIFICATION_REGISTRATION, ilGroupMembershipMailNotification\TYPE_NOTIFICATION_REGISTRATION_REQUEST, ilGroupMembershipMailNotification\TYPE_SUBSCRIBE_MEMBER, and ilGroupMembershipMailNotification\TYPE_WAITING_LIST_MEMBER.

{
global $ilUser,$tree, $rbacreview, $lng;
// set aggreement accepted
$this->setAccepted(true);
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'),
$this->container->getTitle(),
$waiting_list->getPosition($ilUser->getId()));
$this->participants->sendNotification(
$ilUser->getId()
);
ilUtil::sendSuccess($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['subject']));
$this->participants->sendNotification(
$ilUser->getId()
);
ilUtil::sendSuccess($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);
$this->participants->sendNotification(
$ilUser->getId()
);
$this->participants->sendNotification(
$ilUser->getId()
);
include_once './Modules/Forum/classes/class.ilForumNotification.php';
ilForumNotification::checkForumsExistsInsert($this->container->getRefId(), $ilUser->getId());
ilUtil::sendSuccess($this->lng->txt("grp_registration_completed"),true);
$this->ctrl->returnToParent($this);
break;
}
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::addCommandButtons ( )
protected

Add group specific command buttons.

Returns

Reimplemented from ilRegistrationGUI.

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

References GRP_REGISTRATION_REQUEST, and ilRegistrationGUI\isRegistrationPossible().

{
global $ilUser;
switch($this->container->getRegistrationType())
{
if($this->participants->isSubscriber($ilUser->getId()))
{
$this->form->clearCommandButtons();
$this->form->addCommandButton('updateSubscriptionRequest', $this->lng->txt('grp_update_subscr_request'));
$this->form->addCommandButton('cancelSubscriptionRequest', $this->lng->txt('grp_cancel_subscr_request'));
}
else
{
if(!$this->isRegistrationPossible())
{
return false;
}
$this->form->clearCommandButtons();
$this->form->addCommandButton('join', $this->lng->txt('grp_join_request'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::executeCommand ( )

Execute command.

public

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

References $cmd, and ilRegistrationGUI\getWaitingList().

{
global $ilUser,$ilTabs;
$next_class = $this->ctrl->getNextClass($this);
if($this->getWaitingList()->isOnList($ilUser->getId()))
{
$ilTabs->activateTab('leave');
}
switch($next_class)
{
default:
$cmd = $this->ctrl->getCmd("show");
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::fillInformations ( )
protected

fill informations

protected

Parameters
@return

Reimplemented from ilRegistrationGUI.

Definition at line 100 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 181 of file class.ilGroupRegistrationGUI.php.

References ilRegistrationGUI\$tpl, ilRegistrationGUI\$waiting_list, ilRegistrationGUI\enableRegistration(), ilRegistrationGUI\getWaitingList(), ilUtil\sendFailure(), 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());
if($free)
$tpl->setVariable('NUM_FREE',$free);
else
$tpl->setVariable('WARN_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'));
if($free and $waiting_list->getCountUsers())
$tpl->setVariable('WARN_WAIT',$waiting_list->getCountUsers());
else
$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);
}
elseif(!$free and $this->container->isWaitingListEnabled())
{
$alert = $this->lng->txt('grp_warn_no_max_set_on_waiting_list');
}
elseif($free and $this->container->isWaitingListEnabled() and $this->getWaitingList()->getCountUsers())
{
$alert = $this->lng->txt('grp_warn_wl_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 116 of file class.ilGroupRegistrationGUI.php.

References ilRegistrationGUI\$tpl, ilDateTime\_after(), ilDateTime\_before(), ilRegistrationGUI\enableRegistration(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ilUtil\sendFailure(), 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 262 of file class.ilGroupRegistrationGUI.php.

References $_POST, $pass, ilRegistrationGUI\enableRegistration(), ilRegistrationGUI\getWaitingList(), GRP_REGISTRATION_DEACTIVATED, GRP_REGISTRATION_DIRECT, GRP_REGISTRATION_PASSWORD, GRP_REGISTRATION_REQUEST, isWaitingListActive(), ilUtil\sendFailure(), ilNonEditableValueGUI\setValue(), and ilTextAreaInputGUI\setValue().

{
global $ilUser;
if($this->getWaitingList()->isOnList($ilUser->getId()))
{
return true;
}
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;
// no "request" info if waiting list is active
if($this->isWaitingListActive())
return true;
$txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
$txt->setValue($this->lng->txt('grp_reg_request'));
$sub = new ilTextAreaInputGUI($this->lng->txt('grp_reg_subject'),'subject');
$sub->setValue($_POST['subject']);
$sub->setInfo($this->lng->txt('group_req_registration_msg'));
$sub->setCols(40);
$sub->setRows(5);
if($this->participants->isSubscriber($ilUser->getId()))
{
$sub_data = $this->participants->getSubscriberData($ilUser->getId());
$sub->setValue($sub_data['subject']);
$sub->setInfo('');
ilUtil::sendFailure($this->lng->txt('grp_already_assigned'));
$this->enableRegistration(false);
}
$txt->addSubItem($sub);
$this->form->addItem($txt);
break;
// no "direct registration" info if waiting list is active
if($this->isWaitingListActive())
return true;
$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 82 of file class.ilGroupRegistrationGUI.php.

References ilRegistrationGUI\getWaitingList().

{
global $ilUser;
if($this->getWaitingList()->isOnList($ilUser->getId()))
{
return $this->lng->txt('member_status');
}
return $this->lng->txt('grp_registration');
}

+ Here is the call graph for this function:

ilGroupRegistrationGUI::initParticipants ( )
protected

Init course participants.

protected

Reimplemented from ilRegistrationGUI.

Definition at line 506 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::initWaitingList ( )
protected
See Also
ilRegistrationGUI::initWaitingList() protected

Reimplemented from ilRegistrationGUI.

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

{
include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
$this->waiting_list = new ilGroupWaitingList($this->container->getId());
}
ilGroupRegistrationGUI::isWaitingListActive ( )
protected
See Also
ilRegistrationGUI::isWaitingListActive()

Reimplemented from ilRegistrationGUI.

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

References ilRegistrationGUI\getWaitingList().

Referenced by fillRegistrationType().

{
global $ilUser;
static $active = null;
if($active !== null)
{
return $active;
}
if(!$this->container->getMaxMembers())
{
return $active = false;
}
if(!$this->container->isWaitingListEnabled())
{
return $active = false;
}
$free = max(0,$this->container->getMaxMembers() - $this->participants->getCountMembers());
return $active = (!$free or $this->getWaitingList()->getCountUsers());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilGroupRegistrationGUI::validate ( )
protected

validate join request

protected

Returns

Reimplemented from ilRegistrationGUI.

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

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

{
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;
}
}
if(!$this->validateCustomFields())
{
$this->join_error = $this->lng->txt('fill_out_all_required_fields');
return false;
}
if(!$this->validateAgreement())
{
$this->join_error = $this->lng->txt($this->type.'_agreement_required');
return false;
}
return true;
}

+ Here is the call graph for this function:


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