Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
Dataface_QuickForm Class Reference
Inheritance diagram for Dataface_QuickForm:
Dataface_TranslationForm

Public Member Functions

 Dataface_QuickForm ($tablename, $db='', $query='', $formname='', $new=false, $fieldnames=null, $lang=null)
 formSubmitted ()
getRecord ()
 setSubmitLabel ($label)
 Sets the label of the submit button for this form. This will override the default submit label in xataface. If it is set to null then the default label will be used.
 getSubmitLabel ()
 Returns the label to use as the submit button for the form.
 _fillArray (&$arr1, $arr2)
 _buildWidget (&$field)
 tagFormAndSession ()
 _build ()
getElementByFieldName ($fieldname)
 pullField ($fieldname)
 pull ()
 push ()
 validate ()
 pushField ($fieldname)
 pullValue ($fieldname)
 pushValue ($fieldname, &$metaValues, $element=null)
 display ()
 displayTabs ()
 getElementTemplate ($fieldName='')
 getFormTemplate ()
 getFieldGroupTemplate ($name)
 getGroupTemplate ($name)
 getGroupElementTemplate ($groupName='')
 save ($values)
 getKeys ()
 deserialize ($field)
 serialize ($field)
 _formatFieldName ($fieldname)
 htmlValues ()

Static Public Member Functions

static & createNewRecordForm ($tablename, $fieldnames=null)
static & createEditRecordForm (&$tablenameOrRecord, $fieldnames=null)

Data Fields

 $tablename
 $db
 $_iniFile
 $_query
 $_exactMatches = false
 $_table
 $_record
 $_resultSet
 $_attributes = array()
 $_renderer
 $_new = false
 $overrideNoQuery = false
 $_fields = array()
 $_isBuilt = false
 $_fieldnames = null
 $_lang
 $_changed_fields = array()
 $tab
 $app
 $submitLabel = null

Static Public Attributes

static $TRACK_SUBMIT = true

Detailed Description

An HTML_QuickForm object that is aware of the Dataface framework foundation classes.

Definition at line 57 of file QuickForm.php.

Member Function Documentation

_build ( )

Builds the form. (Ie: adds all of the fields, sets the default values, etc..)

Definition at line 408 of file QuickForm.php.

_buildWidget ( $field)

Build an HTML_QuickForm_element object to represent a field from the table.

Parameters
$fieldA field descriptor array for specific field.
$permissionsAn optional second argument to pass a permissions descriptor array to define the current permissions.

Definition at line 354 of file QuickForm.php.

_fillArray ( $arr1,
  $arr2 
)

Fills arr1 with elements of arr2 if they don't already exist in arr1. This will work to infinite levels of depth.

Definition at line 333 of file QuickForm.php.

_formatFieldName (   $fieldname)

Does nothing....

Definition at line 1194 of file QuickForm.php.

static& createEditRecordForm ( $tablenameOrRecord,
  $fieldnames = null 
)
static

Static method to create an Edit record form (ie: a form to edit an existing record).

