Class \Scrivo\ListItemPropertyDefinition

Class to hold the property definitions for list item properties.

It holds the information to propery instantiate a list item property.

These properties are all derived from the ListItemProperty the class. The latter accounts for the persistent storage of the actual property data. But when an list item property is instantiated it should be in the form of a 'typed' list item property (such as image, url). The list item property defintion determines the type property and may hold addition configuration data.

Defined in: ListItemPropertyDefinition.php.


Constructor summary

Attr. Name / Description
public

ListItemPropertyDefinition($context)

Create an empty list item property definiton object.

Constant summary

Name Description
TYPE_CHECKBOX Value indicating a checkbox property.
TYPE_COLOR Value indicating a color property.
TYPE_DATE_TIME Value indicating a date property.
TYPE_HTML_TEXT Value indicating a html textarea property.
TYPE_IMAGE Value indicating an img property.
TYPE_INFO Value indicating an informative text.
TYPE_INPUT Value indicating an input field property.
TYPE_SELECT Value indicating a select list property.
TYPE_TAB Value indicating a tab in the user interface.
TYPE_TEXT Value indicating a textarea property.
TYPE_URL Value indicating a url property.

Properties

Attr. Type Name Description
int $applicationDefinitionId The id of the list/application definition where this list item property defintion belongs to.
read-only int $id The list item property defintion id (DB key).
boolean $inList Setting to show or hide this property in item lists in the user interface.
int $listItemDefinitionId The id of the list item definition where this list item property defintion belongs to.
\..\String $phpSelector A textual identification/key for this list item property.
\..\String $title A descriptive name for the list item property.
\..\String $type The list item property type, one out of ListItemProperty::TYPE_* constants.
stdClass $typeData Optional data needed to for this specific property type.

Member summary

Attr. Type Name Description
private int $applicationDefinitionId The id of the list/application definition where this list item property defintion belongs to.
private \..\Context $context A Scrivo context.
private int $id The list item property defintion id (DB key).
private boolean $inList Setting to show or hide this property in item lists in the user interface.
private int $listItemDefinitionId The id of the list item definition where this list item property defintion belongs to.
private \..\String $phpSelector A textual identification/key for this list item property.
private int $sequenceNo The sequence number of the list item definition defintion.
private \..\String $title A descriptive name for the list item property.
private \..\String $type The list item property type, one out of ListItemProperty::TYPE_* constants.
private stdClass $typeData Optional data needed to for this specific property type.

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 property definiton data from the database.

public static \..\ListItemPropertyDefinition

fetch($context, $id)

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

private \..\String

getTypeDataAsString()

Create a string representation of the type data member.

public static \..\String[]

getTypes()

Get an array of the possible property types.

public

insert()

Insert new list item property definiton object data into the database.

public

move($dir)

Move a list item property one position up or down.

private int

readStr($val)

Convert a string to its most likely type.

public static \..\ListItemPropertyDefinition[]

select($context, $applicationDefinitionId)

Select list item property definitons from the database.

public

setApplicationDefinitionId($appId)

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

private

setFields($context, $rd)

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

private

setInList($inList)

Set Setting to show or hide this property in item lists in the user interface.

private

setListItemDefinitionId($defId)

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

private

setPhpSelector($phpSelector)

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

private

setTitle($title)

Set A descriptive name for the list item property.

private

setType($type)

Set The list item property's type, one out of ListItemPropertyDefinition::TYPE_* constants.

private

setTypeData($typeData)

Set Optional data needed to for this specific property type.

private

setTypeDataAsString($str)

Set the type data member form a string representation.

private

setTypeDataFromRS($rs)

Convert plain text type data to an object.

public

update()

Update existing list item property definiton object data in the database.

private static

validateDelete($context, $id)

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

private

validateInsert()

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

private

validateUpdate()

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

 


Constructor

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

Create an empty list item property definiton object.

Parameters:

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

A Scrivo context.


Constants

TYPE_CHECKBOX

Value indicating a checkbox property.

Value: "checkbox"

TYPE_COLOR

Value indicating a color property.

Value: "color"

TYPE_DATE_TIME

Value indicating a date property.

Value: "datetime"

TYPE_HTML_TEXT

Value indicating a html textarea property.

Value: "html_text"

TYPE_IMAGE

Value indicating an img property.

Value: "img"

TYPE_INFO

Value indicating an informative text.

Value: "info"

TYPE_INPUT

Value indicating an input field property.

Value: "input"

