PHP Class Newscoop\TemplateList\BaseList

Show file Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Property Type Description
$cacheKey mixed List cache key
$columns integer The number of columns (for generating tables)
$constraints array The constraints array.
$critera Newscoop\Criteria The Criteria object
$defaultIterator object The default iterator for the current object.
$defaultTTL integer Default cache time
$firstResult integer The start page number from which to generate the list.
$hasNextResults boolean True if the generated list has more elements than $this->m_limit
$id string The identifier of the list
$maxResults integer The maximum number of objects in the list, null or 0 for no limit
$name string The name of the list
$objectsList Newscoop\ListResult The list of objects.
$operatorsMap
$parameters array The clean array of parameters
$totalCount integer The total number of elements in the list without the limits.

Public Methods

Method Description
__construct ( $criteria )
__get ( string $property ) : mixed Overloaded method call to give access to the list properties.
defaultIterator ( ) : object Returns the default iterator of this list.
getColumn ( integer $iterator = null ) Returns the column number for the given iterator
getColumns ( ) : integer Returns the number of columns.
getConstraints ( ) : array Returns the constraints.
getCurrent ( ) : object Returns the current element of the default iterator.
getEnd ( ) : integer Returns the index of the last element of this list in the original list from which this was truncated.
getIndex ( ) : integer Returns the index of the current element of the default iterator.
getIterator ( ) : object Returns an iterator for this list.
getLength ( ) : integer Returns the length of the list.
getLimit ( ) : integer Returns the maximum number of elements, 0 for limitless.
getList ( $firstResult, $parameters )
getName ( ) : string Returns the list name.
getRow ( $iterator = null ) Returns the row number for the given iterator
getStart ( ) : integer Returns the index of the start element of this list in the original list from which this was truncated.
getTotalCount ( ) : unknown Returns the total number of elements in the list without the limits.
hasNextElements ( ) : boolean Returns true if this list is limited and elements still exist in the original list (from which this was truncated) after the last element of this list.
hasPreviousElements ( ) : boolean Returns true if the index of the start element in the original list - from which this was truncated - is greater than 0.
isBlank ( ) : boolean Return true if the list is blank (see the constructor documentation).
isEmpty ( ) : boolean Return true if the list is empty.
isLimited ( ) : boolean Returns true if the list is limited to a certain number of elements.
setId ( string $id ) Sets the list identifier
setTotalCount ( $totalCount ) : unknown Set list total count.

Protected Methods

Method Description
convertConstraints ( ) Convert constraints array to Criteria
convertParameters ( integer $firstResult, array $parameters ) : Criteria Convert parameters array to Criteria
getCacheKey ( )
parseConstraintsString ( string $constraintsString ) : array Parses the constraints string and returns an array of words
prepareList ( Criteria $criteria, array $parameters ) : ListResult Get ListResult object with list elements
setCriteria ( Criteria $criteria ) Set Criteria object

Private Methods

Method Description
defaultName ( ) : string Generates a unique name for this list object.
duplicateObject ( object $source ) : object Copies the given object
getNextStart ( ) : integer Returns the start element index of the next group of items from the list. Returns null if the list had no limit.
getPrevStart ( ) : integer Returns the start element index of the previous group of items from the list. Returns null if the list had no limit.

Method Details

__construct() public method

public __construct ( $criteria )

__get() public method

Overloaded method call to give access to the list properties.
public __get ( string $property ) : mixed
$property string - the property name
return mixed the property value

convertConstraints() protected method

Convert constraints array to Criteria
protected convertConstraints ( )

convertParameters() protected method

Convert parameters array to Criteria
protected convertParameters ( integer $firstResult, array $parameters ) : Criteria
$firstResult integer
$parameters array
return Newscoop\Criteria

defaultIterator() public method

Returns the default iterator of this list.
public defaultIterator ( ) : object
return object of type ArrayIterator

getCacheKey() protected method

protected getCacheKey ( )

getColumn() public method

