Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Zend_Navigation_Page Class Reference

Public Member Functions

 __construct ($options=null)
 Page constructor.
 
 setConfig (Zend_Config $config)
 Sets page properties using a Zend_Config object.
 
 setOptions (array $options)
 Sets page properties using options from an associative array.
 
 setLabel ($label)
 Sets page label.
 
 getLabel ()
 Returns page label.
 
 setFragment ($fragment)
 Sets a fragment identifier.
 
 getFragment ()
 Returns fragment identifier.
 
 setId ($id=null)
 Sets page id.
 
 getId ()
 Returns page id.
 
 setClass ($class=null)
 Sets page CSS class.
 
 getClass ()
 Returns page class (CSS)
 
 setTitle ($title=null)
 Sets page title.
 
 getTitle ()
 Returns page title.
 
 setTarget ($target=null)
 Sets page target.
 
 getTarget ()
 Returns page target.
 
 setAccesskey ($character=null)
 Sets access key for this page.
 
 getAccesskey ()
 Returns page access key.
 
 setRel ($relations=null)
 Sets the page's forward links to other pages.
 
 getRel ($relation=null)
 Returns the page's forward links to other pages.
 
 setRev ($relations=null)
 Sets the page's reverse links to other pages.
 
 getRev ($relation=null)
 Returns the page's reverse links to other pages.
 
 setCustomHtmlAttrib ($name, $value)
 Sets a single custom HTML attribute.
 
 getCustomHtmlAttrib ($name)
 Returns a single custom HTML attributes by name.
 
 setCustomHtmlAttribs (array $attribs)
 Sets multiple custom HTML attributes at once.
 
 getCustomHtmlAttribs ()
 Returns all custom HTML attributes as an array.
 
 removeCustomHtmlAttrib ($name)
 Removes a custom HTML attribute from the page.
 
 clearCustomHtmlAttribs ()
 Clear all custom HTML attributes.
 
 setOrder ($order=null)
 Sets page order to use in parent container.
 
 getOrder ()
 Returns page order used in parent container.
 
 setResource ($resource=null)
 Sets ACL resource assoicated with this page.
 
 getResource ()
 Returns ACL resource assoicated with this page.
 
 setPrivilege ($privilege=null)
 Sets ACL privilege associated with this page.
 
 getPrivilege ()
 Returns ACL privilege associated with this page.
 
 setActive ($active=true)
 Sets whether page should be considered active or not.
 
 isActive ($recursive=false)
 Returns whether page should be considered active or not.
 
 getActive ($recursive=false)
 Proxy to isActive()
 
 setVisible ($visible=true)
 Sets whether the page should be visible or not.
 
 isVisible ($recursive=false)
 Returns a boolean value indicating whether the page is visible.
 
 getVisible ($recursive=false)
 Proxy to isVisible()
 
 setParent (Zend_Navigation_Container $parent=null)
 Sets parent container.
 
 getParent ()
 Returns parent container.
 
 set ($property, $value)
 Sets the given property.
 
 get ($property)
 Returns the value of the given property.
 
 __set ($name, $value)
 Sets a custom property.
 
 __get ($name)
 Returns a property, or null if it doesn't exist.
 
 __isset ($name)
 Checks if a property is set.
 
 __unset ($name)
 Unsets the given custom property.
 
 __toString ()
 Returns page label.
 
 addRel ($relation, $value)
 Adds a forward relation to the page.
 
 addRev ($relation, $value)
 Adds a reverse relation to the page.
 
 removeRel ($relation)
 Removes a forward relation from the page.
 
 removeRev ($relation)
 Removes a reverse relation from the page.
 
 getDefinedRel ()
 Returns an array containing the defined forward relations.
 
 getDefinedRev ()
 Returns an array containing the defined reverse relations.
 
 getCustomProperties ()
 Returns custom properties as an array.
 
 hashCode ()
 Returns a hash code value for the page.
 
 toArray ()
 Returns an array representation of the page.
 
 getHref ()
 Returns href for this page.
 
