Packageindex Classtrees Modulegroups Elementlist Report XML Files

pxdb.content.input

pxdb_widgets

pxdb_data
   |
  +-- pxdb_confront
     |
    +-- pxdb_widgets

public class pxdb_widgets extends pxdb_confront

This class is used by the pxdb_input class. This widgets provided in this class can be customized in three ways (note: analogous to pxdb_validator class). Also note: updateDatetime() is a JavaScript function, not a PHP function, despite what the documentation implies.

AuthorsHans Lellelid <hans@velum.net>
Version$Revision: 1.19 $

 

Methods inherited from pxdb_confront

pxdb_confront, _get_form_element_name, _invoke_user_method, import, _import_uploaded_files, bind_validator

Methods inherited from pxdb_data

pxdb_data, set_show_unapproved, get_datatype, get_datatype_list, get_datatype_array, set_datatype, bind_tpl, bind_auth, lookup_colname, lookup_tfid, get_column_identifiers, get_identifiers, set_user_minimal_columns, sql_minimal_columns, sql_aliased_columns

Public Method Summary

void pxdb_widgets()
Calls parent constructor & loads parameters array.
object pxdb_widget &singleton()
Attempts to return a reference to an already-instantiated widget class.
void register_field_widget(string $field, mixed $function, [ mixed $datatype ])
Register a function to display a widget for a field.
void register_field_ro_widget(string $field, mixed $function, [ mixed $datatype ])
Register a function to display a read-only (display) widget for a field.
void register_type_widget(string $type, mixed $function)
Register a function to display a widget for a field type.
void register_type_ro_widget(string $type, mixed $function)
Register a function to display a widget for a field.
void add_onsubmit_value_calculator(string $field_element, string $value)
Adds a JavaScript value calculator for the specified field.
void del_onsubmit_value_calculator(string $field_element)
Removes a JavaScript value calculator for the specified field.
array get_onsubmit_value_calculators()
Gets the array of onSubmit value calculators.
string get_onsubmit_value_calculators_jscript(string $form_name)
Gets the JavaScript for onSubmit.
void set_css(string $css, [ string $type ])
Sets the CSS to use in widgets.
string get_widget(object pxdb_input &$data, &$input)
The broker function that fetches a widget.
string get_time_quarters()
Gets the time in 15 minute increments, to take advantage of MySQL's query caching

Private Method Summary

string _get_meta_css(array $data)
Gets the type of CSS we need for the current region.
string _get_css_attribute(array $data)
Gets the CSS attribute to use for a widget.
string _get_css_style(array $data)
Gets the CSS style text or class name to use for a widget.
string _get_css_type(array $data)
Gets the CSS attribute type for a widget.
string _get_id_attribute(array $data)
Generates an id attribute for a widget in a standard way
string _clean_output(string $value)
Cleans output for display.
string _widget(array $data)
For use when there is no defined widget function.
string _ro_widget(array $data)
Read-only counterpart of the generic widget function.
string _widget_num(array $data)
Number widget
string _ro_widget_num(array $data)
Read only number widget
string _widget_txt(array $data)
Text widget
string _ro_widget_txt(array $data)
Read-only text widget
string _widget_amount(array $data)
Amount widget
string _ro_widget_amount(array $data)
Read-only amount widget
string _widget_ltxt(array $data)
Long text widget
string _ro_widget_ltxt(array $data)
Duplicates _text() behavior from functions.lib.php in syntaxcms library
string _widget_email(array $data)
Email widget
string _ro_widget_email(array $data)
Read-only email widget
string _widget_password(array $data)
Password widget
string _ro_widget_password(array $data)
Read-only password widget
string _widget_pass2(array $data)
Password confirmation widget
string _ro_widget_pass2(array $data)
Read-only password confirmation widget
string _widget_phone(array $data)
Phone number widget
string _ro_widget_phone(array $data)
Read-only phone number widget
string _widget_currency(array $data)
Currency widget
string _ro_widget_currency(array $data)
Read-only currency widget
string _widget_date(array $data)
Build the date widget
string _ro_widget_date(array $data)
Read-only date widget
string _widget_url(array $data)
URL widget
string _ro_widget_url(array $data)
Read-only URL widget
string _widget_boolean_radio(array $data)
Boolean radio widget
string _ro_widget_boolean_radio(array $data)
Read-only (View) widget for boolean field
string _widget_boolean_check(array $data)
Checkbox boolean widget
string _ro_widget_boolean_check(array $data)
Read-only (View) widget for boolean checkbox field
string _widget_boolean(array $data)
Generic boolean widget
string _ro_widget_boolean(array $data)
Read-only (View) widget for boolean field
string _widget_primaryrel(array $data)
Primaryrel widget
string _ro_widget_primaryrel(array $data)
Read-only (View) widget for primaryrel field
string _widget_pickid(array $data)
Pick ID widget
string _ro_widget_pickid(array $data)
Read-only (View) widget for pick ID field
string _widget_pick(array $data)
Pick widget
string _ro_widget_pick(array $data)
Read-only (View) widget for pick field
string _widget_upload(array $data)
Upload widget
string _ro_widget_upload(array $data)
Read-only (View) widget for upload field
boolean _widget_plugin_exists(array $data)
Determine whether a plugin exists for widget.
string _include_widget(string $plugin_data, array &$data)
Includes a widget from a (php) file.
string _invoke_class_method(array $data)
Invokes the class method for specified widget.
void updateDatetime()
Warning: documentation is missing.