Returns the column number for the given iterator
public getColumn ( integer $iterator = null )
$iterator integer

getColumns() public method

Returns the number of columns.
public getColumns ( ) : integer
return integer

getConstraints() public method

Returns the constraints.
public getConstraints ( ) : array
return array

getCurrent() public method

Returns the current element of the default iterator.
public getCurrent ( ) : object
return object

getEnd() public method

Returns the index of the last element of this list in the original list from which this was truncated.
public getEnd ( ) : integer
return integer

getIndex() public method

Returns the index of the current element of the default iterator.
public getIndex ( ) : integer
return integer

getIterator() public method

Returns an iterator for this list.
public getIterator ( ) : object
return object of type ArrayIterator

getLength() public method

Returns the length of the list.
public getLength ( ) : integer
return integer

getLimit() public method

Returns the maximum number of elements, 0 for limitless.
public getLimit ( ) : integer
return integer

getList() public method

public getList ( $firstResult, $parameters )

getName() public method

Returns the list name.
public getName ( ) : string
return string

getRow() public method

Returns the row number for the given iterator
public getRow ( $iterator = null )

getStart() public method

Returns the index of the start element of this list in the original list from which this was truncated.
public getStart ( ) : integer
return integer

getTotalCount() public method

Returns the total number of elements in the list without the limits.
public getTotalCount ( ) : unknown
return unknown

hasNextElements() public method

Returns true if this list is limited and elements still exist in the original list (from which this was truncated) after the last element of this list.
public hasNextElements ( ) : boolean
return boolean

hasPreviousElements() public method

Returns true if the index of the start element in the original list - from which this was truncated - is greater than 0.
public hasPreviousElements ( ) : boolean
return boolean

isBlank() public method

Return true if the list is blank (see the constructor documentation).
public isBlank ( ) : boolean
return boolean

isEmpty() public method

Return true if the list is empty.
public isEmpty ( ) : boolean
return boolean

isLimited() public method

Returns true if the list is limited to a certain number of elements.
public isLimited ( ) : boolean
return boolean

parseConstraintsString() protected method

Parses the constraints string and returns an array of words
protected parseConstraintsString ( string $constraintsString ) : array
$constraintsString string
return array

prepareList() abstract protected method

Get ListResult object with list elements
abstract protected prepareList ( Criteria $criteria, array $parameters ) : ListResult
$criteria Newscoop\Criteria
$parameters array
return Newscoop\ListResult

setCriteria() protected method

Set Criteria object
protected setCriteria ( Criteria $criteria )
$criteria Newscoop\Criteria

setId() public method

Sets the list identifier
public setId ( string $id )
$id string

setTotalCount() public method

Set list total count.
public setTotalCount ( $totalCount ) : unknown
return unknown

Property Details

$cacheKey protected property

List cache key
protected mixed $cacheKey
return mixed

$columns protected property

The number of columns (for generating tables)
protected int $columns
return integer

$constraints protected property

The constraints array.
protected array $constraints
return array

$critera protected property

The Criteria object
protected Criteria,Newscoop $critera
return Newscoop\Criteria

$defaultIterator protected property

The default iterator for the current object.
protected object $defaultIterator
return object

$defaultTTL protected property

Default cache time
protected int $defaultTTL
return integer

$firstResult protected property

The start page number from which to generate the list.
protected int $firstResult
return integer

$hasNextResults protected property

True if the generated list has more elements than $this->m_limit
protected bool $hasNextResults
return boolean

$id protected property

The identifier of the list
protected string $id
return string

$maxResults protected property

The maximum number of objects in the list, null or 0 for no limit
protected int $maxResults
return integer

$name protected property

The name of the list
protected string $name
return string

$objectsList protected property

The list of objects.
protected ListResult,Newscoop $objectsList
return Newscoop\ListResult

$operatorsMap protected property

protected $operatorsMap

$parameters protected property

The clean array of parameters
protected array $parameters
return array

$totalCount protected property

The total number of elements in the list without the limits.
protected int $totalCount
return integer