XOOPS  2.6.0
Xoops\Form\Form Class Reference
Inheritance diagram for Xoops\Form\Form:
Inheritance graph

Public Member Functions

 __construct ($title, $name, $action, $method= 'post', $addtoken=false, $display= '')
 
 addElement (Element $formElement, $required=false)
 
 assign (\XoopsTpl $tpl)
 
 display ()
 
 getAction ($encode=true)
 
 getDisplay ($encode=false)
 
 getElementByName ($name)
 
 getElementNames ()
 
 getElements ($recurse=false)
 
 getElementValue ($name, $encode=false)
 
 getElementValues ($encode=false)
 
 getExtra ()
 
 getMethod ()
 
 getName ($encode=true)
 
 getRequired ()
 
 getTitle ($encode=false)
 
 render ()
 
 renderValidationJS ($withtags=true)
 
 setAction ($value= '')
 
 setElementValue ($name, $value)
 
 setElementValues ($values)
 
 setExtra ($extra)
 
 setRequired (Element $formElement)
 
 setSummary ($summary)
 
 setTitle ($title)
 

Private Attributes

 $action
 
 $display = ''
 
 $elements = array()
 
 $extra = array()
 
 $method
 
 $name
 
 $required = array()
 
 $summary = ''
 
 $title
 

Detailed Description

Definition at line 26 of file Form.php.

Constructor & Destructor Documentation

Xoops\Form\Form::__construct (   $title,
  $name,
  $action,
  $method = 'post',
  $addtoken = false,
  $display = '' 
)

constructor

Parameters
string$titletitle of the form
string$namename attribute for the <form> tag
string$actionaction attribute for the <form> tag
string$methodmethod attribute for the <form> tag
boolean$addtokenwhether to add a security token to the form
string$displayclass for the form, i.e. horizontal, vertical, inline
Returns
void

Definition at line 101 of file Form.php.

References Xoops\Form\Form\$action, Xoops\Form\Form\$display, Xoops\Form\Form\$method, Xoops\Form\Form\$name, Xoops\Form\Form\$title, Xoops\Form\Form\addElement(), and Xoops\Form\Form\display().

Here is the call graph for this function:

Member Function Documentation

Xoops\Form\Form::addElement ( Element  $formElement,
  $required = false 
)
Xoops\Form\Form::assign ( \XoopsTpl  $tpl)

assign - assign to smarty form template instead of displaying directly

Parameters
\XoopsTpl$tpltemplate
Returns
void

Definition at line 499 of file Form.php.

References Xoops\Form\Form\$elements, $i, Xoops\Form\Form\getAction(), Xoops\Form\Form\getElements(), Xoops\Form\Form\getExtra(), Xoops\Form\Form\getMethod(), Xoops\Form\Form\getName(), Xoops\Form\Form\getRequired(), Xoops\Form\Form\getTitle(), Xoops\Form\Form\renderValidationJS(), and XoopsLocaleEn_US\REQUIRED.

Here is the call graph for this function:

Xoops\Form\Form::display ( )

display - displays rendered form

Returns
void

Definition at line 442 of file Form.php.

References Xoops\Form\Form\render().

Referenced by Xoops\Form\Form\__construct(), and Xoops\Form\Form\getDisplay().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Form\Form::getAction (   $encode = true)

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

Parameters
boolean$encodeTrue to encode special characters
Returns
string

Definition at line 182 of file Form.php.

References Xoops\Form\Form\$action.

Referenced by Xoops\Form\Form\assign(), Xoops\Form\SimpleForm\render(), Xoops\Form\TableForm\render(), Xoops\Form\ThemeForm\render(), and Xoops\Form\GroupPermissionForm\render().

Here is the caller graph for this function:

Xoops\Form\Form::getDisplay (   $encode = false)

getDisplay - return the summary of the form

Parameters
boolean$encodeTrue to encode special characters
Returns
string

Definition at line 120 of file Form.php.

References Xoops\Form\Form\$display, and Xoops\Form\Form\display().

Referenced by Xoops\Form\ThemeForm\render().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Form\Form::getElementByName (   $name)

getElementByName - get a reference to a Xoops by its name

Parameters
string$namename attribute assigned to a Xoops
Returns
null|Element

Definition at line 280 of file Form.php.

References Xoops\Form\Form\$elements, Xoops\Form\Form\$name, and Xoops\Form\Form\getElements().

Referenced by Xoops\Form\Form\getElementValue(), and Xoops\Form\Form\setElementValue().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Form\Form::getElementNames ( )

getElementNames - get an array of "name" attributes of form elements

Returns
string[] of form element names

Definition at line 261 of file Form.php.

References Xoops\Form\Form\$elements, and Xoops\Form\Form\getElements().

Here is the call graph for this function:

Xoops\Form\Form::getElementValue (   $name,
  $encode = false 
)

getElementValue - Gets the value attribute of a form element

Parameters
string$namethe name attribute of a form element
boolean$encodeTrue to encode special characters
Returns
string|null the value attribute assigned to a form element, null if not set

Definition at line 339 of file Form.php.

References Xoops\Form\Form\$name, and Xoops\Form\Form\getElementByName().

Here is the call graph for this function:

Xoops\Form\Form::getElementValues (   $encode = false)

getElementValues - gets the value attribute of all form elements

Parameters
boolean$encodeTrue to encode special characters
Returns
array array of name/value pairs assigned to form elements

Definition at line 352 of file Form.php.

References Xoops\Form\Form\$elements, Xoops\Form\Form\$name, and Xoops\Form\Form\getElements().

Here is the call graph for this function:

Xoops\Form\Form::getExtra ( )

getExtra - get the extra attributes for the <form> tag