- Public Member Functions inherited from Zend_Navigation_Container
 notifyOrderUpdated ()
 Notifies container that the order of pages are updated.
 
 addPage ($page)
 Adds a page to the container.
 
 addPages ($pages)
 Adds several pages at once.
 
 setPages (array $pages)
 Sets pages this container should have, removing existing pages.
 
 getPages ()
 Returns pages in the container.
 
 removePage ($page)
 Removes the given page from the container.
 
 removePages ()
 Removes all pages in container.
 
 hasPage (Zend_Navigation_Page $page, $recursive=false)
 Checks if the container has the given page.
 
 hasPages ()
 Returns true if container contains any pages.
 
 findOneBy ($property, $value, $useRegex=false)
 Returns a child page matching $property == $value or preg_match($value, $property), or null if not found.
 
 findAllBy ($property, $value, $useRegex=false)
 Returns all child pages matching $property == $value or preg_match($value, $property), or an empty array if no pages are found.
 
 findBy ($property, $value, $all=false, $useRegex=false)
 Returns page(s) matching $property == $value or preg_match($value, $property)
 
 __call ($method, $arguments)
 Magic overload: Proxy calls to finder methods.
 
 toArray ()
 Returns an array representation of all pages in container.
 
 current ()
 Returns current page.
 
 key ()
 Returns hash code of current page.
 
 next ()
 Moves index pointer to next page in the container.
 
 rewind ()
 Sets index pointer to first page in the container.
 
 valid ()
 Checks if container index is valid.
 
 hasChildren ()
 Proxy to hasPages()
 
 getChildren ()
 Returns the child container.
 
 count ()
 Returns number of pages in container.
 

Static Public Member Functions

static factory ($options)
 Factory for Zend_Navigation_Page classes.
 
static setDefaultPageType ($type=null)
 
static getDefaultPageType ()
 

Protected Member Functions

 _init ()
 Initializes page (used by subclasses)
 
- Protected Member Functions inherited from Zend_Navigation_Container
 _sort ()
 Sorts the page index according to page order.
 

Static Protected Member Functions

static _normalizePropertyName ($property)
 Normalizes a property name.
 

Protected Attributes

 $_label
 
 $_fragment
 
 $_id
 
 $_class
 
 $_title
 
 $_target
 
 $_accesskey
 
 $_rel = array()
 
 $_rev = array()
 
 $_order
 
 $_resource
 
 $_privilege
 
 $_active = false
 
 $_visible = true
 
 $_parent
 
 $_properties = array()
 
 $_customHtmlAttribs = array()
 
- Protected Attributes inherited from Zend_Navigation_Container
 $_pages = array()
 
 $_index = array()
 
 $_dirtyIndex = false
 

Static Protected Attributes

static $_defaultPageType
 

Constructor & Destructor Documentation

__construct (   $options = null)

Page constructor.

Parameters
array | Zend_Config$options[optional] page options. Default is null, which should set defaults.
Exceptions
Zend_Navigation_Exceptionif invalid options are given

Member Function Documentation

__get (   $name)

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

Magic overload for enabling $page->propname.

Parameters
string$nameproperty name
Returns
mixed property value or null
Exceptions
Zend_Navigation_Exceptionif property name is invalid
__isset (   $name)

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
string$nameproperty name
Returns
bool whether the given property exists
__set (   $name,
  $value 
)

Sets a custom property.

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

Parameters
string$nameproperty name
mixed$valuevalue to set
Returns
void
Exceptions
Zend_Navigation_Exceptionif property name is invalid
__toString ( )

Returns page label.

Magic overload for enabling echo $page.

Returns
string page label
__unset (   $name)

Unsets the given custom property.

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

Parameters
string$nameproperty name
Returns
void
Exceptions
Zend_Navigation_Exceptionif the property is native
_init ( )
protected

Initializes page (used by subclasses)

Returns
void
static _normalizePropertyName (   $property)
staticprotected

Normalizes a property name.

Parameters
string$propertyproperty name to normalize
Returns
string normalized property name
addRel (   $relation,
  $value 
)

Adds a forward relation to the page.

Parameters
string$relationrelation name (e.g. alternate, glossary, canonical, etc)
mixed$valuevalue to set for relation
Returns
Zend_Navigation_Page fluent interface, returns self
addRev (   $relation,
  $value 
)

Adds a reverse relation to the page.

