• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Navigation_Page类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Navigation_Page的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Navigation_Page类的具体用法?PHP Zend_Navigation_Page怎么用?PHP Zend_Navigation_Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_Navigation_Page类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: htmlify

 /**
  * Returns an HTML string containing an 'a' element for the given page if
  * the page's href is not empty, and a 'span' element if it is empty
  *
  * Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}.
  *
  * @param  Zend_Navigation_Page $page  page to generate HTML for
  * @return string                      HTML string for the given page
  */
 public function htmlify(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
         if (is_string($title) && !empty($title)) {
             $title = $t->translate($title);
         }
     }
     // get attribs for element
     $attribs = array_merge($page->getCustomProperties(), array('id' => $page->getId(), 'title' => $title, 'class' => $page->getClass()));
     // does page have a href?
     if ($href = $page->getHref()) {
         if ($page->isActive()) {
             if ($attribs['class'] != '') {
                 $attribs['class'] .= ' ';
             }
             $attribs['class'] .= 'ui-btn-active';
         }
         $element = 'a';
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
         $attribs['accesskey'] = $page->getAccessKey();
     } else {
         $element = 'span';
     }
     return '<' . $element . $this->_htmlAttribs($attribs) . '>' . $this->view->escape($label) . '</' . $element . '>';
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:42,代码来源:MobileMenu.php


