Class \Scrivo\PagePropertyDefinition
The PagePropertyDefinition is used to create definions for page properties.
Page properties are page objects (text blocks, images, urls, colors, etc) that can be edited using the Scrivo user interface. A page property definition holds the definition of a page property.
TODO: full tab html text entry properties still store their data into the etPageDefinition_ELEMENT table.
Defined in: PagePropertyDefinition.php.
Attr. | Name / Description |
---|---|
public |
PagePropertyDefinition($context) Create an empty page property defintion object. |
Name | Description |
---|---|
TYPE_APPLICATION_TAB | Value indicating there's an application the tab. |
TYPE_CHECKBOX | Value indicating a checkbox property. |
TYPE_COLOR | Value indicating a color property. |
TYPE_COLOR_LIST | Value indicating a color select list property. |
TYPE_DATE_TIME | Value indicating a datetime property. |
TYPE_HTML_TEXT | Value indicating a html textarea property. |
TYPE_HTML_TEXT_TAB | Value indicating a single large html textarea on a tab. |
TYPE_IMAGE | Value indicating an img property. |
TYPE_INPUT | Value indicating an input field property. |
TYPE_SELECT | Value indicating a select list property. |
TYPE_TEXT | Value indicating a textarea property. |
TYPE_URL | Value indicating a url property. |
Attr. | Type | Name | Description |
---|---|---|---|
read-only | int | $id | The page property definition id (DB key). |
int | $pageDefinitionId | The id of the page definition to which this page property definition belongs. | |
int | $pageDefinitionTabId | An optional id of a page definition tab on which the page property is displayed. | |
\..\String | $phpSelector | A textual identification/key for this page property. | |
\..\String | $title | A descriptive name for the page property. | |
\..\String | $type | The page property type, one out of PagePropertyDefinition::TYPE_* constants. | |
stdClass | $typeData | Optional data needed to for this specific page property. |
Attr. | Type | Name | Description |
---|---|---|---|
private | \..\Context | $context | A Scrivo context. |
private | int | $id | The page property definition id (DB key). |
private | int | $pageDefinitionId | The id of the pageDefinition to which this page property definition belongs. |
private | int | $pageDefinitionTabId | An optional id of a pageDefinition tab on which the page property is displayed. |
private | \..\String | $phpSelector | A textual identification/key for this page property. |
private | boolean | $resequence | A flag to indicate a resquence on update |
private | \..\String | $title | A descriptive name for the page property. |
private | \..\String | $type | The page property type, one out of PagePropertyDefinition::TYPE_* constants. |
private | stdClass | $typeData | Optional data needed to for this specific page property. |
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 |
Check if the current php selector is unique. |
|
public static |
delete($context, $id) Delete existing page property defintion data from the database. |
|
public static | \..\PagePropertyDefinition |
fetch($context, $id) Fetch a page property defintion object from the database using its object id. |
private | \..\String |
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 page property defintion object data into the database. |
|
public |
move($dir) Move a property one position up or down. |
|
private | int |
readStr($val) Convert a string to its most likely type. |
public static | \..\PagePropertyDefinition[] |
select($context, $pageDefinitionId) Select page property defintions from the database. |
private |
setFields($context, $rd) Convenience method to set the fields of a page property defintion object from an array (result set row). |
|
private |
setPageDefinitionId($pageDefinitionId) Set the id of the page definition to which this page property definition belongs. |
|
private |
setPageDefinitionTabId($pageDefinitionTabId) Set the id of a page definition tab (optional) on which this page property is displayed. |
|
private |
setPhpSelector($phpSelector) Set the textual identification/key for this page property. |
|
private |
setTitle($title) Set the descriptive name for the page property. |
|
private |
setType($type) Set the page property type, one out of the \Scrivo\PagePropertyDefinition::TYPE_* constants. |
|
private |
setTypeData($typeData) Set the data (optional) needed to for this specific page 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 page property defintion object data in the database. |
|
private |
Set page property definition data for application definitions in the page_definition_tab table. |
|
private |
Set page property definition data for html text tab definitions in the page_definition_tab table. |
|
private static |
validateDelete($context, $id) Check if deletion of page property defintion object data does not violate any business rules. |
|
private |
Check if this page property defintion object can be inserted into the database. |
|
private |
Check if this page property defintion object can be updated in the database. |
Constructor
- public PagePropertyDefinition(\Scrivo\Context $context=null)
-
Create an empty page property defintion object.
Parameters:
Type Name Def. Description \Scrivo\Context $context null A Scrivo context.
View source: PagePropertyDefinition.php line 185.
Constants
- TYPE_APPLICATION_TAB
-
Value indicating there's an application the tab.
Value: "application_tab"
View source: PagePropertyDefinition.php line 116.
- TYPE_CHECKBOX
-
Value indicating a checkbox property.
Value: "checkbox"
View source: PagePropertyDefinition.php line 101.
- TYPE_COLOR
-
Value indicating a color property.
Value: "color"
View source: PagePropertyDefinition.php line 86.
- TYPE_COLOR_LIST
-
Value indicating a color select list property.
Value: "colorlist"
View source: PagePropertyDefinition.php line 81.
- TYPE_DATE_TIME
-
Value indicating a datetime property.
Value: "datetime"
View source: PagePropertyDefinition.php line 91.
- TYPE_HTML_TEXT
-
Value indicating a html textarea property.
Value: "html_text"
View source: PagePropertyDefinition.php line 106.
- TYPE_HTML_TEXT_TAB
-
Value indicating a single large html textarea on a tab.
Value: "html_text_tab"
View source: PagePropertyDefinition.php line 111.
- TYPE_IMAGE
-
Value indicating an img property.
Value: "img"
View source: PagePropertyDefinition.php line 66.
- TYPE_INPUT
-
Value indicating an input field property.
Value: "input"
View source: PagePropertyDefinition.php line 71.
- TYPE_SELECT
-
Value indicating a select list property.
Value: "select"
View source: PagePropertyDefinition.php line 76.
- TYPE_TEXT
-
Value indicating a textarea property.
Value: "text"
View source: PagePropertyDefinition.php line 121.
- TYPE_URL
-
Value indicating a url property.
Value: "url"
View source: PagePropertyDefinition.php line 96.
Members
- private \Scrivo\Context $context
-
A Scrivo context.
Inital value: null
View source: PagePropertyDefinition.php line 172.
- private int $id
-
The page property definition id (DB key).
Inital value: 0
View source: PagePropertyDefinition.php line 127.
- private int $pageDefinitionId
-
The id of the pageDefinition to which this page property definition belongs.
Inital value: 0
View source: PagePropertyDefinition.php line 134.
- private int $pageDefinitionTabId
-
An optional id of a pageDefinition tab on which the page property is displayed.
Inital value: 0
View source: PagePropertyDefinition.php line 166.
- private \Scrivo\String $phpSelector
-
A textual identification/key for this page property.
Inital value: null
View source: PagePropertyDefinition.php line 146.
- private boolean $resequence
-
A flag to indicate a resquence on update
Inital value: false
View source: PagePropertyDefinition.php line 178.
- private \Scrivo\String $title
-
A descriptive name for the page property.
Inital value: null
View source: PagePropertyDefinition.php line 140.
- private \Scrivo\String $type
-
The page property type, one out of PagePropertyDefinition::TYPE_* constants.
Inital value: ""
View source: PagePropertyDefinition.php line 153.
- private \stdClass $typeData
-
Optional data needed to for this specific page property.
Inital value: null
View source: PagePropertyDefinition.php line 159.
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: PagePropertyDefinition.php line 205.
- 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: PagePropertyDefinition.php line 225.
- private checkUniquePhpSelector()
-
Check if the current php selector is unique.
Throws:
Exception Type Description \Scrivo\ApplicationException If one or more of the fields contain invalid data. View source: PagePropertyDefinition.php line 462.
- public static delete(\Scrivo\Context $context, int $id)
-
Delete existing page property defintion data from the database.
First it is is checked if it's possible to delete page property defintion data, then the page property defintion data including its dependecies is deleted from the database.
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $id The object id of the page property defintion to select.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible or if it is not possible to delete the page property defintion data. View source: PagePropertyDefinition.php line 722.
- public static \Scrivo\PagePropertyDefinition fetch(\Scrivo\Context $context, int $id)
-
Fetch a page property defintion 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 property defintion to select.
Returns:
\Scrivo\PagePropertyDefinition Fetch a page property defintion object from the database using its object id.
View source: PagePropertyDefinition.php line 781.
- 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.
View source: PagePropertyDefinition.php line 425.
- public static \Scrivo\String[] getTypes()
-
Get an array of the possible property types.
Returns:
\Scrivo\String[] Get an array of the possible property types.
View source: PagePropertyDefinition.php line 264.
- public insert()
-
Insert new page property defintion object data into the database.
First it is checked if the data of this page property defintion 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: PagePropertyDefinition.php line 503.
- public move(int $dir=\Scrivo\SequenceNo::MOVE_DOWN)
-
Move a 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_*
View source: PagePropertyDefinition.php line 760.
- 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.
View source: PagePropertyDefinition.php line 386.
- public static \Scrivo\PagePropertyDefinition[id] select(\Scrivo\Context $context, int $pageDefinitionId)
-
Select page property defintions from the database.
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $pageDefinitionId An id of a page definition for which to select its properties.
Returns:
\Scrivo\PagePropertyDefinition[id] Select page property defintions from the database.
View source: PagePropertyDefinition.php line 851.
- private setFields(\Scrivo\Context $context, array $rd)
-
Convenience method to set the fields of a page property defintion 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: PagePropertyDefinition.php line 246.
- private setPageDefinitionId(int $pageDefinitionId)
-
Set the id of the page definition to which this page property definition belongs.
Parameters:
Type Name Def. Description int $pageDefinitionId The id of the page definition to which this page property definition belongs.
View source: PagePropertyDefinition.php line 288.
- private setPageDefinitionTabId(int $pageDefinitionTabId)
-
Set the id of a page definition tab (optional) on which this page property is displayed.
Note that TYPE_HTML_TEXT_TAB and TYPE_HTML_TEXT_TAB types have their own exclusive tabs and setting their tab is therefore prohibited.
Parameters:
Type Name Def. Description int $pageDefinitionTabId An optional id of a page definition tab on which this page property is displayed.
View source: PagePropertyDefinition.php line 364.
- private setPhpSelector(\Scrivo\String $phpSelector)
-
Set the textual identification/key for this page property.
Parameters:
Type Name Def. Description \Scrivo\String $phpSelector A textual identification/key for this page property.
View source: PagePropertyDefinition.php line 311.
- private setTitle(\Scrivo\String $title)
-
Set the descriptive name for the page property.
Parameters:
Type Name Def. Description \Scrivo\String $title A descriptive name for the page property.
View source: PagePropertyDefinition.php line 301.
- private setType(string $type)
-
Set the page property type, one out of the \Scrivo\PagePropertyDefinition::TYPE_* constants.
Note that TYPE_HTML_TEXT_TAB and TYPE_HTML_TEXT_TAB behave differently than normal properties so type juggling between these and other types is not allowed.
Parameters:
Type Name Def. Description string $type The property type, one out of the \Scrivo\PagePropertyDefinition::TYPE_* constants.
View source: PagePropertyDefinition.php line 325.
- private setTypeData(\stdClass $typeData)
-
Set the data (optional) needed to for this specific page property type.
Parameters:
Type Name Def. Description \stdClass $typeData Optional data needed to for this specific page property type.
View source: PagePropertyDefinition.php line 351.
- 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.
View source: PagePropertyDefinition.php line 439.
- 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.
View source: PagePropertyDefinition.php line 402.
- public update()
-
Update existing page property defintion object data in the database.
First it is checked if the data of this page property defintion 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: PagePropertyDefinition.php line 584.
- private updateApplicationTab()
-
Set page property definition data for application definitions in the page_definition_tab table.
View source: PagePropertyDefinition.php line 674.
- private updateHtmlTextTab()
-
Set page property definition data for html text tab definitions in the page_definition_tab table.
View source: PagePropertyDefinition.php line 642.
- private static validateDelete(\Scrivo\Context $context, int $id)
-
Check if deletion of page property defintion 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 property defintion 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: PagePropertyDefinition.php line 705.
- private validateInsert()
-
Check if this page property defintion 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: PagePropertyDefinition.php line 488.
- private validateUpdate()
-
Check if this page property defintion 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: PagePropertyDefinition.php line 570.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013