- Symphony 2.6.5
-
› assets
14 -
› boot
14 -
› core
23 -
› cryptography
4 -
› data-sources
6 -
› email-gateways
3 -
› events
3 -
› global
61 -
› interface
9 -
› toolkit
60 - Delegates92
- Deprecated26
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class PageManager
class.pagemanager.php #15The PageManager
class is responsible for providing basic CRUD operations
for Symphony frontend pages. These pages are stored in the database in
tbl_pages
and are resolved to an instance of FrontendPage
class from a URL.
Additionally, this manager provides functions to access the Page's types,
and any linked datasources or events.
Methods
static integer|boolean add(
$fields)
Given an associative array of data, where the key is the column name
in tbl_pages
and the value is the data, this function will create a new
Page and return a Page ID on success.
Parameters
Returns
Returns the Page ID of the created Page on success, false otherwise.
static boolean addPageTypesToPage(
$page_id, $types)
Given a Page ID and an array of types, this function will add Page types
to that Page. If a Page types are stored in tbl_pages_types
.
Parameters
static string createFilePath(
$path, $handle)
This function takes a $path
and $handle
and generates a flattened
string for use as a filename for a Page's template.
Parameters
static string createHandle(
$name)
Given a name, this function will return a page handle. These handles will only contain latin characters
Parameters
static boolean createPageFiles(
$new_path, $new_handle, $old_path, $old_handle)
This function creates the initial .xsl
template for the page, whether
that be from the TEMPLATES/blueprints.page.xsl
file, or from an existing
template with the same name. This function will handle the renaming of a page
by creating the new files using the old files as the templates then removing
the old template. If a template already exists for a Page, it will not
be overridden and the function will return true.
Parameters
Returns
True when the page files have been created successfully, false otherwise.
See Also
static boolean delete(
$page_id, $delete_files)
This function takes a Page ID and removes the Page from the database
in tbl_pages
and it's associated Page Types in tbl_pages_types
.
This function does not delete any of the Page's children.
Parameters
See Also
static boolean deletePageFiles(
$page_path, $handle)
Given a Page's $path
and $handle
, this function will remove
it's templates from the PAGES
directory returning boolean on
completion
Parameters
static boolean deletePageTypes(
$page_id)
Given a $page_id
, this function will remove all associated
Page Types from tbl_pages_types
.
Parameters
static boolean edit(
$page_id, $fields, $delete_types)
This function will update a Page in tbl_pages
given a $page_id
and an associative array of $fields
. A third parameter, $delete_types
will also delete the Page's associated Page Types if passed true.
Parameters
See Also
static boolean editPageChildren(
$page_id, $page_path)
This function will update all children of a particular page (if any) by renaming/moving all related files to their new path and updating their database information. This is a recursive function and will work to any depth.
Parameters
static array|null fetch(
$include_types, $select, $hierarchical, $where, $order_by)
This function will return an associative array of Page information. The
information returned is defined by the $include_types
and $select
parameters, which will return the Page Types for the Page and allow
a developer to restrict what information is returned about the Page.
Optionally, $where
and $order_by
parameters allow a developer to
further refine their query.
Parameters
Returns
An associative array of Page information with the key being the column name from tbl_pages
and the value being the data. If requested, the array can be made multidimensional to reflect the pages hierarchy. If no Pages are found, null is returned.
static array fetchAllPagesPageTypes()
Fetch an associated array with Page ID's and the types they're using.
Returns
A 2-dimensional associated array where the key is the page ID.
static array fetchAvailablePageTypes()
Returns all the page types that exist in this Symphony install. There are 6 default system page types, and new types can be added by Developers via the Page Editor.
Returns
An array of strings of the page types used in this Symphony install. At the minimum, this will be an array with the values 'index', 'XML', 'JSON', 'admin', '404' and '403'.
static array|null fetchChildPages(
$page_id, $select)
Returns the child Pages (if any) of the given $page_id
.
Parameters
Returns
An associative array of Page information with the key being the column name from tbl_pages
and the value being the data. If multiple Pages are found, an array of Pages will be returned. If no Pages are found null is returned.
static integer fetchIDFromHandle(
$handle)
Return a Page ID by the handle
Parameters
Returns
The Page ID
static integer fetchNextSortOrder()
Work out the next available sort order for a new page
Returns
Returns the next sort order
static array|null fetchPageByID(
$page_id, $select)
Returns Pages that match the given $page_id
. Developers can optionally
choose to specify what Page information is returned using the $select
parameter.
Parameters
Returns
An associative array of Page information with the key being the column name from tbl_pages
and the value being the data. If multiple Pages are found, an array of Pages will be returned. If no Pages are found null is returned.
static array|null fetchPageByType(
$type)
Returns Pages that match the given $type
. If no $type
is provided
the function returns the result of PageManager::fetch
.
Parameters
Returns
An associative array of Page information with the key being the column name from tbl_pages
and the value being the data. If multiple Pages are found, an array of Pages will be returned. If no Pages are found null is returned.
static array fetchPageTypes(
$page_id)
This function returns a Page's Page Types. If the $page_id
parameter is given, the types returned will be for that Page.
Parameters
Returns
An array of the Page Types
static integer fetchTitleFromHandle(
$handle)
Return a Page title by the handle
Parameters
Returns
The Page title
static integer getChildPagesCount(
$page_id)
This function will return the number of child pages for a given
$page_id
. This is a recursive function and will return the absolute
count.
Parameters
Returns
The number of child pages for the given $page_id
static mixed getTemplate(
$name)
Returns the path to the page-template by looking at the
WORKSPACE/template/
directory, then at the TEMPLATES
directory for $name.xsl
. If the template is not found,
false is returned
Parameters
Returns
String, which is the path to the template if the template is found, false otherwise
static boolean hasChildPages(
$page_id)
Given a $page_id
, this function returns boolean if the page
has child pages.
Parameters
Returns
True if the page has children, false otherwise
static boolean hasPageTypeBeenUsed(
$page_id, $type)
Returns boolean if a the given $type
has been used by Symphony
for a Page that is not $page_id
.
Parameters
Returns
True if the type is used, false otherwise
static boolean isDataSourceUsed(
$handle)
Check whether a datasource is used or not
Parameters
Returns
True if used, false if not
static boolean isEventUsed(
$handle)
Check whether a event is used or not
Parameters
Returns
True if used, false if not
static array resolvePage(
$page_id, $column)
Given the $page_id
and a $column
, this function will return an
array of the given $column
for the Page, including all parents.
Parameters
Returns
An array of the current Page, containing the $column
requested. The current page will be the last item the array, as all parent pages are prepended to the start of the array
static mixed resolvePageByPath(
$handle, $path, $The)
Resolve a page by it's handle and path
Parameters
Returns
Array if found, false if not
static string resolvePageFileLocation(
$path, $handle)
Resolves the path to this page's XSLT file. The Symphony convention
is that they are stored in the PAGES
folder. If this page has a parent
it will be as if all the / in the URL have been replaced with _. ie.
/articles/read/ will produce a file articles_read.xsl
Parameters
Returns
The path to the XSLT of the page
See Also
static string resolvePagePath(
$page_id)
Given the $page_id
, return the complete path to the
current page. Each part of the Page's path will be
separated by '/'.
Parameters
Returns
The complete path to the current Page including any parent Pages, ie. /articles/read
static string resolvePageTitle(
$page_id)
Given the $page_id
, return the complete title of the
current page. Each part of the Page's title will be
separated by ': '.
Parameters
Returns
The title of the current Page. If the page is a child of another it will be prepended by the parent and a colon, ie. Articles: Read
static boolean writePageFiles(
$path, $data)
A wrapper for General::writeFile
, this function takes a $path
and a $data
and writes the new template to disk.
Parameters
Returns
True when written successfully, false otherwise