Class recmaintainer

Description

The record maintainer class.

Located in /recmaint-defs.php (line 89)

RenderableObject
   |
   --recmaintainer
Variable Summary
 mixed $defaults
 mixed $fields
 mixed $formname
 mixed $keycombo
 mixed $prefix
 mixed $records
Method Summary
 recmaintainer recmaintainer (string $formname, object &$keycombo, [string $prefix = "_"], string $fieldlist)
 void add_defaults (array $defaults)
 void add_record (mixed $keyval, array $record)
 void html (string $prefix)
 void initial_record (mixed $value)
 void register_button (string $type, object The &$button)
 void register_field (object &$field, [string $fieldid = "fdata"])
Variables
mixed $defaults = array() (line 112)

Field defaults for new records

mixed $fields = array() (line 106)

Internal array of field names being maintained

mixed $formname (line 94)

Name of the form containing maintained fields

mixed $initial_record_value (line 115)

Value, if defined, of the record to focus to on initialisation

mixed $keycombo (line 103)

Pointer to the key combo/select box

mixed $prefix = "" (line 97)

Prefix to differentiate one set of records from anther

mixed $records = array() (line 109)

Record data to maintain

mixed $start_disabled = false (line 100)

If true, maintainer will be displayed with fields disabled

Methods
Constructor recmaintainer (line 126)

Define a record maintainer object.

The form name, key combo (select) box, and the list of fields it will be maintaining must be specified.

recmaintainer recmaintainer (string $formname, object &$keycombo, [string $prefix = "_"], string $fieldlist)
  • string $formname: Name of the form containing maintenance fields
  • object $keycombo: The form_combofield object containing record keys
  • string $fieldlist: The name sof all fields being maintained
  • string $prefix: Prefix to identify multiple recmaintainers uniquely
add_defaults (line 214)

Add an array of default values for each field.

The array is a key=>value associative array, with the key = fieldname, and the value = default value for field.

void add_defaults (array $defaults)
  • array $defaults: An associative arrray containing field defaults
add_record (line 204)

Add a record of data to the maintainer.

The record is passed as an associative array, which is directory compatible with the rows returned by get_next() etc. in normal database queries. The array is therefore expected to contain the normal fieldname=>data pairs. The ordering of adding these records should be identical to the ordering of the records in the keycombo.

void add_record (mixed $keyval, array $record)
  • array $record: An associative arrray containing a record of data
display_disabled (line 222)

Cause the maintainer to be displayed initially diabled. All form fields which are part of the maintainer will be readonly/disabled.

void display_disabled ()
html (line 241)

Return the HTML for this maintainer. This consists of Javascript objects to contain the data, and hidden form fields which will be used to POST changes etc. This should be rendered inside your main form element.

void html (string $prefix)
  • string $prefix: A prefix to use in field-naming for uniqueness

Redefinition of:
RenderableObject::html()
Return output suitable for normal HTML-capable device. This method must be over-ridden by a method of the same name in the descendant class which renders output to web browsers.
initial_record (line 230)

Tell the record maintainer to focus the keycombo to the record with the given value, when it first initialises.

void initial_record (mixed $value)
register_button (line 144)

Register a button.

This assigns the proper onclick event so that the button will do the right thing when clicked. There are several types of button recognised: "up", "down", "save", "reset" and "del". NB: If the button in question already has an onclick script attached to it then this is preserved, and will be executed after the new script we attach here.

void register_button (string $type, object The &$button)
  • string $type: Type of button being registered
  • object The &$button: button object to be registered
register_field (line 189)

Register a form field in the maintainer.

The object passed should be a normal Axyl form object such as a form_textfield, form_checkbox or whatever. Add all of the form objects that you have in your maintenance screen.

void register_field (object &$field, [string $fieldid = "fdata"])
  • object $field: A form element eg: a form_textfield object
  • string $fieldid: HTML id attribute to assign to form element

Inherited Methods

Inherited From RenderableObject

 RenderableObject::RenderableObject()
 RenderableObject::html()
 RenderableObject::render()
 RenderableObject::wml()
 RenderableObject::wmlup()
 RenderableObject::xml()

Documentation generated by phpDocumentor 1.3.0RC3