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

Public Member Functions

 setContainer (Zend_Navigation_Container $container=null)
 Sets navigation container the helper operates on by default.
 
 getContainer ()
 Returns the navigation container helper operates on by default.
 
 setMinDepth ($minDepth=null)
 Sets the minimum depth a page must have to be included when rendering.
 
 getMinDepth ()
 Returns minimum depth a page must have to be included when rendering.
 
 setMaxDepth ($maxDepth=null)
 Sets the maximum depth a page can have to be included when rendering.
 
 getMaxDepth ()
 Returns maximum depth a page can have to be included when rendering.
 
 setIndent ($indent)
 Set the indentation string for using in render(), optionally a number of spaces to indent with.
 
 getIndent ()
 Returns indentation (format output is respected)
 
 getEOL ()
 Returns the EOL character (format output is respected)
 
 setFormatOutput ($formatOutput=true)
 Sets whether HTML/XML output should be formatted.
 
 getFormatOutput ()
 Returns whether HTML/XML output should be formatted.
 
 setPrefixForId ($prefix)
 Sets prefix for IDs when they are normalized.
 
 getPrefixForId ()
 Returns prefix for IDs when they are normalized.
 
 skipPrefixForId ($flag=true)
 Skip the current prefix for IDs when they are normalized.
 
 setTranslator ($translator=null)
 Sets translator to use in helper.
 
 getTranslator ()
 Returns translator used in helper.
 
 setAcl (Zend_Acl $acl=null)
 Sets ACL to use when iterating pages.
 
 getAcl ()
 Returns ACL or null if it isn't set using setAcl() or setDefaultAcl().
 
 setRole ($role=null)
 Sets ACL role(s) to use when iterating pages.
 
 getRole ()
 Returns ACL role to use when iterating pages, or null if it isn't set using setRole() or setDefaultRole().
 
 setUseAcl ($useAcl=true)
 Sets whether ACL should be used.
 
 getUseAcl ()
 Returns whether ACL should be used.
 
 getRenderInvisible ()
 Return renderInvisible flag.
 
 setRenderInvisible ($renderInvisible=true)
 Render invisible items?
 
 setUseTranslator ($useTranslator=true)
 Sets whether translator should be used.
 
 getUseTranslator ()
 Returns whether translator should be used.
 
 __call ($method, array $arguments=array())
 Magic overload: Proxy calls to the navigation container.
 
 __toString ()
 Magic overload: Proxy to render().
 
 findActive (Zend_Navigation_Container $container, $minDepth=null, $maxDepth=-1)
 Finds the deepest active page in the given container.
 
 hasContainer ()
 Checks if the helper has a container.
 
 hasAcl ()
 Checks if the helper has an ACL instance.
 
 hasRole ()
 Checks if the helper has an ACL role.
 
 hasTranslator ()
 Checks if the helper has a translator.
 
 htmlify (Zend_Navigation_Page $page)
 Returns an HTML string containing an 'a' element for the given page.
 
 accept (Zend_Navigation_Page $page, $recursive=true)
 Determines whether a page should be accepted when iterating.
 
- Public Member Functions inherited from Zend_View_Helper_HtmlElement
 getClosingBracket ()
 Get the tag closing bracket.
 
- Public Member Functions inherited from Zend_View_Helper_Abstract
 setView (Zend_View_Interface $view)
 Set the View object.
 
 direct ()
 Strategy pattern: currently unutilized.
 
- Public Member Functions inherited from Zend_View_Helper_Navigation_Helper
 render (Zend_Navigation_Container $container=null)
 Renders helper.
 

Static Public Member Functions

static setDefaultAcl (Zend_Acl $acl=null)
 Sets default ACL to use if another ACL is not explicitly set.
 
static setDefaultRole ($role=null)
 Sets default ACL role(s) to use when iterating pages if not explicitly set later with setRole().
 

Protected Member Functions

 _acceptAcl (Zend_Navigation_Page $page)
 Determines whether a page should be accepted by ACL when iterating.
 
 _getWhitespace ($indent)
 Retrieve whitespace representation of $indent.
 
 _htmlAttribs ($attribs)
 Converts an associative array to a string of tag attributes.
 
 _normalizeId ($value)
 Normalize an ID.
 
- Protected Member Functions inherited from Zend_View_Helper_HtmlElement
 _isXhtml ()
 Is doctype XHTML?
 
 _isHtml5 ()
 Is doctype HTML5?
 
 _isStrictDoctype ()
 Is doctype strict?
 
 _htmlAttribs ($attribs)
 Converts an associative array to a string of tag attributes.
 
 _normalizeId ($value)
 Normalize an ID.
 

