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

PHP Varien_Data_Tree_Node类代码示例

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

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



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

示例1: _addCategoriesToMenu

 /**
  * Override Mage_Catalog_Model_Observer _addCategoriesToMenu method to remove the links for the categories having unclickable attribute set
  *
  * @param Varien_Data_Tree_Node_Collection|array $categories
  * @param Varien_Data_Tree_Node $parentCategoryNode
  * @param Mage_Page_Block_Html_Topmenu $menuBlock
  * @param bool $addTags
  */
 protected function _addCategoriesToMenu($categories, $parentCategoryNode, $menuBlock, $addTags = false)
 {
     //Get collection of unclickable category ids in the menu
     $categoryModel = Mage::getModel('catalog/category');
     foreach ($categories as $category) {
         if (!$category->getIsActive()) {
             continue;
         }
         $nodeId = 'category-node-' . $category->getId();
         $categoryModel->setId($category->getId());
         if ($addTags) {
             $menuBlock->addModelTags($categoryModel);
         }
         $tree = $parentCategoryNode->getTree();
         //Set javascript:; as category url if category attribute is unclickable
         $categoryData = array('name' => $category->getName(), 'id' => $nodeId, 'url' => in_array($category->getId(), $this->unClickableIds) ? self::NOLINK : Mage::helper('catalog/category')->getCategoryUrl($category), 'is_active' => $this->_isActiveMenuCategory($category));
         $categoryNode = new Varien_Data_Tree_Node($categoryData, 'id', $tree, $parentCategoryNode);
         $parentCategoryNode->addChild($categoryNode);
         $flatHelper = Mage::helper('catalog/category_flat');
         if ($flatHelper->isEnabled() && $flatHelper->isBuilt(true)) {
             $subcategories = (array) $category->getChildrenNodes();
         } else {
             $subcategories = $category->getChildren();
         }
         $this->_addCategoriesToMenu($subcategories, $categoryNode, $menuBlock, $addTags);
     }
 }
开发者ID:hardanro,项目名称:Monsoon_test,代码行数:35,代码来源:Observer.php


示例2: _addCategoriesToMenu

 /**
  * Recursively adds categories to top menu
  *
  * @param Varien_Data_Tree_Node_Collection|array $categories
  * @param Varien_Data_Tree_Node $parentCategoryNode
  * @param Mage_Page_Block_Html_Topmenu $menuBlock
  * @param bool $addTags
  */
 protected function _addCategoriesToMenu($categories, $parentCategoryNode, $menuBlock, $addTags = false)
 {
     $categoryModel = Mage::getModel('catalog/category');
     foreach ($categories as $category) {
         if (!$category->getIsActive()) {
             continue;
         }
         $nodeId = 'category-node-' . $category->getId();
         $categoryModel->setId($category->getId());
         if ($addTags) {
             $menuBlock->addModelTags($categoryModel);
         }
         //check if there is a cms page set in category
         if ($category->getCmsPage()) {
             $categoryUrl = Mage::helper('cms/page')->getPageUrl($category->getCmsPage());
         } else {
             $categoryUrl = Mage::helper('catalog/category')->getCategoryUrl($category);
         }
         $tree = $parentCategoryNode->getTree();
         $categoryData = array('name' => $category->getName(), 'id' => $nodeId, 'url' => $categoryUrl, 'is_active' => $this->_isActiveMenuCategory($category));
         $categoryNode = new Varien_Data_Tree_Node($categoryData, 'id', $tree, $parentCategoryNode);
         $parentCategoryNode->addChild($categoryNode);
         $flatHelper = Mage::helper('catalog/category_flat');
         if ($flatHelper->isEnabled() && $flatHelper->isBuilt(true)) {
             $subcategories = (array) $category->getChildrenNodes();
         } else {
             $subcategories = $category->getChildren();
         }
         $this->_addCategoriesToMenu($subcategories, $categoryNode, $menuBlock, $addTags);
     }
 }
开发者ID:beljic,项目名称:CmsNavigation,代码行数:39,代码来源:Observer.php


