Class \Scrivo\ListItemDefinition

Class to hold the definition of a list item.

Scrivo lists contain list items and each list item can have a number of configurable fields. List item definitions are used to store this configuration data.

Note that a Scrivo list is not limited to items using one list item definition only, a Scrivo list can contain items that use different list item definitions.

Also note that Scrivo lists are actually defined by these list item defintions: a list is a collection of items using a particular set of list item definitions. This set is determined by the application definition.

Lists can be hierachically structured (like a threaded forum for instance). Therefore list item definitions can structured accordingly: ie. list items using the "reply" definition can only occur underneath list items using the "topic" ore "reply" item.

Defined in: ListItemDefinition.php.


Constructor summary

Attr. Name / Description
public

ListItemDefinition($context)

Create an empty list item definition object.

Properties

Attr. Type Name Description
int $applicationDefinitionId The id of the list/application where this list item definition belongs to.
array $childListItemDefinitionIds List of possible list item definitions for child items.
\..\String $icon The location of an icon to identify the item definition in the user interface.
read-only int $id The id of the list item definition (DB key).
int $pageDefinitionId The id of the template to use for linked pages (optional).
array $parentListItemDefinitionIds List of possible list item definitions for parent items.
\..\String $phpSelector A textual identification/key for this list item definition.
\..\String $title A descriptive name for the list item definition.
\..\String $titleLabel An alternative label for the title property of a list item in the user interface.
int $titleWidth The width of the title property in the user interface for a list item (column width in list view mode).

Member summary

Attr. Type Name Description
private int $applicationDefinitionId The id of the list/application where this list item definition belongs to.
private int[] $childListItemDefinitionIds When working with hierarchical type definitions this member contains an array with the child list item definitions of this list item definition.
private \..\Context $context A Scrivo context.
private \..\String $icon The location of an icon to identify the item definition in the user interface.
private int $id The id of the list item definition (DB key).
private int $pageDefinitionId The id of the template to use for linked pages (optional).
private int[] $parentListItemDefinitionIds When working with hierarchical type definitions this member contains an array with the parent list item definitions of this list item definition.
private \..\String $phpSelector A textual identification/key for this list item definition.
private \..\String $title A descriptive name for the list item definition.
private \..\String $titleLabel An alternative label for the title property of a list item in the user interface.
private int $titleWidth The width of the title property in the user interface for a list item (column width in list view mode).

Method summary

Attr. Type Name / Description
public mixed

__get($name)

Implementation of the readable properties using the PHP magic method __get().

public

__set($name, $value)

Implementation of the writable properties using the PHP magic method __set().

public static

delete($context, $id)

Delete existing list item definition data from the database.

public static \..\ListItemDefinition

fetch($context, $id)

Fetch a list item definition object from the database using its object id.

private array

getChildListItemDefinitionIds()

Get an array with the child list item definitions of this list item definition when working with hierarchical list type definitions.

private array

getParentListItemDefinitionIds()

Get an array with the parent list item definitions of this list item definition when working with hierarchical list type definitions.

public

insert()

Insert new list item definition object data into the database.

public

move($dir)

Move a list item definition one position up or down.

public static \..\ListItemDefinition[]

select($context, $applicationDefinitionId, $parentId)

Select list item definitions from the database.

private \..\object[]

selectChildListItemDefinitionIds()

Retrieve the ids of the child list item definitions.

private \..\object[]

selectParentListItemDefinitionIds()

Retrieve the ids of the parent list item definitions.

private

setApplicationDefinitionId($appId)

Set the id of the list/application where this list item definition belongs to.

private

setFields($context, $rd)

Convenience method to set the fields of a list item definition object from an array (result set row).

private

setIcon($icon)

Set The location of an icon to identify the item definition in the user interface.

private

setPageDefinitionId($pageDefinitionId)

Set The id of the template to use for linked pages (optional).

private

setPhpSelector($phpSelector)

Set A textual identification/key for this list item definition.

private

setTitle($title)

Set A descriptive name for the list item definition.

private

setTitleLabel($titleLabel)

Set An alternative label for the title property of a list item in the user interface.

private

setTitleWidth($titleWidth)

Set The width of the title property in the user interface for a list item (column width in list view mode).

public

update()

Update existing list item definition object data in the database.

public

updateParentListItemDefinitionIds($pids)

Set the parent list item definitions for this list item definition in the database.

private static

validateDelete($context, $id)

Check if deletion of list item definition object data does not violate any business rules.

private

validateInsert()

Check if this list item definition object can be inserted into the database.

private

validateUpdate()

Check if this list item definition object can be updated in the database.

 


Constructor

public ListItemDefinition(\Scrivo\Context $context=null)

Create an empty list item definition object.

Parameters:

Type Name Def. Description
\Scrivo\Context $context null

A Scrivo context.


Members


				
private int $applicationDefinitionId

The id of the list/application where this list item definition belongs to.

Inital value: 0


				
private int[] $childListItemDefinitionIds

When working with hierarchical type definitions this member contains an array with the child list item definitions of this list item definition.

Inital value: null


				
private \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
private \Scrivo\String $icon

The location of an icon to identify the item definition in the user interface.

Inital value: null


				
private int $id

The id of the list item definition (DB key).

Inital value: 0


				
private int $pageDefinitionId

The id of the template to use for linked pages (optional).

Inital value: 0


				
private int[] $parentListItemDefinitionIds

When working with hierarchical type definitions this member contains an array with the parent list item definitions of this list item definition.

Inital value: null


				
private \Scrivo\String $phpSelector

A textual identification/key for this list item definition.

Inital value: null


				
private \Scrivo\String $title

A descriptive name for the list item definition.

