Class ArrayChoiceList

Description

Provide a non-database filled (i.e. array-filled) version of DBChoiceList

See DBChoiceList for more details of interface.

Located in /inc/formslib/arraychoicelist.php (line 25)


	
			
Variable Summary
boolean $changed
array $choicelist
integer $DEBUG
string $displayKey
boolean $editable
boolean $extendable
string $id
integer $length
string $listKey
integer $oob_status
Method Summary
ArrayChoiceList ArrayChoiceList (array $array, string $iv, string $dv)
void append (array $values, [Field $field = ''])
string display ()
void prepend (array $values, [Field $field = ''])
mixed selectedValue (boolean $returnArray)
void set (string $value)
void setDefault (string $val)
boolean sync ()
string text_dump ()
void update (string $newval, array $data)
void _mkaddedarray (array $values, [Field $field = ''])
string _sqlvals ()
Variables
boolean $changed = 0 (line 33)
  • var: list has changed
array $choicelist (line 35)
  • var: list of array($listKey => $unique_name, $displayKey => $displayed_value)
integer $DEBUG = 0 (line 48)
  • var: debug level for object 0=off.
string $displayKey (line 41)
  • var: array index in which to store the displayed_value
boolean $editable = 0 (line 29)
  • var: list is editable
boolean $extendable = 0 (line 31)
  • var: list is extensible by user
string $id = -1 (line 27)
  • var: id value currently selected
integer $length (line 37)
  • var: number of items in the list
string $listKey (line 39)
  • var: array index in which to store the unique_name
string $oob_errorMessage = '' (line 45)
  • var: error message for out-of-band error reporting
integer $oob_status = STATUS_NOOP (line 43)
  • var: status code for out-of-band error reporting
Methods
Constructor ArrayChoiceList (line 57)

Create a new ArrayChoiceList object

ArrayChoiceList ArrayChoiceList (array $array, string $iv, string $dv)
  • array $array: list of unique_name => displayed_value
  • string $iv: index in which the unique_name should be stored in the ChoiceList
  • string $dv: index in which the displayed_value should be stored in the ChoiceList
append (line 93)

append a special field (such as "Create new:") to the choicelist

This method is much simpler than the DB equivalent as we won't need to remember them.

void append (array $values, [Field $field = ''])
  • array $values: list of values to be displayed
  • Field $field: (optional) a field class object to be placed next to this entry, if possible
display (line 115)

display the contents of the list

  • return: text representation of the field
string display ()
prepend (line 106)

prepend a special field (such as "Create new:") to the choicelist

This method is much simpler than the DB equivalent as we won't need to remember them.

void prepend (array $values, [Field $field = ''])
  • array $values: list of values to be displayed
  • Field $field: (optional) a field class object to be placed next to this entry, if possible
selectedValue (line 234)

determine whih values are selected and return them

  • return: list of selected values (array) or current value (string)
mixed selectedValue (boolean $returnArray)
  • boolean $returnArray: return an array of values
set (line 194)

set the currently selected value

void set (string $value)
  • string $value: new value to use as curretly selected
setDefault (line 252)

set which option in the selection list is the default option

void setDefault (string $val)
  • string $val: default value to use
sync (line 204)

synchronise: but we have nothing to do as we are not attached to the db

(provided to give interface to normal Field database)

  • return: false -- there was nothing to do
boolean sync ()
text_dump (line 123)

display the contents of the list

  • return: text representation of the field
string text_dump ()
update (line 139)

update the value of the list based on user data:

  • if it is within the range of current values, then take the value
  • if the field contains a new value (and is allowed to) then keep an illegal value, mark as being changed, and wait until later for the field to be updated
  • if the field contains a new value (and is not allowed to) or an out-of-range value, then flag as being invalid

void update (string $newval, array $data)
  • string $newval: the (possibly) new value for the field
  • array $data: ancillary user data (passed on to any appended or prepended fields)
_mkaddedarray (line 76)

Construct an array suitable for storing the field and the values it takes for later reuse

void _mkaddedarray (array $values, [Field $field = ''])
  • array $values: list of values to be displayed
  • Field $field: Field object associated with these values
_sqlvals (line 213)

generate name=value pairs in case someone actually wants them!

  • return: of form name='value'
string _sqlvals ()

Documentation generated on Tue, 06 Mar 2007 10:00:33 +0000 by phpDocumentor 1.3.0