Andrew's Web Libraries (AWL)
|
Public Member Functions | |
__construct ( $title="", $fields=null) | |
& | AddField ( $field, $sql="", $lookup_sql="") |
SetSql ( $field, $sql) | |
SetLookup ( $field, $lookup_sql) | |
Value ( $value_field_name) | |
Assign ( $value_field_name, $new_value) | |
Id ( $id=null) | |
SetOptionList ( $field, $options, $current=null, $parameters=null) | |
AddAttribute ( $field, $k, $v) | |
SetBaseTable ( $base_table) | |
SetJoins ( $join_list) | |
Title ( $new_title=null) | |
SetSubmitName ( $new_submit) | |
IsSubmit () | |
IsUpdate () | |
IsCreate () | |
SetWhere ( $where_clause) | |
WhereNewRecord ( $where_clause) | |
MoreWhere ( $operator, $more_where) | |
AndWhere ( $more_where) | |
OrWhere ( $more_where) | |
SetTemplate ( $template) | |
Layout ( $template) | |
Available () | |
SetRecord ( $row) | |
Initialise ( $values) | |
PostToValues ( $prefix='') | |
GetRecord ( $where="") | |
ReplaceEditorPart ($matches) | |
Render ( $title_tag=null) | |
Write ( $is_update=null) | |
Public Attributes | |
$Title | |
$Action | |
$Fields | |
$OrderedFields | |
$BaseTable | |
$Joins | |
$Where | |
$NewWhere | |
$Order | |
$Limit | |
$Query | |
$Template | |
$RecordAvailable | |
$Record | |
$SubmitName | |
$Id | |
Definition at line 160 of file classEditor.php.
Editor::__construct | ( | $title = "" , |
|
$fields = null |
|||
) |
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!
string | $title | |
array | or string $fields See above |
Definition at line 189 of file classEditor.php.
Editor::AddAttribute | ( | $field, | |
$k, | |||
$v | |||
) |
Add an attribute to this field.
unknown | $field | |
unknown | $k | |
unknown | $v |
Definition at line 299 of file classEditor.php.
& Editor::AddField | ( | $field, | |
$sql = "" , |
|||
$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.
string | $field | The name for the field. |
string | $sql | The SQL for the target list. Think: "$sql AS $field" |
string | $lookup_sql | The SQL for looking up a list of possible stored values and displayed values. |
Definition at line 226 of file classEditor.php.
Editor::Assign | ( | $value_field_name, | |
$new_value | |||
) |
Assigns the value of a field in the record currently associated with this editor.
string | $value_field_name | |
string | $new_value |
Definition at line 266 of file classEditor.php.
Editor::Available | ( | ) |
Returns 'true' if we have read a row from the database (or set one through SetRecord()), 'false' otherwise.
Definition at line 432 of file classEditor.php.
Editor::GetRecord | ( | $where = "" | ) |
Read the record from the database, optionally overriding the WHERE clause.
string | $where | (optional) An SQL WHERE clause to override any previous SetWhere call. |
Definition at line 482 of file classEditor.php.
Editor::Id | ( | $id = null | ) |
Sets or returns the form ID used for differentiating this form from others in the page.
string | $id |
Definition at line 275 of file classEditor.php.
Editor::Initialise | ( | $values | ) |
Set some particular values to the ones from the array.
array | $values | An array of fieldname / value pairs |
Definition at line 453 of file classEditor.php.
Editor::IsCreate | ( | ) |
Editor::IsUpdate | ( | ) |
Magically knows whether you are in the processing the result of an update or a create.
Definition at line 349 of file classEditor.php.
Editor::Layout | ( | $template | ) |
Like SetTemplate($template) except it surrounds the template with a ##form## ... </form> if there is not a form already in the template.
string | $template |
Definition at line 420 of file classEditor.php.
Editor::MoreWhere | ( | $operator, | |
$more_where | |||
) |
Append more stuff to the WHERE clause
unknown | $operator | |
unknown | $more_where |
Definition at line 387 of file classEditor.php.
Editor::PostToValues | ( | $prefix = '' | ) |
This will assign $_POST values to the internal Values object for each field that exists in the Fields array.
Definition at line 466 of file classEditor.php.
Editor::Render | ( | $title_tag = null | ) |
Render the templated component. The heavy lifting is done by the callback...
Definition at line 658 of file classEditor.php.
Editor::ReplaceEditorPart | ( | $matches | ) |
Replace parts into the form template. Parts that are replaceable are listed below:
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.
array | $matches | The matches found which preg_replace_callback is calling us for. |
Definition at line 536 of file classEditor.php.
Editor::SetBaseTable | ( | $base_table | ) |
Set the base table for the row query.
unknown | $base_table |
Definition at line 308 of file classEditor.php.
Editor::SetJoins | ( | $join_list | ) |
Editor::SetLookup | ( | $field, | |
$lookup_sql | |||
) |
Set the SQL for looking up a list of possible stored values and displayed values.
string | $field | |
string | $lookup_sql |
Definition at line 246 of file classEditor.php.
Editor::SetOptionList | ( | $field, | |
$options, | |||
$current = null , |
|||
$parameters = null |
|||
) |
Set the explicit options & parameters for a list of stored/displayed values. See the description under EditorField::SetOptionList() for full details.
string | $field | |
array | $options | A key => value array of valid store => display values. |
string | $current | The key of the current row |
string | $parameters | Set maxwidth & whether displayed values are translated. |
Definition at line 289 of file classEditor.php.
Editor::SetRecord | ( | $row | ) |
Set a database row to load the field values from.
object | $row |
Definition at line 442 of file classEditor.php.
Editor::SetSql | ( | $field, | |
$sql | |||
) |
Set the SQL for this field for the target list. Think: "$sql AS $field"
string | $field | |
string | $sql |
Definition at line 237 of file classEditor.php.
Editor::SetSubmitName | ( | $new_submit | ) |
Set the name of the SUBMIT button
unknown | $new_submit |
Definition at line 337 of file classEditor.php.
Editor::SetTemplate | ( | $template | ) |
Set this to be the form display template. It's better to use Layout($template) in general.
string | $template |
Definition at line 409 of file classEditor.php.
Editor::SetWhere | ( | $where_clause | ) |
Set the row selection criteria
unknown | $where_clause |
Definition at line 370 of file classEditor.php.
Editor::Title | ( | $new_title = null | ) |
Accessor for the Title for the editor, which could set the title also.
string | $new_title | The new title for the browser |
Definition at line 327 of file classEditor.php.
Editor::Value | ( | $value_field_name | ) |
Gets the value of a field in the record currently assigned to this editor.
string | $value_field_name |
Definition at line 256 of file classEditor.php.
Editor::WhereNewRecord | ( | $where_clause | ) |
Set the criteria used to find the new row after it got created.
unknown | $where_clause |
Definition at line 378 of file classEditor.php.
Editor::Write | ( | $is_update = null | ) |
Write the record. You might want to consider calling Editor::WhereNewRecord() before this if it might be creating a new record.
boolean | $is_update | Explicitly tell the write whether it's an update or insert. Generally it should be able to figure it out though. |
Definition at line 680 of file classEditor.php.