Class \Scrivo\Page

A Scrivo Page is most essential Scrivo entity.

A Scrivo page models a HTML Page (most of the times). The idea is that a Web site is a set of pages. The dynamic content that should be presented on these web pages is contained by Scrivo Page objects.

Therefore a Scrivo page contains some of the standard fields that are typical for a HTML page suchs as the page title, description and keywords along with some managerial (CMS) information as online and ofline date.

What other content should be displayed on the page is determined by its page defintion. Each page is constructed using a a page defintion and this defintion holds the defintions for all other data (properties, texts, lists, applications) that can added to the page.

The Scrivo editor interface provides the means to the editor to create pages and fill in the page properties.

How the content that is assigned to the page should be displayed on the page is determined by the page template. The page defintion has a member that refers to the page template: a user defined script that renders the actual page.

Defined in: Page.php.


Constructor summary

Attr. Name / Description
public

Page($context)

Create an empty page object.

Constant summary

Name Description
TYPE_APPLICATION Value indicating an application: a page that has no functionality as a page but hosts an application in the scrivo user interface.
TYPE_NAVIGABLE_PAGE Value indicating a page that should be shown in the site menu.
TYPE_NAVIGATION_ITEM Value indicating a navigation item (page that only functions as a node).
TYPE_NON_NAVIGABLE_PAGE Value indicating a page that should not be shown in the site menu.
TYPE_SUB_FOLDER Value indicating an extra node to hold automatically generated pages that are linked to list items.

Properties

Attr. Type Name Description
read-only \..\PageSet $children The child pages of this page.
\..\Context $context A Scrivo context of this page.
read-only DateTime $dateCreated The date/time that this page was created.
read-only DateTime $dateModified The last date/time that this page was modified.
DateTime $dateOffline The date/time this page need to go offline.
DateTime $dateOnline The date/time this page need to go online.
read-only \..\PageDefinition $definition The page definition of this page.
write-only int $definitionId The id of the page template.
\..\String $description The page description (<description>).
boolean $hasStaging Setting to indicate if the page can be staged.
read-only int $id The page id (DB key).
read-only \..\booleand $isOnline If this page is online or not.
\..\String $javascript A javascript script for this page (<script>).
\..\String $keywords The keywords for this page (<keywords>).
read-only \..\Language $language The main language for the page (<html lang>).
write-only int $languageId The id of the main language for the page (<html lang>).
read-only \..\PageSet $navigableChildren The navigable child pages of this page.
int $parentId The id of the parent page.
read-only \..\PageSet $path The parent pages of this page.
read-only \..\PropertySet $properties The page properties as a PHP object in which the members correspond with the PHP selector names.
read-only \..\RoleSet $roles The attached roles.
\..\String $stylesheet Additional CSS syle rules for this page (<stylesheet>).
\..\String $title The page title (<title>).
int $type The page type: one out of the Page::TYPE_* constant values.

Member summary

Attr. Type Name Description
private \..\PageSet $children The child pages of this page.
private \..\Context $context A Scrivo context.
private DateTime $dateCreated The date/time that this page was created.
private DateTime $dateModified The last date/time that this page was modified.
private DateTime $dateOffline The date/time this page need to go offline.
private DateTime $dateOnline The date/time this page need to go online.
private int $definitionId The id of the page template.
private \..\String $description The page description (<description>).
private boolean $hasStaging Setting to indicate if the page can be staged.
private int $id The page id (DB key).
private \..\String $javascript A javascript script for this page (<script>).
private \..\String $keywords The keywords for this page (<keywords>).
private int $languageId The id the main language for the page (<html lang>).
private int $parentId The id of the parent page.
private \..\PageSet $path The parent pages of this page.
private \..\PropertySet $properties The page properties as a PHP object in which the members correspond with the PHP selector names.
private \..\RoleSet $roles The attached roles.
private \..\String $stylesheet Additional CSS syle rules for this page (<stylesheet>).
private \..\String $title The page title (<title>).
private int $type The page type: one out of the Page::TYPE_* constant values.
private int $version The current version of the page: -1: scratch version, 0 live version, 1 and up versions.

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 an existing page from the database.

public static

fetch($context, $id)

Retrieve a page from the database or cache.

private \..\PageSet

getChildren()

Get the child pages of this page.

private boolean

getIsOnline()

Check if this page is online.

private \..\PageSet

getNavigableChildren()

Get the navigable child pages of this page.

private \..\PageSet

getPath()

Get the child pages of this page.

private object

getProperties()

Get this pages's property list.

public

insert()

