Class dat_keyvalues

Description

Dat_keyvalues

This class is a simple container class. It specifically deals with a collection of key=>value pairs in an internal array, and provides a few high-level functions to set these and read them out. Used in combo elements for forms.

Located in /data-defs.php (line 36)


	
			
Variable Summary
 mixed $count
 mixed $data
Method Summary
 dat_keyvalues dat_keyvalues ()
 void additem (mixed $key, mixed $value)
 void add_querydata (object $query, string $keyfield, string $displayfields)
 void clearitems ()
 mixed getitem (mixed $key)
 integer getitemindex (mixed $key)
 bool hasdata ()
 void reset ()
Variables
mixed $count = 0 (line 40)

The total data items in our array

mixed $data = array() (line 38)

The array containing data in key=>value pairs

Methods
Constructor dat_keyvalues (line 43)

Constructor

dat_keyvalues dat_keyvalues ()
additem (line 97)

Adds a key=>value pair item into the collection.

void additem (mixed $key, mixed $value)
  • mixed $key: The key value to use
  • mixed $value: The value to assign to the key
add_querydata (line 68)

Add query data

Add items from a query. The 'keyfield' parameter contains the name of the field to get key value from, and 'displayfields' is expected to contain a list of fields separated by the pipe "|" char. Literals are also supported by using a pseudo-fieldname in the list prefixed by a "#" char. In this case everything after the "#" will be used as the content of that field.

  • see: add_item()
void add_querydata (object $query, string $keyfield, string $displayfields)
  • object $query: Pointer to an executed Axyl query object
  • string $keyfield: Name of the key field to use.
  • string $displayfields: List of display fields separated with "|".
clearitems (line 103)

Clears all key=>value pair items from the collection.

void clearitems ()
getitem (line 143)

Return item value

Returns the value of the data item with the given key

  • return: The value of the item
mixed getitem (mixed $key)
  • mixed $key: The key of the value to find the index of
getitemindex (line 123)

Find ordinal array index Finds the ordinal array index of the element with key $key.

  • return: The index of the given key
integer getitemindex (mixed $key)
  • mixed $key: The key of the value to find the index of
hasdata (line 51)

Returns status of data.

Returns true if the container has some data in it, else returns false.

  • return: Status of data in the container.
bool hasdata ()
reset (line 113)

Reset the data Resets the internal array to the start. This is used when you need to repeatedly traverse the data.

void reset ()

Documentation generated by phpDocumentor 1.3.0RC3