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.
Attr. | Name / Description |
---|---|
public |
PageDefinition($context) Create an empty page definition object. |
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. |
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. |
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 |
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 |
Check if this page definition object can be inserted into the database. |
|
private |
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.
View source: PageDefinition.php line 152.
Members
- private \Scrivo\String $action
-
The location of the PHP script to execute when rendering pages using this page definition.
Inital value: null
View source: PageDefinition.php line 105.
- private boolean $configOnly
-
Setting to suppress this page definition in the user interface.
Inital value: false
View source: PageDefinition.php line 111.
- private \Scrivo\Context $context
-
A Scrivo context.
Inital value: null
View source: PageDefinition.php line 145.
- 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
View source: PageDefinition.php line 126.
- private \Scrivo\String $description
-
An additional description for the page definition.
Inital value: null
View source: PageDefinition.php line 98.
- private int $id
-
The page definition id (DB key).
Inital value: 0
View source: PageDefinition.php line 86.
- protected \stdClass $properties
-
The page definition properties as a PHP object in which the members correspond with the PHP selector names.
Inital value: null
View source: PageDefinition.php line 133.
- protected \Scrivo\PageDefinitionTab[] $tabs
-
The page definition tabs.
Inital value: null
View source: PageDefinition.php line 139.
- private \Scrivo\String $title
-
A descriptive title for the page definition.
Inital value: null
View source: PageDefinition.php line 92.
- 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()
View source: PageDefinition.php line 118.
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().
View source: PageDefinition.php line 172.
- 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.
View source: PageDefinition.php line 194.
- 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.
View source: PageDefinition.php line 334.
- 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. View source: PageDefinition.php line 480.
- 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.
View source: PageDefinition.php line 516.
- private object getProperties()
-
Get this page definition's property list.
Returns:
object Get this page definition's property list.
View source: PageDefinition.php line 233.
- private \Scrivo\PageDefinitionTab[] getTabs()
-
Get this page definition's tabs.
Returns:
\Scrivo\PageDefinitionTab[] Get this page definition's tabs.
View source: PageDefinition.php line 246.
- 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. View source: PageDefinition.php line 363.
- 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.
View source: PageDefinition.php line 567.
- 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.
View source: PageDefinition.php line 608.
- 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.
View source: PageDefinition.php line 291.
- 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.
View source: PageDefinition.php line 320.
- 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.
View source: PageDefinition.php line 270.
- 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.
View source: PageDefinition.php line 214.
- 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.
View source: PageDefinition.php line 281.
- 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.
View source: PageDefinition.php line 260.
- 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.
View source: PageDefinition.php line 307.
- 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. View source: PageDefinition.php line 419.
- 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. View source: PageDefinition.php line 463.
- 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. View source: PageDefinition.php line 349.
- 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. View source: PageDefinition.php line 406.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013