Parameters
string$relationrelation name (e.g. alternate, glossary, canonical, etc)
mixed$valuevalue to set for relation
Returns
Zend_Navigation_Page fluent interface, returns self
clearCustomHtmlAttribs ( )

Clear all custom HTML attributes.

Returns
Zend_Navigation_Page fluent interface, returns self
static factory (   $options)
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:

Parameters
array | Zend_Config$optionsoptions used for creating page
Returns
Zend_Navigation_Page a page instance
Exceptions
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
get (   $property)

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
string$propertyproperty name
Returns
mixed the property's value or null
Exceptions
Zend_Navigation_Exceptionif property name is invalid
getAccesskey ( )

Returns page access key.

Returns
string|null page access key or null
getActive (   $recursive = false)

Proxy to isActive()

Parameters
bool$recursive[optional] whether page should be considered active if any child pages are active. Default is false.
Returns
bool whether page should be considered active
getClass ( )

Returns page class (CSS)

Returns
string|null page's CSS class or null
getCustomHtmlAttrib (   $name)

Returns a single custom HTML attributes by name.

Parameters
string$namename of the HTML attribute
Returns
string|null value for the HTML attribute or null
Exceptions
Zend_Navigation_Exceptionif name is not string
getCustomHtmlAttribs ( )

Returns all custom HTML attributes as an array.

Returns
array an array containing custom HTML attributes
getCustomProperties ( )

Returns custom properties as an array.

Returns
array an array containing custom properties
static getDefaultPageType ( )
static
getDefinedRel ( )

Returns an array containing the defined forward relations.

Returns
array defined forward relations
getDefinedRev ( )

Returns an array containing the defined reverse relations.

Returns
array defined reverse relations
getFragment ( )

Returns fragment identifier.

Returns
string|null fragment identifier
getHref ( )
abstract

Returns href for this page.

Returns
string the page's href
getId ( )

Returns page id.

Returns
string|null page id or null
getLabel ( )

Returns page label.

Returns
string page label or null
getOrder ( )

Returns page order used in parent container.

Returns
int|null page order or null
getParent ( )

Returns parent container.

Returns
Zend_Navigation_Container|null parent container or null
getPrivilege ( )

Returns ACL privilege associated with this page.

Returns
string|null ACL privilege or null
getRel (   $relation = null)

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
string$relation[optional] name of relation to return. If not given, all relations will be returned.
Returns
array an array of relations. If $relation is not specified, all relations will be returned in an associative array.
getResource ( )

Returns ACL resource assoicated with this page.

Returns
string|Zend_Acl_Resource_Interface|null ACL resource or null
getRev (   $relation = null)

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
string$relation[optional] name of relation to return. If not given, all relations will be returned.
Returns
array an array of relations. If $relation is not specified, all relations will be returned in an associative array.
getTarget ( )

Returns page target.

Returns
string|null page target or null
getTitle ( )

Returns page title.

Returns
string|null page title or null
getVisible (   $recursive = false)

Proxy to isVisible()

Returns a boolean value indicating whether the page is visible

Parameters
bool$recursive[optional] whether page should be considered invisible if parent is invisible. Default is false.
Returns
bool whether page should be considered visible
hashCode ( )
final

Returns a hash code value for the page.

Returns
string a hash code value for this page
isActive (   $recursive = false)

Returns whether page should be considered active or not.

Parameters
bool$recursive[optional] whether page should be considered active if any child pages are active. Default is false.
Returns
bool whether page should be considered active
isVisible (   $recursive = false)

Returns a boolean value indicating whether the page is visible.

Parameters
bool$recursive[optional] whether page should be considered invisible if parent is invisible. Default is false.
Returns
bool whether page should be considered visible
removeCustomHtmlAttrib (   $name)

Removes a custom HTML attribute from the page.

Parameters
string$namename of the custom HTML attribute
Returns
Zend_Navigation_Page fluent interface, returns self
removeRel (   $relation)

Removes a forward relation from the page.

Parameters
string$relationname of relation to remove
Returns
Zend_Navigation_Page fluent interface, returns self
removeRev (   $relation)

Removes a reverse relation from the page.

Parameters
string$relationname of relation to remove
Returns
Zend_Navigation_Page fluent interface, returns self
set (   $property,
  $value 
)

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
string$propertyproperty name
mixed$valuevalue to set
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif property name is invalid
setAccesskey (   $character = null)

Sets access key for this page.

Parameters
string | null$character[optional] access key to set. Default is null, which sets no access key.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif access key is not string or null or if the string length not equal to one
setActive (   $active = true)

Sets whether page should be considered active or not.

Parameters
bool$active[optional] whether page should be considered active or not. Default is true.
Returns
Zend_Navigation_Page fluent interface, returns self
setClass (   $class = null)

Sets page CSS class.

Parameters
string | null$class[optional] CSS class to set. Default is null, which sets no CSS class.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif not given string or null
setConfig ( Zend_Config  $config)

Sets page properties using a Zend_Config object.

Parameters
Zend_Config$configconfig object to get properties from
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif invalid options are given
setCustomHtmlAttrib (   $name,
  $value 
)

Sets a single custom HTML attribute.

Parameters
string$namename of the HTML attribute
string | null$valuevalue for the HTML attribute
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif name is not string or value is not null or a string
setCustomHtmlAttribs ( array  $attribs)

Sets multiple custom HTML attributes at once.

Parameters
array$attribsan associative array of html attributes
Returns
Zend_Navigation_Page fluent interface, returns self
static setDefaultPageType (   $type = null)
static
setFragment (   $fragment)

Sets a fragment identifier.

Parameters
string$fragmentnew fragment identifier
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif empty/no string is given
setId (   $id = null)

Sets page id.

Parameters
string | null$id[optional] id to set. Default is null, which sets no id.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif not given string or null
setLabel (   $label)

Sets page label.

Parameters
string$labelnew page label
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif empty/no string is given
setOptions ( array  $options)

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
array$optionsassociative array of options to set
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif invalid options are given
setOrder (   $order = null)

Sets page order to use in parent container.

Parameters
int$order[optional] page order in container. Default is null, which sets no specific order.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif order is not integer or null
setParent ( Zend_Navigation_Container  $parent = null)

Sets parent container.

Parameters
Zend_Navigation_Container$parent[optional] new parent to set. Default is null which will set no parent.
Returns
Zend_Navigation_Page fluent interface, returns self
setPrivilege (   $privilege = null)

Sets ACL privilege associated with this page.

Parameters
string | null$privilege[optional] ACL privilege to associate with this page. Default is null, which sets no privilege.
Returns
Zend_Navigation_Page fluent interface, returns self
setRel (   $relations = null)

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
array | Zend_Config$relations[optional] an associative array of forward links to other pages
Returns
Zend_Navigation_Page fluent interface, returns self
setResource (   $resource = null)

Sets ACL resource assoicated with this page.

Parameters
string | Zend_Acl_Resource_Interface$resource[optional] resource to associate with page. Default is null, which sets no resource.
Exceptions
Zend_Navigation_Exceptionif $resource if invalid
Returns
Zend_Navigation_Page fluent interface, returns self
setRev (   $relations = null)

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
array | Zend_Config$relations[optional] an associative array of reverse links to other pages
Returns
Zend_Navigation_Page fluent interface, returns self
setTarget (   $target = null)

Sets page target.

Parameters
string | null$target[optional] target to set. Default is null, which sets no target.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif target is not string or null
setTitle (   $title = null)

Sets page title.

Parameters
string$title[optional] page title. Default is null, which sets no title.
Returns
Zend_Navigation_Page fluent interface, returns self
Exceptions
Zend_Navigation_Exceptionif not given string or null
setVisible (   $visible = true)

Sets whether the page should be visible or not.

Parameters
bool$visible[optional] whether page should be considered visible or not. Default is true.
Returns
Zend_Navigation_Page fluent interface, returns self
toArray ( )

Returns an array representation of the page.

Returns
array associative array containing all page properties

Member Data Documentation

$_accesskey
protected
$_active = false
protected
$_class
protected
$_customHtmlAttribs = array()
protected
$_defaultPageType
staticprotected
$_fragment
protected
$_id
protected
$_label
protected
$_order
protected
$_parent
protected
$_privilege
protected
$_properties = array()
protected
$_rel = array()
protected
$_resource
protected
$_rev = array()
protected
$_target
protected
$_title
protected
$_visible = true
protected