<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}
{composition-setup}
{zone-data:component-name}
Zend_Navigation
{zone-data}
{zone-data:proposer-list}
[~robinsk]
{zone-data}
{zone-data:liaison}
[Alexander Veremyev (Zend Liaison)|~alexander]
{zone-data}
{zone-data:revision}
1.0 - 5 February 2009: Initial Draft.
1.1 - 21 March 2009 Updated based on community feedback.
{zone-data}
{zone-data:overview}
Zend_Navigation and its set of view helpers intend to simplify the creation and rendering of navigational structures, such as menus, breadcrumbs, navigational head links, and XML sitemaps.
{zone-data}
{zone-data:references}
* [Zym_Navigation implementation|http://github.com/robinsk/zym/tree/work]
* [Zym_Navigation documentation|http://robinsk.net/misc/zymdocs-2009-03-21/zym.navigation.html]
* [Breadcrumbs, Yahoo! Design Pattern Library|http://developer.yahoo.com/ypatterns/pattern.php?pattern=breadcrumbs]
* [Navigation Tabs, Yahoo! Design Pattern Library|http://developer.yahoo.com/ypatterns/pattern.php?pattern=navigationtabs]
* [Sitemaps XML format|http://sitemaps.org/protocol.php]
* [Document relationships: the LINK element|http://www.w3.org/TR/html4/struct/links.html#h-12.3]
* [Link types|http://www.w3.org/TR/html4/types.html#h-6.12]
{zone-data}
{zone-data:requirements}
* This component *will* be able to generate URLs for pages
** This component *will* allow assembling of page URLs based on module/contoller/action
** This component *will* allow assembling of page URLs based on routes
** This component *will* allow assembling of page URLs with user params
** This component *will* allow custom URLs (i.e. not based on any of the above)
* This component *will* be able to automatically detect the currently active page in a navigation container
* This component *will* be able to render menus
* This component *will* be able to render breadcrumbs
* This component *will* be able to render navigational head links
* This component *will* be able to render sitemaps (Sitemaps XML)
* This component *will* have optional integration with ACL
* This component *will* have optional implicit localization
* This component *will not* contain any references to the Cthulhu Mythos
{zone-data}
{zone-data:dependencies}
* Zend_Exception
* Zend_Controller_Action_Helper_Url
* Zend_Validate_Abstract
* Zend_View_Helper_HtmlElement
{zone-data}
{zone-data:operation}
Zend_Navigation is a component for managing trees of pointers to web pages. Simply put: It can be used for creating menus, breadcrumbs, links, and sitemaps, or serve as a model for other navigation related purposes.
h4. Pages and containers
There are two concepts in Zend_Navigation:
# *Pages* \\ A page {{Zend_Navigation_Page}} in {{Zend_Navigation}} --- in its most basic form --- is an object that holds a pointer to a web page. In addition to the pointer itself, the page object contains a number of other properties that are typically relevant for navigation, such as label, title, etc. \\ \\
# *Containers* \\ A navigation container ({{Zend_Navigation_Container}}) is a container class for pages. It contains methods for adding, retrieving, deleting and iterating pages. It implementes the SPL interaces {{RecursiveIterator}} and {{Countable}}, and can thus be iterated recursively, either by using the SPL class {{RecursiveIteratorIterator}} class, or by implementing recursive iteration yourself using foreach loops or other iterators. \\ \\ Both {{Zend_Navigation}} and {{Zend_Navigation_Page}} extend {{Zend_Navigation_Container}}, so both can contain any number of hierarchic levels of pages.
By design, it is not possible to create arbitrary graphs of pages. That is, a page X cannot have a parent Y that is also a descendant of page X. It is only possible to create trees.
h4. Finder methods
Containers have finder methods for retrieving pages. They are {{findOneBy($property, $value)}}, {{findAllBy($property, $value)}}, and {{findBy($property, $value, $all = false)}}. Those methods will recursively search the container for pages matching the given {{$page->$property == $value}}. The first method, {{findOneBy()}}, will return a single page matching the property with the given value, or {{null}} if it cannot be found. The second method will return all pages with a property matching the given value. The third method will call one of the two former methods depending on the {{$all}} flag.
The finder methods can also be used magically by appending the property name to {{findBy}}, {{findOneBy}}, or {{findAllBy}}, e.g. {{findOneByLabel('Home')}} to return the first matching page with label {{Home}}. Other combinations are {{findByLabel(...)}}, {{findOnyByTitle(...)}}, {{findAllByController(...)}}, etc. Finder methods also work on custom properties, such as {{findByFoo('bar')}}.
h4. Rendering
Classes in the {{Zend_Navigation}} namespace do not deal with rendering of navigational elements. Rendering is done with navigational view helpers. However, pages contain information that is used by view helpers when rendering, such as; label, CSS class, title, lastmod and priority properties for sitemaps, etc.
h4. I18n, L13n
The navigational helpers support translating of page labels and titles. You can set a translator of type {{Zend_Translate}} or {{Zend_Translate_Adapter}} in the helper using {{$helper->setTranslator($translator)}}, or like with other I18n-enabled components; adding the translator to {{Zend_Registry}} using the key {{Zend_Translate}}, in which case it will be found by the helpers.
h4. ACL
All navigation view helpers support ACL inherently from the class {{Zend_View_Helper_NavigationBase}}. A {{Zend_Acl}} object can be assigned to a helper instance with {{$helper->setAcl($acl)}}, where {{$helper}} refers to an instance of a helper, and {{$acl}} is an ACL instance containing roles and possibly resources. The helpers can be assigned a role to use when iterating pages, by doing {{$helper->setRole('member')}} to set a role id, or {{$helper->setRole(new Zend_Acl_Role('member'))}} to set an instance. If ACL is used in the helper, the role in the helper must have rights for the page's resource and/or privilege to be included in a menu/breadcrumb/sitemap.
{zone-data}
{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal created
* Milestone 2: \[DONE\] Working prototype checked into [public repository|http://github.com/robinsk/zym/tree/work]
* Milestone 3: \[DONE\] Community review of proposal
* Milestone 4: \[DONE\] Proposal acceptance
* Milestone 5: \[DONE\] Passing unit tests and initial documentation committed to incubator
* Milestone 6: Review for inclusion in trunk
{zone-data}
{zone-data:class-list}
* Zend_Navigation
* Zend_Navigation_Container
* Zend_Navigation_Exception
* Zend_Navigation_Page
* Zend_Navigation_Page_Mvc
* Zend_Navigation_Page_Uri
* Zend_Validate_Sitemap_Changefreq
* Zend_Validate_Sitemap_Lastmod
* Zend_Validate_Sitemap_Loc
* Zend_Validate_Sitemap_Priority
* Zend_View_Helper_Navigation
* Zend_View_Helper_Navigation_Abstract
* Zend_View_Helper_Navigation_Breadcrumbs
* Zend_View_Helper_Navigation_Interface
* Zend_View_Helper_Navigation_Links
* Zend_View_Helper_Navigation_Menu
* Zend_View_Helper_Navigation_Sitemap
{zone-data}
{zone-data:use-cases}
{deck:id=UseCases1}
{card:label=UC-01: Basic container creation}
Basic creation of a navigational structure:
{code:php}
$pages = array(
array(
// Zend_Navigation_Page_Uri
'label' => 'Zend Framework',
'uri' => 'http://framework.zend.com/'
),
array(
// Zend_Navigation_Page_Mvc
'label' => 'New blog post',
'action' => 'new',
'controller' => 'blog'
)
);
// create container with a few initial pages
$nav = new Zend_Navigation($pages);
// ...or using Zend_Config
$nav = new Zend_Navigation(new Zend_Config($pages));
{code}
{card}
{card:label=UC-02: Using factory method}
Create a page using the factory method for pages:
{code:php}
// this will create an instance of Zend_Navigation_Page_Mvc
$page = Zend_Navigation_Page::factory(array(
'label' => 'Forums',
'module' => 'forum'
));
// ...or with Zend_Config
$page = Zend_Navigation_Page::factory(new Zend_Config(array(
'label' => 'Forums',
'module' => 'forum'
)));
// $nav refers to a container, as in UC-1
$nav->addPage($page);
{code}
{card}
{card:label=UC-03: Forcing page order}
Force a page to be first in a container:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'Home',
'module' => 'index',
'controller' => 'index',
'action' => 'index',
'order' => -100
));
// $nav refers to a container, as in UC-1
$nav->addPage($page);
{code}
{card}
{card:label=UC-04: Recursive iteration}
Iterate a container recursively:
{code:php}
$nav = new Zend_Navigation(array(
array(
'label' => 'Page 1',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 1.1',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 1.1.1',
'uri' => '#sub'
),
array(
'label' => 'Page 1.1.2',
'uri' => '#sub'
)
)
),
array(
'label' => 'Page 1.2',
'uri' => '#'
)
)
),
array(
'label' => 'Page 2',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 2.1',
'uri' => '#'
)
)
),
array(
'label' => 'Page 3',
'uri' => '#p3'
)
));
$ri = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST);
foreach ($ri as $page) {
echo $page->getLabel(), PHP_EOL;
}
/*
Output:
Page 1
Page 1.1
Page 1.1.1
Page 1.1.2
Page 1.2
Page 2
Page 2.1
Page 3
*/
{code}
{card}
{deck}
{deck:id=UseCases2}
{card:label=UC-05: Using magic overloads}
Use magic overloads to get/set properties:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'foo',
'uri' => 'foo'
));
echo $page->uri; // echoes foo
$page->uri = 'bar';
echo $page->getUri(); // echoes bar
{code}
{card}
{card:label=UC-06: Custom page properties}
Using custom properties in pages:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'foo',
'uri' => 'foo',
'category' => 'music'
));
echo $page->category; // echoes music
$page->category = 'awesomeness';
echo $page->getCategory(); // echoes awesomeness
{code}
{card}
{card:label=UC-07: Finder methods}
Use finder methods to retrieve pages:
{code:php}
// Using container from UC-04
// finds one page
$page2 = $nav->findBy('label', 'Page 2');
$page2 = $nav->findByLabel('Page 2');
$page2 = $nav->findOneByLabel('Page 2');
// finds two pages (returns an array)
$pages = $nav->findAllBy('uri', '#sub');
$pages = $nav->findAllByUri('#sub');
// returns null
$nada = $page->findByLabel('random label');
// returns an empty array
$empty = $page->findAllByLabel('random label');
{code}
{card}
{card:label=UC-08: Getting href's}
Get href's:
{code:php}
$page = new Zend_Navigation_Page_Mvc(array(
'label' => 'foo',
'action' => 'view',
'route' => 'blogroute',
'params' => array(
'page' => 1337
)
));
$frontController->getRouter()->addRoute(
'blogroute',
new Zend_Controller_Router_Route(
'b/:action/:page',
array(
'module' => 'blog',
'controller' => 'page',
'action' => 'index',
'page' => 0
)
)
);
echo $page->getHref(); // echoes /b/view/1337
{code}
{card}
{deck}
{deck:id=UseCases3}
{card:label=UC-09: Print a menu}
Print a menu from a view script or layout:
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->menu();
{code}
{card}
{card:label=UC-10: Print breadcrumbs}
Print breadcrumbs for the currently active page (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->breadcrumbs();
{code}
{card}
{card:label=UC-11: Print Sitemap XML}
Print an XML sitemap (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->sitemap();
{code}
{card}
{card:label=UC-12: Print head links}
Print head links for the currently active page (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->links();
{code}
{card}
{deck}
{zone-data}
{zone-data:skeletons}
{deck:id=ClassSkeletons1}
{card:label=Zend_Navigation}
{code:php}
class Zend_Navigation extends Zend_Navigation_Container
{
/**
* @param array|Zend_Config $pages
*/
public function __construct($pages = null);
}
{code}
{card}
{card:label=Zend_Navigation_Container}
{code:php}
abstract class Zend_Navigation_Container
implements RecursiveIterator, Countable
{
public function notifyOrderUpdated();
public function addPage($page);
public function addPages($pages);
public function setPages(array $pages);
public function getPages();
public function removePage($page);
public function removePages();
public function hasPage(Zend_Navigation_Page $page, $recursive = false);
public function hasPages();
public function findOneBy($property, $value);
public function findAllBy($property, $value);
public function findBy($property, $value, $all = false);
public function __call($method, $arguments);
public function toArray();
// RecursiveIterator interface:
public function current();
public function key();
public function next();
public function rewind();
public function valid();
public function hasChildren();
public function getChildren();
// Countable interface:
public function count();
}
{code}
{card}
{card:label=Zend_Navigation_Exception}
{code:php}
class Zend_Navigation_Exception extends Zend_Exception
{
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons2}
{card:label=Zend_Navigation_Page}
{code:php}
abstract class Zend_Navigation_Page extends Zend_Navigation_Container
{
// Initialization:
public static function factory($options);
public function __construct($options);
protected function _init();
public function setConfig(Zend_Config $config);
public function setOptions(array $options);
// Accessors:
public function setLabel($label);
public function getLabel();
public function setId($id = null);
public function getId();
public function setClass($class = null);
public function getClass();
public function setTitle($title = null);
public function getTitle();
public function setTarget($target = null);
public function getTarget();
public function setRel($relations = null);
public function getRel($relation = null);
public function setRev($relations = null)
public function getRev($relation = null)
public function setOrder($order = null);
public function getOrder();
public function setResource($resource = null);
public function getResource();
public function setPrivilege($privilege = null);
public function getPrivilege();
public function setActive($active = true);
public function isActive($recursive = false);
public function getActive($recursive = false);
public function setVisible($visible = true);
public function isVisible($recursive = false);
public function getVisible($recursive = false);
public function setParent(Zend_Navigation_Container $parent = null);
public function getParent();
// Magic overloads:
public function __set($name, $value);
public function __get($name);
public function __isset($name);
public function __unset($name);
public function __toString();
// Public methods:
public function addRel($relation, $value);
public function addRev($relation, $value);
public function removeRel($relation);
public function removeRev($relation);
public function getDefinedRel();
public function getDefinedRev();
public function getCustomProperties();
public final function hashCode();
public function toArray();
// Abstract methods:
abstract public function getHref();
}
{code}
{card}
{card:label=Zend_Navigation_Page_Mvc}
{code:php}
class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
{
// Accessors:
public function isActive($recursive = false);
public function getHref();
public function setAction($action);
public function getAction();
public function setController($controller);
public function getController();
public function setModule($module);
public function getModule();
public function setParams(array $params = null);
public function getParams();
public function setRoute($route);
public function getRoute();
public function setResetParams($resetParams);
public function getResetParams();
public static function setUrlHelper(Zend_Controller_Action_Helper_Url $uh);
// Public methods:
public function toArray();
}
{code}
{card}
{card:label=Zend_Navigation_Page_Uri}
{code:php}
class Zend_Navigation_Page_Uri extends Zend_Navigation_Page
{
public function setUri($uri);
public function getUri();
public function getHref();
// Public methods:
public function toArray();
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons3}
{card:label=Zend_Validate_Sitemap_Changefreq}
{code:php}
class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapChangefreq';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap changefreq",
);
protected $_changeFreqs = array(
'always', 'hourly', 'daily', 'weekly',
'monthly', 'yearly', 'never'
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Lastmod}
{code:php}
class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
{
const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9]){2}(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/m';
const NOT_VALID = 'invalidSitemapLastmod';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap lastmod",
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Loc}
{code:php}
class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapLoc';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap location",
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Priority}
{code:php}
class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapPriority';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap priority",
);
public function isValid($value);
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons4}
{card:label=Zend_View_Helper_Navigation_Interface}
{code:php}
interface Zend_View_Helper_Navigation_Interface
{
public function setContainer(Zend_Navigation_Container $container = null);
public function getContainer();
public function setTranslator($translator = null);
public function getTranslator();
public function setAcl(Zend_Acl $acl = null);
public function getAcl();
public function setRole($role = null);
public function getRole();
public function setUseAcl($useAcl = true);
public function getUseAcl();
public function setUseTranslator($useTranslator = true);
public function getUseTranslator();
public function hasContainer();
public function hasAcl();
public function hasRole();
public function hasTranslator();
public function __toString();
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Abstract}
{code:php}
abstract class Zend_View_Helper_Navigation_Abstract
extends Zend_View_Helper_HtmlElement
implements Zend_View_Helper_Navigation_Interface
{
protected $_container;
protected $_indent = '';
protected $_translator;
protected $_acl;
protected $_role;
protected $_useTranslator = true;
protected $_useAcl = true;
protected static $_defaultAcl;
protected static $_defaultRole;
// Accessors:
public function setContainer(Zend_Navigation_Container $container = null);
public function getContainer();
public function setIndent($indent);
public function getIndent();
public function setTranslator($translator = null);
public function getTranslator();
public function setAcl(Zend_Acl $acl = null);
public function getAcl();
public function setRole($role = null);
public function getRole();
public function setUseAcl($useAcl = true);
public function getUseAcl();
public function setUseTranslator($useTranslator = true);
public function getUseTranslator();
// Magic overloads:
public function __call($method, array $arguments = array());
public function __toString();
// Public methods:
public function findActive(Zend_Navigation_Container $container);
public function hasContainer();
public function hasAcl();
public function hasRole();
public function hasTranslator();
public function htmlify(Zend_Navigation_Page $page);
// Iterator filter methods:
public function accept(Zend_Navigation_Page $page, $recursive = true);
protected function _acceptAcl(Zend_Navigation_Page $page);
// Util methods:
protected function _getWhitespace($indent);
protected function _htmlAttribs($attribs);
protected function _normalizeId($value);
// Static methods:
public static function setDefaultAcl(Zend_Acl $acl = null);
public static function setDefaultRole($role = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation}
{code:php}
class Zend_View_Helper_Navigation
extends Zend_View_Helper_Navigation_Abstract
{
const NS = 'Zend_View_Helper_Navigation';
protected $_defaultProxy = 'menu';
protected $_helpers = array();
protected $_injectContainer = true;
protected $_injectAcl = true;
protected $_injectTranslator = true;
public function navigation(Zend_Navigation_Container $container = null);
public function __call($method, array $arguments = array());
public function findHelper($proxy, $strict = true);
protected function _inject(Zend_View_Helper_Navigation_Interface $helper);
// Accessors:
public function setDefaultProxy($proxy);
public function getDefaultProxy();
public function setInjectContainer($injectContainer = true);
public function getInjectContainer();
public function setInjectAcl($injectAcl = true);
public function getInjectAcl();
public function setInjectTranslator($injectTranslator = true);
public function getInjectTranslator();
// Zend_View_Helper_Navigation_Abstract:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons5}
{card:label=Zend_View_Helper_Navigation_Breadcrumbs}
{code:php}
class Zend_View_Helper_Navigation_Breadcrumbs
extends Zend_View_Helper_Navigation_Abstract
{
protected $_separator = ' > ';
protected $_minDepth = 1;
protected $_linkLast = false;
protected $_partial = null;
public function breadcrumbs(Zend_Navigation_Container $container = null);
public function setSeparator($separator);
public function getSeparator();
public function setMinDepth($minDepth);
public function getMinDepth();
public function setLinkLast($linkLast);
public function getLinkLast();
public function setPartial($partial);
public function getPartial();
public function renderStraight(Zend_Navigation_Container $container = null);
public function renderPartial(Zend_Navigation_Container $container = null,
$partial = null);
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Links}
{code:php}
class Zend_View_Helper_Navigation_Links
extends Zend_View_Helper_Navigation_Abstract
{
const RENDER_ALTERNATE = 0x0001;
const RENDER_STYLESHEET = 0x0002;
const RENDER_START = 0x0004;
const RENDER_NEXT = 0x0008;
const RENDER_PREV = 0x0010;
const RENDER_CONTENTS = 0x0020;
const RENDER_INDEX = 0x0040;
const RENDER_GLOSSARY = 0x0080;
const RENDER_COPYRIGHT = 0x0100;
const RENDER_CHAPTER = 0x0200;
const RENDER_SECTION = 0x0400;
const RENDER_SUBSECTION = 0x0800;
const RENDER_APPENDIX = 0x1000;
const RENDER_HELP = 0x2000;
const RENDER_BOOKMARK = 0x4000;
const RENDER_CUSTOM = 0x8000;
const RENDER_ALL = 0xffff;
protected static $_RELATIONS = array(
self::RENDER_ALTERNATE => 'alternate',
self::RENDER_STYLESHEET => 'stylesheet',
self::RENDER_START => 'start',
self::RENDER_NEXT => 'next',
self::RENDER_PREV => 'prev',
self::RENDER_CONTENTS => 'contents',
self::RENDER_INDEX => 'index',
self::RENDER_GLOSSARY => 'glossary',
self::RENDER_COPYRIGHT => 'copyright',
self::RENDER_CHAPTER => 'chapter',
self::RENDER_SECTION => 'section',
self::RENDER_SUBSECTION => 'subsection',
self::RENDER_APPENDIX => 'appendix',
self::RENDER_HELP => 'help',
self::RENDER_BOOKMARK => 'bookmark'
);
protected $_renderFlag = self::RENDER_ALL;
protected $_root;
public function links(Zend_Navigation_Container $container = null);
public function __call($method, array $arguments = array());
// Accessors:
public function setRenderFlag($renderFlag);
public function getRenderFlag();
// Finder methods:
public function findAllRelations(Zend_Navigation_Page $page,
$flag = null);
public function findRelation(Zend_Navigation_Page $page, $rel, $type);
protected function _findFromProperty(Zend_Navigation_Page $page, $rel, $type);
protected function _findFromSearch(Zend_Navigation_Page $page, $rel, $type);
// Search methods:
public function searchRelStart(Zend_Navigation_Page $page);
public function searchRelNext(Zend_Navigation_Page $page);
public function searchRelPrev(Zend_Navigation_Page $page);
public function searchRelChapter(Zend_Navigation_Page $page);
public function searchRelSection(Zend_Navigation_Page $page);
public function searchRelSubsection(Zend_Navigation_Page $page);
public function searchRevSection(Zend_Navigation_Page $page);
public function searchRevSubsection(Zend_Navigation_Page $page);
// Util methods:
protected function _convertToPages($mixed, $recursive = true);
protected function _findRoot(Zend_Navigation_Page $page);
// Render methods:
public function renderLink(Zend_Navigation_Page $page, $attrib, $relation);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Menu}
{code:php}
class Zend_View_Helper_Navigation_Menu
extends Zend_View_Helper_Navigation_Abstract
{
protected $_ulClass = 'navigation';
protected $_parentActive = true;
protected $_partial = null;
public function menu(Zend_Navigation_Container $container = null);
public function setUlClass($ulClass);
public function getUlClass();
public function setParentActive($flag);
public function getParentActive();
public function setPartial($partial);
public function getPartial();
// Public methods:
public function htmlify(Zend_Navigation_Page $page);
public function renderMenu(Zend_Navigation_Container $container = null,
$indent = null,
$useUlClass = true);
public function renderSubMenu(Zend_Navigation_Container $container = null,
$indent = null);
public function renderPartial(Zend_Navigation_Container $container = null,
$partial = null);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Sitemap}
{code:php}
class Zend_View_Helper_Navigation_Sitemap
extends Zend_View_Helper_Navigation_Abstract
{
const SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9';
const SITEMAP_XSD = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd';
protected $_maxDepth = null;
protected $_formatOutput = false;
protected $_useXmlDeclaration = true;
protected $_useSchemaValidation = false;
protected $_useSitemapValidators = true;
protected $_serverUrl;
public function sitemap(Zend_Navigation_Container $container = null,
array $options = array());
public function setMaxDepth($maxDepth = null);
public function getMaxDepth();
public function setFormatOutput($formatOutput);
public function getFormatOutput();
public function setUseXmlDeclaration($useXmlDecl);
public function getUseXmlDeclaration();
public function setUseSitemapValidators($useSitemapValidators);
public function getUseSitemapValidators();
public function setUseSchemaValidation($schemaValidation);
public function getUseSchemaValidation();
public function setServerUrl($serverUrl);
public function getServerUrl();
protected function _xmlEscape($string);
public function url(Zend_Navigation_Page $page);
public function getDomSitemap(Zend_Navigation_Container $container = null);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{deck}
{zone-data}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>
{composition-setup}
{zone-data:component-name}
Zend_Navigation
{zone-data}
{zone-data:proposer-list}
[~robinsk]
{zone-data}
{zone-data:liaison}
[Alexander Veremyev (Zend Liaison)|~alexander]
{zone-data}
{zone-data:revision}
1.0 - 5 February 2009: Initial Draft.
1.1 - 21 March 2009 Updated based on community feedback.
{zone-data}
{zone-data:overview}
Zend_Navigation and its set of view helpers intend to simplify the creation and rendering of navigational structures, such as menus, breadcrumbs, navigational head links, and XML sitemaps.
{zone-data}
{zone-data:references}
* [Zym_Navigation implementation|http://github.com/robinsk/zym/tree/work]
* [Zym_Navigation documentation|http://robinsk.net/misc/zymdocs-2009-03-21/zym.navigation.html]
* [Breadcrumbs, Yahoo! Design Pattern Library|http://developer.yahoo.com/ypatterns/pattern.php?pattern=breadcrumbs]
* [Navigation Tabs, Yahoo! Design Pattern Library|http://developer.yahoo.com/ypatterns/pattern.php?pattern=navigationtabs]
* [Sitemaps XML format|http://sitemaps.org/protocol.php]
* [Document relationships: the LINK element|http://www.w3.org/TR/html4/struct/links.html#h-12.3]
* [Link types|http://www.w3.org/TR/html4/types.html#h-6.12]
{zone-data}
{zone-data:requirements}
* This component *will* be able to generate URLs for pages
** This component *will* allow assembling of page URLs based on module/contoller/action
** This component *will* allow assembling of page URLs based on routes
** This component *will* allow assembling of page URLs with user params
** This component *will* allow custom URLs (i.e. not based on any of the above)
* This component *will* be able to automatically detect the currently active page in a navigation container
* This component *will* be able to render menus
* This component *will* be able to render breadcrumbs
* This component *will* be able to render navigational head links
* This component *will* be able to render sitemaps (Sitemaps XML)
* This component *will* have optional integration with ACL
* This component *will* have optional implicit localization
* This component *will not* contain any references to the Cthulhu Mythos
{zone-data}
{zone-data:dependencies}
* Zend_Exception
* Zend_Controller_Action_Helper_Url
* Zend_Validate_Abstract
* Zend_View_Helper_HtmlElement
{zone-data}
{zone-data:operation}
Zend_Navigation is a component for managing trees of pointers to web pages. Simply put: It can be used for creating menus, breadcrumbs, links, and sitemaps, or serve as a model for other navigation related purposes.
h4. Pages and containers
There are two concepts in Zend_Navigation:
# *Pages* \\ A page {{Zend_Navigation_Page}} in {{Zend_Navigation}} --- in its most basic form --- is an object that holds a pointer to a web page. In addition to the pointer itself, the page object contains a number of other properties that are typically relevant for navigation, such as label, title, etc. \\ \\
# *Containers* \\ A navigation container ({{Zend_Navigation_Container}}) is a container class for pages. It contains methods for adding, retrieving, deleting and iterating pages. It implementes the SPL interaces {{RecursiveIterator}} and {{Countable}}, and can thus be iterated recursively, either by using the SPL class {{RecursiveIteratorIterator}} class, or by implementing recursive iteration yourself using foreach loops or other iterators. \\ \\ Both {{Zend_Navigation}} and {{Zend_Navigation_Page}} extend {{Zend_Navigation_Container}}, so both can contain any number of hierarchic levels of pages.
By design, it is not possible to create arbitrary graphs of pages. That is, a page X cannot have a parent Y that is also a descendant of page X. It is only possible to create trees.
h4. Finder methods
Containers have finder methods for retrieving pages. They are {{findOneBy($property, $value)}}, {{findAllBy($property, $value)}}, and {{findBy($property, $value, $all = false)}}. Those methods will recursively search the container for pages matching the given {{$page->$property == $value}}. The first method, {{findOneBy()}}, will return a single page matching the property with the given value, or {{null}} if it cannot be found. The second method will return all pages with a property matching the given value. The third method will call one of the two former methods depending on the {{$all}} flag.
The finder methods can also be used magically by appending the property name to {{findBy}}, {{findOneBy}}, or {{findAllBy}}, e.g. {{findOneByLabel('Home')}} to return the first matching page with label {{Home}}. Other combinations are {{findByLabel(...)}}, {{findOnyByTitle(...)}}, {{findAllByController(...)}}, etc. Finder methods also work on custom properties, such as {{findByFoo('bar')}}.
h4. Rendering
Classes in the {{Zend_Navigation}} namespace do not deal with rendering of navigational elements. Rendering is done with navigational view helpers. However, pages contain information that is used by view helpers when rendering, such as; label, CSS class, title, lastmod and priority properties for sitemaps, etc.
h4. I18n, L13n
The navigational helpers support translating of page labels and titles. You can set a translator of type {{Zend_Translate}} or {{Zend_Translate_Adapter}} in the helper using {{$helper->setTranslator($translator)}}, or like with other I18n-enabled components; adding the translator to {{Zend_Registry}} using the key {{Zend_Translate}}, in which case it will be found by the helpers.
h4. ACL
All navigation view helpers support ACL inherently from the class {{Zend_View_Helper_NavigationBase}}. A {{Zend_Acl}} object can be assigned to a helper instance with {{$helper->setAcl($acl)}}, where {{$helper}} refers to an instance of a helper, and {{$acl}} is an ACL instance containing roles and possibly resources. The helpers can be assigned a role to use when iterating pages, by doing {{$helper->setRole('member')}} to set a role id, or {{$helper->setRole(new Zend_Acl_Role('member'))}} to set an instance. If ACL is used in the helper, the role in the helper must have rights for the page's resource and/or privilege to be included in a menu/breadcrumb/sitemap.
{zone-data}
{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal created
* Milestone 2: \[DONE\] Working prototype checked into [public repository|http://github.com/robinsk/zym/tree/work]
* Milestone 3: \[DONE\] Community review of proposal
* Milestone 4: \[DONE\] Proposal acceptance
* Milestone 5: \[DONE\] Passing unit tests and initial documentation committed to incubator
* Milestone 6: Review for inclusion in trunk
{zone-data}
{zone-data:class-list}
* Zend_Navigation
* Zend_Navigation_Container
* Zend_Navigation_Exception
* Zend_Navigation_Page
* Zend_Navigation_Page_Mvc
* Zend_Navigation_Page_Uri
* Zend_Validate_Sitemap_Changefreq
* Zend_Validate_Sitemap_Lastmod
* Zend_Validate_Sitemap_Loc
* Zend_Validate_Sitemap_Priority
* Zend_View_Helper_Navigation
* Zend_View_Helper_Navigation_Abstract
* Zend_View_Helper_Navigation_Breadcrumbs
* Zend_View_Helper_Navigation_Interface
* Zend_View_Helper_Navigation_Links
* Zend_View_Helper_Navigation_Menu
* Zend_View_Helper_Navigation_Sitemap
{zone-data}
{zone-data:use-cases}
{deck:id=UseCases1}
{card:label=UC-01: Basic container creation}
Basic creation of a navigational structure:
{code:php}
$pages = array(
array(
// Zend_Navigation_Page_Uri
'label' => 'Zend Framework',
'uri' => 'http://framework.zend.com/'
),
array(
// Zend_Navigation_Page_Mvc
'label' => 'New blog post',
'action' => 'new',
'controller' => 'blog'
)
);
// create container with a few initial pages
$nav = new Zend_Navigation($pages);
// ...or using Zend_Config
$nav = new Zend_Navigation(new Zend_Config($pages));
{code}
{card}
{card:label=UC-02: Using factory method}
Create a page using the factory method for pages:
{code:php}
// this will create an instance of Zend_Navigation_Page_Mvc
$page = Zend_Navigation_Page::factory(array(
'label' => 'Forums',
'module' => 'forum'
));
// ...or with Zend_Config
$page = Zend_Navigation_Page::factory(new Zend_Config(array(
'label' => 'Forums',
'module' => 'forum'
)));
// $nav refers to a container, as in UC-1
$nav->addPage($page);
{code}
{card}
{card:label=UC-03: Forcing page order}
Force a page to be first in a container:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'Home',
'module' => 'index',
'controller' => 'index',
'action' => 'index',
'order' => -100
));
// $nav refers to a container, as in UC-1
$nav->addPage($page);
{code}
{card}
{card:label=UC-04: Recursive iteration}
Iterate a container recursively:
{code:php}
$nav = new Zend_Navigation(array(
array(
'label' => 'Page 1',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 1.1',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 1.1.1',
'uri' => '#sub'
),
array(
'label' => 'Page 1.1.2',
'uri' => '#sub'
)
)
),
array(
'label' => 'Page 1.2',
'uri' => '#'
)
)
),
array(
'label' => 'Page 2',
'uri' => '#',
'pages' => array(
array(
'label' => 'Page 2.1',
'uri' => '#'
)
)
),
array(
'label' => 'Page 3',
'uri' => '#p3'
)
));
$ri = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST);
foreach ($ri as $page) {
echo $page->getLabel(), PHP_EOL;
}
/*
Output:
Page 1
Page 1.1
Page 1.1.1
Page 1.1.2
Page 1.2
Page 2
Page 2.1
Page 3
*/
{code}
{card}
{deck}
{deck:id=UseCases2}
{card:label=UC-05: Using magic overloads}
Use magic overloads to get/set properties:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'foo',
'uri' => 'foo'
));
echo $page->uri; // echoes foo
$page->uri = 'bar';
echo $page->getUri(); // echoes bar
{code}
{card}
{card:label=UC-06: Custom page properties}
Using custom properties in pages:
{code:php}
$page = Zend_Navigation_Page::factory(array(
'label' => 'foo',
'uri' => 'foo',
'category' => 'music'
));
echo $page->category; // echoes music
$page->category = 'awesomeness';
echo $page->getCategory(); // echoes awesomeness
{code}
{card}
{card:label=UC-07: Finder methods}
Use finder methods to retrieve pages:
{code:php}
// Using container from UC-04
// finds one page
$page2 = $nav->findBy('label', 'Page 2');
$page2 = $nav->findByLabel('Page 2');
$page2 = $nav->findOneByLabel('Page 2');
// finds two pages (returns an array)
$pages = $nav->findAllBy('uri', '#sub');
$pages = $nav->findAllByUri('#sub');
// returns null
$nada = $page->findByLabel('random label');
// returns an empty array
$empty = $page->findAllByLabel('random label');
{code}
{card}
{card:label=UC-08: Getting href's}
Get href's:
{code:php}
$page = new Zend_Navigation_Page_Mvc(array(
'label' => 'foo',
'action' => 'view',
'route' => 'blogroute',
'params' => array(
'page' => 1337
)
));
$frontController->getRouter()->addRoute(
'blogroute',
new Zend_Controller_Router_Route(
'b/:action/:page',
array(
'module' => 'blog',
'controller' => 'page',
'action' => 'index',
'page' => 0
)
)
);
echo $page->getHref(); // echoes /b/view/1337
{code}
{card}
{deck}
{deck:id=UseCases3}
{card:label=UC-09: Print a menu}
Print a menu from a view script or layout:
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->menu();
{code}
{card}
{card:label=UC-10: Print breadcrumbs}
Print breadcrumbs for the currently active page (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->breadcrumbs();
{code}
{card}
{card:label=UC-11: Print Sitemap XML}
Print an XML sitemap (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->sitemap();
{code}
{card}
{card:label=UC-12: Print head links}
Print head links for the currently active page (still in a view/layout):
{code:php}
// the navigation helper will inject the container to the menu helper
echo $this->navigation()->links();
{code}
{card}
{deck}
{zone-data}
{zone-data:skeletons}
{deck:id=ClassSkeletons1}
{card:label=Zend_Navigation}
{code:php}
class Zend_Navigation extends Zend_Navigation_Container
{
/**
* @param array|Zend_Config $pages
*/
public function __construct($pages = null);
}
{code}
{card}
{card:label=Zend_Navigation_Container}
{code:php}
abstract class Zend_Navigation_Container
implements RecursiveIterator, Countable
{
public function notifyOrderUpdated();
public function addPage($page);
public function addPages($pages);
public function setPages(array $pages);
public function getPages();
public function removePage($page);
public function removePages();
public function hasPage(Zend_Navigation_Page $page, $recursive = false);
public function hasPages();
public function findOneBy($property, $value);
public function findAllBy($property, $value);
public function findBy($property, $value, $all = false);
public function __call($method, $arguments);
public function toArray();
// RecursiveIterator interface:
public function current();
public function key();
public function next();
public function rewind();
public function valid();
public function hasChildren();
public function getChildren();
// Countable interface:
public function count();
}
{code}
{card}
{card:label=Zend_Navigation_Exception}
{code:php}
class Zend_Navigation_Exception extends Zend_Exception
{
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons2}
{card:label=Zend_Navigation_Page}
{code:php}
abstract class Zend_Navigation_Page extends Zend_Navigation_Container
{
// Initialization:
public static function factory($options);
public function __construct($options);
protected function _init();
public function setConfig(Zend_Config $config);
public function setOptions(array $options);
// Accessors:
public function setLabel($label);
public function getLabel();
public function setId($id = null);
public function getId();
public function setClass($class = null);
public function getClass();
public function setTitle($title = null);
public function getTitle();
public function setTarget($target = null);
public function getTarget();
public function setRel($relations = null);
public function getRel($relation = null);
public function setRev($relations = null)
public function getRev($relation = null)
public function setOrder($order = null);
public function getOrder();
public function setResource($resource = null);
public function getResource();
public function setPrivilege($privilege = null);
public function getPrivilege();
public function setActive($active = true);
public function isActive($recursive = false);
public function getActive($recursive = false);
public function setVisible($visible = true);
public function isVisible($recursive = false);
public function getVisible($recursive = false);
public function setParent(Zend_Navigation_Container $parent = null);
public function getParent();
// Magic overloads:
public function __set($name, $value);
public function __get($name);
public function __isset($name);
public function __unset($name);
public function __toString();
// Public methods:
public function addRel($relation, $value);
public function addRev($relation, $value);
public function removeRel($relation);
public function removeRev($relation);
public function getDefinedRel();
public function getDefinedRev();
public function getCustomProperties();
public final function hashCode();
public function toArray();
// Abstract methods:
abstract public function getHref();
}
{code}
{card}
{card:label=Zend_Navigation_Page_Mvc}
{code:php}
class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page
{
// Accessors:
public function isActive($recursive = false);
public function getHref();
public function setAction($action);
public function getAction();
public function setController($controller);
public function getController();
public function setModule($module);
public function getModule();
public function setParams(array $params = null);
public function getParams();
public function setRoute($route);
public function getRoute();
public function setResetParams($resetParams);
public function getResetParams();
public static function setUrlHelper(Zend_Controller_Action_Helper_Url $uh);
// Public methods:
public function toArray();
}
{code}
{card}
{card:label=Zend_Navigation_Page_Uri}
{code:php}
class Zend_Navigation_Page_Uri extends Zend_Navigation_Page
{
public function setUri($uri);
public function getUri();
public function getHref();
// Public methods:
public function toArray();
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons3}
{card:label=Zend_Validate_Sitemap_Changefreq}
{code:php}
class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapChangefreq';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap changefreq",
);
protected $_changeFreqs = array(
'always', 'hourly', 'daily', 'weekly',
'monthly', 'yearly', 'never'
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Lastmod}
{code:php}
class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract
{
const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9]){2}(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/m';
const NOT_VALID = 'invalidSitemapLastmod';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap lastmod",
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Loc}
{code:php}
class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapLoc';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap location",
);
public function isValid($value);
}
{code}
{card}
{card:label=Zend_Validate_Sitemap_Priority}
{code:php}
class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract
{
const NOT_VALID = 'invalidSitemapPriority';
protected $_messageTemplates = array(
self::NOT_VALID => "'%value%' is not a valid sitemap priority",
);
public function isValid($value);
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons4}
{card:label=Zend_View_Helper_Navigation_Interface}
{code:php}
interface Zend_View_Helper_Navigation_Interface
{
public function setContainer(Zend_Navigation_Container $container = null);
public function getContainer();
public function setTranslator($translator = null);
public function getTranslator();
public function setAcl(Zend_Acl $acl = null);
public function getAcl();
public function setRole($role = null);
public function getRole();
public function setUseAcl($useAcl = true);
public function getUseAcl();
public function setUseTranslator($useTranslator = true);
public function getUseTranslator();
public function hasContainer();
public function hasAcl();
public function hasRole();
public function hasTranslator();
public function __toString();
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Abstract}
{code:php}
abstract class Zend_View_Helper_Navigation_Abstract
extends Zend_View_Helper_HtmlElement
implements Zend_View_Helper_Navigation_Interface
{
protected $_container;
protected $_indent = '';
protected $_translator;
protected $_acl;
protected $_role;
protected $_useTranslator = true;
protected $_useAcl = true;
protected static $_defaultAcl;
protected static $_defaultRole;
// Accessors:
public function setContainer(Zend_Navigation_Container $container = null);
public function getContainer();
public function setIndent($indent);
public function getIndent();
public function setTranslator($translator = null);
public function getTranslator();
public function setAcl(Zend_Acl $acl = null);
public function getAcl();
public function setRole($role = null);
public function getRole();
public function setUseAcl($useAcl = true);
public function getUseAcl();
public function setUseTranslator($useTranslator = true);
public function getUseTranslator();
// Magic overloads:
public function __call($method, array $arguments = array());
public function __toString();
// Public methods:
public function findActive(Zend_Navigation_Container $container);
public function hasContainer();
public function hasAcl();
public function hasRole();
public function hasTranslator();
public function htmlify(Zend_Navigation_Page $page);
// Iterator filter methods:
public function accept(Zend_Navigation_Page $page, $recursive = true);
protected function _acceptAcl(Zend_Navigation_Page $page);
// Util methods:
protected function _getWhitespace($indent);
protected function _htmlAttribs($attribs);
protected function _normalizeId($value);
// Static methods:
public static function setDefaultAcl(Zend_Acl $acl = null);
public static function setDefaultRole($role = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation}
{code:php}
class Zend_View_Helper_Navigation
extends Zend_View_Helper_Navigation_Abstract
{
const NS = 'Zend_View_Helper_Navigation';
protected $_defaultProxy = 'menu';
protected $_helpers = array();
protected $_injectContainer = true;
protected $_injectAcl = true;
protected $_injectTranslator = true;
public function navigation(Zend_Navigation_Container $container = null);
public function __call($method, array $arguments = array());
public function findHelper($proxy, $strict = true);
protected function _inject(Zend_View_Helper_Navigation_Interface $helper);
// Accessors:
public function setDefaultProxy($proxy);
public function getDefaultProxy();
public function setInjectContainer($injectContainer = true);
public function getInjectContainer();
public function setInjectAcl($injectAcl = true);
public function getInjectAcl();
public function setInjectTranslator($injectTranslator = true);
public function getInjectTranslator();
// Zend_View_Helper_Navigation_Abstract:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{deck}
{deck:id=ClassSkeletons5}
{card:label=Zend_View_Helper_Navigation_Breadcrumbs}
{code:php}
class Zend_View_Helper_Navigation_Breadcrumbs
extends Zend_View_Helper_Navigation_Abstract
{
protected $_separator = ' > ';
protected $_minDepth = 1;
protected $_linkLast = false;
protected $_partial = null;
public function breadcrumbs(Zend_Navigation_Container $container = null);
public function setSeparator($separator);
public function getSeparator();
public function setMinDepth($minDepth);
public function getMinDepth();
public function setLinkLast($linkLast);
public function getLinkLast();
public function setPartial($partial);
public function getPartial();
public function renderStraight(Zend_Navigation_Container $container = null);
public function renderPartial(Zend_Navigation_Container $container = null,
$partial = null);
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Links}
{code:php}
class Zend_View_Helper_Navigation_Links
extends Zend_View_Helper_Navigation_Abstract
{
const RENDER_ALTERNATE = 0x0001;
const RENDER_STYLESHEET = 0x0002;
const RENDER_START = 0x0004;
const RENDER_NEXT = 0x0008;
const RENDER_PREV = 0x0010;
const RENDER_CONTENTS = 0x0020;
const RENDER_INDEX = 0x0040;
const RENDER_GLOSSARY = 0x0080;
const RENDER_COPYRIGHT = 0x0100;
const RENDER_CHAPTER = 0x0200;
const RENDER_SECTION = 0x0400;
const RENDER_SUBSECTION = 0x0800;
const RENDER_APPENDIX = 0x1000;
const RENDER_HELP = 0x2000;
const RENDER_BOOKMARK = 0x4000;
const RENDER_CUSTOM = 0x8000;
const RENDER_ALL = 0xffff;
protected static $_RELATIONS = array(
self::RENDER_ALTERNATE => 'alternate',
self::RENDER_STYLESHEET => 'stylesheet',
self::RENDER_START => 'start',
self::RENDER_NEXT => 'next',
self::RENDER_PREV => 'prev',
self::RENDER_CONTENTS => 'contents',
self::RENDER_INDEX => 'index',
self::RENDER_GLOSSARY => 'glossary',
self::RENDER_COPYRIGHT => 'copyright',
self::RENDER_CHAPTER => 'chapter',
self::RENDER_SECTION => 'section',
self::RENDER_SUBSECTION => 'subsection',
self::RENDER_APPENDIX => 'appendix',
self::RENDER_HELP => 'help',
self::RENDER_BOOKMARK => 'bookmark'
);
protected $_renderFlag = self::RENDER_ALL;
protected $_root;
public function links(Zend_Navigation_Container $container = null);
public function __call($method, array $arguments = array());
// Accessors:
public function setRenderFlag($renderFlag);
public function getRenderFlag();
// Finder methods:
public function findAllRelations(Zend_Navigation_Page $page,
$flag = null);
public function findRelation(Zend_Navigation_Page $page, $rel, $type);
protected function _findFromProperty(Zend_Navigation_Page $page, $rel, $type);
protected function _findFromSearch(Zend_Navigation_Page $page, $rel, $type);
// Search methods:
public function searchRelStart(Zend_Navigation_Page $page);
public function searchRelNext(Zend_Navigation_Page $page);
public function searchRelPrev(Zend_Navigation_Page $page);
public function searchRelChapter(Zend_Navigation_Page $page);
public function searchRelSection(Zend_Navigation_Page $page);
public function searchRelSubsection(Zend_Navigation_Page $page);
public function searchRevSection(Zend_Navigation_Page $page);
public function searchRevSubsection(Zend_Navigation_Page $page);
// Util methods:
protected function _convertToPages($mixed, $recursive = true);
protected function _findRoot(Zend_Navigation_Page $page);
// Render methods:
public function renderLink(Zend_Navigation_Page $page, $attrib, $relation);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Menu}
{code:php}
class Zend_View_Helper_Navigation_Menu
extends Zend_View_Helper_Navigation_Abstract
{
protected $_ulClass = 'navigation';
protected $_parentActive = true;
protected $_partial = null;
public function menu(Zend_Navigation_Container $container = null);
public function setUlClass($ulClass);
public function getUlClass();
public function setParentActive($flag);
public function getParentActive();
public function setPartial($partial);
public function getPartial();
// Public methods:
public function htmlify(Zend_Navigation_Page $page);
public function renderMenu(Zend_Navigation_Container $container = null,
$indent = null,
$useUlClass = true);
public function renderSubMenu(Zend_Navigation_Container $container = null,
$indent = null);
public function renderPartial(Zend_Navigation_Container $container = null,
$partial = null);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{card:label=Zend_View_Helper_Navigation_Sitemap}
{code:php}
class Zend_View_Helper_Navigation_Sitemap
extends Zend_View_Helper_Navigation_Abstract
{
const SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9';
const SITEMAP_XSD = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd';
protected $_maxDepth = null;
protected $_formatOutput = false;
protected $_useXmlDeclaration = true;
protected $_useSchemaValidation = false;
protected $_useSitemapValidators = true;
protected $_serverUrl;
public function sitemap(Zend_Navigation_Container $container = null,
array $options = array());
public function setMaxDepth($maxDepth = null);
public function getMaxDepth();
public function setFormatOutput($formatOutput);
public function getFormatOutput();
public function setUseXmlDeclaration($useXmlDecl);
public function getUseXmlDeclaration();
public function setUseSitemapValidators($useSitemapValidators);
public function getUseSitemapValidators();
public function setUseSchemaValidation($schemaValidation);
public function getUseSchemaValidation();
public function setServerUrl($serverUrl);
public function getServerUrl();
protected function _xmlEscape($string);
public function url(Zend_Navigation_Page $page);
public function getDomSitemap(Zend_Navigation_Container $container = null);
// Zend_View_Helper_Navigation_Interface:
public function render(Zend_Navigation_Container $container = null);
}
{code}
{card}
{deck}
{zone-data}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>