Inital value: null


				
private \Scrivo\String $titleLabel

An alternative label for the title property of a list item in the user interface.

Inital value: null


				
private int $titleWidth

The width of the title property in the user interface for a list item (column width in list view mode).

Inital value: 0


Methods

public mixed __get(string $name)

Implementation of the readable properties using the PHP magic method __get().

Parameters:

Type Name Def. Description
string $name

The name of the property to get.

Returns:

mixed Implementation of the readable properties using the PHP magic method __get().

public __set(string $name, mixed $value)

Implementation of the writable properties using the PHP magic method __set().

Parameters:

Type Name Def. Description
string $name

The name of the property to set.

mixed $value

The value of the property to set.

public static delete(\Scrivo\Context $context, int $id)

Delete existing list item definition data from the database.

First it is is checked if it's possible to delete list item definition data, then the list item definition data including its dependencies is deleted from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The object id of the list item definition to select.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or if it is not possible to delete the list item definition data.
public static \Scrivo\ListItemDefinition fetch(\Scrivo\Context $context, int $id)

Fetch a list item definition object from the database using its object id.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The object id of the list item definition to select.

Returns:

\Scrivo\ListItemDefinition Fetch a list item definition object from the database using its object id.

private array getChildListItemDefinitionIds()

Get an array with the child list item definitions of this list item definition when working with hierarchical list type definitions.

Returns:

array Get an array with the child list item definitions of this list item definition when working with hierarchical list type definitions.

private array getParentListItemDefinitionIds()

Get an array with the parent list item definitions of this list item definition when working with hierarchical list type definitions.

Returns:

array Get an array with the parent list item definitions of this list item definition when working with hierarchical list type definitions.

public insert()

Insert new list item definition object data into the database.

First it is checked if the data of this list item definition object can be inserted into the database, then the data is inserted into the database. If no id was set a new object id is generated.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data.
public move(int $dir=\Scrivo\SequenceNo::MOVE_DOWN)

Move a list item definition one position up or down.

Parameters:

Type Name Def. Description
int $dir \Scrivo\SequenceNo::MOVE_DOWN

Direction of the move, see \Scrivo\SequenceNo:::MOVE_*

public static \Scrivo\ListItemDefinition[id] select(\Scrivo\Context $context, int $applicationDefinitionId, int $parentId=-1)

Select list item definitions from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $applicationDefinitionId

The id of the application for which to retrieve the list item definitions.

int $parentId -1

An optional parent list item definition id.

Returns:

\Scrivo\ListItemDefinition[id] Select list item definitions from the database.

private \Scrivo\object[id] selectChildListItemDefinitionIds()

Retrieve the ids of the child list item definitions.

List items definitions can have a parent child relation to enable you to create nested (hierarchical) lists.

Returns:

\Scrivo\object[id] Retrieve the ids of the child list item definitions.

private \Scrivo\object[id] selectParentListItemDefinitionIds()

Retrieve the ids of the parent list item definitions.

List items definitions can have a parent child relation to enable you to create nested (hierarchical) lists.

Returns:

\Scrivo\object[id] Retrieve the ids of the parent list item definitions.

private setApplicationDefinitionId(int $appId)

Set the id of the list/application where this list item definition belongs to.

It is only possible to set the application id for uninitialized list item definitions.

Parameters:

Type Name Def. Description
int $appId

The id of the list/application where this list item definition belongs to.

private setFields(\Scrivo\Context $context, array $rd)

Convenience method to set the fields of a list item definition object from an array (result set row).

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

array $rd

An array containing the field data using the database field names as keys.

private setIcon(\Scrivo\String $icon)

Set The location of an icon to identify the item definition in the user interface.

Parameters:

Type Name Def. Description
\Scrivo\String $icon

The location of an icon to identify the item definition in the user interface.

private setPageDefinitionId(int $pageDefinitionId)

Set The id of the template to use for linked pages (optional).

Parameters:

Type Name Def. Description
int $pageDefinitionId

The id of the template to use for linked pages (optional).

private setPhpSelector(\Scrivo\String $phpSelector)

Set A textual identification/key for this list item definition.

Parameters:

Type Name Def. Description
\Scrivo\String $phpSelector

A textual identification/key for this list item definition.

private setTitle(\Scrivo\String $title)

Set A descriptive name for the list item definition.

Parameters:

Type Name Def. Description
\Scrivo\String $title

A descriptive name for the list item definition.

private setTitleLabel(\Scrivo\String $titleLabel)

Set An alternative label for the title property of a list item in the user interface.

Parameters:

Type Name Def. Description
\Scrivo\String $titleLabel

An alternative label for the title property of a list item in the user interface.

private setTitleWidth(int $titleWidth)

Set The width of the title property in the user interface for a list item (column width in list view mode).

Parameters:

Type Name Def. Description
int $titleWidth

The width of the title property in the user interface for a list item (column width in list view mode).

public update()

Update existing list item definition object data in the database.

First it is checked if the data of this list item definition object can be updated in the database, then the data is updated in the database.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data.
public updateParentListItemDefinitionIds(array $pids)

Set the parent list item definitions for this list item definition in the database.

List items definitions can have a parent child relation to enable you to create nested (hierarchical) lists.

Parameters:

Type Name Def. Description
array $pids

An array with ids of parent list item definitions.

private static validateDelete(\Scrivo\Context $context, int $id)

Check if deletion of list item definition object data does not violate any business rules.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The object id of the list item definition to select.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or if it is not possible to delete the language data.
private validateInsert()

Check if this list item definition object can be inserted into the database.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data.
private validateUpdate()

Check if this list item definition object can be updated in the database.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data.

Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013