Navigation/Page.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Navigation  
Version
$Id$  

\Zend_Navigation_Page

Package: Zend_Navigation
Base class for Zend_Navigation_Page pages
Container class for Zend_Navigation_Page classes.
Parent(s)
\Zend_Navigation_Container
Children
\Zend_Navigation_Page_Uri
\Zend_Navigation_Page_Mvc
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedstring|null $_accesskey
Accessibility key character
This attribute assigns an access key to an element. An access key is a single character from the document character set.
Details
Type
string | null
Link
http://www.w3.org/TR/html401/interact/forms.html#access-keys  
>VPropertyprotectedbool $_active = false
Whether this page should be considered active
Default valuefalseDetails
Type
bool
>VPropertyprotectedstring|null $_class
Style class for this page (CSS)
Details
Type
string | null
>VPropertyprotectedarray $_customHtmlAttribs = array()
Custom HTML attributes
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_defaultPageType
static
The type of page to use when it wasn't set
Details
Type
string
>VPropertyprotectedstring|null $_fragment
Fragment identifier (anchor identifier)
The fragment identifier (anchor identifier) pointing to an anchor within a resource that is subordinate to another, primary resource. The fragment identifier introduced by a hash mark "#". Example: http://www.example.org/foo.html#bar ("bar" is the fragment identifier)
Details
Type
string | null
Link
http://www.w3.org/TR/html401/intro/intro.html#fragment-uri  
>VPropertyprotectedstring|null $_id
Page id
Details
Type
string | null
>VPropertyprotectedstring|null $_label
Page label
Details
Type
string | null
>VPropertyprotectedint|null $_order
Page order used by parent container
Details
Type
int | null
>VPropertyprotected\Zend_Navigation_Container|null $_parent
Parent container
Details
Type
\Zend_Navigation_Container | null
>VPropertyprotectedstring|null $_privilege
ACL privilege associated with this page
Details
Type
string | null
>VPropertyprotectedarray $_properties = array()
Custom page properties, used by __set(), __get() and __isset()
Default valuearray()Details
Type
array
>VPropertyprotectedarray $_rel = array()
Forward links to other pages
Default valuearray()Details
Type
array
Link
http://www.w3.org/TR/html4/struct/links.html#h-12.3.1  
>VPropertyprotectedstring|\Zend_Acl_Resource_Interface|null $_resource
ACL resource associated with this page
Details
Type
string | \Zend_Acl_Resource_Interface | null
>VPropertyprotectedarray $_rev = array()
Reverse links to other pages
Default valuearray()Details
Type
array
Link
http://www.w3.org/TR/html4/struct/links.html#h-12.3.1  
>VPropertyprotectedstring|null $_target
This page's target
Details
Type
string | null
>VPropertyprotectedstring|null $_title
A more descriptive title for this page
Details
Type
string | null
>VPropertyprotectedbool $_visible = true
Whether this page should be considered visible
Default valuetrueDetails
Type
bool

Methods

methodpublic__construct(array | \Zend_Config $options = null) : void

Page constructor

Parameters
NameTypeDescription
$optionsarray | \Zend_Config

[optional] page options. Default is

                                 null, which should set defaults.
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif invalid options are given
methodpublic__get(string $name) : mixed

Returns a property, or null if it doesn't exist

Magic overload for enabling $page->propname.
Parameters
NameTypeDescription
$namestring

property name

Returns
TypeDescription
mixedproperty value or null
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif property name is invalid
methodpublic__isset(string $name) : bool

Checks if a property is set

Magic overload for enabling isset($page->propname). Returns true if the property is native (id, class, title, etc), and true or false if it's a custom property (depending on whether the property actually is set).
Parameters
NameTypeDescription
$namestring

property name

Returns
TypeDescription
boolwhether the given property exists
methodpublic__set(string $name, mixed $value) : void

Sets a custom property

Magic overload for enabling $page->propname = $value.
Parameters
NameTypeDescription
$namestring

property name

$valuemixed

value to set

Throws
ExceptionDescription
\Zend_Navigation_Exceptionif property name is invalid
methodpublic__toString() : string

Returns page label

Magic overload for enabling echo $page.
Returns
TypeDescription
stringpage label
methodpublic__unset(string $name) : void

Unsets the given custom property

Magic overload for enabling unset($page->propname).
Parameters
NameTypeDescription
$namestring

property name

