View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{note:title=Archived}
This proposal has been archived, and deprecated in favor of the consolidated [Zend_Form Proposal|ZFPROP:Zend_Form].
{note}

{zone-data:component-name}
Zend_Form
{zone-data}

{zone-data:proposer-list}
[Jurriƫn Stutterheim|mailto:j.stutterheim@hccnet.nl]
{zone-data}

{zone-data:revision}
1.3 - 30 September 2007: Revised.
{zone-data}

{zone-data:overview}
Zend_Form is a component that manages form filtering/validation and, form data/status across multiple pages.
{zone-data}

{zone-data:references}
* [Zend_Form - Simon Mundy & Ralf Eggert|http://framework.zend.com/wiki/pages/viewpage.action?pageId=3596]
* [QuickForm2|http://quickform.mamasam.com/wiki/]
* [My own library with Form implementation|http://tools.assembla.com/svn/IntermentisFW/trunk/Mentis/]
{zone-data}

{zone-data:requirements}
* *Must* provide seperation between form building and form handling.
* *Must* provide view helpers to easiliy render form elements or even an entire form.
* *Must* provide action helpers to automate form handling
* *Must* be able to handle data from multiple pages
* *Must* provide a way to store a multi-page form in multiple storage containers (Session, Cache)
* *Could* utilize Zend_Filter_Input for form validation and filtering
* *Must not* be bound to one output format. Developers must be able to use the Zend_Form for other output than just XHTML.
{zone-data}

{zone-data:dependencies}
* Zend_Cache_Core*
* Zend_Controller_Action_Helper_Abstract
* Zend_Exception
* Zend_Filter_*
* Zend_Filter_Input
* Zend_Session
* Zend_Validate_*
* Zend_View
{zone-data}

{zone-data:operation}
The basic usage is as follows:
A form page is instantiated. The form processes the submitted data (if available).
If not available, pass the form page to the view and render the form.
If available, validate the form and forward to the appropriate action.
To prevent expired forms there should always be a redirection after the form has been handled.

h3. Zend_Form_Factory
The Zend_Form_Factory class is a factory which makes it easy to generate a Zend_Form. It also makes sure the right datasource is used to populate the form and that the form is serialized in storage.

h3. Zend_Form
The Zend_Form represents one form as displayed on a screen. The form contains a collection of fields (called elements, for cross-format naming) and can be validated as a whole.
The entire form can be serialized into a storage container, so it may be reused in another request. It stores the result of a validation attempt, so the requirements for a form can be checked.
(e.g. shop wizzard example where you don't want to access the payment form before user data is entered)

h3. Zend_Form_Element
A form element contains field-specific filter and validation rules, which will be read from the form page and used for validation.
It can also contain a type-hint, so view helpers can automatically display the proper output format for the field.
There are basicly two different types of form field: Zend_Form_Element and Zend_Form_Element_Set (the upload field is ignored for now).
The former can be used for textfields, textareas, hidden fields etc. The latter can be used for radiobuttons, checkboxes, select lists etc.

h3. Zend_Form_Storage
When a form is validated, the submitted form data and the validation result will be stored for reuse. The Zend_Form_Storage provides a way to do this.
There are two storage methods at the moment: Session and Cache. The latter needs a pre-setup Zend_Cache instance.

h3. View helpers
All Zend_Form_Elements of the form page are accessible in the view. The view helpers make it easy to generate XHTML for your forms.
The default Zend Framework views can be used for this, but there are also a few extra view helpers for Zend_Form.
* The FormField only needs the Zend_Form_Element instance and decides which view helper to use based on that. In order for this to work a typehint must be set.
* The MakeForm helper generates an entire form by providing the form page instance. This should only be used for testing/mockup purposes for now. It may be possible to combine this with a Layout or View Enhanced implementation to make the output customizable.
* The FormElement helper already exists in the ZF today. It has been modified to accept a Zend_Form_Element as argument.
* FormError reads the validation errors from the form instance and displays them.
* FormStart generates a <form> tag and a hidden field that contains the unique identifier for that form.

h3. Action helper
* The FormHandler action helper is a basic skeleton for the workflow described in the operations part. It also has support for form plugins, which will be discussed later.
* The FormRedirector is a subclass of the default Redirector. It contains a formForward and formRedirect method, which make sure the unique form identifier gets send.

h3. Plugins
The plugins can be registered in the action helper. The plugins make the basic workflow customizable, so form handling can be largly automated. There are three stock plugins:
* Location: this redirects or forwards the controller to the specified location, based on which button was pressed to submit the form, the status of the form and optionally the status of specific form elements.
* Modal: checks if the form is modal and if the requirements for it are met.
* Upload: this handles file uploads.

h3. Builders
The builders make it possible to generate a form instance in an easy way. The most basic builder is the Formname builder. As the name suggests, it takes the name of a form to make an instance. Other builders make it possible to generate a form instance from a Zend_Config instance or a Zend_Db_Table_Abstract instance.

h3. Zend_Form_Filter_Input
As the name suggests this is a subclass of Zend_Filter_Input. It does not require complete filter/validator chains in the constructor and has a few methods to allow dynamic adding and removing of rules.
{zone-data}

{zone-data:milestones}
* Milestone 1: Make clear what to expect from a Zend_Form component
* Milestone 2: Define an API
* Milestone 3: Have a working prototype with examples
* Milestone 4: Unit tests
* Milestone 5: Complete documentation
* Milestone 6: Complete the component
{zone-data}

{zone-data:class-list}
* Zend_Form
* Zend_Form_Builder...
** _Abstract
** _Config
** _Db...
*** _Abstract
*** _Db2
*** _Mysqli
*** _Oracle
*** _Pdo...
**** _Mssql
**** _Mysql
**** _Oci
**** _Pgsql
**** _Sqlite
** _Exception
** _Form
** _Formname
* Zend_Form_Element
** Zend_Form_Element_Set
* Zend_Form_Element_Hint...
** _HTML
** _PDF
** _XForms
* Zend_Form_Exception
* Zend_Form_Factory
* Zend_Form_Plugin...
** _Abstract
** _Broker
** _Location
** _Modal
** _Upload
* Zend_Form_Storage
** Zend_Form_Storage_Cache
** Zend_Form_Storage_Abstract
** Zend_Form_Storage_Session
* Zend_View_Helper...
** _FormElement
** _FormError
** _FormField
** _FormStart
** _MakeForm
* Zend_Controller_Action_Helper...
** _FormHandler
** _FormRedirector
{zone-data}

{zone-data:use-cases}
{composition-setup}
{deck:id=Usecases}
{card:label=Simple setup}
{code}
/**
A form with the name myCoolForm will be created. A field named foo will be attached.
Zend_Form now expects a form field named foo with an alphanumeric value. The form will get the data from $_POST by default, unless specified otherwise.
*/
$form = Zend_Form_Factory::get(new Zend_Form_Builder($this->_formName), $this->_getParam('id'));
$form->addField('foo')
->addValidator(new Zend_Validate_Alnum())
->addTypeHint(Zend_Form_Element_Hint_HTML::FORMAT, Zend_Form_Element_Hint_HTML::TEXT);

$form->addElement(Zend_Form::SUBMIT_OK)
->setValue('OK');

$form->addElement(Zend_Form::SUBMIT_CANCEL)
->setValue('Cancel');

$formHandler = $this->getHelper('FormHandler');

$locationPlugin = new Zend_Form_Plugin_Location();

/**
If the OK button was pressed to submit, forward to the process action, but only if the form is valid.
If the Cancel button was pressed to submit, forward to the cancel action, even when the form isn't valid.
*/
$locationPlugin->addLocation(Zend_Form::SUBMIT_OK, array('action' => 'process'))
->addLocation(Zend_Form::SUBMIT_CANCEL, array('action' => 'cancel'), false);

$formHandler->registerPlugin($locationPlugin);

$formHandler->handle($form);
{code}
{card}
{card:label=Custom form object}
{code}
class My_Cool_Form extends Zend_Form
{
protected $_name = 'myCoolForm';

public function setup()
{
$this->addField('foo')
->addValidator(new Zend_Validate_Alnum())
->addTypeHint(Zend_Form_Element_Hint_HTML::FORMAT, Zend_Form_Element_Hint_HTML::TEXT);
}
}

$form = Zend_Form::get(new Zend_Form_Builder_Form(new My_Cool_Form()), $this->_getParam('id));

// Form handler routine...
{code}
{card}
{card:label=View rendering}
{code}
Foo: <?php echo $this->formText($this->form->foo->name, $this->form->foo->value, $this->form->foo->attributes); ?>

OR

Foo: <?php echo $this->formField($this->form->foo); ?>

A form generator (for mockup/testing purposes) is also included:

<?php echo $this->makeForm($this->form); ?>

Will generate something like:

<form method="post" action="/mycontroller/form">
<input type="hidden" name="ZendFormIdentifier" value="..." />
<input type="text" name="foo" />
<input type="submit" value="OK" />
<input type="submit" value="Reset" />
<input type="submit" value="Cancel" />
</form>
{code}
{deck}
{zone-data}
{zone-data:skeletons}
The code below is taken directly from my implementation, which can be found in the SVN repository linked on top of this proposal.
{composition-setup}
{deck:id=Source}
{card:label=Zend_Form_Factory}
{code}
class Zend_Form_Factory
{
/**
* POST Data constant
*
*/
const DATASOURCE_POST = 'post';

/**
* GET Data constant
*
*/
const DATASOURCE_GET = 'get';

/**
* Request
*
* @var Zend_Controller_Request_Http
*/
private static $_request;

private static function _getRequest()
{
}

/**
* Gets a form
*
* @param Zend_Form_Builder_Abstract $form
* @param string $identifier
* @param mixed $dataSource
* @param Zend_Form_Storage_Interface $storage
* @return Zend_Form
*/
public static function get(Zend_Form_Builder_Abstract $formBuilder,
$identifier = null,
$dataSource = Zend_Form_Factory::DATASOURCE_POST,
Zend_Form_Storage_Interface $storage = null)
{
}

public static function remove($formName, $identifier)
{
}
}
{code}
{card}
{card:label=Zend_Form_Element}
{code}
class Zend_Form_Element
{
/**
* Field value
*
* @var string
*/
protected $_value = '';

/**
* Validators
*
* @var array
*/
protected $_validatorChain;

/**
* Filter chain
*
* @var array
*/
protected $_filterChain;

/**
* Field is required
*
* @var Boolean
*/
protected $_required = true;

/**
* Allow the element to be empty
*
* @var boolean
*/
protected $_allowEmpty = false;

/**
* Field name
*
* @var String
*/
protected $_name;

/**
* Type hint for output scripts
*
* @var array
*/
protected $_typeHints = array();

/**
* Constructs the form element and prepares the name
*
* @param String $name
*/
public function __construct($name)
{
}

/**
* Gets form element data by magic method
*
* @param String $element
* @return mixed
*/
public function __get($element)
{
}

/**
* Gets form element data by magic method
*
* @param String $element
* @param mixed $value
* @return Zend_Form_Element
*/
public function __set($element, $value)
{
}

/**
* When trying to echo the object, return the value
*
* @return mixed
*/
public function __toString()
{
}

/**
* Get the element value
*
* @return mixed
*/
public function getValue()
{
}

/**
* Set the element value
*
* @param mixed $value
* @return Zend_Form_Element
*/
public function setValue($value)
{
}

/**
* Gets the filter chain
*
* @return Zend_Filter
*/
public function getFilterChain()
{
}

/**
* Sets the filter chain
*
* @param Zend_Filter $filterChain
* @return Zend_Form_Element
*/
public function setFilterChain(Zend_Filter $filterChain)
{
}

/**
* Gets the validator chain
*
* @return Zend_Validate
*/
public function getValidatorChain()
{
}

/**
* Sets the validator chain
*
* @param Zend_Validate $validatorChain
* @return Zend_Form_Element
*/
public function setValidatorChain(Zend_Validate $validatorChain)
{
}

/**
* Adds a validator to the validator chain
*
* @param Zend_Validate_Interface $validator
* @return Zend_Form_Element
*/
public function addValidator(Zend_Validate_Interface $validator)
{
}

/**
* Adds a filter to the filter chain
*
* @param Zend_Filter_Interface $filter
* @return Zend_Form_Element
*/
public function addFilter(Zend_Filter_Interface $filter)
{
}

/**
* Get all type hints
*
* @return array
*/
public function getTypeHints()
{
}

/**
* Get the type hint for the specified format
*
* @throws Zend_Form_Element_Exception
* @param string $format
* @return string
*/
public function getTypeHint($format)
{
}

/**
* Add a type hint
*
* @param string $format
* @param string $hint
* @return Zend_Form_Element
*/
public function addTypeHint($format, $hint)
{
}

/**
* Sets the form element name
*
* @param mixed $name
* @return Zend_Form_Element
*/
public function setName($name)
{
}

/**
* Gets the form element name
*
* @return mixed
*/
public function getName()
{
}

/**
* Gets the required property
*
* @return Boolean
*/
public function getRequired()
{
}

/**
* Sets the required property
*
* @param Boolean $required
* @return Zend_Form_Element
*/
public function setRequired($required = true)
{
}

/**
* Check if the element can be empty
*
* @return boolean
*/
public function getAllowEmpty()
{
}

/**
* Set the allowEmpty flag
*
* @param boolean $allowEmpty
* @return Zend_Form_Element
*/
public function setAllowEmpty($allowEmpty = false)
{
}

/**
* Add a validator or filter
*
* @param string $className
* @param array $arguments
* @return Zend_Form_Element
*/
public function addValidatorOrFilter($className, array $arguments = array())
{
}
}
{code}
{card}
{card:label=Zend_Form_Element_Set}
{code}
class Zend_Form_Element_Set extends Zend_Form_Element
{
/**
* The options for the form element set
*
* @var array
*/
protected $_options = array();

/**
* Gets form element data by magic method
*
* @param String $element
* @return mixed
*/
public function __get($element)
{
}

/**
* Gets form element data by magic method
*
* @param String $element
* @param mixed $value
* @return Zend_Form_Element
*/
public function __set($element, $value)
{
}

/**
* Returns the options
*
* @return array
*/
public function getOptions()
{
}

/**
* Sets the options and overwrites the existing options.
*
* @param array $options
* @return Zend_Form_Element_Set
*/
public function setOptions(array $options)
{
}

/**
* Add an option to the list
*
* @param mixed $value
* @param String $label
* @return Zend_Form_Element_Set
*/
public function addOption($value, $label)
{
}

/**
* Removes an option from the list by value
*
* @throws Zend_Form_Element_Exception
* @param mixed $value
* @return Zend_Form_Element_Set
*/
public function removeOption($value)
{
}
}
{code}
{card}
{card:label=Zend_Form_Storage_*}
{code}
class Zend_Form_Storage
{
const MSG_NOT_IN_STORAGE = 'The specified form is not available in storage.';

/**
* Storage instance
*
* @var Zend_Form_Storage_Interface
*/
private static $_storage;

/**
* Get the storage object
*
* @return Zend_Form_Storage_Interface
*/
private static function getStorage()
{
}

/**
* Set the storage object
*
* @param Zend_Form_Storage_Interface $storage
*/
public static function setStorage(Zend_Form_Storage_Interface $storage)
{
}

/**
* Set the page in the storage object
*
* @param Zend_Form $form
*/
public static function setForm(Zend_Form $form)
{
}

/**
* Get the page from storage
*
* @param string $formName
* @return Zend_Form
*/
public static function getForm($formName, $identifier)
{
}

/**
* Checks if the page exists in the storage
*
* @param string $formName
* @return boolean
*/
public static function hasForm($formName, $identifier)
{
}

/**
* Removes page from storage
*
* @param string $formName
*/
public static function removeForm($formName, $identifier)
{
}

/**
* Clears all pages from storage
*
*/
public static function clearForms()
{
}
}

class Zend_Form_Storage_Cache implements Zend_Form_Storage_Interface
{
/**
* The form forms
*
* @var array
*/
protected $_forms = array();

/**
* The cache ID
*
* @var string
*/
private $_cacheID = 'Zend_Form_Storage_Cache';

/**
* The cache instance
*
* @var Zend_Cache_Core
*/
private $_cache;

/**
* Restore the forms from storage
*/
public function __construct(Zend_Cache_Core $cache)
{
}

/**
* Serialize the forms to storage
*
*/
public function __destruct()
{
}

/**
* Add a form to the forms array
*
* @param Zend_Form $form
*/
public function setForm(Zend_Form $form)
{
}

/**
* Get a form from the forms array
*
* @throws Zend_Form_Storage_Exception
* @param string $formName
* @return Zend_Form
*/
public function getForm($formName, $identifier)
{
}

/**
* Check if the form exists in the forms array
*
* @param string $formName
* @return boolean
*/
public function hasForm($formName, $identifier)
{
}

/**
* Remove the form from the forms array
*
* @throws Zend_Form_Storage_Exception
* @param string $formName
*/
public function removeForm($formName, $identifier)
{
}

/**
* Clears all forms from storage
*
*/
public function clearForms()
{
}
}

interface Zend_Form_Storage_Interface
{
/**
* Add a form to storage
*
* @param Zend_Form $form
*/
public function setForm(Zend_Form $form);

/**
* Get a form from storage
*
* @throws Zend_Form_Storage_Exception
* @param string $name
* @return Zend_Form
*/
public function getForm($name, $identifier);

/**
* Check if the form exists in storage
*
* @param string $name
* @return boolean
*/
public function hasForm($name, $identifier);

/**
* Remove the form from storage
*
* @throws Zend_Form_Storage_Exception
* @param string $name
*/
public function removeForm($name, $identifier);

/**
* Clears all forms from storage
*
*/
public function clearForms();
}

class Zend_Form_Storage_Session implements Zend_Form_Storage_Interface
{
/**
* Session
*
* @var Zend_Session_Namespace
*/
private $_session;

/**
* Starts the session
*
*/
public function __construct()
{
}

/**
* Set the form in storage
*
* @param Zend_Form $form
*/
public function setForm(Zend_Form $form)
{
}

/**
* Gets the form from storage
*
* @param string $formName
* @return Zend_Form
*/
public function getForm($formName, $identifier)
{
}

/**
* Check if the form exists in storage
*
* @param string $formName
* @return boolean
*/
public function hasForm($formName, $identifier)
{
}

/**
* Remove the form from storage
*
* @throws Zend_Form_Storage_Exception
* @param string $formName
*/
public function removeForm($formName, $identifier)
{
}

/**
* Clears all forms from storage
*
*/
public function clearForms()
{
}

/**
* Retrieves the form collection of the given form name.
* Return an empty array if it doesn't exist yet.
*
* @param string $formName
* @return boolean
*/
private function getFormCollection($formName)
{
}
}
{code}
{card}
{card:label=Zend_Form}
{code}
class Zend_Form implements ArrayAccess
{
/**
* Submit button prefix
*
*/
const SUBMIT_PREFIX = 'ZendFormSubmit';

/**
* Constant for confirmation button
*
*/
const SUBMIT_OK = 'ZendFormSubmitOK';

/**
* Submit for reset button
*/
const SUBMIT_RESET = 'ZendFormSubmitReset';

/**
* Constant for cancel buutton
*
*/
const SUBMIT_CANCEL = 'ZendFormSubmitCancel';

/**
* Constant for the next button
*
*/
const SUBMIT_NEXT = 'ZendFormSubmitNext';

/**
* Constant for the previous button
*
*/
const SUBMIT_PREVIOUS = 'ZendFormSubmitPrevious';

/**
* POST submit method (HTML)
*
*/
const METHOD_HTML_POST = 'post';

/**
* POST submit method (XForms)
*
*/
const METHOD_XFORMS_POST = 'urlencoded-post';

/**
* POST with files method (XForms)
*
*/
const METHOD_XFORMS_FORMDATA = 'form-data-post';

/**
* GET submit method
*
*/
const METHOD_GET = 'get';

/**
* Default form encryption
*
*/
const ENCTYPE_FORM = 'application/x-www-form-urlencoded';

/**
* Form encryption for file submissions
*
*/
const ENCTYPE_FORMDATA = 'multipart/form-data';

/**
* Plain text encoding
*
*/
const ENCTYPE_PLAIN = 'text/plain';

/**
* Name of the identifier field/param
*
*/
const FORM_IDENTIFIER_FIELD = 'ZendFormIdentifier';

/**
* A unique identifier to identify this form instance
*
* @var string
*/
protected $_instanceIdentifier;

/**
* The button used to submit the form
*
* @var string
*/
protected $_submitAction;

/**
* The page name
*
* @var String
*/
protected $_name = 'default';

/**
* The page submit method
*
* @var String
*/
protected $_method = Zend_Form::METHOD_HTML_POST;

/**
* Enctype
*
* @var string
*/
protected $_enctype = Zend_Form::ENCTYPE_FORM;

/**
* Page action
*
* @var String
*/
protected $_action = array();

/**
* Set the pages required to be valid before filling in the current page
*
* @var array
*/
protected $_requiredPages = array();

/**
* If the page is model, all required pages must have passed validation
*
* @var boolean
*/
protected $_modal;

/**
* Are the requirements met?
*
* @var boolean
*/
protected $_requirementsMet;

/**
* Collection of page elements
*
* @var array
*/
protected $_elements = array();

/**
* Input filter instance
*
* @var Zend_Filter_Input
*/
protected $_inputFilter;

/**
* Page input data
*
* @var array
*/
protected $_inputData;

/**
* Data after ZFI is done with it
*
* @var array
*/
protected $_filteredData;

/**
* Is the page valid?
*
* @var boolean
*/
protected $_valid = false;

/**
* Is the page processed?
*
* @var boolean
*/
protected $_processed;

/**
* From storage flag
*
* @var boolean
*/
protected $_fromStorage = false;

/**
* Flag to indicate if the form data has changed since last request
*
* @var boolean
*/
protected $_formChanged = false;

/**
* Validation errors
*
* @var array
*/
protected $_errors = array();

/**
* Collection of global filters
*
* @var array
*/
protected $_globalFilters = array();

/**
* Collection of global validators
*
* @var array
*/
protected $_globalValidators = array();

/**
* Constructor
*
* @param string $name
*/
public function __construct($name = null)
{
}

/**
* Provides the list of the data that needs to be serialized when the page is stored
*
* @return array
*/
public function __sleep()
{
}

/**
* Deserialize object
*
*/
public function __wakeup()
{
}

/**
* Gets an element by magic __get method.
*
* @param String $element
* @return Zend_Form_Element
*/
public function __get($element)
{
}

/**
* When echo-ing the object, return the name + identifier
*
* @return string
*/
public function __toString()
{
}

/**
* Check if the page meets it's requirements.
* Return true if requirements are met. If not, the name of the first invalid page is returned.
*
* @return mixed
*/
public function meetsRequirements()
{
}

/**
* Get element by name
*
* @param String $element
* @return Zend_Form_Element
*/
public function getElement($elementName)
{
}

/**
* setup() is used to setup the page.
* Override setup() in the subclass.
*
*/
public function setup()
{
}

/**
* Sets input data
*
* @param array $input
* @return Zend_Form
*/
public function setInputData(array $input)
{
}

/**
* Add a element to the page and return it for chaining
*
* @throws Zend_Form_Exception
* @param String|Zend_Form_Element $element
* @param array $attributes
* @return Zend_Form_Element
*/
public function addElement($element, $elementClass = null)
{
}

/**
* Check if the page has any elements on it
*
* @return boolean
*/
public function hasElements()
{
}

/**
* Check if the given element is set
*
* @param string $element
*/
public function hasElement($element)
{
}

/**
* Remove a element from the page
*
* @param Zend_Form_Element $element
* @return Zend_Form
*/
public function removeElement($element = null)
{
}

/**
* Get the collection of elements
*
* @return array
*/
public function getElements()
{
}

/**
* Set the page requirements
*
* @param array $required
* @return Zend_Form
*/
public function setRequiredPages(array $required)
{
}

/**
* Get page requirements
*
* @return array
*/
public function getRequiredPages()
{
}

/**
* Set page submit method
*
* @param string $method
* @return Zend_Form
*/
public function setMethod($method)
{
}

/**
* Get page submit method
*
* @return string
*/
public function getMethod()
{
}

/**
* Set page submit action
*
* @param array $action
* @return Zend_Form
*/
public function setAction(array $action)
{
}

/**
* Get the page submit action
*
* @return array
*/
public function getAction()
{
}

/**
* Get the input filter instance used for validation
*
* @return Zend_Filter_Input
*/
public function getInputFilter()
{
}

/**
* See if the page is valid
*
* @return boolean
*/
public function isValid()
{
}

/**
* Returns the modal flag
*
* @return boolean
*/
public function isModal()
{
}

/**
* Set the modal flag
*
* @param boolean $modal
* @return Zend_Form
*/
public function setModal($modal = false)
{
}

/**
* Return the error array
*
* @return array
*/
public function getErrors()
{
}

/**
* @throws Zend_Form_Exception
*
* @return boolean
*/
public function process()
{
}

/**
* Populate the elements with the input data
*
* @return Zend_Form
*/
private function _populateElements()
{
}

/**
* Returns the processed flag
*
* @return boolean
*/
public function isProcessed()
{
}

/**
* Returns the form changed flag
*
* @return boolean
*/
public function getFormChanged()
{
}

/**
* Gets the page name
*
* @return String
*/
public function getName()
{
}

/**
* Sets the page name
*
* @param String $name
* @return Zend_Form
*/
public function setName($name)
{
}

/**
* Get the form enctype
*
* @return string
*/
public function getEnctype()
{
}

/**
* Set the form enctype
*
* @param string $enctype
* @return Zend_Form
*/
public function setEnctype($enctype)
{
}

/**
* Get the button used to submit the form
*
* @return string
*/
public function getSubmitAction()
{
}

/**
* Make ZFI rules
*
* @param array $input
* @return array
*/
private function _makeRules($input)
{
}

/**
* Returns true if the form page was taken from storage
* or false when it's a new form page
*
* @return boolean
*/
public function fromStorage()
{
}

/**
* Sets the from storage flag
*
* @param boolean $fromStorage
* @return Zend_Form
*/
public function setFromStorage($fromStorage = true)
{
}

/**
* Checks if the element exists
*
* @param boolean $offset
*/
public function offsetExists($offset)
{
}

/**
* Return the element
*
* @param string $offset
* @return Zend_Form_Element
*/
public function offsetGet($offset)
{
}

/**
* Set an element in the form
*
* @param string $offset
* @param Zend_Form_Element $value
*/
public function offsetSet($offset, $value)
{
}

/**
* Unset a form element
*
* @param string $offset
*/
public function offsetUnset($offset)
{
}

/**
* Get the instance identifier
*
* @return string
*/
public function getIdentifier()
{
}

/**
* Set the instance identifier
*
* @param string $identifier
* @return Zend_Form
*/
public function setIdentifier($identifier)
{
}

/**
* Generate a identifier based on the given seed
*
* @param mixed $seed
* @return string
*/
public static function generateIdentifier($seed = null)
{
}

/**
* Set default field data
*
* @param array $defaultData
* @return Zend_Form
*/
public function setDefaultData(array $defaultData)
{
}

/**
* Copy validator chain from one element to another
*
* @param string $from
* @param string $to
* @return Zend_Form
*/
public function copyValidators($from, $to)
{
}

/**
* Copy filter chain from one element to another
*
* @param string $from
* @param string $to
* @return Zend_Form
*/
public function copyFilters($from, $to)
{
}

/**
* Copy validator- and filter chain from one element to another
*
* @param string $from
* @param string $to
* @return Zend_Form
*/
public function copyValidatorsAndFilters($from, $to)
{
}

/**
* Add a global filter
*
* @param Zend_Filter_Interface $filter
* @return Zend_Form
*/
public function addGlobalFilter(Zend_Filter_Interface $filter)
{
}

/**
* Add a global validator
*
* @param Zend_Validate_Interface $validator
* @return Zend_Form
*/
public function addGlobalValidator(Zend_Validate_Interface $validator)
{
}
}
{code}
{card}
{card:label=Zend_Form_Builder_*}
{code}
abstract class Zend_Form_Builder_Abstract
{
/**
* Get a form element
*
* @param string $elementName
* @param string $className
* @param array $typehints
* @return Zend_Form_Element
*/
protected function _getFormElement($elementName, $className = 'Zend_Form_Element', array $typehints = array())
{
}

/**
* Get the form name
*
* @return string
*/
abstract public function getFormName();

/**
* Get form instance
*
* @return Zend_Form
*/
abstract public function getForm();
}

class Zend_Form_Builder_Config extends Zend_Form_Builder_Abstract
{
private $_config;

public function __construct(Zend_Config $config)
{
}

/**
* Get a form instance
*
* @return Zend_Form
*/
public function getForm()
{
}

/**
* Get an element
*
* @param Zend_Config $elementConfig
* @return Zend_Form_Element
*/
protected function _getElement(Zend_Config $elementConfig)
{
}

/**
* Get the form name
*
* @return string
*/
public function getFormName()
{
}
}

class Zend_Form_Builder_Db extends Zend_Form_Builder_Abstract
{
/**
* Database adapter
*
* @var Zend_Form_Builder_Db_Abstract
*/
private $_adapter;

/**
* Table instance
*
* @var Zend_Db_Table_Abstract
*/
private $_table;

/**
* Config file for fine-tuning
*
* @var Zend_Config
*/
private $_config;

/**
* Constructor
*
* @param Zend_Db_Table_Abstract $table
*/
public function __construct(Zend_Db_Table_Abstract $table, Zend_Config $config = null)
{
}

/**
* Get a form instance
*
* @return Zend_Form
*/
public function getForm()
{
}

/**
* Get the form name
*
* @return string
*/
public function getFormName()
{
}

/**
* Get an element instance
*
* @param string $elementName
* @param array $columnInfo
* @return Zend_Form_Element
*/
private function _getElement($elementName, array $columnInfo)
{
}

/**
* Setup the validators for the element
*
* @param Zend_Form_Element $element
* @param array $columnInfo
* @return Zend_Form_Element
*/
private function _setupValidators(Zend_Form_Element $element, array $columnInfo)
{
}
}

class Zend_Form_Builder_Form extends Zend_Form_Builder_Abstract
{
/**
* Form object
*
* @var Zend_Form
*/
private $_form;

/**
* Constructor
*
* @param Zend_Form $form
*/
public function __construct(Zend_Form $form)
{
}

/**
* Get a form instance
*
* @return Zend_Form
*/
public function getForm()
{
}

/**
* Get the form name
*
* @return string
*/
public function getFormName()
{
}
}

class Zend_Form_Builder_Formname extends Zend_Form_Builder_Abstract
{
/**
* Form name
*
* @var string
*/
private $_formName;

/**
* Class name
*
* @var string
*/
private $_className;

/**
* Constructor
*
* @param string $formName
* @param Zend_Controller_Request_Abstract $request
*/
public function __construct($formName, $className = 'Zend_Form')
{
}

/**
* Get a form instance
*
* @return Zend_Form
*/
public function getForm()
{
}

/**
* Get the form name
*
* @return string
*/
public function getFormName()
{
}
}

class Zend_Form_Builder_Db_Pdo_Mysql extends Zend_Form_Builder_Db_Abstract
{
/**
* Validator mapping
*
* @var array
*/
protected $_validatorMapping = array(
'Alpha' => array(),
'Alnum' => array(),
'Between' => array(),
'Ccnum' => array(),
'Date' => array('date'),
'Digits' => array(),
'EmailAddress' => array(),
'Float' => array('decimal', 'double', 'float'),
'GreaterThan' => array(),
'Hex' => array(),
'Hostname' => array(),
'InArray' => array('enum', 'set'),
'Int' => array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'),
'Ip' => array(),
'LessThan' => array(),
'NotEmpty' => array(),
'RegEx' => array(),
'StringLength' => array('char', 'varchar'),
);

/**
* Data type mapping
*
* @var array
*/
protected $_dataTypeMapping = array(
'date' => array(),
'decimal' => array(),
'double' => array(),
'float' => array(),
'enum' => array(
'class' => 'Zend_Form_Element_Set',
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::SELECT
)
),
'set' => array(
'class' => 'Zend_Form_Element_Set',
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::CHECKBOX
)
),
'year' => array(),
'time' => array(),
'timestamp' => array(),
'datetime' => array(),
'tinytext' => array(
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::TEXTAREA
)
),
'mediumtext' => array(
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::TEXTAREA
)
),
'text' => array(
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::TEXTAREA
)
),
'longtext' => array(
'typehints' => array(
Zend_Form_Element_Hint_HTML::FORMAT => Zend_Form_Element_Hint_HTML::TEXTAREA
)
),
'char' => array(),
'varchar' => array(),
'tinyblob' => array(),
'mediumblob' => array(),
'blob' => array(),
'longblob' => array(),
'binary' => array(),
'varbinary' => array(),
'tinyint' => array(),
'smallint' => array(),
'mediumint' => array(),
'int' => array()
);

/**
* Setup the element
*
* @param Zend_Form_Element $element
* @param array $columnInfo
* @return Zend_Form_Element
*/
public function setupElement(Zend_Form_Element $element, array $columnInfo)
{
}

/**
* Get validator settings
*
* @param array $columnInfo
* @return array
*/
public function getValidatorSettings(array $columnInfo)
{
}
}
{code}
{card}
{card:label=Zend_Form_Filter_Input}
{code}
class Zend_Form_Filter_Input extends Zend_Filter_Input
{
/**
* @param array $filters
* @param array $validators
* @param array $data
* @param array $options
*/
public function __construct($filterRules = null, $validatorRules = null, array $data = null, array $options = null)
{
}

/**
* Add filter rule
*
* @param string $fieldName
* @param Zend_Filter $filter
* @return Zend_Form_Filter_Input
*/
public function addFilterRule($fieldName, Zend_Filter $filter)
{
}

/**
* Remove filter rule
*
* @param string $elementName
* @return Zend_Form_Filter_Input
*/
public function removeFilterRule($elementName)
{
}

/**
* Add validator rule
*
* @param string $fieldName
* @param Zend_Validate $validator
* @param boolean $allowEmpty
* @param boolean $required
* @return Zend_Form_Filter_Input
*/
public function addValidatorRule($fieldName, Zend_Validate $validator, $allowEmpty = false, $required = true)
{
}

/**
* Remove validator rule
*
* @param string $elementName
* @return Zend_Form_Filter_Input
*/
public function removeValidatorRule($elementName)
{
}
}
{code}
{card}
{card:label=Zend_Form_Plugin_*}
{code}
abstract class Zend_Form_Plugin_Abstract
{
/**
* The FormRedirector action helper
*
* @var Zend_Controller_Action_Helper_FormRedirector
*/
protected static $_redirector;

/**
* Get the FormRedirector action helper
*
* @return Zend_Controller_Action_Helper_FormRedirector
*/
public static function getFormRedirector()
{
}

/**
* Set up the form redirector
*
* @param Zend_Controller_Action $actionController
*/
public static function setupFormRedirector(Zend_Controller_Action $actionController = null)
{
}

/**
* Pre form handling routine
*
* @param Zend_Form $form
*/
public function preHandling(Zend_Form $form)
{
}

/**
* Pre form processing routine
*
* @param Zend_Form $form
*/
public function preProcess(Zend_Form $form)
{
}

/**
* Post processing routine. Only called if there was something to process.
*
* @param Zend_Form $form
*/
public function postProcess(Zend_Form $form)
{
}

/**
* Called before the form gets assigned to the view
*
* @param Zend_Form $form
*/
public function preAssign(Zend_Form $form)
{
}

/**
* Called after the form gets assigned to the view
*
* @param Zend_Form $form
*/
public function postAssign(Zend_Form $form)
{
}

/**
* Called after the form handling routine is completed.
*
* @param Zend_Form $form
*/
public function postHandling(Zend_Form $form)
{
}
}

class Zend_Form_Plugin_Broker
{
/**
* Array of instance of objects extending Zend_Form_Plugin_Abstract
*
* @var array
*/
protected $_plugins = array();

/**
* Register a plugin.
*
* @param Zend_Form_Plugin_Abstract $plugin
* @param int $stackIndex
* @return Zend_Form_Plugin_Broker
*/
public function registerPlugin(Zend_Form_Plugin_Abstract $plugin, $stackIndex = null)
{
}

/**
* Unregister a plugin.
*
* @param string|Zend_Form_Plugin_Abstract $plugin Plugin object or class name
* @return Zend_Form_Plugin_Broker
*/
public function unregisterPlugin($plugin)
{
}

/**
* Is a plugin of a particular class registered?
*
* @param string $class
* @return bool
*/
public function hasPlugin($class)
{
}

/**
* Retrieve a plugin or plugins by class
*
* @param string $class Class name of plugin(s) desired
* @return false|Zend_Form_Plugin_Abstract|array Returns false if none found, plugin if only one found, and array of plugins if multiple plugins of same class found
*/
public function getPlugin($class)
{
}

/**
* Retrieve all plugins
*
* @return array
*/
public function getPlugins()
{
}

/**
* Get request object
*
* @return Zend_Form $request
*/
public function getForm()
{
}

/**
* Pre form handling routine
*
* @param Zend_Form $form
*/
public function preHandling(Zend_Form $form)
{
}

/**
* Pre form processing routine
*
* @param Zend_Form $form
*/
public function preProcess(Zend_Form $form)
{
}

/**
* Post processing routine. Only called if there was something to process.
*
* @param Zend_Form $form
*/
public function postProcess(Zend_Form $form)
{
}

/**
* Called before the form gets assigned to the view
*
* @param Zend_Form $form
*/
public function preAssign(Zend_Form $form)
{
}

/**
* Called after the form gets assigned to the view
*
* @param Zend_Form $form
*/
public function postAssign(Zend_Form $form)
{
}

/**
* Called after the form handling routine is completed.
*
* @param Zend_Form $form
*/
public function postHandling(Zend_Form $form)
{
}

}

class Zend_Form_Plugin_Location extends Zend_Form_Plugin_Abstract
{
/**
* Forward method constant
*
*/
const FORWARD = 'forward';

/**
* Redirect method constant
*
*/
const REDIRECT = 'redirect';

/**
* Locations
*
* @var array
*/
protected $_locations = array();

/**
* Add a new location
*
* @param string $submitAction
* @param array $target
* @param array $conditions
* @param boolean $formValid
* @param string $method
* @return Zend_Form_Plugin_Location
*/
public function addLocation($submitAction, array $target, $formValid = true, array $conditions = array(), $method = Zend_Form_Plugin_Location::FORWARD)
{
}

/**
* Check if the conditions are met
*
* @param Zend_Form $form
* @return boolean
*/
public function checkCondition(Zend_Form $form, array $conditions, $formValid = true)
{
}

/**
* Redirect to the proper location
*
* @param Zend_Form $form
*/
public function postProcess(Zend_Form $form)
{
}
}

class Zend_Form_Plugin_Modal extends Zend_Form_Plugin_Abstract
{
/**
* Pre form handling routine
*
* @param Zend_Form $form
*/
public function preHandling(Zend_Form $form)
{
}
}

class Zend_Form_Plugin_Upload extends Zend_Form_Plugin_Abstract
{
/**
* Fieldname of the upload field
*
* @var string
*/
protected $_field;

/**
* Destination directory
*
* @var string
*/
protected $_destinationDirectory;

/**
* Create plugin
*
* @param string $field
* @param string $destinationDirectory
*/
public function __construct($field, $destinationDirectory)
{
}

/**
* Get file name from $_FILES array
*
* @return string
*/
public function getFilename()
{
}

/**
* Get file temp name from $_FILES array
*
* @return string
*/
public function getTempName()
{
}

/**
* Get full path to the target file
*
* @return string
*/
public function getTargetFilename()
{
}

/**
* Post processing routine. Only called if there was something to process.
*
* @param Zend_Form $form
*/
public function postProcess(Zend_Form $form)
{
}
}
{code}
{card}
{card:label=Zend_Controller_Action_Helper_*}
{code}
class Zend_Controller_Action_Helper_FormHandler extends Zend_Controller_Action_Helper_Abstract
{
/**
* Redirector helper
*
* @var Zend_Controller_Action_Helper_Redirector
*/
private $_redirector;

/**
* Plugin broker
*
* @var array
*/
private $_broker;

/**
* Hook into action controller initialization
*
* @return void
*/
public function init()
{
}

/**
* Processes the form and take action according to the result
*
* @param Zend_Form $form
* @param mxied $dataSource
* @param Zend_Form_Storage_Interface $storage
*/
public function handle(Zend_Form $form)
{
}

/**
* Register a plugin.
*
* @param Zend_Form_Plugin_Abstract $plugin
* @param int $stackIndex
* @return Zend_Form_Plugin_Broker
*/
public function registerPlugin(Zend_Form_Plugin_Abstract $plugin, $stackIndex = null)
{
}

/**
* Unregister a plugin.
*
* @param string|Zend_Form_Plugin_Abstract $plugin Plugin object or class name
* @return Zend_Form_Plugin_Broker
*/
public function unregisterPlugin($plugin)
{
}

/**
* Is a plugin of a particular class registered?
*
* @param string $class
* @return bool
*/
public function hasPlugin($class)
{
}

/**
* Retrieve a plugin or plugins by class
*
* @param string $class Class name of plugin(s) desired
* @return false|Zend_Form_Plugin_Abstract|array Returns false if none found, plugin if only one found, and array of plugins if multiple plugins of same class found
*/
public function getPlugin($class)
{
}

/**
* Retrieve all plugins
*
* @return array
*/
public function getPlugins()
{
}
}

class Zend_Controller_Action_Helper_FormRedirector extends Zend_Controller_Action_Helper_Redirector
{
/**
* Forward to a new action
*
* @param Zend_Form $form
* @param string $action
* @param string $controller
* @param string $module
* @param array $params
*/
public function formForward(Zend_Form $form, $action, $controller = null, $module = null, array $params = array())
{
}

/**
* Redirect to a new url
*
* @param Zend_Form $form
* @param string $url
* @param array $options
*/
public function formRedirect(Zend_Form $form, array $action = null)
{
}
}

class Zend_Controller_Action_Helper_FormRedirector extends Zend_Controller_Action_Helper_Redirector
{
/**
* Forward to a new action
*
* @param Zend_Form $form
* @param string $action
* @param string $controller
* @param string $module
* @param array $params
*/
public function formForward(Zend_Form $form, $action, $controller = null, $module = null, array $params = array())
{
}

/**
* Redirect to a new url
*
* @param Zend_Form $form
* @param string $url
* @param array $options
*/
public function formRedirect(Zend_Form $form, array $action = null)
{
}
}
{code}
{card}
{deck}
{zone-data}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>