View/Helper/Navigation/HelperAbstract.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 [email protected] 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_View  
Subpackage
Helper  
Version
$Id$  

\Zend_View_Helper_Navigation_HelperAbstract

Package: Zend_View\Helper
Base class for navigational helpers
Implements
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Acl $_acl
ACL to use when iterating pages
Details
Type
\Zend_Acl
>VPropertyprotected\Zend_Navigation_Container $_container
Container to operate on by default
>VPropertyprotected\Zend_Acl $_defaultAcl
static
Default ACL to use when iterating pages if not explicitly set in the instance by calling {@link setAcl()}
Details
Type
\Zend_Acl
>VPropertyprotectedstring|\Zend_Acl_Role_Interface $_defaultRole
static
Default ACL role to use when iterating pages if not explicitly set in the instance by calling {@link setRole()}
Details
Type
string | \Zend_Acl_Role_Interface
>VPropertyprotectedbool $_formatOutput = true
Whether HTML/XML output should be formatted
Default valuetrueDetails
Type
bool
>VPropertyprotectedstring $_indent = ''
Indentation string
Default value''Details
Type
string
>VPropertyprotectedint $_maxDepth
The maximum depth a page can have to be included when rendering
Details
Type
int
>VPropertyprotectedint $_minDepth
The minimum depth a page must have to be included when rendering
Details
Type
int
>VPropertyprotectedstring|null $_prefixForId = null
Prefix for IDs when they are normalized
Default valuenullDetails
Type
string | null
>VPropertyprotectedbool $_renderInvisible = false
Wheter invisible items should be rendered by this helper
Default valuefalseDetails
Type
bool
>VPropertyprotectedstring|\Zend_Acl_Role_Interface $_role
ACL role to use when iterating pages
Details
Type
string | \Zend_Acl_Role_Interface
>VPropertyprotectedbool $_skipPrefixForId = false
Skip current prefix for IDs when they are normalized (flag)
Default valuefalseDetails
Type
bool
>VPropertyprotected\Zend_Translate_Adapter $_translator
Translator
>VPropertyprotectedbool $_useAcl = true
Whether ACL should be used for filtering out pages
Default valuetrueDetails
Type
bool
>VPropertyprotectedbool $_useTranslator = true
Whether translator should be used for page labels and titles
Default valuetrueDetails
Type
bool

Methods

methodpublic__call(string $method, array $arguments = array()) : mixed

Magic overload: Proxy calls to the navigation container

Parameters
NameTypeDescription
$methodstring

method name in container

$argumentsarray

[optional] arguments to pass

Returns
TypeDescription
mixedreturns what the container returns
Throws
ExceptionDescription
\Zend_Navigation_Exceptionif method does not exist in container
methodpublic__toString() : string

Magic overload: Proxy to {@link render()}.

This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown. Implements {@link Zend_View_Helper_Navigation_Helper::__toString()}.
Returns
TypeDescription
string
methodprotected_acceptAcl(\Zend_Navigation_Page $page) : bool

Determines 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
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to check

Returns
TypeDescription
boolwhether page is accepted by ACL
methodprotected_getWhitespace(int | string $indent) : string

Retrieve whitespace representation of $indent

Parameters
NameTypeDescription
$indentint | string
Returns
TypeDescription
string
methodprotected_htmlAttribs(array $attribs) : string

Converts an associative array to a string of tag attributes.

Overloads {@link Zend_View_Helper_HtmlElement::_htmlAttribs()}.
Parameters
NameTypeDescription
$attribsarray

an array where each key-value pair is converted

                    to an attribute name and value
Returns
TypeDescription
stringan attribute string
methodprotected_normalizeId(string $value) : string

Normalize an ID

Extends {@link Zend_View_Helper_HtmlElement::_normalizeId()}.
Parameters
NameTypeDescription
$valuestring

ID

Returns
TypeDescription
stringNormalized ID
methodpublicaccept(\Zend_Navigation_Page $page, bool $recursive = true) : bool

Determines 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.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to check

$recursivebool

[optional] if true, page will not

                                    be accepted if it is the
                                    descendant of a page that is not
                                    accepted. Default is true.
Returns
TypeDescription
boolwhether page should be accepted
methodpublicfindActive(\Zend_Navigation_Container $container, int | null | int | null $minDepth = null,  $maxDepth = -1) : array

Finds the deepest active page in the given container

Parameters
NameTypeDescription
$container\Zend_Navigation_Container

container to search

$minDepthint | 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
Returns
TypeDescription
arrayan associative array with the values 'depth' and 'page', or an empty array if not found
methodpublicgetAcl() : \Zend_Acl | null

Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}

Implements {@link Zend_View_Helper_Navigation_Helper::getAcl()}.
Returns
TypeDescription
\Zend_Acl | nullACL object or null
methodpublicgetContainer() : \Zend_Navigation_Container

Returns the navigation container helper operates on by default

Implements {@link Zend_View_Helper_Navigation_Interface::getContainer()}. If a helper is not explicitly set in this helper instance by calling {@link setContainer()} or by passing it through the helper entry point, this method will look in {@link 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.
Returns
TypeDescription
\Zend_Navigation_Containernavigation container
methodpublicgetEOL() : string

Returns the EOL character (format output is respected)

Returns
TypeDescription
stringstandard EOL charater or an empty string
Details
See
 
See
 
methodpublicgetFormatOutput() : bool

Returns whether HTML/XML output should be formatted

Returns
TypeDescription
boolwhether HTML/XML output should be formatted
methodpublicgetIndent() : string

Returns indentation (format output is respected)

Returns
TypeDescription
stringindentation string or an empty string
methodpublicgetMaxDepth() : int | null

Returns maximum depth a page can have to be included when rendering

Returns
TypeDescription
int | nullmaximum depth or null
methodpublicgetMinDepth() : int | null

Returns minimum depth a page must have to be included when rendering

Returns
TypeDescription
int | nullminimum depth or null
methodpublicgetPrefixForId() : string

Returns prefix for IDs when they are normalized

Returns
TypeDescription
stringPrefix for
methodpublicgetRenderInvisible() : bool

Return renderInvisible flag

Returns
TypeDescription
bool
methodpublicgetRole() : string | \Zend_Acl_Role_Interface | null

Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}

Implements {@link Zend_View_Helper_Navigation_Helper::getRole()}.
Returns
TypeDescription
string | \Zend_Acl_Role_Interface | nullrole or null
methodpublicgetTranslator() : \Zend_Translate_Adapter | null

Returns translator used in helper

Implements {@link Zend_View_Helper_Navigation_Helper::getTranslator()}.
Returns
TypeDescription
\Zend_Translate_Adapter | nulltranslator or null
methodpublicgetUseAcl() : bool

Returns whether ACL should be used

Implements {@link Zend_View_Helper_Navigation_Helper::getUseAcl()}.
Returns
TypeDescription
boolwhether ACL should be used
methodpublicgetUseTranslator() : bool

Returns whether translator should be used

Implements {@link Zend_View_Helper_Navigation_Helper::getUseTranslator()}.
Returns
TypeDescription
boolwhether translator should be used
methodpublichasAcl() : bool

Checks if the helper has an ACL instance

Implements {@link Zend_View_Helper_Navigation_Helper::hasAcl()}.
Returns
TypeDescription
boolwhether the helper has a an ACL instance or not
methodpublichasContainer() : bool

Checks if the helper has a container

Implements {@link Zend_View_Helper_Navigation_Helper::hasContainer()}.
Returns
TypeDescription
boolwhether the helper has a container or not
methodpublichasRole() : bool

Checks if the helper has an ACL role

Implements {@link Zend_View_Helper_Navigation_Helper::hasRole()}.
Returns
TypeDescription
boolwhether the helper has a an ACL role or not
methodpublichasTranslator() : bool

Checks if the helper has a translator

Implements {@link Zend_View_Helper_Navigation_Helper::hasTranslator()}.
Returns
TypeDescription
boolwhether the helper has a translator or not
methodpublichtmlify(\Zend_Navigation_Page $page) : string

Returns an HTML string containing an 'a' element for the given page

Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to generate HTML for