示例2: treeToPageContainer

 /**
  * Recursively add pages to the container
  * 
  * @param Zoo_Object_Tree $tree
  * @param Zend_Navigation_Container $container
  * @param int $key
  * @return void
  */
 function treeToPageContainer(&$tree, Zend_Navigation_Page $container, $key = 0)
 {
     $children = $tree->getFirstChild($key);
     foreach ($children as $child) {
         $page = $this->nodeToPage($child);
         $container->addPage($page);
         $this->treeToPageContainer($tree, $page, $child->id);
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:17,代码来源:Menu.php


示例3: getLiClass

 function getLiClass(Zend_Navigation_Page $subPage, $isActive)
 {
     if ($isActive && $this->_activeClass) {
         return ' class="' . $this->_activeClass . '"';
     }
     if ($subPage->get('disabled') && $this->_disabledClass) {
         return ' class="' . $this->_disabledClass . '"';
     }
     if ($this->_normalClass) {
         return ' class="' . $this->_normalClass . '"';
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:12,代码来源:Menu.php


示例4: _getHtmlLabel

 public function _getHtmlLabel(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
     }
     return $this->view->escape($label);
 }
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:12,代码来源:DojoMenu.php


示例5: addDefaultPages

 function addDefaultPages()
 {
     $separator = new Am_Navigation_Admin_Item_Separator();
     $this->addPage(array('id' => 'dashboard', 'controller' => 'admin', 'label' => ___('Dashboard')));
     $this->addPage(Zend_Navigation_Page::factory(array('id' => 'users', 'uri' => '#', 'label' => ___('Users'), 'resource' => 'grid_u', 'privilege' => 'browse', 'pages' => array_merge(array(array('id' => 'users-browse', 'controller' => 'admin-users', 'label' => ___('Browse Users'), 'resource' => 'grid_u', 'privilege' => 'browse', 'class' => 'bold'), array('id' => 'users-insert', 'uri' => REL_ROOT_URL . '/admin-users?_u_a=insert', 'label' => ___('Add User'), 'resource' => 'grid_u', 'privilege' => 'insert')), !Am_Di::getInstance()->config->get('manually_approve') ? array() : array(array('id' => 'user-not-approved', 'controller' => 'admin-users', 'action' => 'not-approved', 'label' => ___('Not Approved Users'), 'resource' => 'grid_u', 'privilege' => 'browse')), array(array('id' => 'users-email', 'controller' => 'admin-email', 'label' => ___('E-Mail Users'), 'resource' => Am_Auth_Admin::PERM_EMAIL), clone $separator, array('id' => 'users-import', 'controller' => 'admin-import', 'label' => ___('Import Users'), 'resource' => Am_Auth_Admin::PERM_IMPORT))))));
     $this->addPage(array('id' => 'reports', 'uri' => '#', 'label' => ___('Reports'), 'pages' => array(array('id' => 'reports-reports', 'controller' => 'admin-reports', 'label' => ___('Reports'), 'resource' => Am_Auth_Admin::PERM_REPORT), array('id' => 'reports-payments', 'type' => 'Am_Navigation_Page_Mvc', 'controller' => 'admin-payments', 'label' => ___('Payments'), 'resource' => array('grid_payment', 'grid_invoice')))));
     $this->addPage(array('id' => 'products', 'uri' => '#', 'label' => ___('Products'), 'pages' => array_filter(array(array('id' => 'products-manage', 'controller' => 'admin-products', 'label' => ___('Manage Products'), 'resource' => 'grid_product', 'class' => 'bold'), array('id' => 'products-coupons', 'controller' => 'admin-coupons', 'label' => ___('Coupons'), 'resource' => 'grid_coupon')))));
     /**
      *  Temporary disable this menu if user is on upgrade controller in order to avoid error: 
      *  Fatal error: Class Folder contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ResourceAbstract::getAccessType)
      *  
      *   @todo Remove this in the future;
      * 
      */
     $content_pages = array();
     if (Zend_Controller_Front::getInstance()->getRequest()->getControllerName() != 'admin-upgrade') {
         foreach (Am_Di::getInstance()->resourceAccessTable->getAccessTables() as $t) {
             $k = $t->getPageId();
             $content_pages[] = array('id' => 'content-' . $k, 'module' => 'default', 'controller' => 'admin-content', 'action' => 'index', 'label' => $t->getAccessTitle(), 'resource' => 'grid_content', 'params' => array('page_id' => $k), 'route' => 'inside-pages');
         }
     }
     $this->addPage(array('id' => 'content', 'controller' => 'admin-content', 'label' => ___('Protect Content'), 'resource' => 'grid_content', 'class' => 'bold', 'pages' => $content_pages));
     $this->addPage(array('id' => 'configuration', 'uri' => '#', 'label' => ___('Configuration'), 'pages' => array_filter(array(array('id' => 'setup', 'controller' => 'admin-setup', 'label' => ___('Setup/Configuration'), 'resource' => Am_Auth_Admin::PERM_SETUP, 'class' => 'bold'), array('id' => 'saved-form', 'controller' => 'admin-saved-form', 'label' => ___('Forms Editor'), 'resource' => @constant('Am_Auth_Admin::PERM_FORM'), 'class' => 'bold'), array('id' => 'fields', 'controller' => 'admin-fields', 'label' => ___('Add User Fields'), 'resource' => @constant('Am_Auth_Admin::PERM_ADD_USER_FIELD')), array('id' => 'email-template-layout', 'controller' => 'admin-email-template-layout', 'label' => ___('Email Layouts'), 'resource' => Am_Auth_Admin::PERM_SETUP), array('id' => 'ban', 'controller' => 'admin-ban', 'label' => ___('Blocking IP/E-Mail'), 'resource' => @constant('Am_Auth_Admin::PERM_BAN')), array('id' => 'countries', 'controller' => 'admin-countries', 'label' => ___('Countries/States'), 'resource' => @constant('Am_Auth_Admin::PERM_COUNTRY_STATE')), array('id' => 'admins', 'controller' => 'admin-admins', 'label' => ___('Admin Accounts'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('id' => 'change-pass', 'controller' => 'admin-change-pass', 'label' => ___('Change Password'))))));
     $this->addPage(array('id' => 'utilites', 'uri' => '#', 'label' => ___('Utilities'), 'order' => 1000, 'pages' => array_filter(array(Am_Di::getInstance()->modules->isEnabled('cc') ? null : array('id' => 'backup', 'controller' => 'admin-backup', 'label' => ___('Backup'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), Am_Di::getInstance()->modules->isEnabled('cc') ? null : array('id' => 'restore', 'controller' => 'admin-restore', 'label' => ___('Restore'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), array('id' => 'rebuild', 'controller' => 'admin-rebuild', 'label' => ___('Rebuild Db'), 'resource' => @constant('Am_Auth_Admin::PERM_REBUILD_DB')), clone $separator, array('id' => 'logs', 'type' => 'Am_Navigation_Page_Mvc', 'controller' => 'admin-logs', 'label' => ___('Logs'), 'resource' => array(@constant('Am_Auth_Admin::PERM_LOGS'), @constant('Am_Auth_Admin::PERM_LOGS_ACCESS'), @constant('Am_Auth_Admin::PERM_LOGS_INVOICE'), @constant('Am_Auth_Admin::PERM_LOGS_MAIL'), @constant('Am_Auth_Admin::PERM_LOGS_ADMIN'))), array('id' => 'info', 'controller' => 'admin-info', 'label' => ___('System Info'), 'resource' => @constant('Am_Auth_Admin::PERM_SYSTEM_INFO')), clone $separator, array('id' => 'trans-global', 'controller' => 'admin-trans-global', 'label' => ___('Edit Messages'), 'resource' => @constant('Am_Auth_Admin::PERM_TRANSLATION')), array('id' => 'clear', 'controller' => 'admin-clear', 'label' => ___('Delete Old Records'), 'resource' => @constant('Am_Auth_Admin::PERM_CLEAR')), array('id' => 'build-demo', 'controller' => 'admin-build-demo', 'label' => ___('Build Demo'), 'resource' => @constant('Am_Auth_Admin::PERM_BUILD_DEMO'))))));
     $this->addPage(array('id' => 'help', 'uri' => '#', 'label' => ___('Help & Support'), 'order' => 1001, 'pages' => array_filter(array(array('id' => 'documentation', 'uri' => 'http://www.amember.com/docs/', 'target' => '_blank', 'label' => ___('Documentation')), array('id' => 'report-bugs', 'uri' => 'http://bt.amember.com/', 'target' => '_blank', 'label' => ___('Report Bugs'))))));
     Am_Di::getInstance()->hook->call(Am_Event::ADMIN_MENU, array('menu' => $this));
     /// workaround against using the current route for generating urls
     foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $child) {
         if ($child instanceof Zend_Navigation_Page_Mvc && $child->getRoute() === null) {
             $child->setRoute('default');
         }
     }
 }
开发者ID:irovast,项目名称:eyedock,代码行数:33,代码来源:Admin.php


示例6: toXtype

 public function toXtype(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
         if (is_string($title) && !empty($title)) {
             $title = $t->translate($title);
         }
     }
     // get attribs for element
     $attribs = array('id' => $page->getId(), 'text' => $label, 'iconCls' => $page->get('iconClass'), 'cls' => $page->getClass());
     // does page have a href?
     if ($href = $page->getHref()) {
         $attribs['href'] = $href;
         $attribs['hrefTarget'] = $page->getTarget();
     }
     foreach ($attribs as $key => &$attr) {
         if (empty($attr)) {
             unset($attribs[$key]);
         }
     }
     return $attribs;
 }
开发者ID:roed,项目名称:zend-mvc-extend,代码行数:28,代码来源:Extjs.php


示例7: getLiClass

 function getLiClass(Zend_Navigation_Page $subPage, $isActive)
 {
     $class = '';
     if ($isActive && $this->_activeClass) {
         $class .= $this->_activeClass . ' ';
     } elseif ($subPage->get('disabled') && $this->_disabledClass) {
         $class .= $this->_disabledClass . ' ';
     } elseif ($this->_normalClass) {
         $class .= $this->_normalClass . ' ';
     }
     if ($subPage->hasChildren()) {
         $class .= $this->_hasChildrenClass . ' ';
     }
     if ($class = trim($class)) {
         return " class=\"{$class}\"";
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:17,代码来源:Menu.php


示例8: htmlify

 public function htmlify(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
         if (is_string($title) && !empty($title)) {
             $title = $t->translate($title);
         }
     }
     // get attribs for element
     $attribs = array('id' => $page->getId(), 'title' => $title, 'class' => $page->getClass());
     // does page have a href?
     if ($href = $page->getHref()) {
         $element = 'a';
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
     } else {
         $element = 'span';
     }
     // dodanie ikonki
     if (null !== $page->icon) {
         $icon = '<img src="' . $this->view->baseUrl() . $this->_iconPath . '/' . $page->icon . '" alt="" /> ';
     } else {
         $icon = '';
     }
     return '<' . $element . $this->_htmlAttribs($attribs) . '>' . $icon . $this->view->escape($label) . '</' . $element . '>';
 }
开发者ID:knatorski,项目名称:SMS,代码行数:32,代码来源:IconMenu.php


示例9: htmlify

 /**
  * Returns an HTML string containing an 'a' element for the given page if
  * the page's href is not empty, and a 'span' element if it is empty
  *
  * Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}.
  *
  * @param  Zend_Navigation_Page $page  page to generate HTML for
  * @return string                      HTML string for the given page
  */
 public function htmlify(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
         if (is_string($title) && !empty($title)) {
             $title = $t->translate($title);
         }
     }
     // get attribs for element
     $attribs = array('id' => $page->getId(), 'title' => $title, 'class' => $page->getClass());
     // does page have a href?
     if ($href = $page->getHref()) {
         $element = 'a';
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
     } else {
         $element = 'span';
     }
     return '<' . $element . $this->_htmlAttribs($attribs) . '>' . $label . '</' . $element . '>';
 }
开发者ID:netconstructor,项目名称:Centurion,代码行数:35,代码来源:Menu.php


示例10: buildAdminNav

 public function buildAdminNav()
 {
     $identity = Zend_Auth::getInstance()->getIdentity()->toArray();
     if ($identity['role'] === 'Root') {
         $visible = false;
     } else {
         $visible = false;
     }
     $pages = array(Zend_Navigation_Page::factory(array('label' => 'Accounts', 'action' => 'index', 'controller' => 'modify', 'module' => 'accounts', 'route' => 'admin', 'id' => 'accounts', 'order' => 990, 'visible' => $visible, 'resource' => new Accounts_Model_Acl_Resource_Accounts(), 'pages' => array(Zend_Navigation_Page::factory(array('label' => 'Create Account', 'action' => 'index', 'controller' => 'create', 'module' => 'accounts', 'route' => 'admin')), Zend_Navigation_Page::factory(array('label' => 'Modify Account', 'action' => 'index', 'controller' => 'modify', 'module' => 'accounts', 'route' => 'admin'))))));
     return $pages;
 }
开发者ID:rantoine,项目名称:AdvisorIllustrator,代码行数:11,代码来源:Navigation.php


示例11: getModulePages

 /**
  *Takes the module menus and converts them to Zend_Navigation_Page
  * @param array $sections
  * @param array $moduleMenus
  * @param array $menus
  * @return
  */
 function getModulePages($sections, $moduleMenus, &$menus)
 {
     foreach ($sections as $section) {
         if (isset($moduleMenus[$section])) {
             foreach ($moduleMenus[$section] as $title => $mvc) {
                 $mvc['label'] = $title;
                 $menus[] = Zend_Navigation_Page::factory($mvc);
             }
         }
     }
     return $menus;
 }
开发者ID:kakarot1991,项目名称:paid-to-click-cms,代码行数:19,代码来源:NavigationPlugin.php


示例12: init

 /**
  * Defined by Zend_Application_Resource_Resource
  *
  * @return Zend_Navigation
  */
 public function init()
 {
     if (!$this->_container) {
         $options = $this->getOptions();
         $pages = isset($options['pages']) ? $options['pages'] : array();
         $this->_container = new Zend_Navigation($pages);
         if (isset($options['defaultPageType'])) {
             Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
         }
     }
     $this->store();
     return $this->_container;
 }
开发者ID:rakesh-sankar,项目名称:PHP-Framework-Benchmark,代码行数:18,代码来源:Navigation.php


示例13: tearDown

 public function tearDown()
 {
     Zend_Navigation_Page::setDefaultPageType();
     // Restore original autoloaders
     $loaders = spl_autoload_functions();
     foreach ($loaders as $loader) {
         spl_autoload_unregister($loader);
     }
     foreach ($this->loaders as $loader) {
         spl_autoload_register($loader);
     }
     // Reset autoloader instance so it doesn't affect other tests
     Zend_Loader_Autoloader::resetInstance();
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:14,代码来源:NavigationTest.php


示例14: addDefaultPages

 function addDefaultPages()
 {
     $separator = new Am_Navigation_Admin_Item_Separator();
     $this->addPage(array('id' => 'dashboard', 'controller' => 'admin', 'label' => ___("Dashboard")));
     $this->addPage(Zend_Navigation_Page::factory(array('id' => 'users', 'uri' => '#', 'label' => ___("Users"), 'resource' => 'grid_u', 'privilege' => 'browse', 'pages' => array_merge(array(array('id' => 'users-browse', 'controller' => 'admin-users', 'label' => ___('Browse Users'), 'resource' => 'grid_u', 'privilege' => 'browse', 'class' => 'bold'), array('id' => 'users-insert', 'uri' => REL_ROOT_URL . '/admin-users?_u_a=insert', 'label' => ___('Add User'), 'resource' => 'grid_u', 'privilege' => 'insert')), !Am_Di::getInstance()->config->get('manually_approve') ? array() : array(array('id' => 'user-not-approved', 'controller' => 'admin-users', 'action' => 'not-approved', 'label' => ___('Not Approved Users'), 'resource' => 'grid_u', 'privilege' => 'browse')), array(array('id' => 'users-email', 'controller' => 'admin-email', 'label' => ___('E-Mail Users'), 'resource' => Am_Auth_Admin::PERM_EMAIL), clone $separator, array('id' => 'users-import', 'controller' => 'admin-import', 'label' => ___('Import Users'), 'resource' => Am_Auth_Admin::PERM_IMPORT))))));
     $this->addPage(array('id' => 'reports', 'uri' => '#', 'label' => ___("Reports"), 'pages' => array(array('id' => 'reports-reports', 'controller' => 'admin-reports', 'label' => ___('Reports'), 'resource' => Am_Auth_Admin::PERM_REPORT), array('id' => 'reports-payments', 'controller' => 'admin-payments', 'label' => ___('Payments'), 'resource' => Am_Auth_Admin::PERM_REPORT))));
     $this->addPage(array('id' => 'products', 'uri' => '#', 'label' => ___('Products'), 'pages' => array_filter(array(array('id' => 'products-manage', 'controller' => 'admin-products', 'label' => ___('Manage Products'), 'resource' => 'grid_product', 'class' => 'bold'), array('id' => 'products-protect', 'controller' => 'admin-content', 'label' => ___('Protect Content'), 'resource' => 'grid_content', 'class' => 'bold'), array('id' => 'products-coupons', 'controller' => 'admin-coupons', 'label' => ___('Coupons'), 'resource' => 'grid_coupon')))));
     $this->addPage(array('id' => 'configuration', 'uri' => '#', 'label' => ___('Configuration'), 'pages' => array_filter(array(array('controller' => 'admin-setup', 'label' => ___('Setup/Configuration'), 'resource' => Am_Auth_Admin::PERM_SETUP, 'class' => 'bold'), array('controller' => 'admin-tax', 'label' => ___('Tax Settings'), 'resource' => Am_Auth_Admin::PERM_SETUP), array('controller' => 'admin-fields', 'label' => ___('Add Fields'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-admins', 'label' => ___('Admin Accounts'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-saved-form', 'label' => ___('Forms Editor'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-ban', 'label' => ___('Blocking IP/E-Mail'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-change-pass', 'label' => ___('Change Password'))))));
     $this->addPage(array('id' => 'utilites', 'uri' => '#', 'label' => ___('Utilites'), 'order' => 1000, 'pages' => array_filter(array(array('controller' => 'admin-backup', 'label' => ___('Backup'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), array('controller' => 'admin-restore', 'label' => ___('Restore'), 'resource' => Am_Auth_Admin::PERM_BACKUP_RESTORE), array('controller' => 'admin-rebuild', 'label' => ___('Rebuild Db'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), clone $separator, array('controller' => 'admin-logs', 'label' => ___('Logs'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-info', 'label' => ___('Version Info'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), clone $separator, array('controller' => 'admin-clear', 'label' => ___('Delete Old Records'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER), array('controller' => 'admin-build-demo', 'label' => ___('Build Demo'), 'resource' => Am_Auth_Admin::PERM_SUPER_USER)))));
     $this->addPage(array('id' => 'help', 'uri' => '#', 'label' => ___('Help & Support'), 'pages' => array_filter(array(array('uri' => 'http://www.amember.com/docs/', 'label' => ___('Documentation')), array('uri' => 'http://bt.amember.com/', 'label' => ___('Report Bugs'))))));
     Am_Di::getInstance()->hook->call(Am_Event::ADMIN_MENU, array('menu' => $this));
     /// workaround against using the current route for generating urls
     foreach (new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST) as $child) {
         if ($child instanceof Zend_Navigation_Page_Mvc && $child->getRoute() === null) {
             $child->setRoute('default');
         }
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:18,代码来源:Admin.php


示例15: getSitemap

 /**
  *
  */
 public function getSitemap()
 {
     if (is_null($this->_sitemap)) {
         $options = $this->getOptions();
         $front = $this->getBootstrap()->getResource('FrontController');
         $root = dirname($front->getModuleDirectory());
         //modules directory
         $acl = $this->getBootstrap()->getResource('Acl');
         $role = $this->getBootstrap()->getPluginResource('acl')->getRole();
         try {
             $dir = new DirectoryIterator($root);
         } catch (Exception $e) {
             throw new Streamwide_Exception("Directory {$root} not readable");
         }
         $this->_sitemap = new Zend_Navigation();
         foreach ($dir as $file) {
             if ($file->isDot() || !$file->isDir()) {
                 continue;
             }
             $module = $file->getFilename();
             // Don't use SCCS directories as modules
             if (preg_match('/^[^a-z]/i', $module) || 'CVS' == $module) {
                 continue;
             }
             $controllerPath = "{$root}/{$module}/controllers";
             $controllers = $this->_getControllers($controllerPath);
             foreach ($controllers as $controller => $class) {
                 $actions = $this->_getActions($class);
                 foreach ($actions as $action) {
                     $mca = new Streamwide_Web_Acl_Resource_Mca($module, strtolower($controller), strtolower($action));
                     $all = new Streamwide_Web_Acl_Resource_Mca('*', '*', '*');
                     if ($acl->has($mca) && !$acl->isAllowed($role, $mca)) {
                         continue;
                     }
                     if (!$acl->has($mca) && !$acl->isAllowed($role, $all)) {
                         continue;
                     }
                     $this->_sitemap->addPage(Zend_Navigation_Page::factory(array("label" => "{$module}/{$controller}/{$action}", "module" => $module, "controller" => $controller, "action" => $action)));
                 }
             }
         }
     }
     return $this->_sitemap;
 }
开发者ID:cwcw,项目名称:cms,代码行数:47,代码来源:Sitemap.php


示例16: htmlify

 /**
  * Returns an HTML string containing an 'a' element for the given page if
  * the page's href is not empty, and a 'span' element if it is empty
  *
  * Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}.
  *
  * @param  Zend_Navigation_Page $page  page to generate HTML for
  * @return string                      HTML string for the given page
  */
 public function htmlify(Zend_Navigation_Page $page)
 {
     if (isset($page->custom_html)) {
         return $page->custom_html;
     }
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator() && ($t = $this->getTranslator())) {
         if (is_string($label) && !empty($label)) {
             $label = $t->translate($label);
         }
         if (is_string($title) && !empty($title)) {
             $title = $t->translate($title);
         }
     }
     // get attribs for element
     $attribs = array('id' => $page->getId(), 'title' => $title, 'class' => $page->getClass());
     // does page have a href?
     if ($href = $page->getHref()) {
         $element = 'a';
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
     } else {
         $element = 'span';
     }
     if (isset($page->attribs)) {
         $attribs = array_merge($attribs, $page->attribs);
     }
     if (isset($page->iconClass)) {
         $icoHtml = '<span class="' . $page->iconClass . '"></span>';
     } else {
         $icoHtml = '';
     }
     return '<' . $element . $this->_htmlAttribs($attribs) . '>' . $icoHtml . $this->view->escape($label) . '</' . $element . '>';
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:46,代码来源:Fbmenu.php


示例17: htmlify

 /**
  * Returns an HTML string containing an 'a' element for the given page if
  * the page's href is not empty, and a 'span' element if it is empty
  *
  * Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}.
  *
  * @param  Zend_Navigation_Page $page  page to generate HTML for
  * @return string                      HTML string for the given page
  */
 public function htmlify(Zend_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     // translate label and title?
     if ($this->getUseTranslator()) {
         $_page = $page;
         $pageTranslator = null;
         while ($_page instanceof Zend_Navigation_Page && !($pageTranslator = $_page->get('translator'))) {
             $_page = $_page->getParent();
         }
         if ($pageTranslator) {
             $t = Axis::translate($pageTranslator);
             if (is_string($label) && !empty($label)) {
                 // $label = $t->translate($label);
                 $label = $t->__($label);
             }
             if (is_string($title) && !empty($title)) {
                 // $title = $t->translate($title);
                 $title = $t->__($title);
             }
         }
     }
     // get attribs for element
     $attribs = array('id' => $page->getId(), 'title' => $title);
     // does page have a href?
     if ($href = $page->getHref()) {
         $element = 'a';
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
     } else {
         $element = 'span';
     }
     return '<' . $element . $this->_htmlAttribs($attribs) . '>' . '<span>' . $this->view->escape($label) . '</span>' . '</' . $element . '>';
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:45,代码来源:Menu.php


示例18: renderLink

    /**
     * Renders the given $page as a link element, with $attrib = $relation
     *
     * @param  Zend_Navigation_Page $page      the page to render the link for
     * @param  string               $attrib    the attribute to use for $type,
     *                                         either 'rel' or 'rev'
     * @param  string               $relation  relation type, muse be one of;
     *                                         alternate, appendix, bookmark,
     *                                         chapter, contents, copyright,
     *                                         glossary, help, home, index, next,
     *                                         prev, section, start, stylesheet,
     *                                         subsection
     * @return string                          rendered link element
     * @throws Zend_View_Exception             if $attrib is invalid
     */
    public function renderLink(Zend_Navigation_Page $page, $attrib, $relation)
    {
        if (!in_array($attrib, array('rel', 'rev'))) {
            require_once 'Zend/View/Exception.php';
            $e = new Zend_View_Exception(sprintf(
                    'Invalid relation attribute "%s", must be "rel" or "rev"',
                    $attrib));
            $e->setView($this->view);
            throw $e;
        }

        if (!$href = $page->getHref()) {
            return '';
        }

        // TODO: add more attribs
        // http://www.w3.org/TR/html401/struct/links.html#h-12.2
        $attribs = array(
            $attrib  => $relation,
            'href'   => $href,
            'title'  => $page->getLabel()
        );

        return '<link' .
               $this->_htmlAttribs($attribs) .
               $this->getClosingBracket();
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:42,代码来源:Links.php


示例19: url

    /**
     * Returns an escaped absolute URL for the given page
     *
     * @param  Zend_Navigation_Page $page  page to get URL from
     * @return string
     */
    public function url(Zend_Navigation_Page $page)
    {
        $href = $page->getHref();

        if (!isset($href{0})) {
            // no href
            return '';
        } elseif ($href{0} == '/') {
            // href is relative to root; use serverUrl helper
            $url = $this->getServerUrl() . $href;
        } elseif (preg_match('/^[a-z]+:/im', (string) $href)) {
            // scheme is given in href; assume absolute URL already
            $url = (string) $href;
        } else {
            // href is relative to current document; use url helpers
            $url = $this->getServerUrl()
                 . rtrim($this->view->url(), '/') . '/'
                 . $href;
        }

        return $this->_xmlEscape($url);
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:28,代码来源:Sitemap.php


示例20: _acceptAcl

 /**
  * 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
  *
  * @param  Zend_Navigation_Page $page  page to check
  * @return bool                        whether page is accepted by ACL
  */
 protected function _acceptAcl(Zend_Navigation_Page $page)
 {
     if (true == $page->get('invalid')) {
         return false;
     }
     return parent::_acceptAcl($page);
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:19,代码来源:MvcMenu.php



注:本文中的Zend_Navigation_Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Oauth类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Mime_Message类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap