View/Helper/Navigation/HelperAbstract.php
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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
- Version
- $Id: HelperAbstract.php 25239 2013-01-22 09:45:01Z frosch $
\Zend_View_Helper_Navigation_HelperAbstract
Base class for navigational helpers
- Implements
- \Zend_View_Helper_Navigation_Helper
- Parent(s)
- \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
- Children
- \Zend_View_Helper_Navigation_Menu
- \Zend_View_Helper_Navigation_Breadcrumbs
- \Zend_View_Helper_Navigation_Sitemap
- \Zend_View_Helper_Navigation_Links
- \Zend_View_Helper_Navigation
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

string $_closingBracket = null
nullDetails- Type
- string
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$_closingBracket

\Zend_Acl $_defaultAcl = Default ACL to use when iterating pages if not explicitly set in the instance by calling {@link setAcl()}
- Type
- \Zend_Acl

string|\Zend_Acl_Role_Interface $_defaultRole = Default ACL role to use when iterating pages if not explicitly set in the instance by calling {@link setRole()}
- Type
- string | \Zend_Acl_Role_Interface

bool $_formatOutput = trueWhether HTML/XML output should be formatted
trueDetails- Type
- bool

string|null $_prefixForId = nullPrefix for IDs when they are normalized
nullDetails- Type
- string | null

bool $_renderInvisible = falseWheter invisible items should be rendered by this helper
falseDetails- Type
- bool

string|\Zend_Acl_Role_Interface $_role = ACL role to use when iterating pages
- Type
- string | \Zend_Acl_Role_Interface

bool $_skipPrefixForId = falseSkip current prefix for IDs when they are normalized (flag)
falseDetails- Type
- bool

bool $_useAcl = trueWhether ACL should be used for filtering out pages
trueDetails- Type
- bool

bool $_useTranslator = trueWhether translator should be used for page labels and titles
trueDetails- Type
- bool

\Zend_View_Interface $view = nullView object
Inherited from: \Zend_View_Helper_Abstract::$$view\Zend_View_Helper_HtmlElement::$$viewnullDetails- Type
- \Zend_View_Interface
- Inherited_from
- \Zend_View_Helper_Abstract::$$view
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$view
Methods

__call(string $method, array $arguments = array()) : mixedMagic overload: Proxy calls to the navigation container
| Name | Type | Description |
|---|---|---|
| $method | string | method name in container |
| $arguments | array | [optional] arguments to pass |
| Type | Description |
|---|---|
| mixed | returns what the container returns |
| Exception | Description |
|---|---|
| \Zend_Navigation_Exception | if method does not exist in container |

__toString() : stringMagic overload: Proxy to {@link render()}.
This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown.
Implements Zend_View_Helper_Navigation_Helper::__toString().
| Type | Description |
|---|---|
| string |

_acceptAcl(\Zend_Navigation_Page $page) : boolDetermines whether a page should be accepted by ACL when iterating
Rules: - If helper has no ACL, page is accepted - If page has a resource or privilege defined, page is accepted if the ACL allows access to it using the helper's role - If page has no resource or privilege, page is accepted
| Name | Type | Description |
|---|---|---|
| $page | \Zend_Navigation_Page | page to check |
| Type | Description |
|---|---|
| bool | whether page is accepted by ACL |

_getWhitespace(int | string $indent) : stringRetrieve whitespace representation of $indent
| Name | Type | Description |
|---|---|---|
| $indent | int | string |
| Type | Description |
|---|---|
| string |

_htmlAttribs(array $attribs) : stringConverts an associative array to a string of tag attributes.
Overloads Zend_View_Helper_HtmlElement::_htmlAttribs().
| Name | Type | Description |
|---|---|---|
| $attribs | array | an array where each key-value pair is converted to an attribute name and value |
| Type | Description |
|---|---|
| string | an attribute string |

_normalizeId(string $value) : stringNormalize an ID
| Name | Type | Description |
|---|---|---|
| $value | string | ID |
| Type | Description |
|---|---|
| string | Normalized ID |

accept(\Zend_Navigation_Page $page, bool $recursive = true) : boolDetermines whether a page should be accepted when iterating
Rules: - If a page is not visible it is not accepted, unless RenderInvisible has been set to true. - If helper has no ACL, page is accepted - If helper has ACL, but no role, page is not accepted - If helper has ACL and role: - Page is accepted if it has no resource or privilege - Page is accepted if ACL allows page's resource or privilege - If page is accepted by the rules above and $recursive is true, the page will not be accepted if it is the descendant of a non-accepted page.
| Name | Type | Description |
|---|---|---|
| $page | \Zend_Navigation_Page | page to check |
| $recursive | bool | [optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true. |
| Type | Description |
|---|---|
| bool | whether page should be accepted |

direct() : voidStrategy pattern: currently unutilized
Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()
findActive(\Zend_Navigation_Container $container, int | null | int | null $minDepth = null, $maxDepth = -1) : arrayFinds the deepest active page in the given container
| Name | Type | Description |
|---|---|---|
| $container | \Zend_Navigation_Container | container to search |
| $minDepth | int | null | int | null | [optional] minimum depth required for page to be valid. Default is to use {@link getMinDepth()}. A null value means no minimum depth required. |
| $maxDepth |
| Type | Description |
|---|---|
| array | an associative array with the values 'depth' and 'page', or an empty array if not found |

getAcl() : \Zend_Acl | nullReturns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}
Implements Zend_View_Helper_Navigation_Helper::getAcl().
| Type | Description |
|---|---|
| \Zend_Acl | null | ACL object or null |

getClosingBracket() : stringGet the tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()| Type | Description |
|---|---|
| string |

getContainer() : \Zend_Navigation_ContainerReturns the navigation container helper operates on by default
Implements Zend_View_Helper_Navigation_Interface::getContainer().
If a helper is not explicitly set in this helper instance by calling setContainer() or by passing it through the helper entry point, this method will look in Zend_Registry for a container by using the key 'Zend_Navigation'.
If no container is set, and nothing is found in Zend_Registry, a new container will be instantiated and stored in the helper.
| Type | Description |
|---|---|
| \Zend_Navigation_Container | navigation container |

getEOL() : stringReturns the EOL character (format output is respected)
| Type | Description |
|---|---|
| string | standard EOL charater or an empty string |
- See
- \global\self::EOL
- See
- \global\getFormatOutput()

getFormatOutput() : boolReturns whether HTML/XML output should be formatted
| Type | Description |
|---|---|
| bool | whether HTML/XML output should be formatted |

getIndent() : stringReturns indentation (format output is respected)
| Type | Description |
|---|---|
| string | indentation string or an empty string |

getMaxDepth() : int | nullReturns maximum depth a page can have to be included when rendering
| Type | Description |
|---|---|
| int | null | maximum depth or null |

getMinDepth() : int | nullReturns minimum depth a page must have to be included when rendering
| Type | Description |
|---|---|
| int | null | minimum depth or null |

getPrefixForId() : stringReturns prefix for IDs when they are normalized
| Type | Description |
|---|---|
| string | Prefix for |

getRole() : string | \Zend_Acl_Role_Interface | nullReturns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}
Implements Zend_View_Helper_Navigation_Helper::getRole().
| Type | Description |
|---|---|
| string | \Zend_Acl_Role_Interface | null | role or null |

getTranslator() : \Zend_Translate_Adapter | nullReturns translator used in helper
| Type | Description |
|---|---|
| \Zend_Translate_Adapter | null | translator or null |

getUseAcl() : boolReturns whether ACL should be used
Implements Zend_View_Helper_Navigation_Helper::getUseAcl().
| Type | Description |
|---|---|
| bool | whether ACL should be used |

getUseTranslator() : boolReturns whether translator should be used
| Type | Description |
|---|---|
| bool | whether translator should be used |

hasAcl() : boolChecks if the helper has an ACL instance
Implements Zend_View_Helper_Navigation_Helper::hasAcl().
| Type | Description |
|---|---|
| bool | whether the helper has a an ACL instance or not |

hasContainer() : boolChecks if the helper has a container
| Type | Description |
|---|---|
| bool | whether the helper has a container or not |

hasRole() : boolChecks if the helper has an ACL role
Implements Zend_View_Helper_Navigation_Helper::hasRole().
| Type | Description |
|---|---|
| bool | whether the helper has a an ACL role or not |

hasTranslator() : boolChecks if the helper has a translator
| Type | Description |
|---|---|
| bool | whether the helper has a translator or not |

htmlify(\Zend_Navigation_Page $page) : stringReturns an HTML string containing an 'a' element for the given page
| Name | Type | Description |
|---|---|---|
| $page | \Zend_Navigation_Page | page to generate HTML for |
| Type | Description |
|---|---|
| string | HTML string for the given page |

render(\Zend_Navigation_Container $container = null) : string
| Name | Type | Description |
|---|---|---|
| $container | \Zend_Navigation_Container | [optional] container to render. Default is null, which indicates that the helper should render the container returned by {@link getContainer()}. |
| Type | Description |
|---|---|
| string | helper output |
| Exception | Description |
|---|---|
| \Zend_View_Exception | if unable to render |

setAcl(\Zend_Acl $acl = null) : \Zend_View_Helper_Navigation_HelperAbstractSets ACL to use when iterating pages
Implements Zend_View_Helper_Navigation_Helper::setAcl().
| Name | Type | Description |
|---|---|---|
| $acl | \Zend_Acl | [optional] ACL object. Default is null. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setContainer(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_HelperAbstractSets navigation container the helper operates on by default
| Name | Type | Description |
|---|---|---|
| $container | \Zend_Navigation_Container | [optional] container to operate on. Default is null, meaning container will be reset. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setDefaultAcl(\Zend_Acl $acl = null) : voidSets default ACL to use if another ACL is not explicitly set
| Name | Type | Description |
|---|---|---|
| $acl | \Zend_Acl | [optional] ACL object. Default is null, which sets no ACL object. |

setDefaultRole(\midex $role = null) : voidSets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}
| Name | Type | Description |
|---|---|---|
| $role | \midex | [optional] role to set. Expects null, string, or an instance of {@link Zend_Acl_Role_Interface}. Default is null, which sets no default role. |
| Exception | Description |
|---|---|
| \Zend_View_Exception | if role is invalid |

setFormatOutput(bool $formatOutput = true) : \Zend_View_Helper_Navigation_SitemapSets whether HTML/XML output should be formatted
| Name | Type | Description |
|---|---|---|
| $formatOutput | bool | [optional] whether output should be formatted. Default is true. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_Sitemap | fluent interface, returns self |

setIndent(string | int $indent) : \Zend_View_Helper_Navigation_HelperAbstractSet the indentation string for using in {@link render()}, optionally a number of spaces to indent with
| Name | Type | Description |
|---|---|---|
| $indent | string | int | indentation string or number of spaces |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setMaxDepth(int $maxDepth = null) : \Zend_View_Helper_Navigation_HelperAbstractSets the maximum depth a page can have to be included when rendering
| Name | Type | Description |
|---|---|---|
| $maxDepth | int | [optional] maximum depth. Default is null, which sets no maximum depth. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setMinDepth(int $minDepth = null) : \Zend_View_Helper_Navigation_HelperAbstractSets the minimum depth a page must have to be included when rendering
| Name | Type | Description |
|---|---|---|
| $minDepth | int | [optional] minimum depth. Default is null, which sets no minimum depth. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setPrefixForId(string $prefix) : \Zend_View_Helper_Navigation_HelperAbstractSets prefix for IDs when they are normalized
| Name | Type | Description |
|---|---|---|
| $prefix | string | Prefix for IDs |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setRenderInvisible(bool $renderInvisible = true) : \Zend_View_Helper_Navigation_HelperAbstractRender invisible items?
| Name | Type | Description |
|---|---|---|
| $renderInvisible | bool | [optional] boolean flag |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface returns self |

setRole(mixed $role = null) : \Zend_View_Helper_Navigation_HelperAbstractSets ACL role(s) to use when iterating pages
Implements Zend_View_Helper_Navigation_Helper::setRole().
| Name | Type | Description |
|---|---|---|
| $role | mixed | [optional] role to set. Expects a string, an instance of type {@link Zend_Acl_Role_Interface}, or null. Default is null, which will set no role. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |
| Exception | Description |
|---|---|
| \Zend_View_Exception | if $role is invalid |

setTranslator(mixed $translator = null) : \Zend_View_Helper_Navigation_HelperAbstractSets translator to use in helper
| Name | Type | Description |
|---|---|---|
| $translator | mixed | [optional] translator. Expects an object of type {@link Zend_Translate_Adapter} or {@link Zend_Translate}, or null. Default is null, which sets no translator. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setUseAcl(bool $useAcl = true) : \Zend_View_Helper_Navigation_HelperAbstractSets whether ACL should be used
Implements Zend_View_Helper_Navigation_Helper::setUseAcl().
| Name | Type | Description |
|---|---|---|
| $useAcl | bool | [optional] whether ACL should be used. Default is true. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setUseTranslator(bool $useTranslator = true) : \Zend_View_Helper_Navigation_HelperAbstractSets whether translator should be used
| Name | Type | Description |
|---|---|---|
| $useTranslator | bool | [optional] whether translator should be used. Default is true. |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |

setView(\Zend_View_Interface $view) : \Zend_View_Helper_AbstractSet the View object
Inherited from: \Zend_View_Helper_Abstract::setView()\Zend_View_Helper_HtmlElement::setView()| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_View_Helper_Abstract |

skipPrefixForId(bool $flag = true) : \Zend_View_Helper_Navigation_HelperAbstractSkip the current prefix for IDs when they are normalized
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |