Class \Scrivo\ItemList
Item lists (or Scrivo list) are a very versitle way of adding list like data to a page (faq, comments, news and even a forurm like)
Defined in: ItemList.php.
Attr. | Name / Description |
---|---|
protected |
ItemList($context, $pageId, $pagePropertyDefinitionId) Construct an item list. |
Attr. | Type | Name | Description |
---|---|---|---|
private | int | $applicationDefinitionId | Id of the application definition. |
private | \..\Context | $context | A Scrivo context. |
private | int | $folderId | Optional reference to a page that is parent for pages linked to list items. |
private | int | $id | The list/application id (DB key). |
private | array[] | $listPids | A list of list item pids. |
private | int | $pageId | Id of the page where this list instance is associated with. |
private | int | $pagePropertyDefinitionId | Id of the list definition. |
private | \..\RoleSet | $roles | The attached roles. |
Attr. | Type | Name / Description |
---|---|---|
public | mixed |
__get($name) Implementation of the readable properties using the PHP magic method __get(). |
private | int |
createLinkedPage($item, $def) Create a linked page for a list item. |
public |
deleteItem($id) Delete existing list item data from the database. |
|
public static |
fetch($context, $pageId, $defintionId) Retrieve an item list from the cache or database. |
|
private | int |
getDefinitionId($phpSelector) Get the list item definition id using the phpSelector of the list item definition. |
public | \..\ListItem[] |
getItems($parentId) Retrieve a sub list. |
private |
insert() Insert new list object data into the database. |
|
private |
insertItem($item) Insert new list item object data into the database. |
|
public |
moveItem($id, $dir) Move a list item to another position amongst its siblings. |
|
public | \..\ListItem |
newItem($phpSelector) Create a new list item to insert in the database. |
private |
Remove this list (including all sub lists from the cache). |
|
public |
saveItem($item) Save list item data to the database. |
|
private | \..\ListItem[] |
select($parentId) Select list items from the database. |
private | \..\PropertySet |
selectEmptyProperties($definitionId) Create a set of blank properties for a given list item definition. |
private static | \..\ListItemProperty[] |
selectProperties($context, $listId) Select list item properties from the database. |
private |
update() Update list object data in the database. |
|
private |
updateItem($item) Update existing list item object data in the database. |
|
private |
updateProperty($prp, $itemId) Update an existing list item property in the database. |
Constructor
- protected ItemList(\Scrivo\Context $context, string $pageId, string $pagePropertyDefinitionId)
-
Construct an item list.
Item lists are Scrivo application and therefore linked to a page and an application definition.
Scrivo lists are never created as explicitly, but assumed to exist if a page with a list type application definition does exist. If not the list is created on the fly based upon its defintion. Because actual list creation is an internal issue and not ment to do expicitly the constructor is not public.
To create a list see 'fetch'.
Parameters:
Type Name Def. Description \Scrivo\Context $context A valid Scrivo context
string $pageId The id of the page that hosts the application.
string $pagePropertyDefinitionId The page property definition id.
View source: ItemList.php line 109.
Members
- private int $applicationDefinitionId
-
Id of the application definition.
Inital value: 0
View source: ItemList.php line 60.
- private \Scrivo\Context $context
-
A Scrivo context.
Inital value: null
View source: ItemList.php line 91.
- private int $folderId
-
Optional reference to a page that is parent for pages linked to list items.
Inital value: 0
View source: ItemList.php line 73.
- private int $id
-
The list/application id (DB key).
Inital value: 0
View source: ItemList.php line 48.
- private array[] $listPids
-
A list of list item pids.
Inital value: null
View source: ItemList.php line 79.
- private int $pageId
-
Id of the page where this list instance is associated with.
Inital value: 0
View source: ItemList.php line 66.
- private int $pagePropertyDefinitionId
-
Id of the list definition.
Inital value: 0
View source: ItemList.php line 54.
- private \Scrivo\RoleSet $roles
-
The attached roles.
View source: ItemList.php line 85.
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: ItemList.php line 194.
- private int createLinkedPage(\Scrivo\ListItem $item, \Scrivo\ListItemDefinition $def)
-
Create a linked page for a list item.
Parameters:
Type Name Def. Description \Scrivo\ListItem $item The list item for which to create the linked page.
\Scrivo\ListItemDefinition $def The list item defintion of the list item for which to create the linked page.
Returns:
int Create a linked page for a list item.
View source: ItemList.php line 460.
- public deleteItem(int $id)
-
Delete existing list item data from the database.
First it is is checked if it's possible to delete list item data, then the list item data including its dependencies is deleted from the database.
Parameters:
Type Name Def. Description int $id The object id of the list item to delete.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible or if it is not possible to delete the list item data. View source: ItemList.php line 789.
- public static fetch(\Scrivo\Context $context, int $pageId, int $defintionId)
-
Retrieve an item list from the cache or database.
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $pageId The id of the page that hosts the list.
int $defintionId The id of the page property definition.
Throws:
Exception Type Description \Scrivo\ApplicationException if the page was not readable for the user defined in the context. View source: ItemList.php line 263.
- private int getDefinitionId(\Scrivo\String $phpSelector)
-
Get the list item definition id using the phpSelector of the list item definition.
Parameters:
Type Name Def. Description \Scrivo\String $phpSelector The phpSelector of a list item definition.
Returns:
int Get the list item definition id using the phpSelector of the list item definition.
View source: ItemList.php line 504.
- public \Scrivo\ListItem[] getItems(int $parentId)
-
Retrieve a sub list.
Parameters:
Type Name Def. Description int $parentId The id of the common parent for the list items.
Returns:
\Scrivo\ListItem[] Retrieve a sub list.
View source: ItemList.php line 303.
- private insert()
-
Insert new list object data into the database.
A list record is assumed to exists if page exists and is created silently.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data. View source: ItemList.php line 208.
- private insertItem(\Scrivo\ListItem $item)
-
Insert new list item object data into the database.
First it is checked if the data of this list item 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.
Parameters:
Type Name Def. Description \Scrivo\ListItem $item The list item to insert 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: ItemList.php line 610.
- public moveItem(int $id, int $dir=\Scrivo\SequenceNo::MOVE_DOWN)
-
Move a list item to another position amongst its siblings.
Parameters:
Type Name Def. Description int $id The object id of the list item to move.
int $dir \Scrivo\SequenceNo::MOVE_DOWN Position or direction of the move, see \Scrivo\SequenceNo:::MOVE_*
View source: ItemList.php line 832.
- public \Scrivo\ListItem newItem(\Scrivo\String $phpSelector)
-
Create a new list item to insert in the database.
Parameters:
Type Name Def. Description \Scrivo\String $phpSelector The selector of the list item definition of the list item to create.
Returns:
\Scrivo\ListItem Create a new list item to insert in the database.
View source: ItemList.php line 720.
- private removeFromCache()
-
Remove this list (including all sub lists from the cache).
View source: ItemList.php line 850.
- public saveItem(\Scrivo\ListItem $item)
-
Save list item data to the database.
Parameters:
Type Name Def. Description \Scrivo\ListItem $item The list item to save, either an existing item updated item or a new one craeted with the newItem method.
Throws:
Exception Type Description \Scrivo\ApplicationException if the data is not accessible or it is not possible to insert or update the list item data. View source: ItemList.php line 758.
- private \Scrivo\ListItem[id] select(int $parentId=0)
-
Select list items from the database.
Parameters:
Type Name Def. Description int $parentId 0 An optional parent id is case of a sub-list.
Returns:
\Scrivo\ListItem[id] Select list items from the database.
View source: ItemList.php line 320.
- private \Scrivo\PropertySet selectEmptyProperties(int $definitionId)
-
Create a set of blank properties for a given list item definition.
Parameters:
Type Name Def. Description int $definitionId Returns:
\Scrivo\PropertySet Create a set of blank properties for a given list item definition.
View source: ItemList.php line 528.
- private static \Scrivo\ListItemProperty[type] selectProperties(\Scrivo\Context $context, int $listId)
-
Select list item properties from the database.
Parameters:
Type Name Def. Description \Scrivo\Context $context A Scrivo context.
int $listId The id of the list for which to retrieve the properties.
Returns:
\Scrivo\ListItemProperty[type] Select list item properties from the database.
View source: ItemList.php line 396.
- private update()
-
Update list object data in the database.
Only used to set the subfolder id.
Throws:
Exception Type Description \Scrivo\ApplicationException If the data is not accessible or one or more of the fields contain invalid data. View source: ItemList.php line 239.
- private updateItem(\Scrivo\ListItem $item)
-
Update existing list item object data in the database.
First it is checked if the data of this list item object can be updated in the database, then the data is updated in the database.
Parameters:
Type Name Def. Description \Scrivo\ListItem $item The list item to update 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: ItemList.php line 676.
- private updateProperty(\Scrivo\ListItemProperty $prp, int $itemId)
-
Update an existing list item property in the database.
First the data fields of this user will be validated, then the data is updated in the database.
Parameters:
Type Name Def. Description \Scrivo\ListItemProperty $prp The list item property to update.
int $itemId The id of the list item for which to update the property.
Throws:
Exception Type Description \Scrivo\ApplicationException If one or more of the fields contain invalid data. View source: ItemList.php line 570.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013