Parameters
$tablenameOrRecordEither the name of the table from which to edit the record or a Dataface_Record object that is to be edited. If this parameter is the name of the table then the record to be edited will be obtained form the request parameters and Dataface_QueryTool. string | Dataface_Record
$fieldnames(Optional( Array of field names to include on the form. array(string)
Returns
Dataface_QuickForm object

$form =& DatafaceQuickForm::createEditRecordForm('Profiles'); if ( $form->validate()){ $form->process( array(&$form, 'save'), true); header('Location: success.php'); exit; } $form->display();

Definition at line 1258 of file QuickForm.php.

static& createNewRecordForm (   $tablename,
  $fieldnames = null 
)
static

Static method to create a New record form (ie: A form to create a new record).

Parameters
$tablenameThe name of the table in which to store the record. string
$fieldnamesOptional array of field names to be included on the form. array(string)
Returns
Dataface_QuickForm object

$form =& Dataface_QuickForm::createNewRecordForm('Profiles'); if ( $form->validate() ){ $form->process( array(&$form, 'save'), true); header('Location: success.php'); exit; } $form->display();

Definition at line 1224 of file QuickForm.php.

Dataface_QuickForm (   $tablename,
  $db = '',
  $query = '',
  $formname = '',
  $new = false,
  $fieldnames = null,
  $lang = null 
)
Parameters
$tablenameThe name of the table upon which this form is based. - or a Dataface_Record object to edit. string | Dataface_Record
$dbDB handle for the current database connection. resource
$queryAssociative array of query parameters to dictate which record is loaded for editing. array([String]->[String])
$newFlag to indicate whether this form is creating a new record or editing an existing one. boolean
$fieldnamesAn optional array of field names to include in the form. array(string)

Definition at line 175 of file QuickForm.php.

deserialize (   $field)
Deprecated:
Use Dataface_IO::read()

Definition at line 1173 of file QuickForm.php.

display ( )

Dataface_PermissionsTool::edit($this->_table)

Reimplemented in Dataface_TranslationForm.

Definition at line 870 of file QuickForm.php.

displayTabs ( )

Definition at line 902 of file QuickForm.php.

formSubmitted ( )

Definition at line 273 of file QuickForm.php.

& getElementByFieldName (   $fieldname)

Returns a reference to the Quickform element that is used to display a specified field.

Parameters
$fieldnameThe name of the field whose quickform element we wish to obtain.

Definition at line 653 of file QuickForm.php.

getElementTemplate (   $fieldName = '')

Definition at line 913 of file QuickForm.php.

getFieldGroupTemplate (   $name)

Reimplemented in Dataface_TranslationForm.

Definition at line 963 of file QuickForm.php.

getFormTemplate ( )

Reimplemented in Dataface_TranslationForm.

Definition at line 936 of file QuickForm.php.

getGroupElementTemplate (   $groupName = '')

Definition at line 993 of file QuickForm.php.

getGroupTemplate (   $name)

Reimplemented in Dataface_TranslationForm.

Definition at line 979 of file QuickForm.php.

getKeys ( )

Returns an array of references to the key fields of this form.

Definition at line 1159 of file QuickForm.php.

& getRecord ( )

Definition at line 277 of file QuickForm.php.

getSubmitLabel ( )

Returns the label to use as the submit button for the form.

Returns
string The submit button label. This may be null in which

Note: This is used by the Renderer_ArrayDataface class for rendering.

case the default label will be used.

Definition at line 324 of file QuickForm.php.

htmlValues ( )

Definition at line 1263 of file QuickForm.php.

pull ( )

Fills in the form fields with values from the record. In a sense, this "Pulls" the values from the record into the form.

Definition at line 687 of file QuickForm.php.

pullField (   $fieldname)

Pulls the value from the record into its appropriate field in the form.

Parameters
$fieldnameThe name of the field to pull.

Definition at line 668 of file QuickForm.php.

pullValue (   $fieldname)

REturns a value for the specified field name that is in a format that can be "pulled" into the corresponding widget of the form.

Definition at line 847 of file QuickForm.php.

push ( )

Pushes the values in all form elements into their corresponding field in the record.

Exceptions
Dataface_Error::PermissionDeniederror if the user doesn't have permission. You should always try to catch this error if calling this function - otherwise the push will fail, and you won't know

Definition at line 715 of file QuickForm.php.

pushField (   $fieldname)

"Pushes" the value in a form element into the record.

Parameters
$fieldnameThe name of the field to be pushed.

Definition at line 832 of file QuickForm.php.

pushValue (   $fieldname,
$metaValues,
  $element = null 
)

Extracts value from the form ready to be stored in the table.

Definition at line 856 of file QuickForm.php.

save (   $values)

Reimplemented in Dataface_TranslationForm.

Definition at line 1039 of file QuickForm.php.

serialize (   $field)
setSubmitLabel (   $label)

Sets the label of the submit button for this form. This will override the default submit label in xataface. If it is set to null then the default label will be used.

Parameters
string$labelThe label to place on the submit button.

Definition at line 312 of file QuickForm.php.

tagFormAndSession ( )

Tags the form and the session with matching hash codes that can be used to prevent spoof form submissions. The goal is to make it so that this form will only be processed if the hash is in place. Of course, if there is no session set up, this won't work. So this method first does a check to see if there is a session. If there is a session, it tags the form. This method has a matching method that is called when validating the form to make sure that it was submitted.

Definition at line 395 of file QuickForm.php.

validate ( )

Validates the form input to make sure that it is valid. This extends the standard QuickForm method by adding custom validation from the Record object.

Definition at line 760 of file QuickForm.php.

Field Documentation

$_attributes = array()

???

Definition at line 105 of file QuickForm.php.

$_changed_fields = array()

Will store an array of the names of fields that were changed as a result of processing this form.

Definition at line 145 of file QuickForm.php.

$_exactMatches = false

???

Definition at line 85 of file QuickForm.php.

$_fieldnames = null

Definition at line 137 of file QuickForm.php.

$_fields = array()

Some columns may require some special loading mechanisms. This is an associative array of columns => callbacks to load the column.

Definition at line 129 of file QuickForm.php.

$_iniFile

Path to the ini file for this form. This is used when the form is defined by an ini file. If no ini file is set, then this form is generated based on the fields of the table.

Definition at line 75 of file QuickForm.php.

$_isBuilt = false

Flag that indicates whether the form has been built yet.

Definition at line 135 of file QuickForm.php.

$_lang

Definition at line 139 of file QuickForm.php.

$_new = false

Boolean flag indicating if we are creating a new record or editing an existing record.

Definition at line 115 of file QuickForm.php.

$_query

Array of query values that dictate which record is loaded in this form.

Definition at line 80 of file QuickForm.php.

$_record

Dataface_Record object used as a model for the data in this form.

Definition at line 95 of file QuickForm.php.

$_renderer

The renderer used for this form.

Definition at line 110 of file QuickForm.php.

$_resultSet

Reference to the result set. This is used to load the appropriate record into the form for editing.

Definition at line 100 of file QuickForm.php.

$_table

Reference to the Dataface_Table object for this form.

Definition at line 90 of file QuickForm.php.

$app

Definition at line 153 of file QuickForm.php.

$db

Database handle.

Definition at line 69 of file QuickForm.php.

$overrideNoQuery = false

A flag that overrides the noquery directive that is passed for new record forms. This is needed for join record forms because they are created as new record forms but still the query needs to allow loading the existing record.

Definition at line 122 of file QuickForm.php.

$submitLabel = null

Definition at line 156 of file QuickForm.php.

$tab

The name of the tab that this quick form is on.

Definition at line 151 of file QuickForm.php.

$tablename

The name of the table upon which this form is based.

Definition at line 64 of file QuickForm.php.

$TRACK_SUBMIT = true
static

Definition at line 59 of file QuickForm.php.


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