Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

ilExportUserSettings Class Reference

Public Member Functions

 __construct ($a_user_id, $a_obj_id)
 Constructor.
 set ($a_data)
 Set Settings.
 enabled ($a_option)
 Check if a specific option is enabled.
 getOrderedExportableFields ()
 Get ordered enabled fields.
 store ()
 Store settings in DB.

Static Public Member Functions

static _delete ($a_usr_id)
 Delete user related data.

Private Member Functions

 read ()
 Read store settings.

Private Attributes

 $db
 $user_id
 $obj_id
 $settings = array()

Detailed Description

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

/

Definition at line 31 of file class.ilExportUserSettings.php.


Constructor & Destructor Documentation

ilExportUserSettings::__construct ( a_user_id,
a_obj_id 
)

Constructor.

public

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

References read().

        {
                global $ilDB;
                
                $this->user_id = $a_user_id;
                $this->obj_id = $a_obj_id;
                $this->db = $ilDB;
                
                $this->read();
        }

Here is the call graph for this function:


Member Function Documentation

static ilExportUserSettings::_delete ( a_usr_id  )  [static]

Delete user related data.

public

Definition at line 61 of file class.ilExportUserSettings.php.

        {
                global $ilDB;
                
                $query = "DELETE FROM member_export_settings WHERE user_id = ".$ilDB->quote($a_usr_id);
                $ilDB->query($query);
                return true;
        }

ilExportUserSettings::enabled ( a_option  ) 

Check if a specific option is enabled.

public

Parameters:
strin option

Definition at line 89 of file class.ilExportUserSettings.php.

Referenced by getOrderedExportableFields().

        {
                if(array_key_exists($a_option,$this->settings) and $this->settings[$a_option])
                {
                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilExportUserSettings::getOrderedExportableFields (  ) 

Get ordered enabled fields.

public

Parameters:
 

Definition at line 105 of file class.ilExportUserSettings.php.

References ilCourseDefinedFieldDefinition::_getFields(), ilUserDefinedFields::_getInstance(), ilPrivacySettings::_getInstance(), ilExportFieldsInfo::_getInstance(), ilCourseDefinedFieldDefinition::_hasFields(), and enabled().

        {
                include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
                include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
                include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
                include_once('Services/User/classes/class.ilUserDefinedFields.php');

                $field_info = ilExportFieldsInfo::_getInstance();

                $fields[] = 'role';
                // Append agreement info
                $privacy = ilPrivacySettings::_getInstance();
                if($privacy->confirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->obj_id))
                {
                        $fields[] = 'agreement';
                }

                foreach($field_info->getExportableFields() as $field)
                {
                        if($this->enabled($field))
                        {
                                $fields[] = $field; 
                        }
                }
                
                $udf = ilUserDefinedFields::_getInstance();
                foreach($udf->getCourseExportableFields() as $field_id => $udf_data)
                {
                        $fields[] = 'udf_'.$field_id;
                }
                
                // Add course specific fields
                foreach(ilCourseDefinedFieldDefinition::_getFields($this->obj_id) as $field_obj)
                {
                        if($this->enabled('cdf_'.$field_obj->getId()))
                        {
                                $fields[] = 'cdf_'.$field_obj->getId();
                        }
                }               
                return $fields ? $fields : array();
        }

Here is the call graph for this function:

ilExportUserSettings::read (  )  [private]

Read store settings.

private

Parameters:
 

Definition at line 171 of file class.ilExportUserSettings.php.

References $res.

Referenced by __construct(), and store().

        {
                $query = "SELECT * FROM member_export_user_settings WHERE user_id = ".$this->db->quote($this->user_id);
                $res = $this->db->query($query);
                
                if($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->settings = unserialize(stripslashes($row->settings));
                }
                return true;
        }

Here is the caller graph for this function:

ilExportUserSettings::set ( a_data  ) 

Set Settings.

public

Parameters:
array Array of Settings

Definition at line 77 of file class.ilExportUserSettings.php.

        {
                $this->settings = $a_data;
        }

ilExportUserSettings::store (  ) 

Store settings in DB.

public

Definition at line 153 of file class.ilExportUserSettings.php.

References read().

        {
                $query = "DELETE FROM member_export_user_settings WHERE user_id = ".$this->db->quote($this->user_id);
                $this->db->query($query);
                
                $query = "INSERT INTO member_export_user_settings SET user_id = ".$this->db->quote($this->user_id).", ".
                        "settings = '".addslashes(serialize($this->settings))."' ";
                $this->db->query($query);
                $this->read();
        }

Here is the call graph for this function:


Field Documentation

ilExportUserSettings::$db [private]

Definition at line 33 of file class.ilExportUserSettings.php.

ilExportUserSettings::$obj_id [private]

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

ilExportUserSettings::$settings = array() [private]

Definition at line 36 of file class.ilExportUserSettings.php.

ilExportUserSettings::$user_id [private]

Definition at line 34 of file class.ilExportUserSettings.php.


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