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


PHP Varien_Data_Tree_Node::getChildren方法代码示例

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


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

示例1: 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

示例2: _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

示例3: nodeToArray

 private function nodeToArray(Varien_Data_Tree_Node $node, $mediaUrl, $baseUrl)
 {
     $result = array();
     $thumbnail = '';
     try {
         $thumbImg = $node->getThumbnail();
         if ($thumbImg != null) {
             $thumbnail = $mediaUrl . 'catalog/category/' . $node->getThumbnail();
         }
     } catch (Exception $e) {
     }
     $result['category_id'] = $node->getId();
     $result['image'] = $mediaUrl . 'catalog/category/' . $node->getImage();
     $result['thumbnail'] = $thumbnail;
     $result['description'] = strip_tags($node->getDescription());
     $result['parent_id'] = $node->getParentId();
     $result['name'] = $node->getName();
     $result['is_active'] = $node->getIsActive();
     $result['children'] = array();
     if (method_exists('Mage', 'getEdition') && Mage::getEdition() == Mage::EDITION_COMMUNITY) {
         $result['url_path'] = $baseUrl . $node->getData('url_path');
     } else {
         $category = Mage::getModel('catalog/category')->load($node->getId());
         $result['url_path'] = $category->getUrl();
     }
     foreach ($node->getChildren() as $child) {
         $result['children'][] = $this->nodeToArray($child, $mediaUrl, $baseUrl);
     }
     return $result;
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:30,代码来源:CategoriesController.php

示例4: _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

示例5: _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

示例6: _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

示例7: buildCategoriesMultiselectValues

 public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
 {
     $level++;
     $values[$node->getId()]['value'] = $node->getId();
     $values[$node->getId()]['label'] = str_repeat("--", $level) . $node->getName();
     foreach ($node->getChildren() as $child) {
         $values = $this->buildCategoriesMultiselectValues($child, $values, $level);
     }
     return $values;
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:10,代码来源:Category.php

示例8: _buildCategoriesValues

 /**
  * @param Varien_Data_Tree_Node $node
  * @param array $values
  * @param int $level
  * @return array
  */
 protected function _buildCategoriesValues(Varien_Data_Tree_Node $node, $values, $level = 0)
 {
     ++$level;
     $values[$node->getId()]['value'] = $node->getId();
     $values[$node->getId()]['label'] = str_repeat('--', $level) . $node->getName();
     foreach ($node->getChildren() as $child) {
         $values = $this->_buildCategoriesValues($child, $values, $level);
     }
     return $values;
 }
开发者ID:popovsergiy,项目名称:magento-seo,代码行数:16,代码来源:Category.php

示例9: buildCategoriesMultiselectValues

 public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
 {
     $nonEscapableNbspChar = html_entity_decode('&#160;', ENT_NOQUOTES, 'UTF-8');
     $level++;
     $values[$node->getId()]['value'] = $node->getId();
     $values[$node->getId()]['label'] = str_repeat($nonEscapableNbspChar, ($level - 1) * 5) . $node->getName();
     foreach ($node->getChildren() as $child) {
         $values = $this->buildCategoriesMultiselectValues($child, $values, $level);
     }
     return $values;
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:11,代码来源:Glace_Menu_Model_System_Config_Source_Category.php

示例10: _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

示例11: buildCategoriesMultiselectValues

 public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
 {
     $level++;
     if ($level == 3) {
         //we have to show only third level category in drop down
         $values[$node->getId()]['value'] = $node->getId();
         $values[$node->getId()]['label'] = $node->getName();
     }
     foreach ($node->getChildren() as $child) {
         $values = $this->buildCategoriesMultiselectValues($child, $values, $level);
     }
     return $values;
 }
开发者ID:ravitechrlabs,项目名称:em,代码行数:13,代码来源:Data.php

示例12: 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

示例13: _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-';
     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) {
             if ($child->hasChildren()) {
                 $outermostClassCode = ' class="' . $outermostClass . ' dropdown-toggle" data-toggle="dropdown" ';
                 $child->setClass($outermostClass);
             } else {
                 $outermostClassCode = ' class="' . $outermostClass . '" ';
                 $child->setClass($outermostClass);
             }
         }
         $arrow = '';
         if ($child->hasChildren()) {
             $arrow = '<b class="caret"></b>';
         }
         $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
         $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . ' ' . $arrow . '</span></a>';
         if ($child->hasChildren()) {
             if (!empty($childrenWrapClass)) {
                 $html .= '<div class="' . $childrenWrapClass . '">';
             }
             $html .= '<ul class="level' . $childLevel . ' dropdown-menu">';
             $html .= $this->_getHtml($child, $childrenWrapClass);
             $html .= '</ul>';
             if (!empty($childrenWrapClass)) {
                 $html .= '</div>';
             }
         }
         $html .= '</li>';
         $counter++;
     }
     return $html;
 }
开发者ID:ndufreche,项目名称:Magento-Twitter-Bootstrap-Template,代码行数:55,代码来源:Topmenu.php

示例14: _addHomePageToMenu

 /**
  * Recursively adds cms pages to top menu
  *
  * @param Varien_Data_Tree_Node $parentNode
  * @param Mage_Page_Block_Html_Topmenu $menuBlock
  * @param bool $addTags
  */
 protected function _addHomePageToMenu($parentNode, $menuBlock, $addTags = false)
 {
     $tree = $parentNode->getTree();
     $request = Mage::app()->getRequest();
     $isActive = $request->getModuleName() == 'cms' && $request->getControllerName() == 'index' && $request->getActionName() == 'index';
     $pageId = Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE);
     $nodeData = array('name' => $menuBlock->__('Home'), 'id' => 'cms-node-' . $pageId, 'url' => Mage::getBaseUrl(), 'is_active' => $isActive);
     $categoryNode = new Varien_Data_Tree_Node($nodeData, 'id', $tree, $parentNode);
     $currentItems = array();
     foreach ($parentNode->getChildren() as $child) {
         $currentItems[] = $child;
         $parentNode->removeChild($child);
     }
     $parentNode->addChild($categoryNode);
     foreach ($currentItems as $child) {
         $parentNode->addChild($child);
     }
 }
开发者ID:smart-devs,项目名称:magento-clever-cms,代码行数:25,代码来源:Observer.php

示例15: _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) {
         $categoryId = str_replace('category-node-', '', $child->getId());
         $category = Mage::getModel('catalog/category')->load($categoryId);
         if (!$category->getTopMenu()) {
             continue;
         }
         $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 . '><span>' . $this->escapeHtml($child->getName()) . '</span></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 .= '</li>';
         $counter++;
     }
     return $html;
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:44,代码来源:Topmenu.php


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