Throws
ExceptionDescription
\Zend_Navigation_Exceptionif the property is native
methodprotected_init() : void

Initializes page (used by subclasses)

methodprotected_normalizePropertyName(string $property) : string
static

Normalizes a property name

Parameters
NameTypeDescription
$propertystring

property name to normalize

Returns
TypeDescription
stringnormalized property name
methodpublicaddRel(string $relation, mixed $value) : \Zend_Navigation_Page

Adds a forward relation to the page

Parameters
NameTypeDescription
$relationstring

relation name (e.g. alternate, glossary,

                          canonical, etc)
$valuemixed

value to set for relation

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicaddRev(string $relation, mixed $value) : \Zend_Navigation_Page

Adds a reverse relation to the page

Parameters
NameTypeDescription
$relationstring

relation name (e.g. alternate, glossary,

                          canonical, etc)
$valuemixed

value to set for relation

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicclearCustomHtmlAttribs() : \Zend_Navigation_Page

Clear all custom HTML attributes

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicfactory(array | \Zend_Config $options) : \Zend_Navigation_Page
static

Factory for Zend_Navigation_Page classes

A specific type to construct can be specified by specifying the key 'type' in $options. If type is 'uri' or 'mvc', the type will be resolved to Zend_Navigation_Page_Uri or Zend_Navigation_Page_Mvc. Any other value for 'type' will be considered the full name of the class to construct. A valid custom page class must extend Zend_Navigation_Page. If 'type' is not given, the type of page to construct will be determined by the following rules: - If $options contains either of the keys 'action', 'controller', 'module', or 'route', a Zend_Navigation_Page_Mvc page will be created. - If $options contains the key 'uri', a Zend_Navigation_Page_Uri page will be created.
Parameters
NameTypeDescription
$optionsarray | \Zend_Config

options used for creating page

Returns
TypeDescription
\Zend_Navigation_Pagea page instance
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif $options is not array/Zend_Config
\Zend_Exceptionif 'type' is specified and Zend_Loader is unable to load the class
\Zend_Navigation_Exceptionif something goes wrong during instantiation of the page
\Zend_Navigation_Exceptionif 'type' is given, and the specified type does not extend this class
\Zend_Navigation_Exceptionif unable to determine which class to instantiate
methodpublicget(string $property) : mixed

Returns the value of the given property

If the given property is native (id, class, title, etc), the matching get method will be used. Otherwise, it will return the matching custom property, or null if not found.
Parameters
NameTypeDescription
$propertystring

property name

Returns
TypeDescription
mixedthe property's value or null
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif property name is invalid
methodpublicgetAccesskey() : string | null

Returns page access key

Returns
TypeDescription
string | nullpage access key or null
methodpublicgetActive(bool $recursive = false) : bool

Proxy to isActive()

Parameters
NameTypeDescription
$recursivebool

[optional] whether page should be considered

                     active if any child pages are active. Default
                     is false.
Returns
TypeDescription
boolwhether page should be considered active
methodpublicgetClass() : string | null

Returns page class (CSS)

Returns
TypeDescription
string | nullpage's CSS class or null
methodpublicgetCustomHtmlAttrib(string $name) : string | null

Returns a single custom HTML attributes by name

Parameters
NameTypeDescription
$namestring

name of the HTML attribute

Returns
TypeDescription
string | nullvalue for the HTML attribute or null
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif name is not string
methodpublicgetCustomHtmlAttribs() : array

Returns all custom HTML attributes as an array

Returns
TypeDescription
arrayan array containing custom HTML attributes
methodpublicgetCustomProperties() : array

Returns custom properties as an array

Returns
TypeDescription
arrayan array containing custom properties
methodpublicgetDefaultPageType() : void
static

methodpublicgetDefinedRel() : array

Returns an array containing the defined forward relations

Returns
TypeDescription
arraydefined forward relations
methodpublicgetDefinedRev() : array

Returns an array containing the defined reverse relations

Returns
TypeDescription
arraydefined reverse relations
methodpublicgetFragment() : string | null

Returns fragment identifier

Returns
TypeDescription
string | nullfragment identifier
methodpublicgetHref() : string
abstract

Returns href for this page

Returns
TypeDescription
stringthe page's href
methodpublicgetId() : string | null

Returns page id

Returns
TypeDescription
string | nullpage id or null
methodpublicgetLabel() : string

Returns page label