Protected Attributes

 $_container
 
 $_minDepth
 
 $_maxDepth
 
 $_indent = ''
 
 $_formatOutput = true
 
 $_prefixForId = null
 
 $_skipPrefixForId = false
 
 $_translator
 
 $_acl
 
 $_renderInvisible = false
 
 $_role
 
 $_useTranslator = true
 
 $_useAcl = true
 
- Protected Attributes inherited from Zend_View_Helper_HtmlElement
 $_closingBracket = null
 

Static Protected Attributes

static $_defaultAcl
 
static $_defaultRole
 

Additional Inherited Members

- Public Attributes inherited from Zend_View_Helper_HtmlElement
const EOL = "\n"
 EOL character.
 

Member Function Documentation

__call (   $method,
array  $arguments = array() 
)

Magic overload: Proxy calls to the navigation container.

Parameters
string$methodmethod name in container
array$arguments[optional] arguments to pass
Returns
mixed returns what the container returns
Exceptions
Zend_Navigation_Exceptionif method does not exist in container
__toString ( )

Magic overload: Proxy to 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().

Returns
string

Implements Zend_View_Helper_Navigation_Helper.

_acceptAcl ( Zend_Navigation_Page  $page)
protected

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
Zend_Navigation_Page$pagepage to check
Returns
bool whether page is accepted by ACL
_getWhitespace (   $indent)
protected

Retrieve whitespace representation of $indent.

Parameters
int | string$indent
Returns
string
_htmlAttribs (   $attribs)
protected

Converts an associative array to a string of tag attributes.

Overloads Zend_View_Helper_HtmlElement::_htmlAttribs().

Parameters
array$attribsan array where each key-value pair is converted to an attribute name and value
Returns
string an attribute string
_normalizeId (   $value)
protected

Normalize an ID.

Extends Zend_View_Helper_HtmlElement::_normalizeId().

