Common functions used by the front- and backend

copyright CONTREXX CMS - COMVATION AG
author Thomas Daeppen
version 2.0.0
package contrexx
subpackage coremodule_access
uses \global\/lib/FRAMEWORK/Image.class.php

 Methods

This library can be used to parse/generate the HTML code of a user's profile attributes from within the whole framework.

__construct(\Cx\Core\Html\Sigma $objTemplate) 

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

see \AccessLib::setModulePrefix()
see \AccessLib::setAttributeNamePrefix()
see \AccessLib::parseAttribute()

Parameters

$objTemplate

\Cx\Core\Html\Sigma

\Cx\Core\Html\Sigma object in case this object's use is intended to parse a user profile's attribute from within a different place than the access module.

Returns the password information string

getPasswordInfo() : string
Static

The string returned depends on the password complexity setting

author Reto Kohli

Returns

stringThe password complexity information

This method has two purposes (see param $return): 1.

parseAttribute(\User $objUser, integer $attributeId, integer $historyId, boolean $edit, boolean $return, boolean $isChild, boolean $inFrame, boolean $useMagicBlock, array $arrAdditionalPlaceholders) 

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

Parameters

$objUser

\User

User object of whoem's profile attribute shall be parsed

$attributeId

integer

ID of the profile attribute to be parsed

$historyId

integer

History version of the profile attribute to be parsed

$edit

boolean

If the profile attribute's value shall be modifyable (set to TRUE) or not (set to FALSE)

$return

boolean

If the profile attribute's \Cx\Core\Html\Sigma template block shall be parsed (set to FALSE) or the HTML code of the profile attribute shall be generated and returned instead (set to TRUE).

$isChild

boolean

In case the profile attribute to be parsed is an other profile attribute's child, set this to TRUE, otherwise to FALSE

$inFrame

boolean

In case the profile attribute to be parsed is located within an other profile attribute of the type frame, set this to TRUE, otherwise to FALSE

$useMagicBlock

boolean

The method can use the magic block \Cx\Core\Html\Sigma template block access_profile_attribute_list (set to TRUE), instead of using the profile attribute specific block like for instance access_profile_attribute_firstname (set to FALSE)

$arrAdditionalPlaceholders

array

Pass additional, preparsed placeholders. The array must be an associated array, where the key represents the \Cx\Core\Html\Sigma variable suffix and the value the placeholder's value. For instance: array('_CSS' => 'someSpecialCSSClass');

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.

setAttributeNamePrefix(string $prefix) 

For instance when setting the prefix to 'shop_customer_profile_attribute', then the method {@link AccessLib::parseAttribute()) 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'

see \AccessLib::parseAttribute()

Parameters

$prefix

string

\Cx\Core\Html\Sigma template block prefix to be used

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.

setModulePrefix(string $prefix) 

For instance when setting the prefix to 'SHOP_', then the method {@link AccessLib::parseAttribute()) will parse the \Cx\Core\Html\Sigma variable SHOP_PROFILE_ATTRIBUTE_FIRSTNAME in the case of the profile attribute firstname. Defaults to 'ACCESS_'

see \AccessLib::parseAttribute()

Parameters

$prefix

string

\Cx\Core\Html\Sigma variable prefix to be used

addUploadedImagesToProfile()

addUploadedImagesToProfile($objUser, $arrProfile, $arrImages) 

Parameters

$objUser

$arrProfile

$arrImages

attachJavaScriptFunction()

attachJavaScriptFunction($function) 

Parameters

$function

detachAllJavaScriptFunctions()

detachAllJavaScriptFunctions() 

getJavaScriptCode()

getJavaScriptCode() 

parseAccountAttribute()

parseAccountAttribute($objUser, $attributeId, $edit, $value) 

Parameters

$objUser

$attributeId

$edit

$value

parseAccountAttributes()

parseAccountAttributes($objUser, $edit) 

Parameters

$objUser

$edit

parseLetterIndexList()

parseLetterIndexList($URI, $paramName, $selectedLetter) 

Parameters

$URI

$paramName

$selectedLetter

Parse a user's newsletter-list subscription interface

parseNewsletterLists(\User $objUser) 

Parameters

$objUser

\User

User object of whoem the newsletter-list subscriptions shall be parsed

removeUselessImages()

removeUselessImages() 

_getAtrributeCode()

_getAtrributeCode($objUser, $attributeId, $historyId, $edit) 

Parameters

$objUser

$attributeId

$historyId

$edit

createThumbnailOfImage()

createThumbnailOfImage($imageName, $profilePic) 

Parameters

$imageName

$profilePic

Return the html code for a checkbox attribute

getCheckboxAttributeCode(string $name, string $value, boolean $edit) : string

Parameters

$name

string

$value

string

$edit

boolean

Returns

string

Return the html code for a date attribute

getDateAttributeCode(string $name, string $value, boolean $edit) : string

Parameters

$name

string

$value

string

$edit

boolean

Returns

string

getDateDayMenu()

getDateDayMenu($attributeName, $selectedOption) 

Parameters

$attributeName

$selectedOption

getDateMonthMenu()

getDateMonthMenu($attributeName, $selectedOption) 

Parameters

$attributeName

$selectedOption

getDateYearMenu()

getDateYearMenu($attributeName, $selectedOption) 

Parameters

$attributeName

$selectedOption

Return the html code for an email attribute

getEmailAttributeCode(string $name, string $value, boolean $edit) : string

Parameters

$name

string

$value

string

$edit

boolean

Returns

string

Return the html code for an image attribute

getImageAttributeCode($objUser, string $name, string $value, string $attributeId, string $attributeHtmlId, integer $historyId, boolean $edit, $thumbnail) : string

Parameters

$objUser

$name

string

$value

string

$attributeId

string

$attributeHtmlId

string

$historyId

integer

$edit

boolean

$thumbnail

Returns

string

Return the html code of a menu attribute

getMenuAttributeCode(string $name, string $value, boolean $edit, $style) : string

Parameters

$name

string

$value

string

$edit

boolean

$style

Returns

string

Return the html code of a dropdown menu option

getMenuOptionAttributeCode(string $value, string $selected, string $valueText, $style) : string

Parameters

$value

string

$selected

string

$valueText

string

$style

Returns

string

Return the html code for a password attribute

getPasswordAttributeCode(string $name) : string

Parameters

$name

string

Returns

string

Return the html code for a text attribute

getTextAttributeCode(string $name, string $value, boolean $edit) : string

Parameters

$name

string

$value

string

$edit

boolean

Returns

string

Return the html code for a textarea attribtue

getTextareaAttributeCode(string $name, string $value, boolean $edit) : string

Parameters

$name

string

$value

string

$edit

boolean

Returns

string

Return the html code for an URI attribute

getURIAttributeCode(string $name, string $uri, boolean $edit) : string

Parameters

$name

string

$uri

string

$edit

boolean

Returns

string

isImageWithinAllowedSize()

isImageWithinAllowedSize($size, $profilePic) 

Parameters

$size

$profilePic

loadAccountAttributes()

loadAccountAttributes() 

Load the html code template of the different attribute types

loadAttributeTypeTemplates() 
global array

loadLanguageAccountAttribute()

loadLanguageAccountAttribute() 

moveUploadedImageInToPlace()

moveUploadedImageInToPlace($objUser, $tmpImageName, $name, $profilePic) 

Parameters

$objUser

$tmpImageName

$name

$profilePic

parseAttributePlaceholders()

parseAttributePlaceholders($arrPlaceholders, $defined, $attributeIdUC, $frameIdUC, $childIdUC, $frame, $child) 

Parameters

$arrPlaceholders

$defined

$attributeIdUC

$frameIdUC

$childIdUC

$frame

$child

 Properties

 

$_objTpl : \Cx\Core\Html\Sigma
access private
todo This is probably not meant to be public, but protected instead
 

$defaultProfileThumbnailScaleColor 
 

$objUserFW : object
access private
 

$_mandatorySign : string
 

$arrAccountAttributes 
 

$arrAttachedJSFunctions : array
access private
 

$arrAttributeTypeTemplates 
 

$attributeNamePrefix 
access private
 

$modulePrefix 
© Copyright 2014 by Comvation AG
Generated on 2014-07-11T08:39:15+02:00.