class ListModel extends BaseDatabaseModel

Model class for handling lists of items.

Methods

static  array
addIncludePath( mixed $path = '', string $prefix = '')

Add a directory where \JModelLegacy should search for models. You may either pass a string or an array of directories.

static  void
addTablePath( mixed $path)

Adds to the stack of model table paths in LIFO order.

static  JModelLegacy|boolean
getInstance( string $type, string $prefix = '', array $config = array())

Returns a Model object, always creating it

__construct( array $config = array())

Constructor.

getDbo()

Method to get the database driver object

string
getName()

Method to get the model name

mixed
getState( string $property = null, mixed $default = null)

Method to get model state variables

JTable
getTable( string $name = '', string $prefix = 'Table', array $options = array())

Method to get a table object, load it if necessary.

boolean
loadHistory( integer $version_id, JTable $table)

Method to load a row for editing from the version history table.

void
setDbo( JDatabaseDriver $db)

Method to set the database driver object

mixed
setState( string $property, mixed $value = null)

Method to set model state variables

array
getActiveFilters()

Function to get the active filters

mixed
getItems()

Method to get an array of data items.

JPagination
getPagination()

Method to get a \JPagination object for the data set.

integer
getTotal()

Method to get the total number of items for the data set.

integer
getStart()

Method to get the starting number of items for the data set.

JForm|boolean
getFilterForm( array $data = array(), boolean $loadData = true)

Get the filter form

mixed
getUserStateFromRequest( string $key, string $request, string $default = null, string $type = 'none', boolean $resetPage = true)

Gets the value of a user state variable and sets it in the session

Details

static array addIncludePath( mixed $path = '', string $prefix = '')

Add a directory where \JModelLegacy should search for models. You may either pass a string or an array of directories.

Parameters

mixed $path A path or array[sting] of paths to search.
string $prefix A prefix for models.

Return Value

array An array with directory elements. If prefix is equal to '', all directories are returned.

static void addTablePath( mixed $path)

Adds to the stack of model table paths in LIFO order.

Parameters

mixed $path The directory as a string or directories as an array to add.

Return Value

void

static JModelLegacy|boolean getInstance( string $type, string $prefix = '', array $config = array())

Returns a Model object, always creating it

Parameters

string $type The model type to instantiate
string $prefix Prefix for the model class name. Optional.
array $config Configuration array for model. Optional.

Return Value

JModelLegacy|boolean A \JModelLegacy instance or false on failure

__construct( array $config = array())

Constructor.

Parameters

array $config An array of configuration options (name, state, dbo, tablepath, ignorerequest).

See also

\JModelLegacy

JDatabaseDriver getDbo()

Method to get the database driver object

Return Value

JDatabaseDriver

string getName()

Method to get the model name

The model name. By default parsed using the classname or it can be set by passing a $config['name'] in the class constructor

Return Value

string The name of the model

Exceptions

Exception

mixed getState( string $property = null, mixed $default = null)

Method to get model state variables

Parameters

string $property Optional parameter name
mixed $default Optional default value

Return Value

mixed The property where specified, the state object where omitted

JTable getTable( string $name = '', string $prefix = 'Table', array $options = array())

Method to get a table object, load it if necessary.

Parameters

string $name The table name. Optional.
string $prefix The class prefix. Optional.
array $options Configuration array for model. Optional.

Return Value

JTable A \JTable object

Exceptions

Exception

boolean loadHistory( integer $version_id, JTable $table)

Method to load a row for editing from the version history table.

Parameters

integer $version_id Key to the version history table.
JTable $table &$table Content table object being loaded.

Return Value

boolean False on failure or error, true otherwise.

void setDbo( JDatabaseDriver $db)

Method to set the database driver object

Parameters

JDatabaseDriver $db A \JDatabaseDriver based object

Return Value

void

mixed setState( string $property, mixed $value = null)

Method to set model state variables

Parameters

string $property The name of the property.
mixed $value The value of the property to set or null.

Return Value

mixed The previous value of the property or null if not set.

array getActiveFilters()

Function to get the active filters

Return Value

array Associative array in the format: array('filter_published' => 0)

mixed getItems()

Method to get an array of data items.

Return Value

mixed An array of data items on success, false on failure.

JPagination getPagination()

Method to get a \JPagination object for the data set.

Return Value

JPagination A \JPagination object for the data set.

integer getTotal()

Method to get the total number of items for the data set.

Return Value

integer The total number of items available in the data set.

integer getStart()

Method to get the starting number of items for the data set.

Return Value

integer The starting number of items available in the data set.

JForm|boolean getFilterForm( array $data = array(), boolean $loadData = true)

Get the filter form

Parameters

array $data data
boolean $loadData load current data

Return Value

JForm|boolean The \JForm object or false on error

mixed getUserStateFromRequest( string $key, string $request, string $default = null, string $type = 'none', boolean $resetPage = true)

Gets the value of a user state variable and sets it in the session

This is the same as the method in \JApplication except that this also can optionally force you back to the first page when a filter has changed

Parameters

string $key The key of the user state variable.
string $request The name of the variable passed in a request.
string $default The default value for the variable if not found. Optional.
string $type Filter for the variable, for valid values see {@link \JFilterInput::clean()}. Optional.
boolean $resetPage If true, the limitstart in request is set to zero

Return Value

mixed The request user state.