- Symphony 2.7.6
-
› assets
14 -
› boot
15 -
› core
24 -
› cryptography
4 -
› data-sources
6 -
› email-gateways
3 -
› events
3 -
› global
61 -
› interface
9 -
› toolkit
60 - Delegates101
- Deprecated28
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
Page HTMLPage AdministrationPage
public class AdministrationPage extends HTMLPage
class.administrationpage.php #15The AdministrationPage class represents a Symphony backend page. It extends the HTMLPage class and unlike the Frontend, is generated using a number XMLElement objects. Instances of this class override the view, switchboard and action functions to construct the page. These functions act as pseudo MVC, with the switchboard being controller, and the view/action being the view.
Properties
array $Alert
An array of Alert
objects used to display page level
messages to Symphony backend users one by one. Prior to Symphony 2.3
this variable only held a single Alert
object.
XMLElement $Breadcrumbs
An object that stores the markup for the breadcrumbs and is only used internally.
XMLElement $Contents
A <div>
that contains the content of a Symphony backend page.
XMLElement $Context
A <div>
that contains the breadcrumbs, the page title and some contextual
actions (e.g. "Create new").
array $Drawer
An array of Drawer widgets for the current page
XMLElement $Header
A <div>
that contains the header of a Symphony backend page, which
typically contains the Site title and the navigation.
XMLElement $Wrapper
As the name suggests, a <div>
that holds the following $Header
,
$Contents
and $Footer
.
array $_context
An associative array describing this pages context. This can include the section handle, the current entry_id, the page name and any flags such as 'saved' or 'created'. This variable often provided in delegates so extensions can manipulate based off the current context or add new keys.
Methods
void __construct()
Constructor calls the parent constructor to set up
the basic HTML, Head and Body XMLElement
's. This function
also sets the XMLElement
element style to be HTML, instead of XML
void __switchboard(
$type)
The __switchboard
function acts as a controller to display content
based off the $type. By default, the $type
is 'view' but it can be set
also set to 'action'. The $type
is prepended by __ and the context is
append to the $type to create the name of the function that will provide
that logic. For example, if the $type was action and the context of the
current page was new, the resulting function to be called would be named
__actionNew()
. If an action function is not provided by the Page, this function
returns nothing, however if a view function is not provided, a 404 page
will be returned.
Parameters
void action()
This function is called when $_REQUEST
contains a key of 'action'.
Any logic that needs to occur immediately for the action to complete
should be contained within this function. By default this calls the
__switchboard
with the type set to 'action'.
See Also
void addTimestampValidationPageAlert(
$errorMessage, $existingObject, $action)
Adds a localized Alert message for failed timestamp validations. It also adds meta information about the last author and timestamp.
Parameters
void appendAlert()
If $this->Alert
is set, it will be added to this page. The
AppendPageAlert
delegate is fired to allow extensions to provide their
their own Alert messages for this page. Since Symphony 2.3, there may be
more than one Alert
per page. Alerts are displayed in the order of
severity, with Errors first, then Success alerts followed by Notices.
Uses
void appendSubheading(
$value, $actions)
Appends the heading of this Symphony page to the Context element. Action buttons can be provided (e.g. "Create new") as second parameter.
Parameters
void appendUserLinks()
Creates the Symphony footer for an Administration page. By default
this includes the installed Symphony version and the currently logged
in Author. A delegate is provided to allow extensions to manipulate the
footer HTML, which is an XMLElement of a <ul>
element.
Since Symphony 2.3, it no longer uses the AddElementToFooter
delegate.
void build(
$context)
This function initialises a lot of the basic elements that make up a Symphony
backend page such as the default stylesheets and scripts, the navigation and
the footer. Any alerts are also appended by this function. view()
is called to
build the actual content of the page. The InitialiseAdminPageHead
delegate
allows extensions to add elements to the <head>
. The CanAccessPage
delegate
allows extensions to restrict access to pages.
Uses
Parameters
See Also
boolean canAccessPage(
$context)
Checks the current Symphony Author can access the current page.
This check uses the ASSETS . /xml/navigation.xml
file to determine
if the current page (or the current page namespace) can be viewed
by the currently logged in Author.
Uses
Returns
true if the Author can access the current page, false otherwise
See Also
boolean doesAuthorHaveAccess(
$item_limit)
Given the limit of the current navigation item or page, this function returns if the current Author can access that item or not.
string generate(
$page)
Appends the $this->Header
, $this->Context
and $this->Contents
to $this->Wrapper
before adding the ID and class attributes for
the <body>
element. This function will also place any Drawer elements
in their relevant positions in the page. After this has completed the
parent generate()
is called which will convert the XMLElement
's
into strings ready for output.
See Also
array getContext()
Accessor for $this->_context
which includes contextual information
about the current page such as the class, file location or page root.
This information varies depending on if the page is provided by an
extension, is for the publish area, is the login page or any other page
void insertAction(XMLElement $action, $append)
This function allows a user to insert an Action button to the page.
It accepts an XMLElement
(which should be of the Anchor
type),
an optional parameter $prepend
, which when true
will add this
action before any existing actions.
Parameters
See Also
void insertBreadcrumbs(
$values)
Allows developers to specify a list of nav items that build the path to the current page or, in jargon, "breadcrumbs".
Parameters
void insertDrawer(XMLElement $drawer, $position, $button)
Allows a Drawer element to added to the backend page in one of three
positions, horizontal
, vertical-left
or vertical-right
. The button
to trigger the visibility of the drawer will be added after existing
actions by default.
Parameters
See Also
void pageAlert(
$message, $type)
Given a $message
and an optional $type
, this function will
add an Alert instance into this page's $this->Alert
property.
Since Symphony 2.3, there may be more than one Alert
per page.
Unless the Alert is an Error, it is required the $message
be
passed to this function.
Parameters
void setBodyClass(
$class)
Setter function to set the class attribute on the <body>
element.
This function will respect any previous classes that have been added
to this <body>
Parameters
void setPageType(
$type)
Specifies the type of page that being created. This is used to trigger various styling hooks. If your page is mainly a form, pass 'form' as the parameter, if it's displaying a single entry, pass 'single'. If any other parameter is passed, the 'index' styling will be applied.
Parameters
void sortAlerts(
$a, $b, $context)
Allows for appending of alerts. Administration::instance()->Page->Alert is way to tell what is currently in the system
Parameters
void view()
Called to build the content for the page. This function immediately calls
__switchboard()
which acts a bit of a controller to show content based on
off a type, such as 'view' or 'action'. AdministrationPages
can override this
function to just display content if they do not need the switchboard functionality