PhpToolCase
Api Documentation Version 0.9.2
|
Public Member Functions | |
getOption ($name=null) | |
Alias of PtcForm::getOptions( ) More... | |
__construct ($options=array()) | |
Sets form method(POST/GET) and retrieves sent values. More... | |
addElement ($params) | |
Adds elemtns to the form object. More... | |
addSpacer ($spacerVal=null) | |
Adds a spacer div. More... | |
render ($attributes=array(), $events=array()) | |
Renders the form. More... | |
validate () | |
Validates form fields defined with the "validate" parameter. More... | |
validateRequired ($fieldName, $array) | |
Checks if value is empty. More... | |
validateEmail ($fieldName, $array) | |
Checks if value is valid email. More... | |
validateNumber ($fieldName, $array) | |
Checks if value is numeric. More... | |
validateEqualTo ($fieldName, $matchField, $array) | |
Checks if value matches other field value. More... | |
validatePattern ($fieldName, $pattern, $array) | |
Checks if given regex pattern is matched. More... | |
customTpl ($templates) | |
Alias of PtcForm::customTpls( ) More... | |
customTpls ($templates) | |
Manipulates html templates for all elements. More... | |
addElAttribute ($attributes) | |
Alias of PtcForm::addElAttributes( ) More... | |
addElAttributes ($attributes) | |
Adds attributes to array of attributes for html elements. More... | |
setLabelStyle ($labelStyle, $num, $type=null) | |
Changes label containers default styles. More... | |
setInputStyle ($style, $type) | |
Changes default input fields style. More... | |
observe ($class=null) | |
Adds observers to manage form events with the PtcEvent component. More... | |
getOptions ($name=null) | |
Returns options defined for the form. More... | |
setErrorMsg ($msg) | |
Adds html before the form container, doesn't have to be an error msg. More... | |
Protected Member Functions | |
_addFieldValues ($fieldName, $options) | |
Adds values to fields. More... | |
_removeField ($fieldName) | |
Removes a field from the object. More... | |
_buildContainer ($fieldName, $fieldHtml, $labelHtml= '', $switch=false) | |
Builds the container for the field. More... | |
_addCompositeField ($fieldName, $values) | |
Add composite for multiple layouts with html table. More... | |
_addDefaultValues ($array) | |
Adds empty default values when addElement() is called. More... | |
_switchLabelEl ($fieldName, $labelText) | |
Switches between span and label elements according to field type. More... | |
_buildField ($fieldName) | |
Builds the fields. More... | |
_buildTableData ($cols, $type, $fieldName, $data, $container) | |
Builds a dynamic table for multiple layouts. More... | |
_addFieldParams ($fieldName, $type, $options) | |
Adds parameters to the fields. More... | |
_addValidator ($fieldName, $options) | |
Adds validation to the input field. More... | |
_addClassValidator ($fieldName, $options, $fieldType= 'default') | |
Adds validator classes to the fields for js validation. More... | |
_addInputStyle ($fieldName, $fieldStyle) | |
Adds default styles to fields to align properly. More... | |
_addLabelStyle ($fieldName, $labelContainer, $style) | |
Adds default style to the label container to align properly. More... | |
_addTableStyle ($fieldName, $tableStyle) | |
Adds default style to the table to align properly. More... | |
_buildElAttributes ($container) | |
Compiles PtcForm::_elAttributes with the template {attributes}. More... | |
_buildAttributes ($fieldName, $container, $arrKey) | |
Builds attributes for html elements. More... | |
_addElementId ($fieldName, $arrKey) | |
Adds an id to all html elements. More... | |
_buildList ($fieldName) | |
Builds html select options. More... | |
_buildHtml ($fieldName) | |
Builds container for the field. More... | |
_rebuildValues ($fieldName) | |
Rebuilds values for the fields if form has been sent. More... | |
_buildLabel ($case, $alignLabel, $labelWidth, $labelHtml) | |
Builds the label for field. More... | |
_checkErrors ($fieldName, $type, $function=null, $errType=null) | |
Checks for errors while building and rendering the form. More... | |
_getFormValues () | |
Retrieves form values from POST or GET. More... | |
_editFormValues ($array) | |
Manipulates form values from POST or GET. More... | |
_randomId () | |
Increases number of random generated id for elements. More... | |
_fireEvent ($event, $data) | |
Fires events with the event class. More... | |
_getEventClass () | |
Returns the event component name. More... | |
Static Protected Member Functions | |
static | _debug ($string, $statement=null, $category=null) |
Send messsages to the PtcDebug class if present. More... | |
Protected Attributes | |
$_errMsg = null | |
Property for the message to show on top of the form. More... | |
$_options = array( ) | |
Class options property, to be merged with PtcForm::$_defaultOptions property. More... | |
$_defaultOptions | |
Default options for the class. More... | |
$_htmlTpls | |
Html templates property for all elements. More... | |
$_labelStyles | |
Default label styles property. More... | |
$_inputStyles | |
Default input styles options property. More... | |
$_elAttributes | |
Html attributes for all elements. More... | |
$_storageKeys = array( 'events' , 'attributes' , 'validate' , 'label' , 'labelOptions' , 'parentEl' ) | |
Possible options in fields storage. More... | |
$_fields = array( ) | |
Fields storage property. More... | |
$_hiddenValues = array( ) | |
Auto generated hidden fields storage. More... | |
$_buildHidden = true | |
Build hidden values property. More... | |
$_validate = array( ) | |
Array of fields to validate with the validator engine. More... | |
$_observers = array( ) | |
Observers property. More... | |
$_events | |
Class events property. More... | |
$_submit = array( ) | |
Property that holds the submit buttons names. More... | |
__construct | ( | $options = array( ) | ) |
Sets form method(POST/GET) and retrieves sent values.
See Class Options
array | $options | see PtcForm::$_defaultOptions for available options |
Definition at line 24 of file PtcForm.php.
|
protected |
Adds validator classes to the fields for js validation.
string | $fieldName | the name of the field |
array | string | $options | the options to pass |
string | $fieldType | used by checkbox and radio groups only |
Definition at line 1052 of file PtcForm.php.
|
protected |
Add composite for multiple layouts with html table.
string | $fieldName | the name of the input field |
array | $values | array of fields |
Definition at line 673 of file PtcForm.php.
|
protected |
Adds empty default values when addElement() is called.
string | $array | tne field array to add default values to |
Definition at line 691 of file PtcForm.php.
|
protected |
Adds an id to all html elements.
string | $fieldName | the name of element |
string | $arrKey | the key inside the PtcForm::$_fields array |
Definition at line 1190 of file PtcForm.php.
|
protected |
Adds parameters to the fields.
string | $fieldName | the name of the field |
array | $type | ('events','attributes','validate','label','labelOptions','parentEl','value/s') |
array | string | $options | the options to pass |
Definition at line 929 of file PtcForm.php.
|
protected |
Adds values to fields.
string | $fieldName | the name of the field |
array | string | $options | value/s to add |
Definition at line 608 of file PtcForm.php.
|
protected |
Adds default styles to fields to align properly.
string | $fieldName | the name of the field |
string | $fieldStyle | the style property |
Definition at line 1081 of file PtcForm.php.
|
protected |
Adds default style to the label container to align properly.
string | $fieldName | the name of the field |
string | $labelContainer | the html template for label element |
string | $style | the style property |
Definition at line 1099 of file PtcForm.php.
|
protected |
Adds default style to the table to align properly.
string | $fieldName | the name of the field |
string | $tableStyle | the style property |
Definition at line 1118 of file PtcForm.php.
|
protected |
Adds validation to the input field.
string | $fieldName | the name of the field |
array | string | $options | the options to pass |
Definition at line 1029 of file PtcForm.php.
|
protected |
Builds attributes for html elements.
string | $fieldName | the name of the field |
string | $container | the html template for container |
string | $arrKey | (events,attributes,validate,label,labelOptions,parentEl) |
Definition at line 1157 of file PtcForm.php.
|
protected |
Builds the container for the field.
string | $fieldName | the name of the field |
string | $fieldHtml | the html field element |
string | $labelHtml | the html label element |
bool | $switch | reverse html label position(for radio/checkbox) |
Definition at line 654 of file PtcForm.php.
|
protected |
Compiles PtcForm::_elAttributes with the template {attributes}.
string | $container | the html element |
Definition at line 1144 of file PtcForm.php.
|
protected |
Builds the fields.
string | $fieldName | the name of the field |
Definition at line 727 of file PtcForm.php.
|
protected |
Builds container for the field.
string | $fieldName | the name of the field |
Definition at line 1235 of file PtcForm.php.
|
protected |
Builds the label for field.
string | $case | (1,2,3) |
string | $alignLabel | ("left","top","right","none") |
string | $labelWidth | the width of the label as a percentage |
string | $labelHtml | the html template |
Definition at line 1336 of file PtcForm.php.
|
protected |
Builds html select options.
string | $fieldName | the name of the select field |
Definition at line 1205 of file PtcForm.php.
|
protected |
Builds a dynamic table for multiple layouts.
string | $cols | number of columns |
string | $type | the table type(1,2) |
string | $fieldName | the name of the field |
array | $data | the values for the table |
string | $container | the html table template |
Definition at line 856 of file PtcForm.php.
|
protected |
Checks for errors while building and rendering the form.
string | $fieldName | the name of the field |
string | $type | the check type (1,2,3,4,5) |
string | $function | which function called this process |
string | $errType | the error type |
Definition at line 1450 of file PtcForm.php.
|
staticprotected |
Send messsages to the PtcDebug class if present.
mixed | $string | the string to pass |
mixed | $statement | some statement if required |
string | $category | a category for the messages panel |
Definition at line 1563 of file PtcForm.php.
|
protected |
Manipulates form values from POST or GET.
array | $array | array of values(POST or GET) |
Definition at line 1515 of file PtcForm.php.
|
protected |
Fires events with the event class.
string | $event | the name of the event |
mixed | $data | the data to push |
Definition at line 1535 of file PtcForm.php.
|
protected |
Returns the event component name.
Definition at line 1553 of file PtcForm.php.
|
protected |
Retrieves form values from POST or GET.
Definition at line 1503 of file PtcForm.php.
|
protected |
Increases number of random generated id for elements.
Definition at line 1526 of file PtcForm.php.
|
protected |
Rebuilds values for the fields if form has been sent.
string | $fieldName | the name of the field |
Definition at line 1275 of file PtcForm.php.
|
protected |
Removes a field from the object.
string | $fieldName | the name of the field to be removed |
Definition at line 646 of file PtcForm.php.
|
protected |
Switches between span and label elements according to field type.
string | $fieldName | the name of the input field |
string | $labelText | the text for the label |
Definition at line 704 of file PtcForm.php.
addElAttribute | ( | $attributes | ) |
Alias of PtcForm::addElAttributes( )
Definition at line 404 of file PtcForm.php.
addElAttributes | ( | $attributes | ) |
Adds attributes to array of attributes for html elements.
See Adding Html Attributes To Elements
array | string | $attributes | array or string to add as attribute/s |
Definition at line 409 of file PtcForm.php.
addElement | ( | $params | ) |
Adds elemtns to the form object.
array | $params | parameters for the field, see Field Parameters |
Definition at line 74 of file PtcForm.php.
addSpacer | ( | $spacerVal = null | ) |
Adds a spacer div.
string | $spacerVal | the height for the spacer in px |
Definition at line 164 of file PtcForm.php.
customTpl | ( | $templates | ) |
Alias of PtcForm::customTpls( )
Definition at line 392 of file PtcForm.php.
customTpls | ( | $templates | ) |
Manipulates html templates for all elements.
See Manipulating Html Templates
array | $templates | array of html templates |
Definition at line 397 of file PtcForm.php.
getOption | ( | $name = null | ) |
Alias of PtcForm::getOptions( )
string | $name | the name of the option |
Definition at line 19 of file PtcForm.php.
getOptions | ( | $name = null | ) |
Returns options defined for the form.
string | $name | the option name |
Definition at line 470 of file PtcForm.php.
observe | ( | $class = null | ) |
Adds observers to manage form events with the PtcEvent component.
string | $class | the name of the observer class |
Definition at line 447 of file PtcForm.php.
render | ( | $attributes = array( ) , |
|
$events = array( ) |
|||
) |
Renders the form.
array | $attributes | form attributes |
array | $events | form events |
Definition at line 176 of file PtcForm.php.
setErrorMsg | ( | $msg | ) |
Adds html before the form container, doesn't have to be an error msg.
string | $msg | some text |
Definition at line 478 of file PtcForm.php.
setInputStyle | ( | $style, | |
$type | |||
) |
Changes default input fields style.
See Changing default styles for fields
array | $style | ex: "array('border'=>'2px inset','padding'=>'5px');" |
string | $type | "input", "radio" or "button" |
Definition at line 435 of file PtcForm.php.
setLabelStyle | ( | $labelStyle, | |
$num, | |||
$type = null |
|||
) |
Changes label containers default styles.
See Changing Default Styles For Label Containers
array | $labelStyle | ex: "array('float'=>'left','margin'=>'2px 3px 0 0');" |
int | $num | options(1,2,3) |
string | $type | "left","right","top" |
Definition at line 420 of file PtcForm.php.
validate | ( | ) |
Validates form fields defined with the "validate" parameter.
See Validating The Form (Server Side)
Definition at line 233 of file PtcForm.php.
validateEmail | ( | $fieldName, | |
$array | |||
) |
Checks if value is valid email.
string | $fieldName | the name of the input field |
array | $array | array of values to check |
Definition at line 335 of file PtcForm.php.
validateEqualTo | ( | $fieldName, | |
$matchField, | |||
$array | |||
) |
Checks if value matches other field value.
string | $fieldName | the name of the input field |
string | $matchField | the name of the input field to match |
array | $array | array of values to check |
Definition at line 366 of file PtcForm.php.
validateNumber | ( | $fieldName, | |
$array | |||
) |
Checks if value is numeric.
string | $fieldName | the name of the input field |
array | $array | array of values to check |
Definition at line 351 of file PtcForm.php.
validatePattern | ( | $fieldName, | |
$pattern, | |||
$array | |||
) |
Checks if given regex pattern is matched.
string | $fieldName | the name of the input field |
string | $pattern | the pattern to match(regex) |
array | $array | array of values to check |
Definition at line 381 of file PtcForm.php.
validateRequired | ( | $fieldName, | |
$array | |||
) |
Checks if value is empty.
string | $fieldName | the name of the input field |
array | $array | array of values to check |
Definition at line 325 of file PtcForm.php.
|
protected |
Build hidden values property.
Definition at line 582 of file PtcForm.php.
|
protected |
Default options for the class.
Definition at line 490 of file PtcForm.php.
|
protected |
Html attributes for all elements.
Definition at line 561 of file PtcForm.php.
|
protected |
Property for the message to show on top of the form.
Definition at line 482 of file PtcForm.php.
|
protected |
Class events property.
Definition at line 594 of file PtcForm.php.
|
protected |
Fields storage property.
Definition at line 574 of file PtcForm.php.
|
protected |
Auto generated hidden fields storage.
Definition at line 578 of file PtcForm.php.
|
protected |
Html templates property for all elements.
Definition at line 512 of file PtcForm.php.
|
protected |
Default input styles options property.
Definition at line 552 of file PtcForm.php.
|
protected |
Default label styles property.
Definition at line 532 of file PtcForm.php.
|
protected |
Observers property.
Definition at line 590 of file PtcForm.php.
|
protected |
Class options property, to be merged with PtcForm::$_defaultOptions property.
Definition at line 486 of file PtcForm.php.
|
protected |
Possible options in fields storage.
Definition at line 570 of file PtcForm.php.
|
protected |
Property that holds the submit buttons names.
Definition at line 602 of file PtcForm.php.
|
protected |
Array of fields to validate with the validator engine.
Definition at line 586 of file PtcForm.php.