Returns
TypeDescription
stringpage label or null
methodpublicgetOrder() : int | null

Returns page order used in parent container

Returns
TypeDescription
int | nullpage order or null
methodpublicgetParent() : \Zend_Navigation_Container | null

Returns parent container

Returns
TypeDescription
\Zend_Navigation_Container | nullparent container or null
methodpublicgetPrivilege() : string | null

Returns ACL privilege associated with this page

Returns
TypeDescription
string | nullACL privilege or null
methodpublicgetRel(string $relation = null) : array

Returns the page's forward links to other pages

This method returns an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.
Parameters
NameTypeDescription
$relationstring

[optional] name of relation to return. If not

                      given, all relations will be returned.
Returns
TypeDescription
arrayan array of relations. If $relation is not specified, all relations will be returned in an associative array.
methodpublicgetResource() : string | \Zend_Acl_Resource_Interface | null

Returns ACL resource assoicated with this page

Returns
TypeDescription
string | \Zend_Acl_Resource_Interface | nullACL resource or null
methodpublicgetRev(string $relation = null) : array

Returns the page's reverse links to other pages

This method returns an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.
Parameters
NameTypeDescription
$relationstring

[optional] name of relation to return. If not

                      given, all relations will be returned.
Returns
TypeDescription
arrayan array of relations. If $relation is not specified, all relations will be returned in an associative array.
methodpublicgetTarget() : string | null

Returns page target

Returns
TypeDescription
string | nullpage target or null
methodpublicgetTitle() : string | null

Returns page title

Returns
TypeDescription
string | nullpage title or null
methodpublicgetVisible(bool $recursive = false) : bool

Proxy to isVisible()

Returns a boolean value indicating whether the page is visible
Parameters
NameTypeDescription
$recursivebool

[optional] whether page should be considered

                     invisible if parent is invisible. Default is
                     false.
Returns
TypeDescription
boolwhether page should be considered visible
methodpublichashCode() : string
final

Returns a hash code value for the page

Returns
TypeDescription
stringa hash code value for this page
methodpublicisActive(bool $recursive = false) : bool

Returns whether page should be considered active or not

Parameters
NameTypeDescription
$recursivebool

[optional] whether page should be considered

                     active if any child pages are active. Default is
                     false.
Returns
TypeDescription
boolwhether page should be considered active
methodpublicisVisible(bool $recursive = false) : bool

Returns a boolean value indicating whether the page is visible

Parameters
NameTypeDescription
$recursivebool

[optional] whether page should be considered

                     invisible if parent is invisible. Default is
                     false.
Returns
TypeDescription
boolwhether page should be considered visible
methodpublicremoveCustomHtmlAttrib(string $name) : \Zend_Navigation_Page

Removes a custom HTML attribute from the page

Parameters
NameTypeDescription
$namestring

name of the custom HTML attribute

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicremoveRel(string $relation) : \Zend_Navigation_Page

Removes a forward relation from the page

Parameters
NameTypeDescription
$relationstring

name of relation to remove

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicremoveRev(string $relation) : \Zend_Navigation_Page

Removes a reverse relation from the page

Parameters
NameTypeDescription
$relationstring

name of relation to remove

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicset(string $property, mixed $value) : \Zend_Navigation_Page

Sets the given property

If the given property is native (id, class, title, etc), the matching set method will be used. Otherwise, it will be set as a custom property.
Parameters
NameTypeDescription
$propertystring

property name

$valuemixed

value to set

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif property name is invalid
methodpublicsetAccesskey(string | null $character = null) : \Zend_Navigation_Page

Sets access key for this page

Parameters
NameTypeDescription
$characterstring | null

[optional] access key to set. Default

                               is null, which sets no access key.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif access key is not string or null or if the string length not equal to one
methodpublicsetActive(bool $active = true) : \Zend_Navigation_Page

Sets whether page should be considered active or not

Parameters
NameTypeDescription
$activebool

[optional] whether page should be

                          considered active or not. Default is true.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetClass(string | null $class = null) : \Zend_Navigation_Page

Sets page CSS class

Parameters
NameTypeDescription
$classstring | null

[optional] CSS class to set. Default

                               is null, which sets no CSS class.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif not given string or null
methodpublicsetConfig(\Zend_Config $config) : \Zend_Navigation_Page

Sets page properties using a Zend_Config object

