当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractPage::isActive方法代码示例

本文整理汇总了PHP中Zend\Navigation\Page\AbstractPage::isActive方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPage::isActive方法的具体用法?PHP AbstractPage::isActive怎么用?PHP AbstractPage::isActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Navigation\Page\AbstractPage的用法示例。


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

示例1: decorateDropdown

 protected function decorateDropdown($content, \Zend\Navigation\Page\AbstractPage $page, $renderIcons = true, $activeIconInverse = true, array $options = array())
 {
     //Get attribs
     $liAttribs = array('id' => $page->getId(), 'class' => 'dropdown' . ($page->isActive(true) ? ' active' : ''));
     $html = "\n" . '<li' . $this->htmlAttribs($liAttribs) . '>' . "\n" . $content . "\n</li>";
     return $html;
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:7,代码来源:AbstractNavHelper.php

示例2: getLiClass

 /**
  * Get list item class.
  *
  * @param AbstractPage $page
  *
  * @return string
  */
 public function getLiClass(AbstractPage $page)
 {
     /* @var $escaper \Zend\View\Helper\EscapeHtmlAttr */
     $escaper = $this->getView()->plugin('escapeHtmlAttr');
     $liClasses = array($this->liClass);
     if ($this->getAddClassToListItem()) {
         $liClasses[] = $page->getClass();
     }
     if ($page->hasPages()) {
         $liClasses[] = $this->getLiHasMenuClass();
     }
     if ($page->isActive(true)) {
         $liClasses[] = $this->getLiActiveClass();
     }
     return $escaper(implode(' ', $liClasses));
 }
开发者ID:kashandarash,项目名称:blog-example,代码行数:23,代码来源:Menu.php

示例3: isActive

 /**
  * Returns whether page should be considered active or not
  *
  * This method will compare the page properties against the request uri.
  *
  * @param bool $recursive
  *            [optional] whether page should be considered
  *            active if any child pages are active. Default is
  *            false.
  * @return bool whether page should be considered active or not
  */
 public function isActive($recursive = false)
 {
     if (!$this->active) {
         if ($this->getRequest() instanceof Request) {
             if ($this->getRequest()->getUri()->getPath() == $this->getUri()) {
                 $this->active = true;
                 return true;
             }
         }
     }
     return parent::isActive($recursive);
 }
开发者ID:rafael-labegalini,项目名称:zf2,代码行数:23,代码来源:Uri.php

示例4: isActive

 /**
  * Returns whether page should be considered active or not
  *
  * This method will compare the page properties against the route matches
  * composed in the object.
  *
  * @param  bool $recursive  [optional] whether page should be considered
  *                          active if any child pages are active. Default is
  *                          false.
  * @return bool             whether page should be considered active or not
  */
 public function isActive($recursive = false)
 {
     if (!$this->active) {
         $reqParams = array();
         if ($this->routeMatch instanceof RouteMatch) {
             $reqParams = $this->routeMatch->getParams();
             if ($this->routeMatch->getMatchedRouteName() === $this->getRoute()) {
                 $this->active = true;
                 return true;
             }
         }
         $myParams = $this->params;
         if (null !== $this->controller) {
             $myParams['controller'] = $this->controller;
         } else {
             /**
              * @todo In ZF1, this was configurable and pulled from the front controller
              */
             $myParams['controller'] = 'index';
         }
         if (null !== $this->action) {
             $myParams['action'] = $this->action;
         } else {
             /**
              * @todo In ZF1, this was configurable and pulled from the front controller
              */
             $myParams['action'] = 'action';
         }
         if (count(array_intersect_assoc($reqParams, $myParams)) == count($myParams)) {
             $this->active = true;
             return true;
         }
     }
     return parent::isActive($recursive);
 }
开发者ID:ranxin1022,项目名称:zf2,代码行数:46,代码来源:Mvc.php

示例5: isActive

 /**
  * Returns whether page should be considered active or not
  *
  * This method will compare the page properties against the route matches
  * composed in the object.
  *
  * @param  bool $recursive  [optional] whether page should be considered
  *                          active if any child pages are active. Default is
  *                          false.
  * @return bool             whether page should be considered active or not
  */
 public function isActive($recursive = false)
 {
     if (!$this->active) {
         $reqParams = array();
         if ($this->routeMatch instanceof RouteMatch) {
             $reqParams = $this->routeMatch->getParams();
             if (isset($reqParams[ModuleRouteListener::ORIGINAL_CONTROLLER])) {
                 $reqParams['controller'] = $reqParams[ModuleRouteListener::ORIGINAL_CONTROLLER];
             }
             $pageParams = $this->params;
             if (null !== $this->controller) {
                 $pageParams['controller'] = $this->controller;
             }
             if (null !== $this->action) {
                 $pageParams['action'] = $this->action;
             }
             if (null !== $this->getRoute()) {
                 if ($this->routeMatch->getMatchedRouteName() === $this->getRoute() && count(array_intersect_assoc($reqParams, $pageParams)) == count($pageParams)) {
                     $this->active = true;
                     return $this->active;
                 } else {
                     return parent::isActive($recursive);
                 }
             }
         }
         $pageParams = $this->params;
         if (null !== $this->controller) {
             $pageParams['controller'] = $this->controller;
         } else {
             /**
              * @todo In ZF1, this was configurable and pulled from the front controller
              */
             $pageParams['controller'] = 'index';
         }
         if (null !== $this->action) {
             $pageParams['action'] = $this->action;
         } else {
             /**
              * @todo In ZF1, this was configurable and pulled from the front controller
              */
             $pageParams['action'] = 'index';
         }
         if (count(array_intersect_assoc($reqParams, $pageParams)) == count($pageParams)) {
             $this->active = true;
             return true;
         }
     }
     return parent::isActive($recursive);
 }
开发者ID:KBO-Techo-Dev,项目名称:MagazinePro-zf25,代码行数:60,代码来源:Mvc.php

示例6: renderDropdown

 protected function renderDropdown(\Zend\Navigation\Page\AbstractPage $page, $renderIcons = true, $activeIconInverse = true, array $options = array())
 {
     $class = $page->getClass();
     $this->addWord('btn', $class);
     if ($page->isActive(true)) {
         $this->addWord('active', $class);
     }
     $page->setClass($class);
     $html = parent::renderDropdown($page, $renderIcons, $activeIconInverse, $options);
     return $html;
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:11,代码来源:AbstractButtonHelper.php

示例7: isActive

 /**
  * Returns whether page should be considered active or not
  *
  * This method will compare the page properties against the request object
  * that is found in the front controller.
  *
  * @param  bool $recursive  [optional] whether page should be considered
  *                          active if any child pages are active. Default is
  *                          false.
  *
  * @return bool             whether page should be considered active or not
  */
 public function isActive($recursive = false)
 {
     if (!$this->active) {
         $front = FrontController::getInstance();
         $reqParams = $front->getRequest()->getParams();
         if (!array_key_exists('module', $reqParams)) {
             $reqParams['module'] = $front->getDefaultModule();
         }
         $myParams = $this->params;
         if (null !== $this->module) {
             $myParams['module'] = $this->module;
         } else {
             $myParams['module'] = $front->getDefaultModule();
         }
         if (null !== $this->controller) {
             $myParams['controller'] = $this->controller;
         } else {
             $myParams['controller'] = $front->getDefaultControllerName();
         }
         if (null !== $this->action) {
             $myParams['action'] = $this->action;
         } else {
             $myParams['action'] = $front->getDefaultAction();
         }
         if (count(array_intersect_assoc($reqParams, $myParams)) == count($myParams)) {
             $this->active = true;
             return true;
         }
     }
     return parent::isActive($recursive);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:43,代码来源:Mvc.php

示例8: htmlifyIcon

 protected function htmlifyIcon(\Zend\Navigation\Page\AbstractPage $item, $activeIconInverse = true)
 {
     if ($item->icon) {
         $iClass = $item->icon;
         if ($activeIconInverse && $item->isActive(true)) {
             $classes = explode(' ', $iClass);
             $iconWhiteClassKey = array_search('icon-white', $classes);
             if ($iconWhiteClassKey === false) {
                 //icon-white class not found
                 $iClass .= ' icon-white';
             } else {
                 //icon-white class found
                 unset($classes[$iconWhiteClassKey]);
                 $iClass = implode(' ', $classes);
             }
         }
         $icon = '<i class="' . $iClass . '"></i> ';
     } else {
         $icon = '';
     }
     return $icon;
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:22,代码来源:AbstractHelper.php


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