Parameters
string$valueID
Returns
string Normalized ID
accept ( Zend_Navigation_Page  $page,
  $recursive = true 
)

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
Zend_Navigation_Page$pagepage to check
bool$recursive[optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true.
Returns
bool whether page should be accepted
findActive ( Zend_Navigation_Container  $container,
  $minDepth = null,
  $maxDepth = -1 
)

Finds the deepest active page in the given container.

Parameters
Zend_Navigation_Container$containercontainer to search
int | null$minDepth[optional] minimum depth required for page to be valid. Default is to use getMinDepth(). A null value means no minimum depth required.
int | null$minDepth[optional] maximum depth a page can have to be valid. Default is to use getMaxDepth(). A null value means no maximum depth required.
Returns
array an associative array with the values 'depth' and 'page', or an empty array if not found
getAcl ( )

Returns ACL or null if it isn't set using setAcl() or setDefaultAcl().

Implements Zend_View_Helper_Navigation_Helper::getAcl().

Returns
Zend_Acl|null ACL object or null

Implements Zend_View_Helper_Navigation_Helper.

getContainer ( )

Returns 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.

Returns
Zend_Navigation_Container navigation container

Implements Zend_View_Helper_Navigation_Helper.

getEOL ( )

Returns the EOL character (format output is respected)

See Also
self::EOL
getFormatOutput()
Returns
string standard EOL charater or an empty string
getFormatOutput ( )

Returns whether HTML/XML output should be formatted.

Returns
bool whether HTML/XML output should be formatted
getIndent ( )

Returns indentation (format output is respected)

Returns
string indentation string or an empty string
getMaxDepth ( )

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

Returns
int|null maximum depth or null
getMinDepth ( )

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

Returns
int|null minimum depth or null
getPrefixForId ( )

Returns prefix for IDs when they are normalized.

Returns
string Prefix for
getRenderInvisible ( )

Return renderInvisible flag.

Returns
bool

Implements Zend_View_Helper_Navigation_Helper.

getRole ( )

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

Implements Zend_View_Helper_Navigation_Helper::getRole().

Returns
string|Zend_Acl_Role_Interface|null role or null

Implements Zend_View_Helper_Navigation_Helper.

getTranslator ( )

Returns translator used in helper.

Implements Zend_View_Helper_Navigation_Helper::getTranslator().

Returns
Zend_Translate_Adapter|null translator or null

Implements Zend_View_Helper_Navigation_Helper.

getUseAcl ( )

Returns whether ACL should be used.

Implements Zend_View_Helper_Navigation_Helper::getUseAcl().

Returns
bool whether ACL should be used

Implements Zend_View_Helper_Navigation_Helper.

getUseTranslator ( )

Returns whether translator should be used.

Implements Zend_View_Helper_Navigation_Helper::getUseTranslator().

Returns
bool whether translator should be used

Implements Zend_View_Helper_Navigation_Helper.

hasAcl ( )

Checks if the helper has an ACL instance.

Implements Zend_View_Helper_Navigation_Helper::hasAcl().

Returns
bool whether the helper has a an ACL instance or not

Implements Zend_View_Helper_Navigation_Helper.

hasContainer ( )

Checks if the helper has a container.

Implements Zend_View_Helper_Navigation_Helper::hasContainer().

Returns
bool whether the helper has a container or not

Implements Zend_View_Helper_Navigation_Helper.

hasRole ( )

Checks if the helper has an ACL role.

Implements Zend_View_Helper_Navigation_Helper::hasRole().

Returns
bool whether the helper has a an ACL role or not

Implements Zend_View_Helper_Navigation_Helper.

hasTranslator ( )

Checks if the helper has a translator.

Implements Zend_View_Helper_Navigation_Helper::hasTranslator().

Returns
bool whether the helper has a translator or not

Implements Zend_View_Helper_Navigation_Helper.

htmlify ( Zend_Navigation_Page  $page)

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

Parameters
Zend_Navigation_Page$pagepage to generate HTML for
Returns
string HTML string for the given page
setAcl ( Zend_Acl  $acl = null)

Sets ACL to use when iterating pages.

Implements Zend_View_Helper_Navigation_Helper::setAcl().

Parameters
Zend_Acl$acl[optional] ACL object. Default is null.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

setContainer ( Zend_Navigation_Container  $container = null)

Sets navigation container the helper operates on by default.

Implements Zend_View_Helper_Navigation_Interface::setContainer().

Parameters
Zend_Navigation_Container$container[optional] container to operate on. Default is null, meaning container will be reset.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

static setDefaultAcl ( Zend_Acl  $acl = null)
static

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

Parameters
Zend_Acl$acl[optional] ACL object. Default is null, which sets no ACL object.
Returns
void
static setDefaultRole (   $role = null)
static

Sets default ACL role(s) to use when iterating pages if not explicitly set later with setRole().

Parameters
midex$role[optional] role to set. Expects null, string, or an instance of Zend_Acl_Role_Interface. Default is null, which sets no default role.
Exceptions
Zend_View_Exceptionif role is invalid
Returns
void
setFormatOutput (   $formatOutput = true)

Sets whether HTML/XML output should be formatted.

Parameters
bool$formatOutput[optional] whether output should be formatted. Default is true.
Returns
Zend_View_Helper_Navigation_Sitemap fluent interface, returns self
setIndent (   $indent)

Set the indentation string for using in render(), optionally a number of spaces to indent with.

Parameters
string | int$indentindentation string or number of spaces
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
setMaxDepth (   $maxDepth = null)

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

Parameters
int$maxDepth[optional] maximum depth. Default is null, which sets no maximum depth.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
setMinDepth (   $minDepth = null)

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

Parameters
int$minDepth[optional] minimum depth. Default is null, which sets no minimum depth.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
setPrefixForId (   $prefix)

Sets prefix for IDs when they are normalized.

Parameters
string$prefixPrefix for IDs
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
setRenderInvisible (   $renderInvisible = true)

Render invisible items?

Parameters
bool$renderInvisible[optional] boolean flag
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface returns self

Implements Zend_View_Helper_Navigation_Helper.

setRole (   $role = null)

Sets ACL role(s) to use when iterating pages.

Implements Zend_View_Helper_Navigation_Helper::setRole().

Parameters
mixed$role[optional] role to set. Expects a string, an instance of type Zend_Acl_Role_Interface, or null. Default is null, which will set no role.
Exceptions
Zend_View_Exceptionif $role is invalid
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

setTranslator (   $translator = null)

Sets translator to use in helper.

Implements Zend_View_Helper_Navigation_Helper::setTranslator().

Parameters
mixed$translator[optional] translator. Expects an object of type Zend_Translate_Adapter or Zend_Translate, or null. Default is null, which sets no translator.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

setUseAcl (   $useAcl = true)

Sets whether ACL should be used.

Implements Zend_View_Helper_Navigation_Helper::setUseAcl().

Parameters
bool$useAcl[optional] whether ACL should be used. Default is true.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

setUseTranslator (   $useTranslator = true)

Sets whether translator should be used.

Implements Zend_View_Helper_Navigation_Helper::setUseTranslator().

Parameters
bool$useTranslator[optional] whether translator should be used. Default is true.
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Implements Zend_View_Helper_Navigation_Helper.

skipPrefixForId (   $flag = true)

Skip the current prefix for IDs when they are normalized.

Parameters
bool$flag
Returns
Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self

Member Data Documentation

$_acl
protected
$_container
protected
$_defaultAcl
staticprotected
$_defaultRole
staticprotected
$_formatOutput = true
protected
$_indent = ''
protected
$_maxDepth
protected
$_minDepth
protected
$_prefixForId = null
protected
$_renderInvisible = false
protected
$_role
protected
$_skipPrefixForId = false
protected
$_translator
protected
$_useAcl = true
protected
$_useTranslator = true
protected