ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMemberAgreementGUI Class Reference
+ Collaboration diagram for ilMemberAgreementGUI:

Public Member Functions

 __construct ($a_ref_id)
 Constructor.
 executeCommand ()
 Execute Command.

Private Member Functions

 showAgreement ($send_info=true)
 show agreement
 save ()
 Save.
 showCourseDefinedFields ()
 checkCourseDefinedFields ()
 Check required course fields.
 checkAgreement ()
 Check Agreement.
 init ()
 Read setting.
 sendInfoMessage ()
 Send info message.

Private Attributes

 $ref_id
 $obj_id
 $type
 $db
 $ctrl
 $lng
 $tpl
 $privacy
 $agreement

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

ilMemberAgreementGUI:

Definition at line 38 of file class.ilMemberAgreementGUI.php.

Constructor & Destructor Documentation

ilMemberAgreementGUI::__construct (   $a_ref_id)

Constructor.

public

Definition at line 58 of file class.ilMemberAgreementGUI.php.

References $ilCtrl, $ilUser, $lng, $obj_id, $tpl, ilPrivacySettings\_getInstance(), ilObject\_lookupType(), and init().

{
global $ilDB,$ilCtrl,$lng,$tpl,$ilUser,$ilObjDataCache;
$this->ref_id = $a_ref_id;
$this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
$this->type = ilObject::_lookupType($this->obj_id);
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('ps');
$this->privacy = ilPrivacySettings::_getInstance();
$this->agreement = new ilMemberAgreement($ilUser->getId(),$this->obj_id);
$this->init();
}

+ Here is the call graph for this function:

Member Function Documentation

ilMemberAgreementGUI::checkAgreement ( )
private

Check Agreement.

private

Definition at line 290 of file class.ilMemberAgreementGUI.php.

References $_POST, and $ilUser.

Referenced by save().

{
global $ilUser;
if($_POST['agreed'])
{
return true;
}
if($this->privacy->confirmationRequired($this->type))
{
return false;
}
return true;
}

+ Here is the caller graph for this function:

ilMemberAgreementGUI::checkCourseDefinedFields ( )
private

Check required course fields.

private

Definition at line 229 of file class.ilMemberAgreementGUI.php.

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

Referenced by save().

{
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->obj_id) as $field_obj)
{
$required_given = false;
switch($field_obj->getType())
{
$tmp_values = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]);
$tmp_values = explode('_', $tmp_values,2);
if(isset($tmp_values[1]))
{
$tmp_value = isset($tmp_values[1]) ? $tmp_values[1] : '';
$value = '';
foreach((array) $field_obj->getValues() as $v)
{
if($v == $tmp_value)
{
$value = $tmp_value;
$required_given = true;
break;
}
}
}
break;
$value = ilUtil::stripSlashes($_POST['cdf'][$field_obj->getId()]);
if(trim($value) != "") // #14220
{
$required_given = true;
}
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 !$required_given)
{
$all_required = false;
}
}
return $all_required;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberAgreementGUI::executeCommand ( )

Execute Command.

public

Definition at line 81 of file class.ilMemberAgreementGUI.php.

References $cmd.

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
if(!$cmd or $cmd == 'view')
{
$cmd = 'showAgreement';
}
$this->$cmd();
break;
}
}
ilMemberAgreementGUI::init ( )
private

Read setting.

private

Parameters

Definition at line 314 of file class.ilMemberAgreementGUI.php.

References $ilUser, $obj_id, and ilCourseUserData\_checkRequired().

Referenced by __construct().

