Public Member Functions | |
DynamicList ($identifier, $title=null, $width=500) | |
Class constructor. | |
fillWithPost () | |
Fill in the list using HTTP POST. | |
fillWithDatabase () | |
Fill in the list using the database. | |
addItem ($key, $value) | |
Add an item. | |
deleteItem ($key) | |
Remove an item. | |
save () | |
Save the list. | |
databaseItemExists ($itemId, $value) | |
Checks if the given item exist. | |
isEmpty () | |
Checks if the list is empty. | |
html () | |
Output the list in HTML. | |
Protected Member Functions | |
databaseInsertItem ($value) | |
Insert a new item. | |
databaseUpdateItem ($itemId, $newValue) | |
Update an existing item. | |
databaseDeleteItemsExcluding ($idArray) | |
Delete existing item(s). | |
Protected Attributes | |
$items = array() | |
$identifier | |
$title | |
$width | |
$emptyListMessage | |
An message saying the list is empty. | |
$alreadyExistsMessage | |
An message saying the item already exists. |
This class is an abstraction layer for dynamic lists in HTML forms.
DynamicList-p::DynamicList | ( | $ | identifier, | |
$ | title = null , |
|||
$ | width = 500 | |||
) |
DynamicList-p::fillWithPost | ( | ) |
Fill in the list using HTTP POST.
This function will fill in the System using variables from $_POST.
DynamicList-p::fillWithDatabase | ( | ) | [abstract] |
Fill in the list using the database.
This function is responsible for filling in the list using data from the database.
DynamicList-p::addItem | ( | $ | key, | |
$ | value | |||
) |
Add an item.
This function adds an item. key The key of the new item.
value | The value of the new item. |
DynamicList-p::deleteItem | ( | $ | key | ) |
Remove an item.
This function removes an item.
key | The key of the item to be deleted. |
DynamicList-p::save | ( | ) |
Save the list.
This function will call insert() or update() to save the list.
DynamicList-p::databaseItemExists | ( | $ | itemId, | |
$ | value | |||
) | [abstract] |
Checks if the given item exist.
Checks if the given item already exists in the database.
itemId | The itemId to search for. | |
value | The item value to search for. |
DynamicList-p::databaseInsertItem | ( | $ | value | ) | [abstract, protected] |
Insert a new item.
This function will insert a new item with value $value in the database.
value | The value to be inserted. |
DynamicList-p::databaseUpdateItem | ( | $ | itemId, | |
$ | newValue | |||
) | [abstract, protected] |
Update an existing item.
This function will update an existing item in the database with $newValue.
itemId | The id number of the item. | |
newValue | The new value of the item. |
DynamicList-p::databaseDeleteItemsExcluding | ( | $ | idArray | ) | [abstract, protected] |
Delete existing item(s).
This function is responsible for removing item(s) from the database.
idArray | An array containing id's which NOT to delete. |
DynamicList-p::isEmpty | ( | ) |
Checks if the list is empty.
Returns true if the list is empty.
DynamicList-p::html | ( | ) |
Output the list in HTML.
This function will output the list in a HTML table.
DynamicList-p::$items = array() [protected] |
DynamicList-p::$identifier [protected] |
DynamicList-p::$title [protected] |
DynamicList-p::$width [protected] |
DynamicList-p::$emptyListMessage [protected] |
An message saying the list is empty.
DynamicList-p::$alreadyExistsMessage [protected] |
An message saying the item already exists.