Class \Scrivo\PageSet
A Scrivo Page set is a group of Scrivo pages with a common parent id.
A page set is actually a simple array of (child) pages but it does a couple of things extra:
- When serialized only the ids are stored.
- When iteratering, counting or getting pages from the array only the readable pages in the array will be taken into account.
Page sets are a part of a Scrivo page and are used to retrieve and iterate through the child pages (or path) of a page.
Implements
Defined in:
PageSet.php.
Attr. | Name / Description |
---|---|
public |
PageSet($page) Construct a page set. |
Attr. | Type | Name | Description |
---|---|---|---|
private | \..\int[] | $ids | An array containing the keys of the items array, used when serializing. |
private | \..\Page[] | $items | The array containing the pages or page ids. |
private | \..\Page | $page | The parent page of the set. |
Attr. | Type | Name / Description |
---|---|---|
public |
__sleep() When serializing retrieve the don't store the items array but just the keys. |
|
public |
__wakeup() When unserializing restore the items array only the id. |
|
private |
check($id) When reading the items array always check of the actual entry is an instantiated Scrivo page. |
|
public | int |
count() The page count of pages in the set. |
public | \..\Page |
current() Get the current page from the page set when iterating. |
public | \..\Page |
key() Get the key(id) of the current page from the page set when iterating. |
public | \..\Page |
next() Get the current page from the page set and move the internal pointer to the next page in the set. |
public | boolean |
offsetExists($id) Test if page is set in the page set. |
public | \..\Page |
offsetGet($id) Get a page with a specific id from the page set. |
public |
offsetSet($id, $page) Set a page in the page set. |
|
public |
offsetUnset($id) It is not possible to unset pages in a page set. |
|
public |
prepend($page) Add a page to the beginning of the set. |
|
public |
rewind() Rewind the page set so that iterating will start at the beginning. |
|
public | boolean |
valid() Test if the current page is valid. |
Constructor
- public PageSet(\Scrivo\Page $page)
-
Construct a page set.
Parameters:
Type Name Def. Description \Scrivo\Page $page The parent page of the page set.
View source: PageSet.php line 90.
Members
- private \Scrivo\int[id] $ids
-
An array containing the keys of the items array, used when serializing.
Inital value: null
View source: PageSet.php line 68.
- private \Scrivo\Page[id] $items
-
The array containing the pages or page ids.
Inital value: array()
View source: PageSet.php line 56.
- private \Scrivo\Page $page
-
The parent page of the set.
Inital value: null
View source: PageSet.php line 62.
Methods
- public __sleep()
-
When serializing retrieve the don't store the items array but just the keys.
return array An array with the names of the serializable members.
View source: PageSet.php line 242.
- public __wakeup()
-
When unserializing restore the items array only the id.
View source: PageSet.php line 255.
- private check(int $id)
-
When reading the items array always check of the actual entry is an instantiated Scrivo page.
If not, get that page and store it in the items array.
Parameters:
Type Name Def. Description int $id The page id of the entry to check.
View source: PageSet.php line 77.
- public int count()
-
The page count of pages in the set.
Note that returned page count depends on whether the pages are readable for the user defined in the Scrivo context. So the returned count is always equeal or less that the actual count of pages in the items array.
Returns:
int The page count of pages in the set.
View source: PageSet.php line 225.
- public \Scrivo\Page current()
-
Get the current page from the page set when iterating.
Returns:
\Scrivo\Page Get the current page from the page set when iterating.
View source: PageSet.php line 166.
- public \Scrivo\Page key()
-
Get the key(id) of the current page from the page set when iterating.
Returns:
\Scrivo\Page Get the key(id) of the current page from the page set when iterating.
View source: PageSet.php line 175.
- public \Scrivo\Page next()
-
Get the current page from the page set and move the internal pointer to the next page in the set.
Returns:
\Scrivo\Page Get the current page from the page set and move the internal pointer to the next page in the set.
View source: PageSet.php line 185.
- public boolean offsetExists(int $id)
-
Test if page is set in the page set.
Parameters:
Type Name Def. Description int $id A Scrivo page id to test.
Returns:
boolean Test if page is set in the page set.
View source: PageSet.php line 125.
- public \Scrivo\Page offsetGet(int $id)
-
Get a page with a specific id from the page set.
Parameters:
Type Name Def. Description int $id A Scrivo page id to test.
Returns:
\Scrivo\Page Get a page with a specific id from the page set.
View source: PageSet.php line 147.
- public offsetSet(int $id, \Scrivo\Page $page)
-
Set a page in the page set.
Parameters:
Type Name Def. Description int $id A Scrivo page id.
\Scrivo\Page $page The parent page of the page set.
View source: PageSet.php line 103.
- public offsetUnset(int $id)
-
It is not possible to unset pages in a page set.
Calling this method will raise a system exception.
Parameters:
Type Name Def. Description int $id A Scrivo page id to unset.
View source: PageSet.php line 136.
- public prepend(\Scrivo\Page $page)
-
Add a page to the beginning of the set.
Parameters:
Type Name Def. Description \Scrivo\Page $page The parent page of the page set.
View source: PageSet.php line 112.
- public rewind()
-
Rewind the page set so that iterating will start at the beginning.
View source: PageSet.php line 157.
- public boolean valid()
-
Test if the current page is valid.
Returns:
boolean Test if the current page is valid.
View source: PageSet.php line 194.
Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013