Class \Scrivo\PageDefinition

The PageDefinition class is used to create a definition for a page.

In the Scrivo user interface the editor will select a page definition to create a page from. The page definition holds a list of configurable properties (text blocks, images, urls, colors, etc) that can be edited for that page. See also the class PageDefinitionProperty that is used to define the individual properties and the class PageDefinitionTab that is used to distribute these properties over several tabs in the Scrivo user interface.

Furthermore the page definition holds a reference to the PHP script that should be executed when rendering pages with this page definition definition.

PageDefinitions can be suppressed in the user interface using the 'configOnly'property: for instance, there is no need to let the editor chose another page using the 'Home' page definition in a site. Or they can be shown conditionally in the interface: you can only select pages of page definition 'Main Menu' as sub pages of a page of page definition 'Home'. See the 'PageDefinitionHints' class for more details.

TODO: field type_set now is a semicolon seperated list (DB data), better to serialize this data. TODO: field search_index_rule has no function anymore.

Defined in: PageDefinition.php.


Constructor summary

Attr. Name / Description
public

PageDefinition($context)

Create an empty page definition object.

Properties

Attr. Type Name Description
\..\String $action The location of the PHP script to execute when rendering pages using this page definition.
boolean $configOnly Setting to suppress this page definition in the user interface.
int $defaultTabId The id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.
\..\String $description An additional description for the page definition.
read-only int $id The page definition id (DB key).
read-only object $properties The page definition properties.
read-only \..\PageDefinitionTab[] $tabs The page definition tabs.
\..\String $title A descriptive title for the page definition.
int[] $typeSet The set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

Member summary

Attr. Type Name Description
private \..\String $action The location of the PHP script to execute when rendering pages using this page definition.
private boolean $configOnly Setting to suppress this page definition in the user interface.
private \..\Context $context A Scrivo context.
private int $defaultTabId The id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.
private \..\String $description An additional description for the page definition.
private int $id The page definition id (DB key).
protected stdClass $properties The page definition properties as a PHP object in which the members correspond with the PHP selector names.
protected \..\PageDefinitionTab[] $tabs The page definition tabs.
private \..\String $title A descriptive title for the page definition.
private int[] $typeSet The set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

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().

private int[]

convertTypeSet($typeSetString)

Convert the semicolon seperated value from the database to an array.

public static

delete($context, $id)

Delete existing page definition data from the database.

public static \..\PageDefinition

fetch($context, $id)

Fetch a page definition object from the database using its object id.

private object

getProperties()

Get this page definition's property list.

private \..\PageDefinitionTab[]

getTabs()

Get this page definition's tabs.

public

insert()

Insert new page definition object data into the database.

public static \..\PageDefinition[]

select($context)

Select page definitions from the database.

public static \..\PageDefinition[]

selectSelectable($context, $parentId)

Select the list of page definitions that are selectable by a an editor.

private

setConfigOnly($configOnly)

Set the setting to suppress this page definition in the user interface.

private

setDefaultTabId($defaultTabId)

Set the id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.

private

setDescription($description)

Set the additional description for the page definition.

private

setFields($context, $rd)

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

private

setFileName($action)

Set the location of the PHP script to execute when rendering pages using this page definition.

private

setTitle($title)

Set A descriptive title for the page definition.

private

setTypeSet($typeSet)

Set the set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

public

update()

Update existing page definition object data in the database.

private static

validateDelete($context, $id)

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

private

validateInsert()

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

private

validateUpdate()

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

 


Constructor

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

Create an empty page definition object.

Parameters:

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

A Scrivo context.


Members


				
private \Scrivo\String $action

The location of the PHP script to execute when rendering pages using this page definition.

Inital value: null


				
private boolean $configOnly

Setting to suppress this page definition in the user interface.

Inital value: false


				
private \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
private int $defaultTabId

The id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.

Inital value: 0


				
private \Scrivo\String $description

An additional description for the page definition.

Inital value: null


				
private int $id

The page definition id (DB key).

Inital value: 0


				
protected \stdClass $properties

The page definition properties as a PHP object in which the members correspond with the PHP selector names.

Inital value: null


				
protected \Scrivo\PageDefinitionTab[] $tabs

The page definition tabs.

Inital value: null


				
private \Scrivo\String $title

A descriptive title for the page definition.

Inital value: null


				
private int[] $typeSet

The set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

Inital value: array()


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.

private int[] convertTypeSet(\Scrivo\String $typeSetString)

Convert the semicolon seperated value from the database to an array.

Parameters:

Type Name Def. Description
\Scrivo\String $typeSetString

typeSetString An semicolon seperated string.

Returns:

int[] Convert the semicolon seperated value from the database to an array.

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

Delete existing page definition data from the database.

First it is is checked if it's possible to delete page definition data, then the page 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 page definition to select.

Throws:

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

Fetch a page 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 page definition to select.

Returns:

\Scrivo\PageDefinition Fetch a page definition object from the database using its object id.

private object getProperties()

Get this page definition's property list.

Returns:

object Get this page definition's property list.

private \Scrivo\PageDefinitionTab[] getTabs()

Get this page definition's tabs.

Returns:

\Scrivo\PageDefinitionTab[] Get this page definition's tabs.

public insert()

Insert new page definition object data into the database.

First it is checked if the data of this page 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 static \Scrivo\PageDefinition[id] select(\Scrivo\Context $context)

Select page definitions from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

Returns:

\Scrivo\PageDefinition[id] Select page definitions from the database.

public static \Scrivo\PageDefinition[id] selectSelectable(\Scrivo\Context $context, int $parentId)

Select the list of page definitions that are selectable by a an editor.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $parentId

The id of the page where the editor wants to create a page underneath.

Returns:

\Scrivo\PageDefinition[id] Select the list of page definitions that are selectable by a an editor.

private setConfigOnly(boolean $configOnly)

Set the setting to suppress this page definition in the user interface.

Parameters:

Type Name Def. Description
boolean $configOnly

Setting to suppress this page definition in the user interface.

private setDefaultTabId(int $defaultTabId)

Set the id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.

Parameters:

Type Name Def. Description
int $defaultTabId

The id of the tab that should be shown in the user interface as the active tab when the editor selects a page using this page definition for editing.

private setDescription(\Scrivo\String $description)

Set the additional description for the page definition.

Parameters:

Type Name Def. Description
\Scrivo\String $description

An additional description for the page definition.

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

Convenience method to set the fields of a page 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 setFileName(\Scrivo\String $action)

Set the location of the PHP script to execute when rendering pages using this page definition.

Parameters:

Type Name Def. Description
\Scrivo\String $action

The location of the PHP script to execute when rendering pages using this page definition.

private setTitle(\Scrivo\String $title)

Set A descriptive title for the page definition.

Parameters:

Type Name Def. Description
\Scrivo\String $title

A descriptive title for the page definition.

private setTypeSet(array $typeSet)

Set the set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

Parameters:

Type Name Def. Description
array $typeSet

The set of page types that the user can select in the user interface when creating/modifing pages using this page definition.

public update()

Update existing page definition object data in the database.

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

Check if deletion of page 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 page 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 page 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 page 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