示例3: _drawTwoLevelMenu

 /**
  * @param Varien_Data_Tree_Node $menuTree
  * @return string
  */
 protected function _drawTwoLevelMenu(Varien_Data_Tree_Node $menuTree)
 {
     $children = $menuTree->getChildren();
     $html = '<li>';
     $html .= '<a href="' . $menuTree->getUrl() . '"><span>' . $this->escapeHtml($menuTree->getName()) . '</span></a>';
     $html .= '<div class="drop"><div class="drop-holder"><div class="col-frame"><div class="col-holder">';
     $index = 1;
     foreach ($children as $child) {
         $html .= '<div class="col">';
         $html .= '<strong class="title-drop">' . $this->escapeHtml($child->getName()) . '</strong><ul>';
         $secondLevelChildren = $child->getChildren();
         $childrenCount = $secondLevelChildren->count();
         $key = 0;
         foreach ($secondLevelChildren as $ch) {
             if ($key == 5) {
                 break;
             }
             $html .= '<li><a href="' . $ch->getUrl() . '">' . $this->escapeHtml($ch->getName()) . '</a></li>';
             $key++;
         }
         $html .= '</ul>';
         if ($childrenCount > 5 || $childrenCount == 0) {
             $html .= '<a class="all-links" href="' . $child->getUrl() . '">All ' . $this->escapeHtml($child->getName()) . '</a>';
         }
         $html .= '</div>';
         if ($index % 3 == 0 && $index > 0) {
             $html .= '</div><div class="col-holder">';
         }
         $index++;
     }
     $html .= '</div></div></div></div>';
     $html .= '</li>';
     return $html;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:38,代码来源:Topmenu.php


示例4: _injectLinks

 /**
  * Inject links into the top navigation
  *
  * @param Fishpig_Wordpress_Model_Resource_Menu_Item_Collection $items
  * @param Varien_Data_Tree_Node $parentNode
  * @return bool
  */
 protected function _injectLinks($items, $parentNode)
 {
     if (!$parentNode) {
         return false;
     }
     foreach ($items as $item) {
         try {
             $nodeId = 'wp-node-' . $item->getId();
             $data = array('name' => $item->getLabel(), 'id' => $nodeId, 'url' => $item->getUrl(), 'is_active' => $item->isItemActive());
             if ($data['is_active']) {
                 $parentNode->setIsActive(true);
                 $buffer = $parentNode;
                 while ($buffer->getParent()) {
                     $buffer = $buffer->getParent();
                     $buffer->setIsActive(true);
                 }
             }
             $itemNode = new Varien_Data_Tree_Node($data, 'id', $parentNode->getTree(), $parentNode);
             $parentNode->addChild($itemNode);
             if (count($children = $item->getChildrenItems()) > 0) {
                 $this->_injectLinks($children, $itemNode);
             }
         } catch (Exception $e) {
             Mage::helper('wordpress')->log($e->getMessage());
         }
     }
     return true;
 }
开发者ID:linusshops,项目名称:mirror-connect20-fishpig-wordpress-integration,代码行数:35,代码来源:Menu.php


示例5: _getNodeJson

 /**
  * Get JSON of a tree node or an associative array
  *
  * @param Varien_Data_Tree_Node|array $node
  * @param int $level
  * @return string
  */
 protected function _getNodeJson($node, $level = 1)
 {
     $item = array();
     $item['text'] = $this->htmlEscape($node->getName());
     if ($this->_withProductCount) {
         $item['text'] .= ' (' . $node->getProductCount() . ')';
     }
     $item['id'] = $node->getId();
     $item['path'] = $node->getData('path');
     $item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
     $item['allowDrop'] = false;
     $item['allowDrag'] = false;
     if ($node->hasChildren()) {
         $item['children'] = array();
         foreach ($node->getChildren() as $child) {
             $item['children'][] = $this->_getNodeJson($child, $level + 1);
         }
     }
     if (empty($item['children']) && (int) $node->getChildrenCount() > 0) {
         $item['children'] = array();
     }
     if (!empty($item['children'])) {
         $item['expanded'] = true;
     }
     if (in_array($node->getId(), $this->getCategoryIds())) {
         $item['checked'] = true;
     }
     return $item;
 }
开发者ID:CopeX,项目名称:BannerSlider-Magento,代码行数:36,代码来源:Categories.php


示例6: _injectLinks

 /**
  * Inject links into the top navigation
  *
  * @param Mage_Core_Model_Resource_Db_Collection_Abstract $items
  * @param Varien_Data_Tree_Node $parentNode
  * @return bool
  */
 protected function _injectLinks($items, $parentNode)
 {
     if (!$parentNode) {
         return false;
     }
     foreach ($items as $item) {
         if (!$item->canIncludeInMenu()) {
             continue;
         }
         $children = $item->getSplashPages();
         if ($children && count($children->addOrderByName()->addFieldToFilter('include_in_menu', 1)->load()) === 0) {
             continue;
         }
         $data = array('name' => $item->getName(), 'id' => $item->getMenuNodeId(), 'url' => $item->getUrl(), 'is_active' => $item->isActive());
         if ($data['is_active']) {
             $parentNode->setIsActive(true);
             $buffer = $parentNode;
             while ($buffer->getParent()) {
                 $buffer = $buffer->getParent();
                 $buffer->setIsActive(true);
             }
         }
         $itemNode = new Varien_Data_Tree_Node($data, 'id', $parentNode->getTree(), $parentNode);
         $parentNode->addChild($itemNode);
         if ($children) {
             $this->_injectLinks($children, $itemNode);
         }
     }
     return true;
 }
开发者ID:Benjamin021,项目名称:magento-attribute-page,代码行数:37,代码来源:Observer.php


示例7: drawItem

 /**
  * @param Varien_Data_Tree_Node $category
  * @param int $level
  * @param boolean $last
  * @return string
  */
 function drawItem($category, $categoryDepth = 0, $last = false)
 {
     $html = '';
     if (!$category->getIsActive() && !$this->categoryIsRoot($category)) {
         return $html;
     }
     if (!$this->categoryHasProductUnderIt($category)) {
         return;
     }
     $html .= '<li>';
     $html .= '<div class="vaf-cat-toggler">';
     $html .= $this->htmlEscape($this->categoryName($category));
     $html .= '<div class="vaf-toggle-icon vaf-toggle-icon-plus"></div>';
     $html .= '</div>' . "\n";
     $html .= '<div class="vaf-toggle">';
     if ($category->hasChildren()) {
         $htmlChildren = $this->drawCategoryCollection($category, $categoryDepth);
         if (!empty($htmlChildren)) {
             $html .= '<ul >' . "\n" . $htmlChildren . '</ul>';
         }
     }
     $html .= $this->drawProductCollection($category);
     $html .= '</div>';
     $html .= '</li>' . "\n";
     return $html;
 }
开发者ID:hashir-dhattiwala,项目名称:vfmagento,代码行数:32,代码来源:Group.php


示例8: _getHtml

 /**
  * @param Varien_Data_Tree_Node $menuTree
  * @param string                $childrenWrapClass
  *
  * @return string
  */
 protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
 {
     $html = '';
     $counter = 1;
     $children = $menuTree->getChildren();
     $parentLevel = $menuTree->getLevel();
     $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
     $childrenCount = $children->count();
     $parentPositionClass = $menuTree->getPositionClass();
     $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
     foreach ($children as $child) {
         $child->setLevel($childLevel);
         $child->setIsFirst($counter == 1);
         $child->setIsLast($counter == $childrenCount);
         $child->setPositionClass($itemPositionClassPrefix . $counter);
         $outermostClassCode = '';
         $outermostClass = $menuTree->getOutermostClass();
         if ($childLevel == 0 && $outermostClass) {
             $outermostClassCode = ' class="' . $outermostClass . '" ';
             $child->setClass($outermostClass);
         }
         $blockName = $childLevel == 0 ? 'bennoislost.easy-navigation.renderer.with-children' : 'bennoislost.easy-navigation.renderer.single';
         $html .= $this->_renderBlockItem($blockName, $childrenWrapClass, $child, $outermostClassCode);
         $counter++;
     }
     return $html;
 }
开发者ID:bennoislost,项目名称:easy-navigation,代码行数:33,代码来源:Renderer.php


示例9: BuildBranch

    public function BuildBranch(Varien_Data_Tree_Node $node)
    {
        $buildString = '<li style="padding-left: 16px;">';
        $buildString .= '<div class="tree-level-' . $node->getLevel() . '">';
        if ($node->getChildrenCount() != 0) {
            $buildString .= '<div class="opener" id="opener' . $node->getId() . '"  OnClick="OpenMe(this)"></div>';
        } else {
            $buildString .= '<div class="child"></div>';
        }
        $buildString .= '
			<input type="checkbox" class="inputcb" id="inputcb' . $node->getId() . '" OnClick="Decide(this)" enabled="false"/>
			<div class="folder"></div>
			<a tabindex="1" href="#" hidefocus="on" id="linkItem"><span unselectable="on" id="extdd-' . $node->getLevel() . '">' . $node->getName() . '</a>
		';
        $buildString .= '</div>';
        if ($node->getChildrenCount() != 0) {
            $buildString .= '<ul id="ToOpen' . $node->getId() . '">';
            foreach ($node->getChildren() as $child) {
                $buildString .= $this->BuildBranch($child);
            }
            $buildString .= '</ul>';
        }
        $buildString .= '</li>';
        return $buildString;
    }
开发者ID:rcclaudrey,项目名称:dev,代码行数:25,代码来源:Categories.php


示例10: _isCategoryClickAble

 /**
  * Check if click able enabled for category.
  *
  * @param Varien_Data_Tree_Node|Mage_Catalog_Model_Category $category
  * @return bool
  */
 protected function _isCategoryClickAble($category)
 {
     $isCategoryClickAbleStatus = true;
     $isCategoryClickAble = $category->getData(Monsoon_Test_Helper_Data::IS_CLICK_ABLE_LINK_CODE);
     if ($isCategoryClickAble !== null && (bool) $isCategoryClickAble === false) {
         $isCategoryClickAbleStatus = false;
     }
     return $isCategoryClickAbleStatus;
 }
开发者ID:sergiozt,项目名称:monsoon,代码行数:15,代码来源:Observer.php


示例11: _getHtml

 /**
  * {@inheritDoc}
  */
 protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
 {
     $html = '';
     $children = $menuTree->getChildren();
     $parentLevel = $menuTree->getLevel();
     $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
     $counter = 1;
     $childrenCount = $children->count();
     $parentPositionClass = $menuTree->getPositionClass();
     $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
     foreach ($children as $child) {
         $child->setLevel($childLevel);
         $child->setIsFirst($counter == 1);
         $child->setIsLast($counter == $childrenCount);
         $child->setPositionClass($itemPositionClassPrefix . $counter);
         $outermostClassCode = '';
         $outermostClass = $menuTree->getOutermostClass();
         if ($childLevel == 0 && $outermostClass) {
             $outermostClassCode = ' class="' . $outermostClass . '" ';
             $child->setClass($outermostClass);
         }
         if ($child->hasChildren()) {
             $outermostClassCode .= ' data-toggle="dropdown" ';
         }
         $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
         $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>';
         $html .= $this->escapeHtml($child->getName());
         if ($child->hasChildren()) {
             $html .= ' <b class="caret"></b>';
         }
         $html .= '</span></a>';
         if ($child->hasChildren()) {
             if (!empty($childrenWrapClass)) {
                 $html .= '<div class="' . $childrenWrapClass . '">';
             }
             $html .= '<ul class="level' . $childLevel . ' dropdown-menu">';
             if (Mage::getStoreConfig('catalog/navigation/top_in_dropdown') && $childLevel == 0) {
                 $prefix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_prefix');
                 $suffix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_suffix');
                 $html .= '<li class="level1 level-top-in-dropdown">';
                 $html .= '<a href="' . $child->getUrl() . '"><span>';
                 $html .= $this->escapeHtml($this->__($prefix) . ' ' . $child->getName() . ' ' . $suffix);
                 $html .= '</span></a>';
                 $html .= '</li>';
                 $html .= '<li class="divider"></li>';
             }
             $html .= $this->_getHtml($child, $childrenWrapClass);
             $html .= '</ul>';
             if (!empty($childrenWrapClass)) {
                 $html .= '</div>';
             }
         }
         $html .= '</li>';
         $counter++;
     }
     return $html;
 }
开发者ID:a13wes,项目名称:MRKT,代码行数:60,代码来源:Topmenu.php


示例12: add

 /**
  * Adds a node to this node
  */
 public function add(Varien_Data_Tree_Node $node)
 {
     $node->setParent($this->_container);
     // Set the Tree for the node
     if ($this->_container->getTree() instanceof Varien_Data_Tree) {
         $node->setTree($this->_container->getTree());
     }
     $this->_nodes[$node->getId()] = $node;
     return $node;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:13,代码来源:Collection.php


示例13: _exportProductCollection

 /**
  * Export product collection
  *
  * @param Varien_Data_Tree_Node $category
  */
 protected function _exportProductCollection($category)
 {
     $categoryModel = Mage::getModel('catalog/category')->load($category->getId());
     $this->setCategory($categoryModel)->setLayer(Mage::getSingleton('catalog/layer'));
     foreach ($this->_getProductCollection() as $product) {
         $product->load($product->getEntityId());
         Mage::app()->getRequest()->setParam('id', $product->getId());
         $this->_getExportModel(self::TYPE_PRODUCT)->setProduct($product)->exportData();
         $this->_getExportModel(self::TYPE_GALLERY)->setProduct($product)->exportData();
         $this->_getExportModel(self::TYPE_REVIEW)->setProduct($product)->exportData();
     }
 }
开发者ID:okite11,项目名称:frames21,代码行数:17,代码来源:Product.php


示例14: _getHtml

 /**
  * Recursively generates top menu html from data that is specified in $menuTree
  *
  * @param Varien_Data_Tree_Node $menuTree
  * @param string $childrenWrapClass
  * @return string
  */
 protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
 {
     $html = '';
     $children = $menuTree->getChildren();
     $parentLevel = $menuTree->getLevel();
     $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
     $counter = 1;
     $childrenCount = $children->count();
     $parentPositionClass = $menuTree->getPositionClass();
     $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
     $brandCategoryId = Mage::getStoreConfig('brand/brand/category_id');
     $_helperBrands = Mage::helper('brand');
     $brandUrl = Mage::getUrl($_helperBrands->getBrandsUrl());
     foreach ($children as $child) {
         $child->setLevel($childLevel);
         $child->setIsFirst($counter == 1);
         $child->setIsLast($counter == $childrenCount);
         $child->setPositionClass($itemPositionClassPrefix . $counter);
         $outermostClassCode = '';
         $outermostClass = $menuTree->getOutermostClass();
         if ($childLevel == 0 && $outermostClass) {
             $outermostClassCode = ' class="' . $outermostClass . '" ';
             $child->setClass($outermostClass);
         }
         $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
         $categoryId = str_replace("category-node-", "", $child->getId());
         //$url=($categoryId==$brandCategoryId)?$brandUrl:$child->getUrl();
         $url = $child->getUrl();
         $html .= '<a href="' . $url . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
         if ($child->hasChildren()) {
             if (!empty($childrenWrapClass)) {
                 $html .= '<div class="' . $childrenWrapClass . '">';
             }
             $html .= '<ul class="level' . $childLevel . '">';
             /*if($childLevel==0)
              	{
                	 $html .= '<div class="submenu">';
              	}*/
             $html .= $this->_getHtml($child, $childrenWrapClass);
             /*if($childLevel==0)
               {
                 $html .= '</div>';
               }*/
             $html .= '</ul>';
             if (!empty($childrenWrapClass)) {
                 $html .= '</div>';
             }
         }
         $html .= '</li>';
         $counter++;
     }
     return $html;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:60,代码来源:Topmenu.php


示例15: _isActiveMenuCategory

 /**
  * Checks whether category belongs to active category's path
  *
  * @param Varien_Data_Tree_Node $category
  * @return bool
  */
 protected function _isActiveMenuCategory($category)
 {
     $catalogLayer = Mage::getSingleton('catalog/layer');
     if (!$catalogLayer) {
         return false;
     }
     $currentCategory = $catalogLayer->getCurrentCategory();
     if (!$currentCategory) {
         return false;
     }
     $categoryPathIds = explode(',', $currentCategory->getPathInStore());
     return in_array($category->getId(), $categoryPathIds);
 }
开发者ID:bennoislost,项目名称:easy-navigation,代码行数:19,代码来源:Add.php


示例16: getCategories

 /**
  * Returns categories with include_in_mega_menu set to yes in Admin
  *
  * @return Varien_Data_Tree_Node_Collection
  */
 public function getCategories()
 {
     $root = Mage::app()->getStore()->getRootCategoryId();
     $tree = Mage::getResourceModel('catalog/category_tree');
     /* @var $tree Mage_Catalog_Model_Resource_Category_Tree */
     $nodes = $tree->loadNode($root);
     $categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect(array('name', 'url_key', 'is_active', 'mega_menu_block', 'mega_menu_sort_order'))->addAttributeToSort('mega_menu_sort_order', 'ASC')->addAttributeToFilter('include_in_mega_menu', 1);
     foreach ($categories as $category) {
         $categoryData = $this->getCategoryData($category);
         $categoryNode = new Varien_Data_Tree_Node($categoryData, 'id', $tree, $nodes);
         $categoryChildren = $this->getSubcategories($category);
         foreach ($categoryChildren as $child) {
             $childData = $this->getCategoryData($child);
             $childCategoryNode = new Varien_Data_Tree_Node($childData, 'id', $tree, $nodes);
             $categoryNode->addChild($childCategoryNode);
         }
         $nodes->addChild($categoryNode);
     }
     return $nodes->getChildren();
 }
开发者ID:lgilders,项目名称:MegaMenu,代码行数:25,代码来源:Data.php


示例17: buildCategoriesMultiselectValues

 public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
 {
     $level++;
     $values[$node->getId()]['value'] = $node->getId();
     if ($level > 3) {
         $values[$node->getId()]['label'] = str_repeat("-", $level) . $node->getName();
     } else {
         $values[$node->getId()]['label'] = $node->getName();
     }
     foreach ($node->getChildren() as $child) {
         $values = $this->buildCategoriesMultiselectValues($child, $values, $level);
     }
     return $values;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:14,代码来源:Data.php


示例18: _getHtml

 protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
 {
     $html = '';
     $children = $menuTree->getChildren();
     $parentLevel = $menuTree->getLevel();
     $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;
     $counter = 1;
     $childrenCount = $children->count();
     $parentPositionClass = $menuTree->getPositionClass();
     $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
     foreach ($children as $child) {
         $child->setLevel($childLevel);
         $child->setIsFirst($counter == 1);
         $child->setIsLast($counter == $childrenCount);
         $child->setPositionClass($itemPositionClassPrefix . $counter);
         $outermostClassCode = '';
         $outermostClass = $menuTree->getOutermostClass();
         if ($childLevel == 0 && $outermostClass) {
             $outermostClassCode = ' class="' . $outermostClass . '" ';
             $child->setClass($outermostClass);
         }
         $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
         $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '  class="nav-link">' . $this->escapeHtml($child->getName()) . '</a>';
         if ($child->hasChildren()) {
             if (!empty($childrenWrapClass)) {
                 $html .= '<div class="' . $childrenWrapClass . '">';
             }
             $html .= '<ul class="level' . $childLevel . '">';
             $html .= $this->_getHtml($child, $childrenWrapClass);
             $html .= '</ul>';
             if (!empty($childrenWrapClass)) {
                 $html .= '</div>';
             }
             $html .= '<span class="subnav-toggle"><i class="icon icon-angle-down"></i><i class="icon icon-angle-up"></i></span>';
         }
         $html .= '</li>';
         $counter++;
     }
     return $html;
 }
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:40,代码来源:Topmenu.php


示例19: _getHtml

 protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass)
 {
     $html = '';
     $children = $menuTree->getChildren();
     foreach ($children as $child) {
         $menu_class = "";
         if ($child->hasChildren()) {
             $menu_class = "has-submenu";
         }
         $html .= '<li class="' . $menu_class . '"">';
         $html .= '<a href="' . $child->getUrl() . '"><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
         if ($child->hasChildren()) {
             $html .= '<ul class="left-submenu">
                 <li class="back"><a href="#">' . $this->__('Back') . '</a></li>';
             $html .= '<li><a href="' . $child->getUrl() . '">' . $this->__('View All ') . $this->escapeHtml($child->getName()) . '</a></li>';
             $html .= $this->_getHtml($child, $childrenWrapClass);
             $html .= '</ul>';
         }
         $html .= '</li>';
     }
     return $html;
 }
开发者ID:adampmoss,项目名称:hutch,代码行数:22,代码来源:Offcanvas.php


示例20: nodeToArray

 function nodeToArray(Varien_Data_Tree_Node $node)
 {
     $result = array();
     $result['category_id'] = $node->getId();
     $result['parent_id'] = $node->getParentId();
     $result['name'] = $node->getName();
     $result['is_active'] = $node->getIsActive();
     $result['position'] = $node->getPosition();
     $result['level'] = $node->getLevel();
     $result['children'] = array();
     foreach ($node->getChildren() as $child) {
         $result['children'][] = $this->nodeToArray($child);
     }
     return $result;
 }
开发者ID:ahsanmage,项目名称:vr,代码行数:15,代码来源:Categorytree.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Varien_Date类代码示例发布时间:2022-05-23
下一篇:
PHP Varien_Data_Form_Element_Text类代码示例发布时间: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