Insert a new page into the database.

public

move($dir)

Move a page one position up or down amongst its siblings.

private static \..\PageSet

selectChildren($page)

Select child pages from the database.

private static \..\PageSet

selectPath($page)

Select the page path.

private static

selectProperties($context, $pages)

Select the page properties from the database.

private static

selectRoles($context, $pages)

Select the roles for this page.

private

setContext($context)

Set the page context.

private

setDateOffline($dateOffline)

Set the date/time this page need to go offline.

private

setDateOnline($dateOnline)

Set the date/time this page needs to go online.

private

setDefinitionId($definitionId)

Set the id of the page template.

private

setDescription($description)

Set the page description (<description>).

private

setFields($context, $rd)

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

private

setHasStaging($hasStaging)

Set the setting to indicate if a page can be staged.

private

setJavascript($javascript)

Set a javascript script for this page (<script>).

private

setKeywords($keywords)

Set the keywords for this page (<keywords>).

private

setLanguageId($languageId)

Set the id the main language for the page (<html lang>).

private

setParentPageId($parentId)

Set the id of the parent page.

private

setStylesheet($stylesheet)

Set additional CSS syle rules for this page (<stylesheet>).

private

setTitle($title)

Set The page title (<title>).

private

setType($type)

Set the page type: one out of the Page::TYPE_* constant values.

public static

touch($context, $id)

Touch (update modification time) a page.

public

update()

Update an existing page in the database.

private static

validateDelete($context, $id)

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

private

validateInsert()

Check if the page data can be inserted into the database.

private

validateUpdate()

Check if the page data can be updated in the database.

 


Constructor

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

Create an empty page object.

Parameters:

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

A Scrivo context.


Constants

TYPE_APPLICATION

Value indicating an application: a page that has no functionality as a page but hosts an application in the scrivo user interface.

Value: 5

TYPE_NAVIGABLE_PAGE

Value indicating a page that should be shown in the site menu.

Value: 1

TYPE_NAVIGATION_ITEM

Value indicating a navigation item (page that only functions as a node).

Value: 0

TYPE_NON_NAVIGABLE_PAGE

Value indicating a page that should not be shown in the site menu.

Value: 2

TYPE_SUB_FOLDER

Value indicating an extra node to hold automatically generated pages that are linked to list items.

Value: 4


Members


				
private \Scrivo\PageSet $children

The child pages of this page.

Inital value: null


				
private \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
private \DateTime $dateCreated

The date/time that this page was created.

Inital value: null


				
private \DateTime $dateModified

The last date/time that this page was modified.

Inital value: null


				
private \DateTime $dateOffline

The date/time this page need to go offline.

Inital value: null


				
private \DateTime $dateOnline

The date/time this page need to go online.

Inital value: null


				
private int $definitionId

The id of the page template.

Inital value: 0


				
private \Scrivo\String $description

The page description (<description>).

Inital value: null


				
private boolean $hasStaging

Setting to indicate if the page can be staged.

Inital value: 0


				
private int $id

The page id (DB key).

Inital value: 0


				
private \Scrivo\String $javascript

A javascript script for this page (<script>).

Inital value: null


				
private \Scrivo\String $keywords

The keywords for this page (<keywords>).

Inital value: null


				
private int $languageId

The id the main language for the page (<html lang>).

Inital value: 0


				
private int $parentId

The id of the parent page.

Inital value: 0


				
private \Scrivo\PageSet $path

The parent pages of this page.

Inital value: null


				
private \Scrivo\PropertySet $properties

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

Inital value: null


				
private \Scrivo\RoleSet $roles

The attached roles.

Inital value: null


				
private \Scrivo\String $stylesheet

Additional CSS syle rules for this page (<stylesheet>).

Inital value: null


				
private \Scrivo\String $title

The page title (<title>).

Inital value: null


				
private int $type

The page type: one out of the Page::TYPE_* constant values.

Inital value: 0


				
private int $version

The current version of the page: -1: scratch version, 0 live version, 1 and up versions.

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 an existing page from the database.

First it is is checked if it's possible to delete this page then the page data including its dependecies is deleted from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The id of the page to delete.

Throws:

Exception Type Description
\Scrivo\ApplicationException If it is not possible to delete this page.
public static fetch(\Scrivo\Context $context, int $id=null)

Retrieve a page from the database or cache.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id null

An object id of a page.

Throws:

Exception Type Description
\Scrivo\ApplicationException if the page was not readable for the user defined in the context.
private \Scrivo\PageSet getChildren()

Get the child pages of this page.