Returns
TypeDescription
stringHTML string for the given page
methodpublicsetAcl(\Zend_Acl $acl = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets ACL to use when iterating pages

Implements {@link Zend_View_Helper_Navigation_Helper::setAcl()}.
Parameters
NameTypeDescription
$acl\Zend_Acl

[optional] ACL object.

                                                Default is null.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetContainer(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets navigation container the helper operates on by default

Implements {@link Zend_View_Helper_Navigation_Interface::setContainer()}.
Parameters
NameTypeDescription
$container\Zend_Navigation_Container

[optional] container

                                                to operate on.
                                                Default is null,
                                                meaning container
                                                will be reset.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetDefaultAcl(\Zend_Acl $acl = null) : void
static

Sets default ACL to use if another ACL is not explicitly set

Parameters
NameTypeDescription
$acl\Zend_Acl

[optional] ACL object. Default is null, which

                   sets no ACL object.
methodpublicsetDefaultRole(\midex $role = null) : void
static

Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}

Parameters
NameTypeDescription
$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.
Throws
ExceptionDescription
\Zend_View_Exceptionif role is invalid
methodpublicsetFormatOutput(bool $formatOutput = true) : \Zend_View_Helper_Navigation_Sitemap

Sets whether HTML/XML output should be formatted

Parameters
NameTypeDescription
$formatOutputbool

[optional] whether output

                                         should be formatted. Default
                                         is true.
Returns
TypeDescription
\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self
methodpublicsetIndent(string | int $indent) : \Zend_View_Helper_Navigation_HelperAbstract

Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with

Parameters
NameTypeDescription
$indentstring | int

indentation string or number of spaces

Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetMaxDepth(int $maxDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets the maximum depth a page can have to be included when rendering

Parameters
NameTypeDescription
$maxDepthint

[optional] maximum

                                                depth. Default is
                                                null, which sets no
                                                maximum depth.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetMinDepth(int $minDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets the minimum depth a page must have to be included when rendering

Parameters
NameTypeDescription
$minDepthint

[optional] minimum

                                                depth. Default is
                                                null, which sets
                                                no minimum depth.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetPrefixForId(string $prefix) : \Zend_View_Helper_Navigation_HelperAbstract

Sets prefix for IDs when they are normalized

Parameters
NameTypeDescription
$prefixstring

Prefix for IDs

Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetRenderInvisible(bool $renderInvisible = true) : \Zend_View_Helper_Navigation_HelperAbstract

Render invisible items?

Parameters
NameTypeDescription
$renderInvisiblebool

[optional] boolean flag

Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface returns self
methodpublicsetRole(mixed $role = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets ACL role(s) to use when iterating pages

Implements {@link Zend_View_Helper_Navigation_Helper::setRole()}.
Parameters
NameTypeDescription
$rolemixed

[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.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
Throws
ExceptionDescription
\Zend_View_Exceptionif $role is invalid
methodpublicsetTranslator(mixed $translator = null) : \Zend_View_Helper_Navigation_HelperAbstract

Sets translator to use in helper

Implements {@link Zend_View_Helper_Navigation_Helper::setTranslator()}.
Parameters
NameTypeDescription
$translatormixed

[optional] translator.

                                                Expects an object of
                                                type
                                                {@link Zend_Translate_Adapter}
                                                or {@link Zend_Translate},
                                                or null. Default is
                                                null, which sets no
                                                translator.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetUseAcl(bool $useAcl = true) : \Zend_View_Helper_Navigation_HelperAbstract

Sets whether ACL should be used

Implements {@link Zend_View_Helper_Navigation_Helper::setUseAcl()}.
Parameters
NameTypeDescription
$useAclbool

[optional] whether ACL

                                                should be used.
                                                Default is true.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicsetUseTranslator(bool $useTranslator = true) : \Zend_View_Helper_Navigation_HelperAbstract

Sets whether translator should be used

Implements {@link Zend_View_Helper_Navigation_Helper::setUseTranslator()}.
Parameters
NameTypeDescription
$useTranslatorbool

[optional] whether

                                                translator should be
                                                used. Default is true.
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
methodpublicskipPrefixForId(bool $flag = true) : \Zend_View_Helper_Navigation_HelperAbstract

Skip the current prefix for IDs when they are normalized

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self
Documentation was generated by phpDocumentor 2.2.0 .