Fields inherited from pxdb_confront

$_imported, $validator, $_upload_fields, $_params, $_widget_params, $_data, $data_name_structure, $param_name_structure, $widget_param_name_structure

Fields inherited from pxdb_data

$debug, $errors, $datatype, $auth, $tpl, $show_unapproved, $db, $user_minimal_columns

Public Field Summary

array $css
Holds CSS types (e.g. style/class) and styles for various conditions.
array $field_widgets
Widgets registered for a particular field.
array $field_ro_widgets
Read-only widgets registered for a particular field.
array $type_widgets
Widgets registered for a type of field.
array $type_ro_widgets
Read-only widgets registered for a type of field.
array $jscript_value_calculators
Hash of elementname / JavaScript code values that will be set onSubmit.
array $class_methods
The methods in this class (for speed only set in constructor).
object pxdb_input $input
The input class that is requesting the widget.

Private Field Summary

boolean $popcalendar_included
Whether a popup calendar has already been included (needs to be generalized)
$_current_time
Current time, using MySQL database for timing consistency

Included files Summary, Type: include

$wpath Warning: documentation is missing.

Public Method Details

pxdb_widgets

public void pxdb_widgets()

 

Returns void


&singleton

public object pxdb_widget &singleton()

  Will create a new widget class only if one does not already exist.

Returns object pxdb_widget


register_field_widget

public void register_field_widget(string $field, mixed $function, [ mixed $datatype ])

 

Parameter
string $field
The field name that will use this widget.
mixed $function
The function name or array of object reference and method name.
mixed $datatype = >>null<<
The datatype this field belongs to -- in case more than one dt has defined that field.
Returns void


register_field_ro_widget

public void register_field_ro_widget(string $field, mixed $function, [ mixed $datatype ])

 

Parameter
string $field
The field name that will use this widget.
mixed $function
The function name or array of object reference and method name.
mixed $datatype = >>null<<
The datatype this field belongs to -- in case more than one dt has defined that field.
Returns void


register_type_widget

public void register_type_widget(string $type, mixed $function)

 

Parameter
string $type
The field type (e.g. 'url', 'primaryrel') that will use this widget.
mixed $function
The function name or array of object reference and method name.
Returns void


register_type_ro_widget

public void register_type_ro_widget(string $type, mixed $function)

 

Parameter
string $type
The field type (e.g. 'url', 'primaryrel') that will use this widget.
mixed $function
The function name or array of object reference and method name.
Returns void


add_onsubmit_value_calculator

public void add_onsubmit_value_calculator(string $field_element, string $value)

  A widget may require that onSubmit a value for a field is calculated from several different (non-pxdb?) elements, etc. This method allows a widget to specify what the value should be set to when the form is submitted.

Parameter
string $field_element
The name of the field that we are setting, e.g. pxdb[data][date2]
string $value
The value we will set this to -- could be a javascript function, series of statements, etc.
Returns void


del_onsubmit_value_calculator

public void del_onsubmit_value_calculator(string $field_element)

 

Parameter
string $field_element
The field for which we want to remove any calculator.
Returns void


get_onsubmit_value_calculators

public array get_onsubmit_value_calculators()

 

Returns array

The hash of fields / javascript code (values).


get_onsubmit_value_calculators_jscript

public string get_onsubmit_value_calculators_jscript(string $form_name)

 

Parameter
string $form_name
Returns string

The javascript that can be inserted in the onSubmit = "" paramter of the form.


set_css

public void set_css(string $css, [ string $type ])

  This method can set any number of different class CSS tag variables; by default only default_css, error_css, and required_css are implemented by the widgets. However, if you register your own widget functions you may want to implement new CSS options in your widgets class.

Parameter
string $css
The style text or CSS class name.
string $type = >>'default'<<
The type of tag this is -- e.g. "default" or "error" or "required".
Returns void


get_widget

public string get_widget(object pxdb_input &$data, &$input)

  This function first checks for a registered *field* function, then a *type* function, then it looks for a widget to include, and if all else fails then the class method is invoked.

Parameter
object pxdb_input &$data
The input object (useful for getting the form name, etc.)
&$input
Warning: documentation is missing.
Returns string

The built widget (i.e. HTML)


get_time_quarters

public string get_time_quarters()

 

Returns string

ISO -formatted hour and minute to the previous 15 minute increment


Private Method Details

_get_meta_css

private string _get_meta_css(array $data)

  Examines the data passed and returns an appropriate CSS category -- e.g. 'default' or 'error'. You will want to override this method if you want to create widgets that use new CSS categories.

Parameter
array $data
Hash of widget properties.
Returns string

The category of CSS (e.g. 'error', 'default').


_get_css_attribute

private string _get_css_attribute(array $data)

  Examines the data passed and returns an appropriate CSS attribute -- by default $default_css_attribute; if there's an error, $error_css_attribute, etc.

Parameter
array $data
The hash of widget properties.
Returns string

The CSS tag to use.


_get_css_style

private string _get_css_style(array $data)

  Examines the data passed and returns an appropriate CSS tag -- by default $default_css; if there's an error, $error_css, etc.

Parameter
array $data
The hash of widget properties.
Returns string

The CSS to use.


_get_css_type

private string _get_css_type(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

The CSS tag type to use.


_get_id_attribute

private string _get_id_attribute(array $data)

 

Parameter
array $data
Associative array of widget properties
Returns string

id attribute prepended with space


_clean_output

private string _clean_output(string $value)

  This function strips slashes from values in a smart way and returns html entities.

Parameter
string $value
The value to clean.
Returns string

The cleaned value.


_widget

private string _widget(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget

private string _ro_widget(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_num

private string _widget_num(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_num

private string _ro_widget_num(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_txt

private string _widget_txt(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_txt

private string _ro_widget_txt(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_amount

private string _widget_amount(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_amount

private string _ro_widget_amount(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_ltxt

private string _widget_ltxt(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_ltxt

private string _ro_widget_ltxt(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_email

private string _widget_email(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_email

private string _ro_widget_email(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_password

private string _widget_password(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_password

private string _ro_widget_password(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_pass2

private string _widget_pass2(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_pass2

private string _ro_widget_pass2(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_phone

private string _widget_phone(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_phone

private string _ro_widget_phone(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_currency

private string _widget_currency(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_currency

private string _ro_widget_currency(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_date

private string _widget_date(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_date

private string _ro_widget_date(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_url

private string _widget_url(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_url

private string _ro_widget_url(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_boolean_radio

private string _widget_boolean_radio(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_boolean_radio

private string _ro_widget_boolean_radio(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_boolean_check

private string _widget_boolean_check(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_boolean_check

private string _ro_widget_boolean_check(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_boolean

private string _widget_boolean(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_boolean

private string _ro_widget_boolean(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_primaryrel

private string _widget_primaryrel(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_primaryrel

private string _ro_widget_primaryrel(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_pickid

private string _widget_pickid(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_pickid

private string _ro_widget_pickid(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_pick

private string _widget_pick(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_pick

private string _ro_widget_pick(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_upload

private string _widget_upload(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

input widget


_ro_widget_upload

private string _ro_widget_upload(array $data)

 

Parameter
array $data
The hash of widget properties.
Returns string

read only widget


_widget_plugin_exists

private boolean _widget_plugin_exists(array $data)

  Upload widget

Parameter
array $data
The hash of widget properties.
Returns boolean


_include_widget

private string _include_widget(string $plugin_data, array &$data)

  If no widget is found at the specified path, the appropriate class method will be called instead. You PHP script will be included inside a function & therefore will have only local scope. Of course you can use references to methods of this object with $this->methodname() calls, however, some variables are copied so that you should not need to do this. In particular your PHP script may use the following variables $data -- the Hash of widget properties (e.g. 'name', 'label', 'error', etc.) $params -- params passed to widgets, from pxdb[widgets] array $db -- the ADOdb connection $css_tag -- the CSS tag (i.e. "style = 'color: red'" or "class = 'widgetclass'") for this widget $css_style -- the CSS style text or class name for this widget $css_type -- the CSS tag type (i.e. "style" or "class") for this widget In addition it is expected that your code will set a variable named $widget with the actual HTML that is to be displayed.

Parameter
string $plugin_data
The name of widget plugin to include AND params.
array &$data
Hash of widget properties.
Returns string

The widget returned by included file.


_invoke_class_method

private string _invoke_class_method(array $data)

 

Parameter
array $data
Hash of widget properties.
Returns string

The widget returned by class method.


updateDatetime

private void updateDatetime()

 

Warning: documentation is missing.

Returns void


Public Field Details

$css

public array $css

>>array()<<


$field_widgets

public array $field_widgets

>>array()<<


$field_ro_widgets

public array $field_ro_widgets

>>array()<<


$type_widgets

public array $type_widgets

>>array()<<


$type_ro_widgets

public array $type_ro_widgets

>>array()<<


$jscript_value_calculators

public array $jscript_value_calculators

>>array()<<


$class_methods

public array $class_methods

>><<


$input

public object pxdb_input $input

>><<


Private Field Details

$popcalendar_included

private boolean $popcalendar_included

>><<


$_current_time

private $_current_time

>>null<<


Included Files, Type: include

$wpath

include( $wpath )



Packageindex Classtrees Modulegroups Elementlist Report XML Files
Generated on Fri, 28 Apr 2006 19:07:22 -0400 by PHPDoc v1.5 www.phpdoc.de