Returns:

\Scrivo\PageSet Get the child pages of this page.

private boolean getIsOnline()

Check if this page is online.

Returns:

boolean Check if this page is online.

private \Scrivo\PageSet getNavigableChildren()

Get the navigable child pages of this page.

Returns:

\Scrivo\PageSet Get the navigable child pages of this page.

private \Scrivo\PageSet getPath()

Get the child pages of this page.

Returns:

\Scrivo\PageSet Get the child pages of this page.

private object getProperties()

Get this pages's property list.

Returns:

object Get this pages's property list.

public insert()

Insert a new page into the database.

First the data fields of this page will be validated. If no id is set a new object id is generated. Then the data is inserted into to database.

Throws:

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

Move a page one position up or down amongst its siblings.

Parameters:

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

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

private static \Scrivo\PageSet selectChildren(\Scrivo\Page $page)

Select child pages from the database.

Parameters:

Type Name Def. Description
\Scrivo\Page $page

A Scrivo page.

Returns:

\Scrivo\PageSet Select child pages from the database.

private static \Scrivo\PageSet selectPath(\Scrivo\Page $page)

Select the page path.

Parameters:

Type Name Def. Description
\Scrivo\Page $page

A Scrivo page.

Returns:

\Scrivo\PageSet Select the page path.

private static selectProperties(\Scrivo\Context $context, array $pages)

Select the page properties from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A valid Scrivo context.

array $pages

the set of pages for which to retrieve the properties.

private static selectRoles(\Scrivo\Context $context, array $pages)

Select the roles for this page.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A valid Scrivo context.

array $pages

the set of pages for which to retrieve the properties.

private setContext(\Scrivo\Context $context)

Set the page context.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

private setDateOffline(\DateTime $dateOffline=null)

Set the date/time this page need to go offline.

Parameters:

Type Name Def. Description
\DateTime $dateOffline null

The date/time this page need to go offline.

private setDateOnline(\DateTime $dateOnline)

Set the date/time this page needs to go online.

Parameters:

Type Name Def. Description
\DateTime $dateOnline

The date/time this page needs to go online.

private setDefinitionId(int $definitionId)

Set the id of the page template.

Parameters:

Type Name Def. Description
int $definitionId

The id ot the page template.

private setDescription(\Scrivo\String $description)

Set the page description (<description>).

Parameters:

Type Name Def. Description
\Scrivo\String $description

The page description (<description>).

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 setHasStaging(boolean $hasStaging)

Set the setting to indicate if a page can be staged.

Parameters:

Type Name Def. Description
boolean $hasStaging

Setting to indicate if a page can be staged.

private setJavascript(\Scrivo\String $javascript)

Set a javascript script for this page (<script>).

Parameters:

Type Name Def. Description
\Scrivo\String $javascript

A javascript script for this page (<script>).

private setKeywords(\Scrivo\String $keywords)

Set the keywords for this page (<keywords>).

Parameters:

Type Name Def. Description
\Scrivo\String $keywords

The keywords for this page (<keywords>).

private setLanguageId(int $languageId)

Set the id the main language for the page (<html lang>).

Parameters:

Type Name Def. Description
int $languageId

The id the main language for the page (<html lang>).

private setParentPageId(int $parentId)

Set the id of the parent page.

Parameters:

Type Name Def. Description
int $parentId

The id of the parent page.

private setStylesheet(\Scrivo\String $stylesheet)

Set additional CSS syle rules for this page (<stylesheet>).

Parameters:

Type Name Def. Description
\Scrivo\String $stylesheet

Additional CSS syle rules for this page (<stylesheet>).

private setTitle(\Scrivo\String $title)

Set The page title (<title>).

Parameters:

Type Name Def. Description
\Scrivo\String $title

The page title (<title>).

private setType(int $type)

Set the page type: one out of the Page::TYPE_* constant values.

Parameters:

Type Name Def. Description
int $type

The page type: one out of the Page::TYPE_* constant values.

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

Touch (update modification time) a page.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The id of the page to touch.

public update()

Update an existing page in the database.

First the data fields of this user will be validated, then the data is updated in to database.

Throws:

Exception Type Description
\Scrivo\ApplicationException If one or more of the fields contain invalid data.
private static validateDelete(\Scrivo\Context $context, int $id)

Check if deletion of page 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 the page data can be inserted into the database.

Throws:

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

Check if the page data can be updated in the database.

Throws:

Exception Type Description
\Scrivo\ApplicationException If the data is not accessible, one or more of the fields contain invalid data or some other business rule is not met.

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