Parameters
NameTypeDescription
$config\Zend_Config

config object to get properties from

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif invalid options are given
methodpublicsetCustomHtmlAttrib(string $name, string | null $value) : \Zend_Navigation_Page

Sets a single custom HTML attribute

Parameters
NameTypeDescription
$namestring

name of the HTML attribute

$valuestring | null

value for the HTML attribute

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif name is not string or value is not null or a string
methodpublicsetCustomHtmlAttribs(array $attribs) : \Zend_Navigation_Page

Sets multiple custom HTML attributes at once

Parameters
NameTypeDescription
$attribsarray

an associative array of html attributes

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetDefaultPageType( $type = null) : void
static

Parameters
NameTypeDescription
$type
methodpublicsetFragment(string $fragment) : \Zend_Navigation_Page

Sets a fragment identifier

Parameters
NameTypeDescription
$fragmentstring

new fragment identifier

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif empty/no string is given
methodpublicsetId(string | null $id = null) : \Zend_Navigation_Page

Sets page id

Parameters
NameTypeDescription
$idstring | null

[optional] id to set. Default is null,

                               which sets no id.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif not given string or null
methodpublicsetLabel(string $label) : \Zend_Navigation_Page

Sets page label

Parameters
NameTypeDescription
$labelstring

new page label

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif empty/no string is given
methodpublicsetOptions(array $options) : \Zend_Navigation_Page

Sets page properties using options from an associative array

Each key in the array corresponds to the according set*() method, and each word is separated by underscores, e.g. the option 'target' corresponds to setTarget(), and the option 'reset_params' corresponds to the method setResetParams().
Parameters
NameTypeDescription
$optionsarray

associative array of options to set

Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif invalid options are given
methodpublicsetOrder(int $order = null) : \Zend_Navigation_Page

Sets page order to use in parent container

Parameters
NameTypeDescription
$orderint

[optional] page order in container.

                               Default is null, which sets no
                               specific order.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif order is not integer or null
methodpublicsetParent(\Zend_Navigation_Container $parent = null) : \Zend_Navigation_Page

Sets parent container

Parameters
NameTypeDescription
$parent\Zend_Navigation_Container

[optional] new parent to set.

                                       Default is null which will set
                                       no parent.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetPrivilege(string | null $privilege = null) : \Zend_Navigation_Page

Sets ACL privilege associated with this page

Parameters
NameTypeDescription
$privilegestring | null

[optional] ACL privilege to associate

                            with this page. Default is null, which
                            sets no privilege.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetRel(array | \Zend_Config $relations = null) : \Zend_Navigation_Page

Sets the page's forward links to other pages

This method expects an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.
Parameters
NameTypeDescription
$relationsarray | \Zend_Config

[optional] an associative array of

                                  forward links to other pages
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetResource(string | \Zend_Acl_Resource_Interface $resource = null) : \Zend_Navigation_Page

Sets ACL resource assoicated with this page

Parameters
NameTypeDescription
$resourcestring | \Zend_Acl_Resource_Interface

[optional] resource

                                                  to associate with
                                                  page. Default is
                                                  null, which sets no
                                                  resource.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif $resource if invalid
methodpublicsetRev(array | \Zend_Config $relations = null) : \Zend_Navigation_Page

Sets the page's reverse links to other pages

This method expects an associative array of reverse links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.
Parameters
NameTypeDescription
$relationsarray | \Zend_Config

[optional] an associative array of

                                  reverse links to other pages
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublicsetTarget(string | null $target = null) : \Zend_Navigation_Page

Sets page target

Parameters
NameTypeDescription
$targetstring | null

[optional] target to set. Default is

                               null, which sets no target.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif target is not string or null
methodpublicsetTitle(string $title = null) : \Zend_Navigation_Page

Sets page title

Parameters
NameTypeDescription
$titlestring

[optional] page title. Default is

                               null, which sets no title.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif not given string or null
methodpublicsetVisible(bool $visible = true) : \Zend_Navigation_Page

Sets whether the page should be visible or not

Parameters
NameTypeDescription
$visiblebool

[optional] whether page should be

                          considered visible or not. Default is true.
Returns
TypeDescription
\Zend_Navigation_Pagefluent interface, returns self
methodpublictoArray() : array

Returns an array representation of the page

Returns
TypeDescription
arrayassociative array containing all page properties
Documentation was generated by phpDocumentor 2.2.0 .