TYPE_SELECT

Value indicating a select list property.

Value: "select"

TYPE_TAB

Value indicating a tab in the user interface.

Value: "tab"

TYPE_TEXT

Value indicating a textarea property.

Value: "text"

TYPE_URL

Value indicating a url property.

Value: "url"


Members


				
private int $applicationDefinitionId

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

Inital value: 0


				
private \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
private int $id

The list item property defintion id (DB key).

Inital value: 0


				
private boolean $inList

Setting to show or hide this property in item lists in the user interface.

Inital value: false


				
private int $listItemDefinitionId

The id of the list item definition where this list item property defintion belongs to.

Inital value: 0


				
private \Scrivo\String $phpSelector

A textual identification/key for this list item property.

Inital value: null


				
private int $sequenceNo

The sequence number of the list item definition defintion.

Inital value: 0


				
private \Scrivo\String $title

A descriptive name for the list item property.

Inital value: null


				
private \Scrivo\String $type

The list item property type, one out of ListItemProperty::TYPE_* constants.

Inital value: ""


				
private \stdClass $typeData

Optional data needed to for this specific property type.

Inital value: null


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 property definiton data from the database.

First it is is checked if it's possible to delete list item property definiton data, then the list item property definiton 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 property definiton 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 property definiton data.
public static \Scrivo\ListItemPropertyDefinition fetch(\Scrivo\Context $context, int $id)

Fetch a list item property definiton 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 property definiton to select.

Returns:

\Scrivo\ListItemPropertyDefinition Fetch a list item property definiton object from the database using its object id.

private \Scrivo\String getTypeDataAsString()

Create a string representation of the type data member.

Returns:

\Scrivo\String Create a string representation of the type data member.

public static \Scrivo\String[] getTypes()

Get an array of the possible property types.

Returns:

\Scrivo\String[] Get an array of the possible property types.

public insert()

Insert new list item property definiton object data into the database.

First it is checked if the data of this list item property definiton 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 property one position up or down.

Parameters:

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

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

private int readStr(string $val)

Convert a string to its most likely type.

Parameters:

Type Name Def. Description
string $val

The value to convert to either an int, float or \Scrivo\String.

Returns:

int Convert a string to its most likely type.

public static \Scrivo\ListItemPropertyDefinition[id] select(\Scrivo\Context $context, int $applicationDefinitionId)

Select list item property definitons 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 properties.

Returns:

\Scrivo\ListItemPropertyDefinition[id] Select list item property definitons from the database.

public setApplicationDefinitionId(int $appId)

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

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

Parameters:

Type Name Def. Description
int $appId

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

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

Convenience method to set the fields of a list item property definiton 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 setInList(boolean $inList)

Set Setting to show or hide this property in item lists in the user interface.

Parameters:

Type Name Def. Description
boolean $inList

Setting to show or hide this property in item lists in the user interface.

private setListItemDefinitionId(int $defId)

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

Parameters:

Type Name Def. Description
int $defId

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

private setPhpSelector(\Scrivo\String $phpSelector)

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

Parameters:

Type Name Def. Description
\Scrivo\String $phpSelector

A textual identification/key for this list item property.

private setTitle(\Scrivo\String $title)

Set A descriptive name for the list item property.

Parameters:

Type Name Def. Description
\Scrivo\String $title

A descriptive name for the list item property.

private setType(string $type)

Set The list item property's type, one out of ListItemPropertyDefinition::TYPE_* constants.

Parameters:

Type Name Def. Description
string $type

The list item property's type, one out of ListItemPropertyDefinition::TYPE_* constants.

private setTypeData(\stdClass $typeData)

Set Optional data needed to for this specific property type.

Parameters:

Type Name Def. Description
\stdClass $typeData

Optional data needed to for this specific property type.

private setTypeDataAsString(\Scrivo\String $str)

Set the type data member form a string representation.

The format of the string should be NAME1=VALUE1\nNAME2=VALUE2\nNAME3...etc.

Parameters:

Type Name Def. Description
\Scrivo\String $str

The type data string.

private setTypeDataFromRS(array $rs)

Convert plain text type data to an object.

Parameters:

Type Name Def. Description
array $rs

The type data as stored in the database (result set row).

public update()

Update existing list item property definiton object data in the database.

First it is checked if the data of this list item property definiton 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.
private static validateDelete(\Scrivo\Context $context, int $id)

Check if deletion of list item property definiton 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 property definiton 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 property definiton 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 property definiton 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