Methods summary
public
|
#
__construct( string $title = "", array $fields = null )
Constructs an editor widget, with a title and fields.
Constructs an editor widget, with a title and fields.
The second parameter maybe passed as a string, to be interpreted as the name
of a table, from which all fields will be included, or as an array of specific
fields, in which case you should make sure to call SetBaseTable('tablename') so
the editor knows where to find those fields!
Parameters
- $title
string $title
- $fields
array or string $fields See above
|
public
&
|
#
AddField( string $field, string $sql = "", string $lookup_sql = "" )
Creates a new field in the Editor, possibly initialising the SQL for
calculating it's value, and lookup_sql for use in drop-down lists.
Creates a new field in the Editor, possibly initialising the SQL for
calculating it's value, and lookup_sql for use in drop-down lists.
Parameters
- $field
string $field The name for the field.
- $sql
string $sql The SQL for the target list. Think: "$sql AS $field"
- $lookup_sql
string $lookup_sql The SQL for looking up a list of possible stored values and
displayed values.
|
public
|
#
SetSql( string $field, string $sql )
Set the SQL for this field for the target list. Think: "$sql AS $field"
Set the SQL for this field for the target list. Think: "$sql AS $field"
Parameters
- $field
string $field
- $sql
string $sql
|
public
|
#
SetLookup( string $field, string $lookup_sql )
Set the SQL for looking up a list of possible stored values and displayed
values.
Set the SQL for looking up a list of possible stored values and displayed
values.
Parameters
- $field
string $field
- $lookup_sql
string $lookup_sql
|
public
|
#
Value( string $value_field_name )
Gets the value of a field in the record currently assigned to this
editor.
Gets the value of a field in the record currently assigned to this
editor.
Parameters
- $value_field_name
string $value_field_name
|
public
|
#
Assign( string $value_field_name, string $new_value )
Assigns the value of a field in the record currently associated with this
editor.
Assigns the value of a field in the record currently associated with this
editor.
Parameters
- $value_field_name
string $value_field_name
- $new_value
string $new_value
|
public
|
#
Id( string $id = null )
Sets or returns the form ID used for differentiating this form from others in
the page.
Sets or returns the form ID used for differentiating this form from others in
the page.
Parameters
|
public
|
#
SetOptionList( string $field, array $options, string $current = null, string $parameters = null )
Set the explicit options & parameters for a list of stored/displayed
values. See the description under EditorField::SetOptionList() for full
details.
Set the explicit options & parameters for a list of stored/displayed
values. See the description under EditorField::SetOptionList() for full
details.
Parameters
- $field
string $field
- $options
array $options A key => value array of valid store => display values.
- $current
string $current The key of the current row
- $parameters
string $parameters Set maxwidth & whether displayed values are translated.
|
public
|
#
AddAttribute( unknown $field, unknown $k, unknown $v )
Add an attribute to this field.
Add an attribute to this field.
Parameters
- $field
unknown $field
- $k
unknown $k
- $v
unknown $v
|
public
|
#
SetBaseTable( unknown $base_table )
Set the base table for the row query.
Set the base table for the row query.
Parameters
- $base_table
unknown $base_table
|
public
|
#
SetJoins( unknown $join_list )
Set any joins
Parameters
- $join_list
unknown $join_list
|
public
string
|
#
Title( string $new_title = null )
Accessor for the Title for the editor, which could set the title also.
Accessor for the Title for the editor, which could set the title also.
Parameters
- $new_title
string $new_title The new title for the browser
Returns
string The current title for the browser
|
public
|
#
SetSubmitName( unknown $new_submit )
Set the name of the SUBMIT button
Set the name of the SUBMIT button
Parameters
- $new_submit
unknown $new_submit
|
public
|
|
public
boolean
|
#
IsUpdate( )
Magically knows whether you are in the processing the result of an update or
a create.
Magically knows whether you are in the processing the result of an update or
a create.
Returns
boolean
|
public
boolean
|
#
IsCreate( )
The opposite of IsUpdate. Really.
The opposite of IsUpdate. Really.
Returns
boolean
|
public
|
#
SetWhere( unknown $where_clause )
Set the row selection criteria
Set the row selection criteria
Parameters
- $where_clause
unknown $where_clause
|
public
|
#
WhereNewRecord( unknown $where_clause )
Set the criteria used to find the new row after it got created.
Set the criteria used to find the new row after it got created.
Parameters
- $where_clause
unknown $where_clause
|
public
|
#
MoreWhere( unknown $operator, unknown $more_where )
Append more stuff to the WHERE clause
Append more stuff to the WHERE clause
Parameters
- $operator
unknown $operator
- $more_where
unknown $more_where
|
public
|
|
public
|
|
public
|
#
SetTemplate( string $template )
Set this to be the form display template. It's better to use
Layout($template) in general.
Set this to be the form display template. It's better to use
Layout($template) in general.
Deprecated
Parameters
- $template
string $template
|
public
|
#
Layout( string $template )
Like SetTemplate($template) except it surrounds the template with a ##form##
... </form> if there is not a form already in the template.
Like SetTemplate($template) except it surrounds the template with a ##form##
... </form> if there is not a form already in the template.
Parameters
- $template
string $template
|
public
boolean
|
#
Available( )
Returns 'true' if we have read a row from the database (or set one through
SetRecord()), 'false' otherwise.
Returns 'true' if we have read a row from the database (or set one through
SetRecord()), 'false' otherwise.
Returns
boolean
|
public
object
|
#
SetRecord( object $row )
Set a database row to load the field values from.
Set a database row to load the field values from.
Parameters
Returns
object The row that was passed in.
|
public
|
#
Initialise( array $values )
Set some particular values to the ones from the array.
Set some particular values to the ones from the array.
Parameters
- $values
array $values An array of fieldname / value pairs
|
public
|
#
PostToValues( mixed $prefix = '' )
This will assign $_POST values to the internal Values object for each field
that exists in the Fields array.
This will assign $_POST values to the internal Values object for each field
that exists in the Fields array.
|
public
object
|
#
GetRecord( string $where = "" )
Read the record from the database, optionally overriding the WHERE
clause.
Read the record from the database, optionally overriding the WHERE
clause.
Parameters
- $where
string $where (optional) An SQL WHERE clause to override any previous SetWhere call.
Returns
object The row that was read from the database.
|
public
string
|
#
ReplaceEditorPart( array $matches )
Replace parts into the form template. Parts that are replaceable are listed
below:
##form## A <form ...> tag. You should close this with </form> or use
Layout($template) which will take care of it for you.
##submit## A <input type="submit" ...> tag for the form.
##f.options## A list of options explicitly specified
##f.select## A select list from the lookup SQL specified
##f.checkbox## A checkbox, perhaps with a "_label" attribute
##f.input## A normal input field.
##f.file## A file upload field.
##f.money## A money input field.
##f.date## A date input field.
##f.textarea## A textarea
##f.hidden## A hidden input field
##f.password## An input field for entering passwords without them being echoed
to the screen
##f.enc## Just print the value with special chars escaped for use in URLs.
##f.submit## An <input type="submit" where you specify the field name.
Replace parts into the form template. Parts that are replaceable are listed
below: ##form## A <form ...> tag. You should close this with </form>
or use Layout($template) which will take care of it for you. ##submit## A
<input type="submit" ...> tag for the form. ##f.options## A list of
options explicitly specified ##f.select## A select list from the lookup SQL
specified ##f.checkbox## A checkbox, perhaps with a "_label" attribute
##f.input## A normal input field. ##f.file## A file upload field. ##f.money## A
money input field. ##f.date## A date input field. ##f.textarea## A textarea
##f.hidden## A hidden input field ##f.password## An input field for entering
passwords without them being echoed to the screen ##f.enc## Just print the value
with special chars escaped for use in URLs. ##f.submit## An <input
type="submit" where you specify the field name.
Most of these begin with "f", which should be replaced by the name of the
field. Many also take an option after the name as well, so (for example) you can
force the current value in ##options## or ##select## by setting
##field.select.current##. The input, file, money & date all accept the third
parameter as a size value, so ##fieldname.date.14## would be a 14-character-wide
date field. Similarly a textarea allows for a COLSxROWS value, so
##myfield.textarea.80x5## would be an 80-column textarea, five rows high.
For ##fieldname.password.fakevalue## you can set the 'fake' value used to
populate the password field so that you can check for this on submit to be able
to tell whether the password field has been edited.
Other attributes are added to the <input ...> tag based on any
SetAttributes() that may have been applied.
Parameters
- $matches
array $matches The matches found which preg_replace_callback is calling us for.
Returns
string What we want to replace this match with.
|
public
|
#
Render( mixed $title_tag = null )
Render the templated component. The heavy lifting is done by the
callback...
Render the templated component. The heavy lifting is done by the
callback...
|
public
|
#
Write( boolean $is_update = null )
Write the record. You might want to consider calling Editor::WhereNewRecord()
before this if it might be creating a new record.
Write the record. You might want to consider calling Editor::WhereNewRecord()
before this if it might be creating a new record.
Parameters
- $is_update
boolean $is_update Explicitly tell the write whether it's an update or insert. Generally
it should be able to figure it out though.
|