Class \Scrivo\PageDefinitionTab

The class PageDefinitionTab is used to create tabs in the Scrivo user interface.

A page can have can a number of configurable properities, which are defined by the page definition. The PageDefinitionTab class is used as a means to distribute these properties over different tabs in the Scrivo user interface.

With respect to the content this class has no function at all, it is used for display purposes.

TODO: The page_definition_tab table is still used to hold property data for 'html_text' and 'application' tabs. Access to this data is handled bij the PageProperty class now. In a later version the data model should be changed also.

Defined in: PageDefinitionTab.php.


Constructor summary

Attr. Name / Description
public

PageDefinitionTab($context)

Create an empty page defintion tab object.

Constant summary

Name Description
TYPE_APPLICATION_TAB Constant to mark a tab as an application tab.
TYPE_HTML_TEXT_TAB Constant to mark a tab as an html text tab.
TYPE_PROPERTY_TAB Constant to mark a tab as a property tab.

Properties

Attr. Type Name Description
read-only int $id The page definition tab id (DB key).
int $pageDefinitionId The page definition id of the page definition where this tab belongs to.
\..\String $title A descriptive title for the tab.
int $type The type of the tab: one out of the PageDefinitionTab::TYPE_* constant values.

Member summary

Attr. Type Name Description
private \..\Context $context A Scrivo context.
private int $id The page definition tab id (DB key).
private int $pageDefinitionId The page definition id of the page definition where this tab belongs to.
private \..\String $title A descriptive title for the tab.
private int $type The type of the tab: one out of the PageDefinitionTab::TYPE_* constant values.

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 page defintion tab data from the database.

public static \..\PageDefinitionTab

fetch($context, $id)

Fetch a page defintion tab object from the database using its object id.

public

insert()

Insert new page defintion tab object data into the database.

public

move($dir)

Move an tab one position up (left) or down (right).

public static \..\PageDefinitionTab[]

select($context, $pageDefinitionId)

Select page defintion tabs from the database.

private

setFields($context, $rd)

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

private

setPageDefinitionId($pageDefinitionId)

Set The page definition id of the page definition where this tab belongs to.

private

setTitle($title)

Set A descriptive title for the tab.

private

toType($rd)

Set The type of the tab: one out of the PageDefinitionTab::TYPE_* constant values.

public

update()

Update existing page defintion tab object data in the database.

private static

validateDelete($context, $id)

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

private

validateInsert()

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

private

validateUpdate()

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

 


Constructor

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

Create an empty page defintion tab object.

Parameters:

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

A Scrivo context.


Constants

TYPE_APPLICATION_TAB

Constant to mark a tab as an application tab.

Value: 3

TYPE_HTML_TEXT_TAB

Constant to mark a tab as an html text tab.

Value: 2

TYPE_PROPERTY_TAB

Constant to mark a tab as a property tab.

Value: 1


Members


				
private \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
private int $id

The page definition tab id (DB key).

Inital value: 0


				
private int $pageDefinitionId

The page definition id of the page definition where this tab belongs to.

Inital value: 0


				
private \Scrivo\String $title

A descriptive title for the tab.

Inital value: null


				
private int $type

The type of the tab: one out of the PageDefinitionTab::TYPE_* constant values.

Inital value: self::TYPE_PROPERTY_TAB


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 page defintion tab data from the database.

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

Throws:

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

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

Returns:

\Scrivo\PageDefinitionTab Fetch a page defintion tab object from the database using its object id.

public insert()

Insert new page defintion tab object data into the database.

First it is checked if the data of this page defintion tab 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 an tab one position up (left) or down (right).

Parameters:

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

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

public static \Scrivo\PageDefinitionTab[id] select(\Scrivo\Context $context, int $pageDefinitionId)

Select page defintion tabs from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $pageDefinitionId

The id of the pageDefinition for which to retrieve the tabs.

Returns:

\Scrivo\PageDefinitionTab[id] Select page defintion tabs from the database.

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

Convenience method to set the fields of a page defintion tab 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 setPageDefinitionId(int $pageDefinitionId)

Set The page definition id of the page definition where this tab belongs to.

Parameters:

Type Name Def. Description
int $pageDefinitionId

The page definition id of the page definition where this tab belongs to.

private setTitle(\Scrivo\String $title)

Set A descriptive title for the tab.

Parameters:

Type Name Def. Description
\Scrivo\String $title

A descriptive title for the tab.

private toType(array $rd)

Set The type of the tab: one out of the PageDefinitionTab::TYPE_* constant values.

Parameters:

Type Name Def. Description
array $rd

Array (result set row) that contains the application_definition_id field.

public update()

Update existing page defintion tab object data in the database.

First it is checked if the data of this page defintion tab 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 defintion tab 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 defintion tab 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 defintion tab 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 defintion tab 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