Returns
string

Definition at line 400 of file Form.php.

References Xoops\Form\Form\$extra.

Referenced by Xoops\Form\Form\assign(), Xoops\Form\SimpleForm\render(), Xoops\Form\TableForm\render(), Xoops\Form\ThemeForm\render(), and Xoops\Form\GroupPermissionForm\render().

Here is the caller graph for this function:

Xoops\Form\Form::getMethod ( )

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

Returns
string

Definition at line 193 of file Form.php.

Referenced by Xoops\Form\Form\assign(), Xoops\Form\SimpleForm\render(), Xoops\Form\TableForm\render(), Xoops\Form\ThemeForm\render(), and Xoops\Form\GroupPermissionForm\render().

Here is the caller graph for this function:

Xoops\Form\Form::getName (   $encode = true)

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

Deprecated, to be refactored

Parameters
boolean$encodeTrue to encode special characters
Returns
string

Definition at line 158 of file Form.php.

References Xoops\Form\Form\$name.

Referenced by Xoops\Form\Form\assign(), Xoops\Form\SimpleForm\render(), Xoops\Form\TableForm\render(), Xoops\Form\ThemeForm\render(), Xoops\Form\GroupPermissionForm\render(), and Xoops\Form\Form\renderValidationJS().

Here is the caller graph for this function:

Xoops\Form\Form::getRequired ( )

getRequired - get an array of required form elements

Returns
array array of Xoops

Implements Xoops\Form\ContainerInterface.

Definition at line 423 of file Form.php.

References Xoops\Form\Form\$required.

Referenced by Xoops\Form\Form\assign().

Here is the caller graph for this function:

Xoops\Form\Form::getTitle (   $encode = false)

getTitle - return the title of the form

Parameters
bool$encodeTo sanitizer the text?
Returns
string

Definition at line 132 of file Form.php.

References Xoops\Form\Form\$title.

Referenced by Xoops\Form\Form\assign(), Xoops\Form\SimpleForm\render(), Xoops\Form\TableForm\render(), Xoops\Form\ThemeForm\render(), and Xoops\Form\GroupPermissionForm\render().

Here is the caller graph for this function:

Xoops\Form\Form::render ( )
abstract

render - returns renderered form

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

Returns
string the rendered form

Referenced by Xoops\Form\Form\display().

Here is the caller graph for this function:

Xoops\Form\Form::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
boolean$withtagsInclude the < javascript > tags in the returned string
Returns
string

Definition at line 471 of file Form.php.

References Xoops\Form\Form\$elements, Xoops\Form\Form\getElements(), and Xoops\Form\Form\getName().

Referenced by Xoops\Form\Form\assign(), Xoops\Form\ThemeForm\render(), and Xoops\Form\GroupPermissionForm\render().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Form\Form::setAction (   $value = '')

setAction

Parameters
string$valueURL of form action
Returns
void

Definition at line 170 of file Form.php.

Xoops\Form\Form::setElementValue (   $name,
  $value 
)

setElementValue - Sets the "value" attribute of a form element

Parameters
string$namethe "name" attribute of a form element
string$valuethe "value" attribute of a form element
Returns
void

Definition at line 301 of file Form.php.

References Xoops\Form\Form\$name, and Xoops\Form\Form\getElementByName().

Here is the call graph for this function:

Xoops\Form\Form::setElementValues (   $values)

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

Parameters
array$valuesarray of name/value pairs to be assigned to form elements
Returns
void

Definition at line 316 of file Form.php.

References Xoops\Form\Form\$elements, Xoops\Form\Form\$name, and Xoops\Form\Form\getElements().

Here is the call graph for this function:

Xoops\Form\Form::setExtra (   $extra)

set the extra attributes for the <form> tag

Parameters
string$extraextra attributes for the <form> tag
Returns
void

Definition at line 374 of file Form.php.

References Xoops\Form\Form\$extra.

Referenced by AvatarsAvatar_userForm\__construct(), ImagesImageForm\__construct(), AvatarsAvatarForm\__construct(), SmiliesSmiliesForm\__construct(), UserrankRanksForm\__construct(), ImagesImage_imagemanagerForm\__construct(), and SystemGroupForm\__construct().

Here is the caller graph for this function:

Xoops\Form\Form::setRequired ( Element  $formElement)

setRequired - mark an element as required entry

Parameters
Element$formElementXoops to set as required entry
Returns
void

Definition at line 413 of file Form.php.

Xoops\Form\Form::setSummary (   $summary)

setSummary - set the summary tag for the <form> tag

Parameters
string$summarysummary
Returns
void

Definition at line 388 of file Form.php.

References Xoops\Form\Form\$summary.

Xoops\Form\Form::setTitle (   $title)

setTitle

Parameters
string$titleform title
Returns
string

Definition at line 144 of file Form.php.

References Xoops\Form\Form\$title.

Member Data Documentation

Xoops\Form\Form::$action
private
Xoops\Form\Form::$display = ''
private

Definition at line 61 of file Form.php.

Referenced by Xoops\Form\Form\__construct(), and Xoops\Form\Form\getDisplay().

Xoops\Form\Form::$extra = array()
private
Xoops\Form\Form::$method
private

Definition at line 40 of file Form.php.

Referenced by Xoops\Form\Form\__construct().

Xoops\Form\Form::$required = array()
private

Definition at line 82 of file Form.php.

Referenced by Xoops\Form\Form\addElement(), and Xoops\Form\Form\getRequired().

Xoops\Form\Form::$summary = ''
private

Definition at line 87 of file Form.php.

Referenced by Xoops\Form\Form\setSummary().


The documentation for this class was generated from the following file: