Inherits Plugin.

Public Member Functions | |
| tpForm () | |
| propagate ($data='', $prefix='', $suffix='') | |
| error_box ($errors) | |
| tooltip ($text, $icon='') | |
| tooltip_bind ($elements) | |
| open_form ($name, $action, $method='post', $errors=array(), $attribs=array()) | |
| close_form () | |
| imagebutton ($name, $src, $attribs=array()) | |
| submit ($name, $value='Submit', $attribs=array()) | |
| hidden ($name, $value, $attribs=array()) | |
| text ($name, $value='', $size='', $maxlength='', $attribs=array()) | |
| password ($name, $value='', $size='', $maxlength='', $attribs=array()) | |
| file ($name, $value='', $size='', $preview_url='', $remove_url='', $attribs=array()) | |
| image ($name, $value='', $size='', $preview_url='', $remove_url='', $attribs=array()) | |
| date ($name, $value='', $format='%Y-%m-%d', $attribs=array()) | |
| datetime ($name, $value='', $format='%Y-%m-%d%k:%M', $attribs=array()) | |
| color ($name, $value, $attribs=array()) | |
| textarea ($name, $value='', $rows=10, $cols=50, $attribs=array()) | |
| htmlarea ($name, $value='', $rows=15, $cols=100, $mceinit='', $attribs=array()) | |
| htmlarea_preload ($mceinit='') | |
| checkbox ($name, $value='', $label='', $checked=false, $attribs=array()) | |
| radio ($name, $value='', $options=array(), $sep='< br/>', $attribs=array()) | |
| select ($name, $value='', $options=array(), $size='', $multiple=false, $attribs=array()) | |
| _select_option ($optval, $optlbl, $value, $mult, &$sel) | |
| multiselect ($name, $value, $options, $show_selects=false, $multiple=true, $attribs=array()) | |
| build_form ($params, $data=array(), $errors=array()) | |
| build_tabbed_form ($params, $tabs, $data=array(), $errors=array()) | |
| _show_element ($name, $elem, $attribs) | |
| dom_id ($name) | |
| _getparam ($params, $name, $default) | |
| _escape ($var) | |
| _error ($name, &$attribs) | |
Public Attributes | |
| $guid = 0 | |
| $data_id = 0 | |
| $errors | |
| $form_name | |
| $element_layouts | |
PRONTO WEB FRAMEWORK Copyright © 2006, Judd Vinet
Description: Template plugin for common HTML elements.
Definition at line 10 of file form.php.
| tpForm::_getparam | ( | $ | params, | |
| $ | name, | |||
| $ | default | |||
| ) |
| tpForm::_select_option | ( | $ | optval, | |
| $ | optlbl, | |||
| $ | value, | |||
| $ | mult, | |||
| &$ | sel | |||
| ) |
| tpForm::build_form | ( | $ | params, | |
| $ | data = array(), |
|||
| $ | errors = array() | |||
| ) |
Generate a multi-column form.
| array | $params General form parameters | |
| array | $data Values to prefill form elements with | |
| array | $errors Errors to attach to elements containing invalid data |
Form Parameters:
Definition at line 846 of file form.php.
References $opts, $params, __(), and assert_type().
| tpForm::build_tabbed_form | ( | $ | params, | |
| $ | tabs, | |||
| $ | data = array(), |
|||
| $ | errors = array() | |||
| ) |
Generate a tabbed form.
| array | $params General parameters | |
| array | $tabs Array of arrays containing tab labels and form definitions | |
| array | $data Values to prefill form elements with | |
| array | $errors Errors to attach to elements containing invalid data |
General Parameters:
echo $form->build_tabbed_form(
array('data_id'=>$data['id'], 'submit'=>'Save'),
array(
'tab1' => array('label'=>'First Tab', 'form'=>$f1),
'tab2' => array('label'=>'Second Tab', 'form'=>$f2, 'active'=>true),
'tab3' => array('label'=>'Third Tab', 'content'=>'No form, just some content')
), $data, $errors
);
| tpForm::checkbox | ( | $ | name, | |
| $ | value = '', |
|||
| $ | label = '', |
|||
| $ | checked = false, |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::close_form | ( | ) |
| tpForm::color | ( | $ | name, | |
| $ | value, | |||
| $ | attribs = array() | |||
| ) |
| tpForm::date | ( | $ | name, | |
| $ | value = '', |
|||
| $ | format = '%Y-%m-%d', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::datetime | ( | $ | name, | |
| $ | value = '', |
|||
| $ | format = '%Y-%m-%d %k:%M', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::dom_id | ( | $ | name | ) |
| tpForm::error_box | ( | $ | errors | ) |
| tpForm::file | ( | $ | name, | |
| $ | value = '', |
|||
| $ | size = '', |
|||
| $ | preview_url = '', |
|||
| $ | remove_url = '', |
|||
| $ | attribs = array() | |||
| ) |
Generate a file-upload form element
| string | $name | |
| string | $value | |
| string | $size | |
| boolean | $preview Show a "preview" link so the user can view the file currently in use. | |
| boolean | $remove Show a "remove" link so the user can delete the file currently in use without having to upload a new one. | |
| array | $attribs Additional HTML attributes |
| tpForm::hidden | ( | $ | name, | |
| $ | value, | |||
| $ | attribs = array() | |||
| ) |
Generate a hidden form element
| string | $name | |
| string | $value | |
| array | $attribs Additional HTML attributes |
Definition at line 210 of file form.php.
Referenced by propagate().
| tpForm::htmlarea | ( | $ | name, | |
| $ | value = '', |
|||
| $ | rows = 15, |
|||
| $ | cols = 100, |
|||
| $ | mceinit = '', |
|||
| $ | attribs = array() | |||
| ) |
Generate a rich WYSIWYG textarea form element
| string | $name | |
| string | $value | |
| int | $rows Number of rows for the textarea element | |
| int | $cols Number of columns for the textarea element | |
| string | $mceinit Initialization JS code for the MCE control; if blank, the default will be used. If an array, then the settings in the array will override those in the default. If it is a non-empty string, then that string will be used instead of the default. In this case, make sure the string is a valid Javascript object. | |
| array | $attribs Additional HTML attributes |
| tpForm::htmlarea_preload | ( | $ | mceinit = '' |
) |
Preload libraries for a htmlarea widget. This function is necessary if you're going to be loading an htmlarea widget via AJAX, as TinyMCE has some pecularities when loading dynamically (eg, through a .getScript() call). To work around this, use htmlarea_preload() in the page that will be loading an htmlarea widget via AJAX.
| array | $css An array of CSS files that should be loaded into the editor widget. | |
| string | $mceinit Initialization JS code for the MCE control; if blank, the default will be used. If an array, then the settings in the array will override those in the default. If it is a non-empty string, then that string will be used instead of the default. In this case, make sure the string is a valid Javascript object. |
| tpForm::image | ( | $ | name, | |
| $ | value = '', |
|||
| $ | size = '', |
|||
| $ | preview_url = '', |
|||
| $ | remove_url = '', |
|||
| $ | attribs = array() | |||
| ) |
Generate a file-upload form element intended for images, with a preview
| string | $name | |
| string | $value | |
| string | $size | |
| boolean | $preview Show a "preview" link so the user can view a larger version of the image currently in use. | |
| boolean | $remove Show a "remove" link so the user can delete the image currently in use without having to upload a new one. | |
| array | $attribs Additional HTML attributes |
| tpForm::imagebutton | ( | $ | name, | |
| $ | src, | |||
| $ | attribs = array() | |||
| ) |
| tpForm::multiselect | ( | $ | name, | |
| $ | value, | |||
| $ | options, | |||
| $ | show_selects = false, |
|||
| $ | multiple = true, |
|||
| $ | attribs = array() | |||
| ) |
Generate a multi-select form element that is more intuitive than the standard select with CTRL-click. Can also be used for single selects.
| string | $name | |
| mixed | $value The current selection(s) | |
| array | $options A hash of option=>value tuples | |
| boolean | $show_selects Show select-all and select-none icons | |
| boolean | $multiple Allow multiple selections | |
| array | $attribs Additional HTML attributes |
Definition at line 736 of file form.php.
References __().
| tpForm::open_form | ( | $ | name, | |
| $ | action, | |||
| $ | method = 'post', |
|||
| $ | errors = array(), |
|||
| $ | attribs = array() | |||
| ) |
Open a new form. Returns the form tag, and can optionally load in an array of errors that can be linked to form elements within this form.
| string | $name Name and ID of the form element | |
| string | $method Submission method ('get' or 'post') | |
| array | $errors Associative array of errors | |
| array | $attribs Additional HTML attributes |
| tpForm::password | ( | $ | name, | |
| $ | value = '', |
|||
| $ | size = '', |
|||
| $ | maxlength = '', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::propagate | ( | $ | data = '', |
|
| $ | prefix = '', |
|||
| $ | suffix = '' | |||
| ) |
Propagate all GET/POST fields into hidden form elements
| mixed | $data If blank, propagate all GET/POST vars. If set to "get" or "post", propagate only those variables. If set to an array, propagate all values in the array. |
Definition at line 54 of file form.php.
References hidden().
| tpForm::radio | ( | $ | name, | |
| $ | value = '', |
|||
| $ | options = array(), |
|||
| $ | sep = '<br />', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::select | ( | $ | name, | |
| $ | value = '', |
|||
| $ | options = array(), |
|||
| $ | size = '', |
|||
| $ | multiple = false, |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::submit | ( | $ | name, | |
| $ | value = 'Submit', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::text | ( | $ | name, | |
| $ | value = '', |
|||
| $ | size = '', |
|||
| $ | maxlength = '', |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::textarea | ( | $ | name, | |
| $ | value = '', |
|||
| $ | rows = 10, |
|||
| $ | cols = 50, |
|||
| $ | attribs = array() | |||
| ) |
| tpForm::tooltip | ( | $ | text, | |
| $ | icon = '' | |||
| ) |
Generate a tooltip (contextual help) icon. When the mouse hovers over it, a little popup will appear, displaying the help text.
| string | $text The text to display in the popup. | |
| string | $icon URL of the icon to use, relative to the /img directory. Default is icons/info.gif. |
Definition at line 103 of file form.php.
Referenced by tooltip_bind().
| tpForm::tooltip_bind | ( | $ | elements | ) |
| tpForm::tpForm | ( | ) |
Constructor
Definition at line 22 of file form.php.
References Plugin_Base::depend(), and Plugin::Plugin().
| tpForm::$errors |
Definition at line 15 of file form.php.
Referenced by error_box().
1.6.1