Access
extends AccessLib
in package
Frontend for the user management
Tags
Table of Contents
Constants
- MANAGE_GROUPS_ACCESS_ID = 203
- Static Access id to manage the user groups
- MANAGE_USER_ACCESS_ID = 202
- Static Access id to manage the users(add/edit)
Properties
- $_objTpl : Sigma
- $accountAttributeNamePrefix : mixed
- $cx : Cx
- $defaultProfileThumbnailScaleColor : mixed
- $modulePrefix : mixed
- $objUserFW : object
- User FRAMEWORK Object
- $arrStatusMsg : mixed
Methods
- __construct() : mixed
- This library can be used to parse/generate the HTML code of a user's profile attributes from within the whole framework. To do so, follow the following steps: 1. Initialize an object from this class and pass the target \Cx\Core\Html\Sigma object as a paramater to it.
- checkManageGroupAccessPermission() : bool
- Additional permission check for users with access permission MANAGE_GROUPS_ACCESS_ID.
- dashboard() : mixed
- getImageUploader() : Uploader
- Initialize the access image uploader and get the uploader instance
- getPage() : mixed
- getPasswordInfo() : string
- Returns the password information string
- handleSignUp() : mixed
- parseAccountAttributes() : mixed
- parseAttribute() : mixed
- This method has two purposes (see param $return): 1. Parse the \Cx\Core\Html\Sigma template block of a specific profile attribute 2. Generate the HTML code of a specific profile attribute and return it
- removeUselessImages() : mixed
- setAccountAttributeNamePrefix() : mixed
- When using this library from within a different place (not access module), use this method to specify the template block prefix to be used when parsing a user's account attributes (username, email, password, etc.).
- setAttributeNamePrefix() : mixed
- When using this library from within a different place (not access module), use this method to specify the template block prefix to be used when parsing a user's profile attribute.
- setModulePrefix() : mixed
- When using this library from within a different place (not access module), use this method to specify the template placeholder prefix to be used when parsing a user's profile attribute.
- addUploadedImagesToProfile() : bool
- Move the uploaded images into place and link to the user
- attachJavaScriptFunction() : mixed
- detachAllJavaScriptFunctions() : mixed
- escapeCsvValue() : string
- Escape a value that it could be inserted into a csv file.
- export() : mixed
- Export user section
- exportUsers() : mixed
- Export users of a group as CSV
- fetchAllowedFilterAttributes() : array<string|int, mixed>
- Identifies all valid filter keys (of the current request) to be used for filtering the users.
- fetchGroupFilterFromTemplate() : array<string|int, mixed>
- Identifies all group filters (of the current request) to be used for filtering the users.
- fetchProfileDataOfUser() : array<string|int, mixed>
- Get profile data of a user as an array
- fetchSearchArgumentFromRequest() : array<string|int, mixed>
- fetchSortFlags() : array<string|int, mixed>
- Fetch sort flags from current application template
- generateHtmlForProfileNotificationPlaceholder() : string
- Generate a Html table of user's changed profile attributes
- getGroupListOfUser() : array<string|int, mixed>
- Get a list of user groups a user is a member of
- getJavaScriptCode() : mixed
- listUsers() : bool
- members() : mixed
- List users
- parseAccountAttribute() : mixed
- parseLetterIndexList() : mixed
- parseNewsletterLists() : void
- Parse a user's newsletter-list subscription interface
- preprocessProfileNotificationMail() : mixed
- Preprocess the notification mail sent after a new user did sign-up or after a profile modification had been done
- sanitizeProfileFilter() : mixed
- Sanitize the array $filter by ensuring that is only contains valid keys specified by $allowedFilterKeys.
- sendProfileChangeNotificationMail() : mixed
- Send mail notification (user_profile_modification) regarding a modified user profile
- sendSignUpNotificationMail() : mixed
- Send mail notification (signup_notification) regarding a signed-up user profile
- checkCaptcha() : mixed
- checkTos() : mixed
- confirmSignUp() : mixed
- setLanguageCookie() : mixed
- settings() : mixed
- signUp() : mixed
- user() : mixed
Constants
MANAGE_GROUPS_ACCESS_ID
Static Access id to manage the user groups
public
mixed
MANAGE_GROUPS_ACCESS_ID
= 203
MANAGE_USER_ACCESS_ID
Static Access id to manage the users(add/edit)
public
mixed
MANAGE_USER_ACCESS_ID
= 202
Properties
$_objTpl
public
Sigma
$_objTpl
Tags
$accountAttributeNamePrefix
protected
mixed
$accountAttributeNamePrefix
= 'access_user_'
$cx
protected
Cx
$cx
$defaultProfileThumbnailScaleColor
protected
mixed
$defaultProfileThumbnailScaleColor
= '#FFFFFF'
$modulePrefix
protected
mixed
$modulePrefix
= 'ACCESS_'
$objUserFW
User FRAMEWORK Object
protected
object
$objUserFW
Tags
$arrStatusMsg
private
mixed
$arrStatusMsg
= array('ok' => array(), 'error' => array())
Methods
__construct()
This library can be used to parse/generate the HTML code of a user's profile attributes from within the whole framework. To do so, follow the following steps: 1. Initialize an object from this class and pass the target \Cx\Core\Html\Sigma object as a paramater to it.
public
__construct(mixed $pageContent) : mixed
- Call to set the \Cx\Core\Html\Sigma's placeholders prefix. Where the passed argument would be like: ACCESS_
- Call to set the \Cx\Core\Html\Sigma's block prefix used in the user's profile attribute template blocks. Where the passed argument would be like: access_profile_attribute
- Finaly, call to parse a user account's profile attribute template block or to return the generated HTML code of a user account's profile attribute.
Example: $objAccessLib = new AccessLib($objTemplate); $objAccessLib->setModulePrefix('shop'); $objAccessLib->setAttributeNamePrefix('shop_customer_profile_attribute'); $objAccessLib->parseAttribute($objUser, 'firstname', 0, false, false, false, false, false);
Parameters
- $pageContent : mixed
checkManageGroupAccessPermission()
Additional permission check for users with access permission MANAGE_GROUPS_ACCESS_ID.
public
checkManageGroupAccessPermission(int $groupId) : bool
Exists to avoid that the user removes his permission to manage access groups
Will return false when the group which is edited/deactivated/deleted is the only group which grants the user the permission to edit groups
Will return true otherwise (or if the user has administrator privileges)
Parameters
- $groupId : int
-
The id of the group which is edited
Return values
booldashboard()
public
dashboard() : mixed
getImageUploader()
Initialize the access image uploader and get the uploader instance
public
getImageUploader() : Uploader
Return values
UploadergetPage()
public
getPage(mixed &$metaPageTitle, mixed &$pageTitle) : mixed
Parameters
- $metaPageTitle : mixed
- $pageTitle : mixed
getPasswordInfo()
Returns the password information string
public
static getPasswordInfo() : string
The string returned depends on the password complexity setting
Tags
Return values
string —The password complexity information
handleSignUp()
public
handleSignUp(mixed $objUser) : mixed
Parameters
- $objUser : mixed
parseAccountAttributes()
public
parseAccountAttributes(mixed $objUser[, mixed $edit = false ]) : mixed
Parameters
- $objUser : mixed
- $edit : mixed = false
parseAttribute()
This method has two purposes (see param $return): 1. Parse the \Cx\Core\Html\Sigma template block of a specific profile attribute 2. Generate the HTML code of a specific profile attribute and return it
public
parseAttribute(mixed $objUser, mixed $attributeId[, mixed $historyId = 0 ][, mixed $edit = false ][, mixed $return = false ][, mixed $isChild = false ][, mixed $inFrame = false ][, mixed $useMagicBlock = true ][, mixed $arrAdditionalPlaceholders = null ]) : mixed
Parameters
- $objUser : mixed
- $attributeId : mixed
- $historyId : mixed = 0
- $edit : mixed = false
- $return : mixed = false
- $isChild : mixed = false
- $inFrame : mixed = false
- $useMagicBlock : mixed = true
- $arrAdditionalPlaceholders : mixed = null
removeUselessImages()
public
static removeUselessImages() : mixed
setAccountAttributeNamePrefix()
When using this library from within a different place (not access module), use this method to specify the template block prefix to be used when parsing a user's account attributes (username, email, password, etc.).
public
setAccountAttributeNamePrefix(mixed $prefix) : mixed
For instance when setting the prefix to 'shop_customer_attribute', then the method will try to parse the \Cx\Core\Html\Sigma template block shop_customer_attribute_email in the case of the account attribute email. Defaults to 'access_user'
Parameters
- $prefix : mixed
Tags
setAttributeNamePrefix()
When using this library from within a different place (not access module), use this method to specify the template block prefix to be used when parsing a user's profile attribute.
public
setAttributeNamePrefix(mixed $prefix) : mixed
For instance when setting the prefix to 'shop_customer_profile_attribute', then the method will try to parse the \Cx\Core\Html\Sigma template block shop_customer_profile_attribute_firstname in the case of the profile attribute firstname. Defaults to 'access_profile_attribute'
Parameters
- $prefix : mixed
Tags
setModulePrefix()
When using this library from within a different place (not access module), use this method to specify the template placeholder prefix to be used when parsing a user's profile attribute.
public
setModulePrefix(mixed $prefix) : mixed
For instance when setting the prefix to 'SHOP_', then the method will parse the \Cx\Core\Html\Sigma variable SHOP_PROFILE_ATTRIBUTE_FIRSTNAME in the case of the profile attribute firstname. Defaults to 'ACCESS_'
Parameters
- $prefix : mixed
Tags
addUploadedImagesToProfile()
Move the uploaded images into place and link to the user
protected
addUploadedImagesToProfile(User $objUser, array<string|int, mixed> &$arrProfile, array<string|int, mixed> $arrImages, string $uploaderId) : bool
Parameters
- $objUser : User
-
\User object
- $arrProfile : array<string|int, mixed>
-
Array profile data
- $arrImages : array<string|int, mixed>
-
Uploaded images array
- $uploaderId : string
-
Uploader id
Return values
bool —TRUE on success false otherwise
attachJavaScriptFunction()
protected
attachJavaScriptFunction(mixed $function) : mixed
Parameters
- $function : mixed
detachAllJavaScriptFunctions()
protected
detachAllJavaScriptFunctions() : mixed
escapeCsvValue()
Escape a value that it could be inserted into a csv file.
protected
escapeCsvValue(string $value) : string
Parameters
- $value : string
Return values
stringexport()
Export user section
protected
export() : mixed
This section lists the existing active frontend user groups. Additionally is provides the ability to export the members of the active frontend groups as CSV file.
exportUsers()
Export users of a group as CSV
protected
exportUsers([int $groupId = 0 ][, int $langId = null ]) : mixed
Parameters
- $groupId : int = 0
-
Id of a user group to filter the export by
- $langId : int = null
-
Id of frontend locale to filter the export by
Tags
fetchAllowedFilterAttributes()
Identifies all valid filter keys (of the current request) to be used for filtering the users.
protected
fetchAllowedFilterAttributes() : array<string|int, mixed>
Valid filter arguments can be specified in the application template in the form of template placeholders. I.e. add the following placeholder to allow filtering by firstname: {ACCESS_FILTER_PROFILE_ATTRIBUTE_FIRSTNAME}
Return values
array<string|int, mixed> —Array consisting of valid filter keys to be used for filtering users.
fetchGroupFilterFromTemplate()
Identifies all group filters (of the current request) to be used for filtering the users.
protected
fetchGroupFilterFromTemplate() : array<string|int, mixed>
Valid filter arguments can be specified in the application template in the form of template placeholders. I.e. add the following placeholder to allow filtering by group having ID 3: {ACCESS_FILTER_GROUP_3}
Return values
array<string|int, mixed> —Array consisting of group-IDs to be used for filtering users.
fetchProfileDataOfUser()
Get profile data of a user as an array
protected
fetchProfileDataOfUser(User $objUser) : array<string|int, mixed>
Parameters
- $objUser : User
-
User of which its profile data shall be returned.
Return values
array<string|int, mixed> —Two-dimensional array of the user's profile data. The array key represents the profile's attribute-ID and the array's value the assocated attribute's value.
fetchSearchArgumentFromRequest()
protected
fetchSearchArgumentFromRequest() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of strings that have been submitted through the GET or POST argument 'search'.
fetchSortFlags()
Fetch sort flags from current application template
protected
fetchSortFlags() : array<string|int, mixed>
Identifies all sort flags (of the current request) to be used
for sorting the users.
Valid sort arguments can be specified in the application
template in the form of template placeholders having the following
scheme: {ACCESS_SORT_<attribute-ID>_
Return values
array<string|int, mixed> —Array consisting of valid sort flags to be used for sorting the users.
generateHtmlForProfileNotificationPlaceholder()
Generate a Html table of user's changed profile attributes
protected
generateHtmlForProfileNotificationPlaceholder(array<string|int, mixed> $data[, bool $showDiff = false ]) : string
Parameters
- $data : array<string|int, mixed>
-
List of profile attributes. The array should have the following format:
array( array( 'label' => '
', 'new' => ' ', 'old' => ' ', ), array( 'label' => ' ', 'new' => ' ', 'old' => ' ', ), ) - $showDiff : bool = false
-
Whether or not to output the differnce of the changed profile attributes
Return values
string —The generated Html table
getGroupListOfUser()
Get a list of user groups a user is a member of
protected
getGroupListOfUser(User $objUser) : array<string|int, mixed>
Returns an array of all user groups the supplied user (identified by $objUser) is a member of. In frontend mode, this method does only return frontend user groups. Whereas in every other mode, it does return all associated user groups.
Parameters
- $objUser : User
-
The user of whom the associated groups shall be returned.
Return values
array<string|int, mixed> —An array containing the names of the associated groups.
getJavaScriptCode()
protected
getJavaScriptCode() : mixed
listUsers()
protected
listUsers(array<string|int, mixed> $groupFilter, array<string|int, mixed> $userFilter, array<string|int, mixed> $search, array<string|int, mixed> $sort, int $limit, int $limitOffset[, int &$userCount = 0 ]) : bool
Parameters
- $groupFilter : array<string|int, mixed>
-
Array of user group ID by which the users shall be filtered by.
- $userFilter : array<string|int, mixed>
-
Argument to be passed as argument $filter to method \User::getUsers()
- $search : array<string|int, mixed>
-
Argument to be passed as argument $search to method \User::getUsers()
- $sort : array<string|int, mixed>
-
Argument to be passed as argument $sort to method \User::getUsers()
- $limit : int
-
Argument to be passed as argument $limit to method \User::getUsers()
- $limitOffset : int
-
Argument to be passed as argument $limitOffset to method \User::getUsers()
- $userCount : int = 0
-
The number of listed users will be set into $userCount.
Return values
bool —TRUE if one or more users have been listed. Otherwise FALSE if no user has been listed.
members()
List users
protected
members([int $groupIdFromCmd = 0 ]) : mixed
Parameters
- $groupIdFromCmd : int = 0
-
List only users that are a member of the user group identified by ID $groupId. This argument is overwritten in case the requested page's application template contains functional placeholders used for filtering by specific groups.
parseAccountAttribute()
protected
parseAccountAttribute(mixed $objUser, mixed $attributeId[, mixed $edit = false ][, mixed $value = null ]) : mixed
Parameters
- $objUser : mixed
- $attributeId : mixed
- $edit : mixed = false
- $value : mixed = null
parseLetterIndexList()
protected
parseLetterIndexList(mixed $URI, mixed $paramName, mixed $selectedLetter) : mixed
Parameters
- $URI : mixed
- $paramName : mixed
- $selectedLetter : mixed
parseNewsletterLists()
Parse a user's newsletter-list subscription interface
protected
parseNewsletterLists(mixed $objUser) : void
Parameters
- $objUser : mixed
preprocessProfileNotificationMail()
Preprocess the notification mail sent after a new user did sign-up or after a profile modification had been done
protected
preprocessProfileNotificationMail(string $type, mixed $objMail, User $objUser, array<string|int, mixed> $changedAttributes, array<string|int, mixed> $newProfileData[, array<string|int, mixed> $oldProfileData = array() ]) : mixed
Parameters
- $type : string
-
The notification action. One of: user_profile_modification / signup_notification
- $objMail : mixed
- $objUser : User
-
The user that triggered the event
- $changedAttributes : array<string|int, mixed>
-
A one-dimensional list of user profile attributes that had been stored.
- $newProfileData : array<string|int, mixed>
-
Two-dimensional array of the user's profile data after the event.
- $oldProfileData : array<string|int, mixed> = array()
-
Two-dimensional array of the user's profile data before the event. If argument is set, then any associated element in $newProfileData will be marked as changed.
sanitizeProfileFilter()
Sanitize the array $filter by ensuring that is only contains valid keys specified by $allowedFilterKeys.
protected
sanitizeProfileFilter(array<string|int, mixed> &$filter, array<string|int, mixed> $allowedFilterKeys) : mixed
Parameters
- $filter : array<string|int, mixed>
-
Nested array containing profile attribute filter conditions.
- $allowedFilterKeys : array<string|int, mixed>
-
Array consisting of keys that are allowed to be used as filter keys.
sendProfileChangeNotificationMail()
Send mail notification (user_profile_modification) regarding a modified user profile
protected
sendProfileChangeNotificationMail(User $objUser, array<string|int, mixed> $changedAttributes, array<string|int, mixed> $oldProfileData, array<string|int, mixed> $newProfileData) : mixed
Parameters
- $objUser : User
-
The user on which the profile modifications had been made on.
- $changedAttributes : array<string|int, mixed>
-
A one-dimensional list of user profile attributes that had been modified.
- $oldProfileData : array<string|int, mixed>
-
Two-dimensional array of the user's profile data before the modification.
- $newProfileData : array<string|int, mixed>
-
Two-dimensional array of the user's profile data after the modification.
Tags
sendSignUpNotificationMail()
Send mail notification (signup_notification) regarding a signed-up user profile
protected
sendSignUpNotificationMail(User $objUser, mixed $profileData) : mixed
Parameters
- $objUser : User
-
The user who did sign-up
- $profileData : mixed
Tags
checkCaptcha()
private
checkCaptcha() : mixed
checkTos()
private
checkTos() : mixed
confirmSignUp()
private
confirmSignUp(mixed $userId, mixed $restoreKey) : mixed
Parameters
- $userId : mixed
- $restoreKey : mixed
setLanguageCookie()
private
setLanguageCookie(mixed $currentLangId, mixed $newLangId) : mixed
Parameters
- $currentLangId : mixed
- $newLangId : mixed
settings()
private
settings() : mixed
signUp()
private
signUp() : mixed
user()
private
user(mixed &$metaPageTitle, mixed &$pageTitle) : mixed
Parameters
- $metaPageTitle : mixed
- $pageTitle : mixed