\APIForm

Email Account Propogation REST Services API

You may not change or alter any portion of this comment or credits of supporting developers from this source code or any supporting source code which is considered copyrighted (c) material of the original comment or credit authors. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Summary

Methods
Properties
Constants
__construct()
APIForm()
getObjectID()
getArrayID()
getSummary()
getTitle()
getName()
getAction()
getMethod()
addElement()
getElements()
getElementNames()
getElementByName()
setElementValue()
setElementValues()
getElementValue()
getElementValues()
setExtra()
setSummary()
getExtra()
setRequired()
getRequired()
insertBreak()
render()
display()
renderValidationJS()
assign()
$_action
$_method
$_name
$_title
$_summary
$_elements
$_extra
$_required
$_objid
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$_action

$_action : 

"action" attribute for the html form

Type

$_method

$_method : 

"method" attribute for the form.

Type

$_name

$_name : 

"name" attribute of the form

Type

$_title

$_title : 

title for the form

Type

$_summary

$_summary : 

summary for the form (WGAC2 Requirement)

Type

$_elements

$_elements : mixed||string|int

array of {@link APIFormElement} objects

Type

mixed||string|int —

$_extra

$_extra : mixed||string|int

extra information for the <form> tag

Type

mixed||string|int —

$_required

$_required : mixed||string|int

required elements

Type

mixed||string|int —

$_objid

$_objid : 

additional serialised object checksum (ERM Analysis - Requirement)

Type

Methods

__construct()

__construct(  title,   name,   action,   method = post,   addtoken = false,   summary) : 

constructor

Parameters

title

title of the form

name

"name" attribute for the

tag

action

"action" attribute for the tag

method

"method" attribute for the tag

addtoken

whether to add a security token to the form

summary

Returns

APIForm()

APIForm() : 

PHP 4 style constructor compatibility shim

Returns

getObjectID()

getObjectID( object,   hashinfo = sha1) : 

*#@+ retrieves object serialisation/identification id (sha1 used)

each object has serialisation

  • legal requirement of enterprise relational management (ERM)

Parameters

object
hashinfo

Returns

getArrayID()

getArrayID( value,  key,  ret,   hashinfo = sha1) : 

Parameters

value
key
ret
hashinfo

Returns

getSummary()

getSummary(  encode = false) : 

return the summary of the form

Parameters

encode

To sanitizer the text?

Returns

getTitle()

getTitle(  encode = false) : 

return the title of the form

Parameters

encode

To sanitizer the text?

Returns

getName()

getName(  encode = true) : 

get the "name" attribute for the <form> tag

Deprecated, to be refactored

Parameters

encode

To sanitizer the text?

Returns

getAction()

getAction(  encode = true) : 

get the "action" attribute for the <form> tag

Parameters

encode

To sanitizer the text?

Returns

getMethod()

getMethod() : 

get the "method" attribute for the <form> tag

Returns

addElement()

addElement(string|\APIFormElement  formElement,   required = false) : 

Add an element to the form

Parameters

string|\APIFormElement formElement

reference to a {@link APIFormElement}

required

is this a "required" element?

Returns

getElements()

getElements(  recurse = false) : \APIFormElement||string|int

get an array of forms elements

Parameters

recurse

get elements recursively?

Returns

\APIFormElement||string|int —

array of {@link APIFormElement}s

getElementNames()

getElementNames() : mixed||string|int

get an array of "name" attributes of form elements

Returns

mixed||string|int —

array of form element names

getElementByName()

getElementByName(  name) : 

get a reference to a {@link APIFormElement} object by its "name"

Parameters

name

"name" attribute assigned to a {@link APIFormElement}

Returns

reference to a {@link APIFormElement}, false if not found

setElementValue()

setElementValue(  name,   value) : 

Sets the "value" attribute of a form element

Parameters

name

the "name" attribute of a form element

value

the "value" attribute of a form element

Returns

setElementValues()

setElementValues(mixed||string|int  values) : 

Sets the "value" attribute of form elements in a batch

Parameters

mixed||string|int values

array of name/value pairs to be assigned to form elements

Returns

getElementValue()

getElementValue(  name,   encode = false) : 

Gets the "value" attribute of a form element

Parameters

name

the "name" attribute of a form element

encode

To sanitizer the text?

Returns

the "value" attribute assigned to a form element, null if not set

getElementValues()

getElementValues(  encode = false) : mixed||string|int

gets the "value" attribute of all form elements

Parameters

encode

To sanitizer the text?

Returns

mixed||string|int —

array of name/value pairs assigned to form elements

setExtra()

setExtra(  extra) : 

set the extra attributes for the <form> tag

Parameters

extra

extra attributes for the tag

Returns

setSummary()

setSummary(  summary) : 

set the summary tag for the <form> tag

Parameters

summary

Returns

getExtra()

getExtra() : 

get the extra attributes for the <form> tag

Returns

setRequired()

setRequired(\APIFormElement  formElement) : 

make an element "required"

Parameters

\APIFormElement formElement

reference to a {@link APIFormElement}

Returns

getRequired()

getRequired() : mixed||string|int

get an array of "required" form elements

Returns

mixed||string|int —

array of {@link APIFormElement}s

insertBreak()

insertBreak(  extra = null) : 

insert a break in the form

This method is abstract. It must be overwritten in the child classes.

Parameters

extra

extra information for the break

Returns

render()

render() : 

returns renderered form

This method is abstract. It must be overwritten in the child classes.

Returns

display()

display() : 

displays rendered form

Returns

renderValidationJS()

renderValidationJS(  withtags = true) : 

Renders the Javascript function needed for client-side for validation

Form elements that have been declared "required" and not set will prevent the form from being submitted. Additionally, each element class may provide its own "renderValidationJS" method that is supposed to return custom validation code for the element.

The element validation code can assume that the JS "myform" variable points to the form, and must execute return false if validation fails.

A basic element validation method may contain something like this: function renderValidationJS() { $name = $this->getName(); return "if (myform.{$name}.value != 'valid') { " . "myform.{$name}.focus(); window.alert( '$name is invalid' ); return false;" . " }"; }

Parameters

withtags

Include the < javascript > tags in the returned string

Returns

assign()

assign(\APITpl  tpl) : 

assign to smarty form template instead of displaying directly

Parameters

\APITpl tpl

reference to a {@link Smarty} object object

Returns