Adds default element loading to standard form

package Gems
subpackage User
copyright Copyright (c) 2012 Erasmus MC
license New BSD License
since Class available since version 1.5
inherited_from \Gems_Form_AutoLoadFormAbstract

 Methods

Copy from \Zend_Translate_Adapter

_(string $text, string|\Zend_Locale $locale = null) : string

Translates the given string returns the translation

Parameters

$text

string

Translation string

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

Constructor

__construct(mixed $options = null) : void
Inherited

Registers form view helper as decorator

Parameters

$options

mixed

activateBootstrap()

activateBootstrap() 
Inherited

Activate JQuery for this form

activateJQuery() : \MUtil_Form
Inherited

Returns

\MUtil_Form(continuation pattern)

addButtons()

addButtons(mixed $links) 

Parameters

$links

mixed

Add a new element

addElement(string|\Zend_Form_Element $element, string $name = null, array|\Zend_Config $options = null) : \Zend_Form
Inherited

$element may be either a string element type, or an object of type \Zend_Form_Element. If a string element type is provided, $name must be provided, and $options may be optionally provided for configuring the element.

If a \Zend_Form_Element is provided, $name may be optionally provided, and any provided $options will be ignored.

Parameters

$element

string\Zend_Form_Element

$name

string

$options

array\Zend_Config

Exceptions

\Zend_Form_Exception on invalid element

Returns

\Zend_Form(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void

This function is no needed if the classes are setup correctly

inherited_from \Gems_Form_AutoLoadFormAbstract::afterRegistry()

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean

Returns

booleanFalse if required values are missing.

Should a user specific check question be asked?

getAskCheck() : boolean

Returns

boolean

Should the for asking for an old password

getAskOld() : boolean

Returns

boolean

Get the autosubmit arguments (if any)

getAutoSubmit() : array
Inherited

Returns

arrayor null

When true all elements are loaded after initiation.

getLoadDefault($loadDefault = true) : boolean
Inherited

Parameters

$loadDefault

Returns

boolean$loadDefault

Returns/sets a new password element.

getNewPasswordElement() : \Zend_Form_Element_Password

Returns

\Zend_Form_Element_Password

Returns/sets a check old password element.

getOldPasswordElement() : \Zend_Form_Element_Password

Returns

\Zend_Form_Element_Password

Returns/sets a repeat password element.

getRepeatPasswordElement() : \Zend_Form_Element_Password

Returns

\Zend_Form_Element_Password

Returns/sets an element showing the password rules

getReportNoEnforcementElement() : \MUtil_Form_Element_Html

Returns

\MUtil_Form_Element_Html

Returns/sets an element showing the password rules

getReportRulesElement() : \MUtil_Form_Element_Html

Returns

\MUtil_Form_Element_Html

Returns/sets a submit button.

getSubmitButton() : \Zend_Form_Element_Submit
Inherited

Returns

\Zend_Form_Element_Submit

Returns the label for the submitbutton

getSubmitButtonLabel() : string
inherited_from \Gems_Form_AutoLoadFormAbstract::getSubmitButtonLabel()

Returns

string

Returns the label for the submitbutton

getSubmitButtonLabel() : string
Inherited

Returns

string

Returns a user

getUser() : \Gems_User_User
inherited_from \Gems_User_Validate_GetUserInterface::getUser()

Returns

\Gems_User_User

hasRuleEnforcement()

hasRuleEnforcement() : boolean

Returns

boolean

Is this a form that autosubmits?

isAutoSubmit() : boolean
Inherited

Returns

boolean

Validate the form

isValid(array $data, boolean $disableTranslateValidators = null) : boolean

As it is better for translation utilities to set the labels etc. translated, the MUtil default is to disable translation.

However, this also disables the translation of validation messages, which we cannot set translated. The MUtil form is extended so it can make this switch.

Parameters

$data

array

$disableTranslateValidators

boolean

Extra switch

Returns

boolean

The function that determines the element load order

loadDefaultElements() : \Gems_User_Form_LoginForm
inherited_from \Gems_Form_AutoLoadFormAbstract::loadDefaultElements()

Returns

\Gems_User_Form_LoginForm(continuation pattern)

The function loads the elements for this form

loadDefaultElements() : \Gems_Form_AutoLoadFormAbstract
Inherited

Returns

\Gems_Form_AutoLoadFormAbstract(continuation pattern)

Copy from \Zend_Translate_Adapter

plural(string $singular, string $plural, integer $number, string|\Zend_Locale $locale = null) : string

Translates the given string using plural notations Returns the translated string

see

Parameters

$singular

string

Singular translation string

$plural

string

Plural translation string

$number

integer

Number for detecting the correct plural

$locale

string\Zend_Locale

(Optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

Should a user specific check question be asked?

setAskCheck(boolean $askCheck = true) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$askCheck

boolean

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

Should the form ask for an old password

setAskOld(boolean $askOld = true) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$askOld

boolean

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

Change the form into an autosubmit form

setAutoSubmit(mixed $submitUrl, mixed $targetId, $selective = false
Inherited

Parameters

$submitUrl

mixed

Url as \MUtil_Html_UrlArrayAttribute, array or string

$targetId

mixed

Id of html element whose content is replaced by the submit result: \MUtil_Html_ElementInterface or string

$selective

Set optional user specific check question to be asked when getAskCheck() is on.

setCheckFields(array $checkFields) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$checkFields

array

Of 'label name' => 'required values' or \Zend_Form_Element elements

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

Should the form enforce the password rules

setForceRules(boolean $forceRules = true) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$forceRules

boolean

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

When true all elements are loaded after initiation.

setLoadDefault(boolean $loadDefault = true) : \Gems_User_Form_LoginForm
Inherited

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$loadDefault

boolean

Returns

\Gems_User_Form_LoginForm(continuation pattern)

Should the form report the password rules

setReportRules(boolean $reportRules = true) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$reportRules

boolean

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

Should the form report use the default form table layout

setUseTableLayout(boolean $useTableLayout = true) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$useTableLayout

boolean

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

The user to change the password for

setUser(\Gems_User_User $user) : \Gems_User_Form_ChangePasswordForm

Enables loading of parameter through \Zend_Form::__construct()

Parameters

$user

\Gems_User_User

Returns

\Gems_User_Form_ChangePasswordForm(continuation pattern)

True when this form was submitted.

wasSubmitted() : boolean

Returns

boolean

_activateJQueryView()

_activateJQueryView(\Zend_View_Interface $view = null
Inherited

Parameters

$view

Add user defined checkfields

addCheckFields() : void

Function that checks the setup of this class/traight

initTranslateable() 

This function is not needed if the variables have been defined correctly in the source for this object and theose variables have been applied.

return @void

Change all elements into an autosubmit element

_enableAutoSubmitElement(mixed $element) 
Inherited

Call only when $_autoSubmit is set

Parameters

$element

mixed

 Properties

 

If set this holds the url and targetid for the autosubmit

$_autosubmit : array

Default

null
 

The field name for the new password element.

$_newPasswordFieldName : string

Default

'new_password'
 

The field name for the old password element.

$_oldPasswordFieldName : string

Default

'old_password'
 

The field name for the repeat password element.

$_repeatPasswordFieldName : string

Default

'repeat_password'
 

The field name for the report no rule enforcement element.

$_reportNoEnforcementFieldName : string

Default

'report_no_enforcement'
 

The field name for the report rules element.

$_reportRulesFieldName : string

Default

'report_rules'
 

The field name for the submit element.

$_submitFieldName : string

Default

'button'
 

Layout table

$_table : \MUtil_Html_TableElements

Default

 

Should a user specific check question be asked?

$askCheck : boolean

Default

false
 

Should the old password be requested.

$askOld : boolean

Default

null

Calculated when null

 

Returns an array of elements for check fields during password reset and/or 'label name' => 'required value' pairs. vor asking extra questions before allowing a password change.

$checkFields 

Default

array()

Default is asking for the username but you can e.g. ask for someones birthday.

return Of 'label name' => 'required values' or \Zend_Form_Element elements
 

Should the password rules be enforced.

$forceRules : boolean

Default

true
 

When true all elements are loaded after initiation.

$loadDefault : boolean

Default

true
 

Should the password rules be reported.

$reportRules : boolean

Default

true
 

$translate

$translate : \Zend_Translate

Default

inherited_from \Gems_Form_AutoLoadFormAbstract::translate
 

$translate

$translate : \Zend_Translate

Default

 

$translateAdapter

$translateAdapter : \Zend_Translate_Adapter

Default

 

Use the default form table layout

$useTableLayout : boolean

Default

false
 

$user

$user : \Gems_User_User

Default