ILIAS  Release_5_0_x_branch Revision 61816
 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.
 getContainer ()
 Parent object.
 getRefId ()
 Get ref.
 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 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 596 of file class.ilRegistrationGUI.php.

References $ilUser, 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 490 of file class.ilRegistrationGUI.php.

References $ilCtrl.

{
global $tree, $ilCtrl;
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
$tree->getParentId($this->container->getRefId()));
$ilCtrl->redirectByClass("ilrepositorygui", "");
}
ilRegistrationGUI::cancelSubscriptionRequest ( )
protected

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

References $ilCtrl, $ilUser, and ilUtil\sendSuccess().

{
global $ilUser, $tree, $ilCtrl;
$this->participants->deleteSubscriber($ilUser->getId());
ilUtil::sendSuccess($this->lng->txt('sub_request_deleted'),true);
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
$tree->getParentId($this->container->getRefId()));
$ilCtrl->redirectByClass("ilrepositorygui", "");
}

+ Here is the call graph for this function:

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

Show user agreement.

protected

Returns

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

References $ilUser, $section, ilExportFieldsInfo\_getInstanceByType(), ilCourseDefinedFieldDefinition\_hasFields(), ilObject\_lookupType(), ilMemberAgreementGUI\addAgreement(), ilMemberAgreementGUI\addCustomFields(), ilMemberAgreementGUI\addExportFieldInfo(), and isRegistrationPossible().

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->setTitle($this->lng->txt($this->type.'_usr_agreement'));
$this->form->addItem($section);
include_once './Services/Membership/classes/class.ilMemberAgreementGUI.php';
ilMemberAgreementGUI::addExportFieldInfo($this->form, $this->obj_id, $this->type);
ilMemberAgreementGUI::addCustomFields($this->form, $this->obj_id, $this->type);
// Checkbox agreement
if($this->privacy->confirmationRequired($this->type))
{
ilMemberAgreementGUI::addAgreement($this->form, $this->obj_id, $this->type);
}
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 ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

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 227 of file class.ilRegistrationGUI.php.

References $_GET, $ilCtrl, $obj_id, $ref_id, $tpl, ilObjCourseGrouping\_checkGroupingDependencies(), ilObjCourseGrouping\_getGroupingItems(), ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), enableRegistration(), and ilCustomInputGUI\setHtml().

Referenced by initForm().

{
global $ilAccess, $ilCtrl;
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('./Services/Link/classes/class.ilLink.php');
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
$tpl->setVariable('LINK_ITEM',
$ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
$tpl->setVariable('ITEM_LINKED_TITLE',$title);
}
else
{
$tpl->setVariable('ITEM_TITLE');
}
$tpl->setCurrentBlock('items');
$tpl->setVariable('TYPE_ICON',ilObject::_getIcon($obj_id,tiny,$type));
$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::getContainer ( )

Parent object.

Returns
ilObject

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

References $container.

{
}
ilRegistrationGUI::getFormTitle ( )
abstractprotected

Get title for property form.

protected

Returns
string title

Reimplemented in ilCourseRegistrationGUI, and ilGroupRegistrationGUI.

Referenced by initForm().

+ Here is the caller graph for this function:

ilRegistrationGUI::getRefId ( )

Get ref.

Returns
type

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

References $ref_id.

Referenced by ilCourseRegistrationGUI\executeCommand().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilRegistrationGUI::initForm ( )
protected

init registration form

protected

Returns

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

References $ilUser, 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 112 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 525 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 165 of file class.ilRegistrationGUI.php.

References $ilCtrl, $ilUser, getWaitingList(), 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);
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent);
$ilCtrl->redirectByClass("ilrepositorygui", "");
}

+ Here is the call graph for this function:

ilRegistrationGUI::setAccepted (   $a_status)
protected

Set Agreement accepted.

private

Parameters
bool

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

References $ilUser, 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 506 of file class.ilRegistrationGUI.php.

References $_SESSION, initForm(), and ilUtil\sendInfo().

Referenced by ilCourseRegistrationGUI\add(), and join().

{
$this->initForm();
if($_SESSION["pending_goto"])
{
ilUtil::sendInfo($this->lng->txt("reg_goto_parent_membership_info"));
}
$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 332 of file class.ilRegistrationGUI.php.

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

{
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:

ilRegistrationGUI::updateSubscriptionRequest ( )
protected

Update subscription message.

Returns
void

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

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

{
global $ilUser, $tree, $ilCtrl;
$this->participants->updateSubject($ilUser->getId(),ilUtil::stripSlashes($_POST['subject']));
ilUtil::sendSuccess($this->lng->txt('sub_request_saved'),true);
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
$tree->getParentId($this->container->getRefId()));
$ilCtrl->redirectByClass("ilrepositorygui", "");
}

+ 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 546 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 391 of file class.ilRegistrationGUI.php.

References $_POST, and $ilUser.

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 413 of file class.ilRegistrationGUI.php.

References $_POST, $GLOBALS, $ilUser, ilCourseDefinedFieldDefinition\_getFields(), IL_CDF_TYPE_SELECT, IL_CDF_TYPE_TEXT, and ilCourseUserData\setValue().

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

{
global $ilUser;
$required_fullfilled = true;
foreach(ilCourseDefinedFieldDefinition::_getFields($this->container->getId()) as $field_obj)
{
switch($field_obj->getType())
{
// Split value id from post
list($field_id,$option_id) = explode('_', $_POST['cdf_'.$field_obj->getId()]);
#$GLOBALS['ilLog']->write(__METHOD__.': '.print_r($field_id,TRUE).' '.print_r($option_id,TRUE).' '.print_r($_POST,TRUE));
$open_answer_indexes = (array) $field_obj->getValueOptions();
if(in_array($option_id, $open_answer_indexes))
{
$value = $_POST['cdf_oa_'.$field_obj->getId().'_'.$option_id];
}
else
{
$value = $field_obj->getValueById($option_id);
}
break;
$value = $_POST['cdf_'.$field_obj->getId()];
break;
}
$GLOBALS['ilLog']->write(__METHOD__.': new value '. $value);
$course_user_data = new ilCourseUserData($ilUser->getId(),$field_obj->getId());
$course_user_data->setValue($value);
$course_user_data->update();
if($field_obj->isRequired() and !$value)
{
$required_fullfilled = false;
}
}
return $required_fullfilled;
}

+ 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.

Referenced by getContainer().

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(), and getRefId().

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: