ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRegistrationGUI Class Reference

Base class for Course and Group registration. More...

+ Inheritance diagram for ilRegistrationGUI:
+ Collaboration diagram for ilRegistrationGUI:

Public Member Functions

 __construct ($a_container)
 Constructor.
 cancel ()
 cancel subscription
 show ()
 show registration form
 join ()
 join

Protected Member Functions

 isRegistrationPossible ()
 check if registration is possible
 enableRegistration ($a_status)
 set registration disabled
 initParticipants ()
 Init participants object (course or group participants)
 initWaitingList ()
 Init waiting list (course or group waiting list)
 isWaitingListActive ()
 Check if the waiting list is active Maximum of members exceeded or any user on the waiting list.
 getWaitingList ()
 Get waiting list object.
 leaveWaitingList ()
 getFormTitle ()
 Get title for property form.
 fillInformations ()
 fill informations
 fillRegistrationPeriod ()
 show informations about the registration period
 fillMaxMembers ()
 show informations about the maximum number of user.
 fillRegistrationType ()
 show informations about registration procedure
 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.
 validate ()
 validate join request
 initForm ()
 init registration form
 addCommandButtons ()
 Add command buttons.
 updateSubscriptionRequest ()
 Update subscription message.
 cancelSubscriptionRequest ()

Protected Attributes

 $privacy = null
 $container = null
 $ref_id
 $obj_id
 $participants
 $waiting_list = null
 $form
 $registration_possible = true
 $join_error = ''
 $tpl
 $lng
 $ctrl

Detailed Description

Base class for Course and Group registration.

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.ilRegistrationGUI.php.

Constructor & Destructor Documentation

ilRegistrationGUI::__construct (   $a_container)

Constructor.

public

Parameters
objectCourse or Group object
Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 62 of file class.ilRegistrationGUI.php.

References $ilCtrl, $lng, $tpl, ilPrivacySettings\_getInstance(), ilObject\_lookupObjId(), ilObject\_lookupType(), initParticipants(), and initWaitingList().

{
global $lng,$ilCtrl,$tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('crs');
$this->lng->loadLanguageModule('grp');
$this->lng->loadLanguageModule('ps');
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->container = $a_container;
$this->ref_id = $this->container->getRefId();
$this->obj_id = ilObject::_lookupObjId($this->ref_id);
$this->type = ilObject::_lookupType($this->obj_id);
// Init participants
$this->initParticipants();
// Init waiting list
$this->initWaitingList();
$this->privacy = ilPrivacySettings::_getInstance();
}

+ Here is the call graph for this function:

Member Function Documentation

ilRegistrationGUI::addCommandButtons ( )
protected

Add command buttons.

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 572 of file class.ilRegistrationGUI.php.

References getWaitingList(), isRegistrationPossible(), isWaitingListActive(), and ilUtil\sendQuestion().

Referenced by initForm().

{
global $ilUser;
if($this->isRegistrationPossible() and $this->isWaitingListActive() and !$this->getWaitingList()->isOnList($ilUser->getId()))
{
$this->form->addCommandButton('join',$this->lng->txt('mem_add_to_wl'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
elseif($this->isRegistrationPossible() and !$this->getWaitingList()->isOnList($ilUser->getId()))
{
$this->form->addCommandButton('join',$this->lng->txt('join'));
$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
}
if($this->getWaitingList()->isOnList($ilUser->getId()))
{
sprintf($this->lng->txt($this->container->getType().'_cancel_waiting_list'),
$this->container->getTitle())
);
$this->form->addCommandButton('leaveWaitingList', $this->lng->txt('leave_waiting_list'));
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::cancel ( )

cancel subscription

public

Definition at line 472 of file class.ilRegistrationGUI.php.

References ilUtil\redirect().

{
global $tree;
ilUtil::redirect('repository.php?ref_id='.
$tree->getParentId($this->container->getRefId()));
}

+ Here is the call graph for this function:

ilRegistrationGUI::cancelSubscriptionRequest ( )
protected

Definition at line 610 of file class.ilRegistrationGUI.php.

References ilUtil\redirect(), and ilUtil\sendSuccess().

{
global $ilUser,$tree;
$this->participants->deleteSubscriber($ilUser->getId());
ilUtil::sendSuccess($this->lng->txt('sub_request_deleted'),true);
ilUtil::redirect("repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
}

+ Here is the call graph for this function:

ilRegistrationGUI::enableRegistration (   $a_status)
protected
ilRegistrationGUI::fillAgreement ( )
protected

Show user agreement.

protected

Returns

Definition at line 261 of file class.ilRegistrationGUI.php.

References $tpl, ilExportFieldsInfo\_getInstanceByType(), ilCourseDefinedFieldDefinition\_hasFields(), ilObject\_lookupType(), isRegistrationPossible(), ilCustomInputGUI\setHtml(), ilFormPropertyGUI\setRequired(), and showCustomFields().

Referenced by initForm().

{
global $ilUser;
if(!$this->isRegistrationPossible())
{
return true;
}
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!$this->privacy->confirmationRequired($this->type) and !ilCourseDefinedFieldDefinition::_hasFields($this->container->getId()))
{
return true;
}
$this->lng->loadLanguageModule('ps');
include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
$fields_info = ilExportFieldsInfo::_getInstanceByType(ilObject::_lookupType($this->container->getId()));
if(!count($fields_info->getExportableFields()))
{
return true;
}
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('usr_agreement'));
$this->form->addItem($section);
$fields = new ilCustomInputGUI($this->lng->txt($this->type.'_user_agreement'),'');
$tpl = new ilTemplate('tpl.agreement_form.html',true,true,'Services/Membership');
$tpl->setVariable('TXT_INFO_AGREEMENT',$this->lng->txt($this->type.'_info_agreement'));
foreach($fields_info->getExportableFields() as $field)
{
$tpl->setCurrentBlock('field_item');
$tpl->setVariable('FIELD_NAME',$this->lng->txt($field));
$tpl->parseCurrentBlock();
}
$fields->setHtml($tpl->get());
$this->form->addItem($fields);
$this->showCustomFields();
// Checkbox agreement
if($this->privacy->confirmationRequired($this->type))
{
$agreement = new ilCheckboxInputGUI($this->lng->txt($this->type.'_agree'),'agreement');
$agreement->setRequired(true);
$agreement->setOptionTitle($this->lng->txt($this->type.'_info_agree'));
$agreement->setValue(1);
$this->form->addItem($agreement);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::fillInformations ( )
abstractprotected

fill informations

protected

Returns

Reimplemented in ilGroupRegistrationGUI, and ilCourseRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillMaxMembers ( )
abstractprotected

show informations about the maximum number of user.

protected

Parameters
@return

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillMembershipLimitation ( )
protected

Show membership limitations.

protected

Returns

Definition at line 207 of file class.ilRegistrationGUI.php.

References $obj_id, $ref_id, $title, $tpl, $type, ilObjCourseGrouping\_checkGroupingDependencies(), ilObjCourseGrouping\_getGroupingItems(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), enableRegistration(), ilUtil\getTypeIconPath(), and ilCustomInputGUI\setHtml().

Referenced by initForm().

{
global $ilAccess;
include_once('Modules/Course/classes/class.ilObjCourseGrouping.php');
if(!$items = ilObjCourseGrouping::_getGroupingItems($this->container))
{
return true;
}
$mem = new ilCustomInputGUI($this->lng->txt('groupings'));
$tpl = new ilTemplate('tpl.membership_limitation_form.html',true,true,'Services/Membership');
$tpl->setVariable('LIMIT_INTRO',$this->lng->txt($this->type.'_grp_info_reg'));
foreach($items as $ref_id)
{
if($ilAccess->checkAccess('visible','',$ref_id,$type))
{
include_once('./classes/class.ilLink.php');
$tpl->setVariable('LINK_ITEM','repository.php?ref_id='.$ref_id);
$tpl->setVariable('ITEM_LINKED_TITLE',$title);
}
else
{
$tpl->setVariable('ITEM_TITLE');
}
$tpl->setCurrentBlock('items');
$tpl->setVariable('TYPE_ICON',ilUtil::getTypeIconPath($type,$obj_id,'tiny'));
$tpl->setVariable('ALT_ICON',$this->lng->txt('obj_'.$type));
$tpl->parseCurrentBlock();
}
$mem->setHtml($tpl->get());
{
$mem->setAlert($this->container->getMessage());
$this->enableRegistration(false);
}
$this->form->addItem($mem);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::fillRegistrationPeriod ( )
abstractprotected

show informations about the registration period

protected

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::fillRegistrationType ( )
abstractprotected

show informations about registration procedure

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::getFormTitle ( )
abstractprotected

Get title for property form.

protected

Returns
string title

Reimplemented in ilGroupRegistrationGUI, and ilCourseRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::initForm ( )
protected

init registration form

protected

Returns

Definition at line 533 of file class.ilRegistrationGUI.php.

References addCommandButtons(), fillAgreement(), fillInformations(), fillMaxMembers(), fillMembershipLimitation(), fillRegistrationPeriod(), fillRegistrationType(), getFormTitle(), and isRegistrationPossible().

Referenced by join(), and show().

{
global $ilUser;
if(is_object($this->form))
{
return true;
}
include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'join'));
$this->form->setTitle($this->getFormTitle());
$this->fillInformations();
{
}
{
}
{
$this->fillMaxMembers();
}
{
$this->fillAgreement();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::initParticipants ( )
abstractprotected

Init participants object (course or group participants)

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by __construct().

+ Here is the caller graph for this function:

ilRegistrationGUI::initWaitingList ( )
abstractprotected

Init waiting list (course or group waiting list)

protected

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by __construct().

+ Here is the caller graph for this function:

ilRegistrationGUI::isRegistrationPossible ( )
protected

check if registration is possible

protected

Returns
bool

Definition at line 94 of file class.ilRegistrationGUI.php.

References $registration_possible.

Referenced by ilGroupRegistrationGUI\addCommandButtons(), ilCourseRegistrationGUI\addCommandButtons(), addCommandButtons(), fillAgreement(), initForm(), ilGroupRegistrationGUI\validate(), and ilCourseRegistrationGUI\validate().

{
}

+ Here is the caller graph for this function:

ilRegistrationGUI::isWaitingListActive ( )
abstractprotected

Check if the waiting list is active Maximum of members exceeded or any user on the waiting list.

Returns

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by addCommandButtons().

+ Here is the caller graph for this function:

ilRegistrationGUI::join ( )

join

public

Parameters
@return

Definition at line 501 of file class.ilRegistrationGUI.php.

References initForm(), ilUtil\sendFailure(), show(), and validate().

{
$this->initForm();
if(!$this->validate())
{
ilUtil::sendFailure($this->join_error);
$this->show();
return false;
}
$this->add();
}

+ Here is the call graph for this function:

ilRegistrationGUI::leaveWaitingList ( )
protected

Definition at line 147 of file class.ilRegistrationGUI.php.

References $ilCtrl, getWaitingList(), ilUtil\redirect(), and ilUtil\sendSuccess().

{
global $ilUser,$tree,$ilCtrl;
$this->getWaitingList()->removeFromList($ilUser->getId());
$parent = $tree->getParentId($this->container->getRefId());
$message = sprintf($this->lng->txt($this->container->getType().'_removed_from_waiting_list'),
$this->container->getTitle());
ilUtil::sendSuccess($message,true);
ilUtil::redirect('repository.php?ref_id='.$parent);
}

+ Here is the call graph for this function:

ilRegistrationGUI::setAccepted (   $a_status)
protected

Set Agreement accepted.

private

Parameters
bool

Definition at line 450 of file class.ilRegistrationGUI.php.

References ilCourseDefinedFieldDefinition\_hasFields(), and ilMemberAgreement\setAccepted().

Referenced by ilGroupRegistrationGUI\add(), ilCourseRegistrationGUI\add(), and ilCourseRegistrationGUI\validate().

{
global $ilUser;
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!$this->privacy->confirmationRequired($this->type) and !ilCourseDefinedFieldDefinition::_hasFields($this->container->getId()))
{
return true;
}
include_once('Services/Membership/classes/class.ilMemberAgreement.php');
$this->agreement = new ilMemberAgreement($ilUser->getId(),$this->container->getId());
$this->agreement->setAccepted($a_status);
$this->agreement->setAcceptanceTime(time());
$this->agreement->save();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::show ( )

show registration form

public

Parameters
@return

Definition at line 487 of file class.ilRegistrationGUI.php.

References initForm().

Referenced by join().

{
$this->initForm();
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::showCustomFields ( )
protected

Show course defined fields.

protected

Definition at line 322 of file class.ilRegistrationGUI.php.

References $_POST, ilCourseDefinedFieldDefinition\_getFields(), IL_CDF_TYPE_SELECT, IL_CDF_TYPE_TEXT, ilNonEditableValueGUI\setValue(), and ilUtil\stripSlashes().

Referenced by fillAgreement().

{
global $ilUser;
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
if(!count($cdf_fields = ilCourseDefinedFieldDefinition::_getFields($this->container->getId())))
{
return true;
}
$cdf = new ilNonEditableValueGUI($this->lng->txt('ps_crs_user_fields'));
$cdf->setValue($this->lng->txt($this->type.'_ps_cdf_info'));
$cdf->setRequired(true);
foreach($cdf_fields as $field_obj)
{
$course_user_data = new ilCourseUserData($ilUser->getId(),$field_obj->getId());
switch($field_obj->getType())
{
$select = new ilSelectInputGUI($field_obj->getName(),'cdf['.$field_obj->getId().']');
$select->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
$select->setOptions($field_obj->prepareSelectBox());
if($field_obj->isRequired())
{
$select->setRequired(true);
}
$cdf->addSubItem($select);
break;
$text = new ilTextInputGUI($field_obj->getName(),'cdf['.$field_obj->getId().']');
$text->setValue(ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]));
$text->setSize(32);
$text->setMaxLength(255);
if($field_obj->isRequired())
{
$text->setRequired(true);
}
$cdf->addSubItem($text);
break;
}
}
$this->form->addItem($cdf);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRegistrationGUI::updateSubscriptionRequest ( )
protected

Update subscription message.

Returns
void

Definition at line 601 of file class.ilRegistrationGUI.php.

References $_POST, ilUtil\redirect(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

{
global $ilUser,$tree;
$this->participants->updateSubject($ilUser->getId(),ilUtil::stripSlashes($_POST['subject']));
ilUtil::sendSuccess($this->lng->txt('sub_request_saved'),true);
ilUtil::redirect("repository.php?ref_id=".$tree->getParentId($this->container->getRefId()));
}

+ Here is the call graph for this function:

ilRegistrationGUI::validate ( )
protected

validate join request

protected

Returns
bool

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Definition at line 522 of file class.ilRegistrationGUI.php.

Referenced by join().

{
return true;
}

+ Here is the caller graph for this function:

ilRegistrationGUI::validateAgreement ( )
protected

Check Agreement.

protected

Definition at line 381 of file class.ilRegistrationGUI.php.

References $_POST.

Referenced by ilGroupRegistrationGUI\validate(), and ilCourseRegistrationGUI\validate().

{
global $ilUser;
if($_POST['agreement'])
{
return true;
}
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
if(!$this->privacy->confirmationRequired($this->type))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilRegistrationGUI::validateCustomFields ( )
protected

Check required course fields.

protected

Definition at line 403 of file class.ilRegistrationGUI.php.

References $_POST, ilCourseDefinedFieldDefinition\_getFields(), IL_CDF_TYPE_SELECT, IL_CDF_TYPE_TEXT, ilCourseUserData\setValue(), and ilUtil\stripSlashes().

Referenced by ilGroupRegistrationGUI\validate(), and ilCourseRegistrationGUI\validate().

{
global $ilUser;
include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
$all_required = true;
foreach(ilCourseDefinedFieldDefinition::_getFields($this->container->getId()) as $field_obj)
{
switch($field_obj->getType())
{
$tmp_value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]);
$value = '';
foreach((array) $field_obj->getValues() as $v)
{
if($v == $tmp_value)
{
$value = $tmp_value;
break;
}
}
break;
$value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]);
break;
}
$course_user_data = new ilCourseUserData($ilUser->getId(),$field_obj->getId());
$course_user_data->setValue($value);
$course_user_data->update();
if($field_obj->isRequired() and (!strlen($value) or $value == -1))
{
$all_required = false;
}
}
return $all_required;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilRegistrationGUI::$container = null
protected

Definition at line 39 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$ctrl
protected

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

ilRegistrationGUI::$form
protected

Definition at line 45 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$join_error = ''
protected

Definition at line 48 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$lng
protected

Definition at line 52 of file class.ilRegistrationGUI.php.

Referenced by __construct(), and ilGroupRegistrationGUI\add().

ilRegistrationGUI::$obj_id
protected

Definition at line 41 of file class.ilRegistrationGUI.php.

Referenced by fillMembershipLimitation().

ilRegistrationGUI::$participants
protected

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

ilRegistrationGUI::$privacy = null
protected

Definition at line 37 of file class.ilRegistrationGUI.php.

ilRegistrationGUI::$ref_id
protected

Definition at line 40 of file class.ilRegistrationGUI.php.

Referenced by fillMembershipLimitation().

ilRegistrationGUI::$registration_possible = true
protected

Definition at line 47 of file class.ilRegistrationGUI.php.

Referenced by isRegistrationPossible().


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