User_Profile
in package
User Profile
The User object is used for all user related operations.
Tags
Table of Contents
Constants
- ADDRESS_PROFILE_ATTRIBUTE_DB_TABLE = 'access_user_profile_address'
- Database table storing address profile attribute values.
Properties
- $arrAttributeHistories : mixed
- $arrNoAvatar : array<string|int, mixed>
- $arrNoPicture : mixed
- $arrUpdatedAttributeHistories : mixed
- $objAttribute : User_Profile_Attribute
- $addressProfileAttribute : User_Profile_Attribute|null
- Root address profile attribute definition.
- $addressProfileAttributeChildren : array<string, string>
- Mapping of attribute child IDs to their database field names.
Methods
- __construct() : mixed
- checkMandatoryCompliance() : mixed
- getAddressProfileAttribute() : User_Profile_Attribute
- Returns the root address profile attribute.
- setProfile() : mixed
- createProfile() : bool
- Create a profile for the loaded user
- initAddressProfileAttribute() : void
- Initializes the address profile attribute and resolves its child attributes.
- loadCustomAttributeProfileData() : bool
- Load custom attribute profile data
- loadProfileAddresses() : void
- Loads address profile attribute values for all currently loaded users.
- parseAttributeSearchConditions() : array<string|int, mixed>
- Enter description here... Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match.
- parseCoreAttributeFilterConditions() : array<string|int, mixed>
- Parse core attribute filter conditions
- parseCustomAttributeFilterConditions() : array<string|int, mixed>
- Parse custom attribute filter conditions
- storeProfile() : mixed
- initAttributes() : mixed
Constants
ADDRESS_PROFILE_ATTRIBUTE_DB_TABLE
Database table storing address profile attribute values.
protected
string
ADDRESS_PROFILE_ATTRIBUTE_DB_TABLE
= 'access_user_profile_address'
Properties
$arrAttributeHistories
public
mixed
$arrAttributeHistories
$arrNoAvatar
public
static array<string|int, mixed>
$arrNoAvatar
= array('src' => '0_noavatar.gif', 'width' => 121, 'height' => 160)
Tags
$arrNoPicture
public
static mixed
$arrNoPicture
= array('src' => '0_no_picture.gif', 'width' => 80, 'height' => 84)
$arrUpdatedAttributeHistories
public
mixed
$arrUpdatedAttributeHistories
$objAttribute
public
User_Profile_Attribute
$objAttribute
$addressProfileAttribute
Root address profile attribute definition.
protected
User_Profile_Attribute|null
$addressProfileAttribute
= \null
$addressProfileAttributeChildren
Mapping of attribute child IDs to their database field names.
protected
array<string, string>
$addressProfileAttributeChildren
= []
Example: [ 'address_data_city' => 'city', 'address_data_zip' => 'zip' ]
Methods
__construct()
public
__construct() : mixed
checkMandatoryCompliance()
public
checkMandatoryCompliance() : mixed
getAddressProfileAttribute()
Returns the root address profile attribute.
public
getAddressProfileAttribute() : User_Profile_Attribute
The attribute must be initialized beforehand via static::initAddressProfileAttribute().
Return values
User_Profile_AttributesetProfile()
public
setProfile(mixed $arrProfile[, mixed $ignoreAccessPermissions = false ]) : mixed
Parameters
- $arrProfile : mixed
- $ignoreAccessPermissions : mixed = false
createProfile()
Create a profile for the loaded user
protected
createProfile() : bool
This creates an entry in the dabase table contrexx_access_user_profile which is related to the entry in the table cotnrexx_access_users of the same user. This methode will be obsolete as soon as we're using InnoDB as storage engine.
Return values
boolinitAddressProfileAttribute()
Initializes the address profile attribute and resolves its child attributes.
protected
initAddressProfileAttribute() : void
The method retrieves the root address attribute and builds a mapping of child attribute IDs to their corresponding database column names.
loadCustomAttributeProfileData()
Load custom attribute profile data
protected
loadCustomAttributeProfileData([array<string|int, mixed> $arrAttributes = array() ]) : bool
Gets the data of the custom profile attributes from the database an puts it into the class variables $this->arrLoadedUsers and $this->arrCachedUsers. On the other hand it fills the class variables $this->arrAttributeHistories and $this->arrUpdataedAttributeHistories with the history IDs of each attribute. Returns FALSE if a database error had occurred, otherwise TRUE.
Parameters
- $arrAttributes : array<string|int, mixed> = array()
Return values
boolloadProfileAddresses()
Loads address profile attribute values for all currently loaded users.
protected
loadProfileAddresses() : void
The method queries the address attribute table and populates:
- User::$arrCachedUsers
- User::$arrLoadedUsers
- User_Profile::$arrAttributeHistories
- User_Profile::$arrUpdatedAttributeHistories
Values are indexed by:
[userId]['profile'][attributeId][historyId].
Early returns occur when:
- No users are loaded
- Address profile attributes are not initialized
- Query execution fails or returns no rows
parseAttributeSearchConditions()
Enter description here... Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match.
protected
parseAttributeSearchConditions(mixed $search[, unknown_type $core = false ][, unknown_type $attributeId = 0 ]) : array<string|int, mixed>
However, if the search parameter is a string and does contain a percent sign already, none will be added to the query. This allows searches using custom patterns, like "fields beginning with "a" ("a%"). (You might even want to extend this to work with arrays, too. Currently, only the shop module uses this feature.) -- RK 20100910
Parameters
- $search : mixed
-
The term or array of terms
- $core : unknown_type = false
- $attributeId : unknown_type = 0
Return values
array<string|int, mixed> —The array of SQL snippets
parseCoreAttributeFilterConditions()
Parse core attribute filter conditions
protected
parseCoreAttributeFilterConditions(array<string|int, mixed> $arrFilter) : array<string|int, mixed>
Generate conditions of the core attributes for the SQL WHERE statement. The filter conditions are defined through the two dimensional array $arrFilter. Each key-value pair represents an attribute and its associated condition to which it must fit to. The condition could either be a integer or string depending on the attributes type, or it could be a collection of integers or strings represented in an array.
Parameters
- $arrFilter : array<string|int, mixed>
Return values
array<string|int, mixed>parseCustomAttributeFilterConditions()
Parse custom attribute filter conditions
protected
parseCustomAttributeFilterConditions(mixed $arrFilter[, string $forceTableIdx = null ][, bool $uniqueJoins = true ][, int &$joinIdx = 0 ]) : array<string|int, mixed>
Generate conditions of the custom attributes for the SQL WHERE statement. The filter conditions are defined through the two dimensional array $arrFilter. Each key-value pair represents an attribute and its associated condition to which it must fit to. The condition could either be a integer or string depending on the attributes type, or it could be a collection of integers or strings represented in an array.
Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match. However, if the search parameter is a string and does contain a percent sign already, none will be added to the query. This allows searches using custom patterns, like "fields beginning with "a" ("a%"). (You might even want to extend this to work with arrays, too. Currently, only the shop module uses this feature.) -- RK 20100910
Parameters
- $arrFilter : mixed
-
The term or array of terms
- $forceTableIdx : string = null
-
Argument must not be used directly. Will internally be used for recursion (parsing child attributes of complex profile attributes like gender or country). If $forceTableIdx is set then its value will be used as prefix for the table alias of the SQL statement.
- $uniqueJoins : bool = true
-
Whether the filter arguments shall be joined by separate unique JOINs or by a single common JOIN statement.
- $joinIdx : int = 0
-
The current index used for separate unique JOINs.
Return values
array<string|int, mixed> —The array of SQL snippets
storeProfile()
protected
storeProfile([mixed &$profileUpdated = null ]) : mixed
Parameters
- $profileUpdated : mixed = null
-
If $profileUpdated is provided, then in case any profile changes are being flushed to the database, $profileUpdated will be set to TRUE, otherwise it'll be left untouched.
initAttributes()
private
initAttributes() : mixed