{
global $ilUser;
$this->required_fullfilled = ilCourseUserData::_checkRequired($ilUser->getId(),$this->obj_id);
$this->agreement_required = $this->agreement->agreementRequired();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberAgreementGUI::save ( )
private

Save.

private

Parameters

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

References checkAgreement(), checkCourseDefinedFields(), ilUtil\sendFailure(), and showAgreement().

{
{
ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
$this->showAgreement(false);
return false;
}
if(!$this->checkAgreement())
{
ilUtil::sendFailure($this->lng->txt($this->type.'_agreement_required'));
$this->showAgreement(false);
return false;
}
$this->agreement->setAccepted(true);
$this->agreement->setAcceptanceTime(time());
$this->agreement->save();
$this->ctrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilMemberAgreementGUI::sendInfoMessage ( )
private

Send info message.

private

Definition at line 327 of file class.ilMemberAgreementGUI.php.

References ilUtil\sendFailure().

Referenced by showAgreement().

{
$message = '';
if($this->agreement_required)
{
$message = $this->lng->txt($this->type.'_ps_agreement_req_info');
}
if(!$this->required_fullfilled)
{
if(strlen($message))
{
$message .= '<br />';
}
$message .= $this->lng->txt($this->type.'_ps_required_info');
}
if(strlen($message))
{
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberAgreementGUI::showAgreement (   $send_info = true)
private

show agreement

private

Definition at line 104 of file class.ilMemberAgreementGUI.php.

References ilExportFieldsInfo\_getInstanceByType(), ilObject\_lookupType(), ilUtil\formCheckbox(), sendInfoMessage(), and showCourseDefinedFields().

Referenced by save().

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.crs_user_agreement.html','Modules/Course');
$this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
if($send_info)
{
$this->sendInfoMessage();
}
include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
foreach($fields_info->getExportableFields() as $field)
{
$this->tpl->setCurrentBlock('field');
$this->tpl->setVariable('FIELD_NAME',$this->lng->txt($field));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable('AGREEMENT_HEADER',$this->lng->txt($this->type.'_agreement_header'));
$this->tpl->setVariable('TXT_AGREEMENT',$this->lng->txt($this->type.'_user_agreement'));
$this->tpl->setVariable('TXT_INFO_AGREEMENT',$this->lng->txt($this->type.'_info_agreement'));
if($this->privacy->confirmationRequired($this->type))
{
$this->tpl->setCurrentBlock('agreement');
$this->tpl->setVariable('CHECK_AGREE',ilUtil::formCheckbox(0,'agreed',1));
$this->tpl->setVariable('INFO_AGREE',$this->lng->txt($this->type.'_info_agree'));
$this->tpl->setVariable('TXT_AGREE',$this->lng->txt($this->type.'_agree'));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable('TXT_SAVE',$this->lng->txt('save'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMemberAgreementGUI::showCourseDefinedFields ( )
private

Definition at line 168 of file class.ilMemberAgreementGUI.php.

References $ilUser, ilCourseDefinedFieldDefinition\_getFields(), ilUtil\formSelect(), IL_CDF_TYPE_SELECT, and IL_CDF_TYPE_TEXT.

Referenced by showAgreement().

{
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->obj_id)))
{
return true;
}
foreach($cdf_fields as $field_obj)
{
$course_user_data = new ilCourseUserData($ilUser->getId(),$field_obj->getId());
switch($field_obj->getType())
{
$this->tpl->setCurrentBlock('sel_row');
// Workaround for mantis 9868
$options = array();
$options[0] = $this->lng->txt('links_select_one');
foreach($field_obj->getValues() as $value)
{
$options[$field_obj->getId().'_'.$value] = $value;
}
$this->tpl->setVariable('SEL_SELECT',ilUtil::formSelect($field_obj->getId().'_'.$course_user_data->getValue(),
'cdf['.$field_obj->getId().']',
$options,
false,
true));
break;
$this->tpl->setCurrentBlock('txt_row');
$this->tpl->setVariable('TXT_ROW_NAME',$field_obj->getId());
$this->tpl->setVariable('TXT_ROW_VALUE',$course_user_data->getValue());
break;
}
if($field_obj->isRequired())
{
$this->show_required_info = true;
$this->tpl->touchBlock('cdf_required');
}
$this->tpl->setCurrentBlock('cdf_row');
$this->tpl->setVariable('CDF_FIELD_NAME',$field_obj->getName());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock('cdf');
$this->tpl->setVariable('CDF_TXT',$this->lng->txt($this->type.'_ps_cdf_info'));
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMemberAgreementGUI::$agreement
private

Definition at line 50 of file class.ilMemberAgreementGUI.php.

ilMemberAgreementGUI::$ctrl
private

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

ilMemberAgreementGUI::$db
private

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

ilMemberAgreementGUI::$lng
private

Definition at line 46 of file class.ilMemberAgreementGUI.php.

Referenced by __construct().

ilMemberAgreementGUI::$obj_id
private

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

Referenced by __construct(), and init().

ilMemberAgreementGUI::$privacy
private

Definition at line 49 of file class.ilMemberAgreementGUI.php.

ilMemberAgreementGUI::$ref_id
private

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

ilMemberAgreementGUI::$tpl
private

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

Referenced by __construct().

ilMemberAgreementGUI::$type
private

Definition at line 42 of file class.ilMemberAgreementGUI.php.


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