AccessBlocks
extends AccessLib
in package
Info Blocks about Community used in the layout
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
- $defaultProfileThumbnailScaleColor : mixed
- $modulePrefix : mixed
- $objUserFW : object
- User FRAMEWORK Object
- $_mandatorySign : string
- Sign to mark mandatory fields as required
- $arrAccountAttributes : mixed
- $arrAttachedJSFunctions : array<string|int, mixed>
- $arrAttributeTypeTemplates : mixed
- $attributeNamePrefix : 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.
- fetchGroupFilter() : array<string|int, mixed>
- Scan the supplied template for group-filter-placeholders and return the parsed group-IDs.
- getImageUploader() : Uploader
- Initialize the access image uploader and get the uploader instance
- getPasswordInfo() : string
- Returns the password information string
- isSomeonesBirthdayToday() : bool
- Check if any of the active users having their birthday today.
- 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
- parseBasePlaceholders() : mixed
- Parses ACCESS_USER_ID, -USERNAME and -REGDATE placeholders and the user's attributes
- 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.
- setBirthdayUsers() : mixed
- Parse a list (into the loaded template object) of those users having their birthday today.
- setCurrentlyOnlineUsers() : mixed
- Parse a list (into the loaded template object) of those users currently signed in.
- setLastActiveUsers() : mixed
- Parse a list (into the loaded template object) of those users having signed in the most recent.
- setLatestRegisteredUsers() : mixed
- Parse a list (into the loaded template object) of those users having signed up the most recent.
- 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.
- setNextBirthdayUsers() : mixed
- Parse a list (into the loaded template object) of those users having their birthday coming up.
- 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.
- exportUsers() : mixed
- Export users of a group as CSV
- fetchSearchArgumentFromRequest() : array<string|int, mixed>
- getGroupListOfUser() : array<string|int, mixed>
- Get a list of user groups a user is a member of
- getJavaScriptCode() : mixed
- parseAccountAttribute() : mixed
- parseLetterIndexList() : mixed
- parseNewsletterLists() : mixed
- Parse a user's newsletter-list subscription interface
- _getAtrributeCode() : mixed
- createThumbnailOfImage() : mixed
- getCheckboxAttributeCode() : string
- Return the html code for a checkbox attribute
- getDateAttributeCode() : string
- Return the html code for a date attribute
- getDateDayMenu() : mixed
- getDateMonthMenu() : mixed
- getDateYearMenu() : mixed
- getEmailAttributeCode() : string
- Return the html code for an email attribute
- getImageAttributeCode() : string
- Return the html code for an image attribute
- getMenuAttributeCode() : string
- Return the html code of a menu attribute
- getMenuOptionAttributeCode() : string
- Return the html code of a dropdown menu option
- getPasswordAttributeCode() : string
- Return the html code for a password attribute
- getTextareaAttributeCode() : string
- Return the html code for a textarea attribtue
- getTextAttributeCode() : string
- Return the html code for a text attribute
- getURIAttributeCode() : string
- Return the html code for an URI attribute
- isImageWithinAllowedSize() : mixed
- loadAccountAttributes() : mixed
- loadAttributeTypeTemplates() : mixed
- Load the html code template of the different attribute types
- loadLanguageAccountAttribute() : mixed
- moveUploadedImageInToPlace() : bool|string
- Copy the uploaded images from temp folder to images folder
- parseAttributePlaceholders() : 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_'
$defaultProfileThumbnailScaleColor
protected
mixed
$defaultProfileThumbnailScaleColor
= '#FFFFFF'
$modulePrefix
protected
mixed
$modulePrefix
= 'ACCESS_'
$objUserFW
User FRAMEWORK Object
protected
object
$objUserFW
Tags
$_mandatorySign
Sign to mark mandatory fields as required
private
string
$_mandatorySign
= '<strong style="padding: 0px 2px 0px 2px;color:#f00;">*</strong>'
$arrAccountAttributes
private
mixed
$arrAccountAttributes
$arrAttachedJSFunctions
private
array<string|int, mixed>
$arrAttachedJSFunctions
= array()
Tags
$arrAttributeTypeTemplates
private
mixed
$arrAttributeTypeTemplates
$attributeNamePrefix
private
mixed
$attributeNamePrefix
= 'access_profile_attribute'
Tags
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 $objTemplate = null ]) : 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
- $objTemplate : mixed = null
Tags
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
boolfetchGroupFilter()
Scan the supplied template for group-filter-placeholders and return the parsed group-IDs.
public
static fetchGroupFilter(Sigma $template, string $blockName) : array<string|int, mixed>
Scheme of a group-filter-placeholder: ACCESS_FILTER_GROUP_<ID>
Parameters
- $template : Sigma
-
Template to look for group filter placeholders for
- $blockName : string
-
The template block in which to look for the placeholders for
Return values
array<string|int, mixed> —Array of group-IDs
getImageUploader()
Initialize the access image uploader and get the uploader instance
public
getImageUploader() : Uploader
Return values
UploadergetPasswordInfo()
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
isSomeonesBirthdayToday()
Check if any of the active users having their birthday today.
public
isSomeonesBirthdayToday() : bool
Return values
bool —TRUE if one user's birthday is today. Otherwise FALSE
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
parseBasePlaceholders()
Parses ACCESS_USER_ID, -USERNAME and -REGDATE placeholders and the user's attributes
public
parseBasePlaceholders(mixed $objUser) : mixed
Parameters
- $objUser : mixed
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
setBirthdayUsers()
Parse a list (into the loaded template object) of those users having their birthday today.
public
setBirthdayUsers([string $gender = '' ]) : mixed
Parameters
- $gender : string = ''
-
Optional set to 'female' or 'male' to filter the list by gender
setCurrentlyOnlineUsers()
Parse a list (into the loaded template object) of those users currently signed in.
public
setCurrentlyOnlineUsers([string $gender = '' ]) : mixed
Parameters
- $gender : string = ''
-
Optional set to 'female' or 'male' to filter the list by gender
setLastActiveUsers()
Parse a list (into the loaded template object) of those users having signed in the most recent.
public
setLastActiveUsers([string $gender = '' ]) : mixed
Parameters
- $gender : string = ''
-
Optional set to 'female' or 'male' to filter the list by gender
setLatestRegisteredUsers()
Parse a list (into the loaded template object) of those users having signed up the most recent.
public
setLatestRegisteredUsers([string $gender = '' ]) : mixed
Parameters
- $gender : string = ''
-
Optional set to 'female' or 'male' to filter the list by gender
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
setNextBirthdayUsers()
Parse a list (into the loaded template object) of those users having their birthday coming up.
public
setNextBirthdayUsers([string $gender = '' ]) : mixed
Parameters
- $gender : string = ''
-
Optional set to 'female' or 'male' to filter the list by gender
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
stringexportUsers()
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
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'.
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
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) : mixed
Parameters
- $objUser : mixed
_getAtrributeCode()
private
_getAtrributeCode(mixed $objUser, mixed $attributeId, mixed $historyId[, mixed $edit = false ]) : mixed
Parameters
- $objUser : mixed
- $attributeId : mixed
- $historyId : mixed
- $edit : mixed = false
createThumbnailOfImage()
private
createThumbnailOfImage(mixed $imageName[, mixed $profilePic = false ]) : mixed
Parameters
- $imageName : mixed
- $profilePic : mixed = false
getCheckboxAttributeCode()
Return the html code for a checkbox attribute
private
getCheckboxAttributeCode(string $name, string $value, bool $edit) : string
Parameters
- $name : string
- $value : string
- $edit : bool
Return values
stringgetDateAttributeCode()
Return the html code for a date attribute
private
getDateAttributeCode(string $name, string $value, bool $edit) : string
Parameters
- $name : string
- $value : string
- $edit : bool
Return values
stringgetDateDayMenu()
private
getDateDayMenu(mixed $attributeName, mixed $selectedOption) : mixed
Parameters
- $attributeName : mixed
- $selectedOption : mixed
getDateMonthMenu()
private
getDateMonthMenu(mixed $attributeName, mixed $selectedOption) : mixed
Parameters
- $attributeName : mixed
- $selectedOption : mixed
getDateYearMenu()
private
getDateYearMenu(mixed $attributeName, mixed $selectedOption) : mixed
Parameters
- $attributeName : mixed
- $selectedOption : mixed
getEmailAttributeCode()
Return the html code for an email attribute
private
getEmailAttributeCode(string $name, string $value, bool $edit) : string
Parameters
- $name : string
- $value : string
- $edit : bool
Return values
stringgetImageAttributeCode()
Return the html code for an image attribute
private
getImageAttributeCode(mixed $objUser, string $name, string $value, string $attributeId, string $attributeHtmlId, int $historyId, bool $edit[, mixed $thumbnail = false ]) : string
Parameters
- $objUser : mixed
- $name : string
- $value : string
- $attributeId : string
- $attributeHtmlId : string
- $historyId : int
- $edit : bool
- $thumbnail : mixed = false
Return values
stringgetMenuAttributeCode()
Return the html code of a menu attribute
private
getMenuAttributeCode(string $name, string $value, bool $edit[, mixed $style = null ]) : string
Parameters
- $name : string
- $value : string
- $edit : bool
- $style : mixed = null
Return values
stringgetMenuOptionAttributeCode()
Return the html code of a dropdown menu option
private
getMenuOptionAttributeCode(string $value, string $selected, string $valueText[, mixed $style = null ]) : string
Parameters
- $value : string
- $selected : string
- $valueText : string
- $style : mixed = null
Return values
stringgetPasswordAttributeCode()
Return the html code for a password attribute
private
getPasswordAttributeCode(string $name) : string
Parameters
- $name : string
Return values
stringgetTextareaAttributeCode()
Return the html code for a textarea attribtue
private
getTextareaAttributeCode(string $name, string $value, bool $edit) : string
Parameters
- $name : string
- $value : string
- $edit : bool
Return values
stringgetTextAttributeCode()
Return the html code for a text attribute
private
getTextAttributeCode(string $name, string $value, bool $edit) : string
Parameters
- $name : string
- $value : string
- $edit : bool
Return values
stringgetURIAttributeCode()
Return the html code for an URI attribute
private
getURIAttributeCode(string $name, string $uri, bool $edit) : string
Parameters
- $name : string
- $uri : string
- $edit : bool
Return values
stringisImageWithinAllowedSize()
private
isImageWithinAllowedSize(mixed $size, mixed $profilePic) : mixed
Parameters
- $size : mixed
- $profilePic : mixed
loadAccountAttributes()
private
loadAccountAttributes() : mixed
loadAttributeTypeTemplates()
Load the html code template of the different attribute types
private
loadAttributeTypeTemplates() : mixed
Tags
loadLanguageAccountAttribute()
private
loadLanguageAccountAttribute() : mixed
moveUploadedImageInToPlace()
Copy the uploaded images from temp folder to images folder
private
moveUploadedImageInToPlace(User $objUser, string $tmpImagePath, string $name[, bool $profilePic = false ]) : bool|string
Parameters
- $objUser : User
-
User object
- $tmpImagePath : string
-
Temporary Image path
- $name : string
-
Image file name
- $profilePic : bool = false
-
True when processing profile picture
Tags
Return values
bool|string —False when copying file or file name on success
parseAttributePlaceholders()
private
parseAttributePlaceholders(mixed $arrPlaceholders[, mixed $defined = false ][, mixed $attributeIdUC = 0 ][, mixed $frameIdUC = 0 ][, mixed $childIdUC = 0 ][, mixed $frame = false ][, mixed $child = false ]) : mixed
Parameters
- $arrPlaceholders : mixed
- $defined : mixed = false
- $attributeIdUC : mixed = 0
- $frameIdUC : mixed = 0
- $childIdUC : mixed = 0
- $frame : mixed = false
- $child : mixed = false