Documentation

AccessLib

Common functions used by the front- and backend

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Thomas Daeppen thomas.daeppen@comvation.com

version
2.0.0
subpackage

coremodule_access

uses
ImageManager

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
$_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.
getImageUploader()  : Uploader
Initialize the access image uploader and get the uploader instance
getPasswordInfo()  : string
Returns the password information string
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.
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()  : void
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
access

private

todo

This is probably not meant to be public, but protected instead

$accountAttributeNamePrefix

protected mixed $accountAttributeNamePrefix = 'access_user_'

$defaultProfileThumbnailScaleColor

protected mixed $defaultProfileThumbnailScaleColor = '#FFFFFF'

$objUserFW

User FRAMEWORK Object

protected object $objUserFW
Tags
access

private

$_mandatorySign

Sign to mark mandatory fields as required

private string $_mandatorySign = '<strong style="padding: 0px 2px 0px 2px;color:#f00;">*</strong>'

$arrAttachedJSFunctions

private array<string|int, mixed> $arrAttachedJSFunctions = array()
Tags
access

private

$attributeNamePrefix

private mixed $attributeNamePrefix = 'access_profile_attribute'
Tags
access

private

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
  1. Call to set the \Cx\Core\Html\Sigma's placeholders prefix. Where the passed argument would be like: ACCESS_
  2. 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
  3. 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
see
AccessLib::setModulePrefix()
see
AccessLib::setAttributeNamePrefix()
see
AccessLib::parseAttribute()

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
bool

getPasswordInfo()

Returns the password information string

public static getPasswordInfo() : string

The string returned depends on the password complexity setting

Tags
author

Reto Kohli reto.kohli@comvation.com

Return values
string

The password complexity information

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

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
see
AccessLib::parseAccountAttribute()

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
see
AccessLib::parseAttribute()

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
see
AccessLib::parseAttribute()

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
string

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
throws
InstanceException

At the end of the CSV export to properly end the script execution.

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.

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

_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
string

getDateAttributeCode()

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
string

getDateDayMenu()

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
string

getImageAttributeCode()

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
string

getMenuAttributeCode()

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
string

getMenuOptionAttributeCode()

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
string

getPasswordAttributeCode()

Return the html code for a password attribute

private getPasswordAttributeCode(string $name) : string
Parameters
$name : string
Return values
string

getTextareaAttributeCode()

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
string

getTextAttributeCode()

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
string

getURIAttributeCode()

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
string

isImageWithinAllowedSize()

private isImageWithinAllowedSize(mixed $size, mixed $profilePic) : mixed
Parameters
$size : mixed
$profilePic : mixed

loadAttributeTypeTemplates()

Load the html code template of the different attribute types

private loadAttributeTypeTemplates() : mixed
Tags
global

array

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
staticvar

\ImageManager $objImage Image object

staticvar

type $arrSettings User settings

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

        
On this page

Search results