本文整理汇总了PHP中Varien_Data_Tree_Node::hasChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Tree_Node::hasChildren方法的具体用法?PHP Varien_Data_Tree_Node::hasChildren怎么用?PHP Varien_Data_Tree_Node::hasChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Tree_Node
的用法示例。
在下文中一共展示了Varien_Data_Tree_Node::hasChildren方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'li_on';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'parent';
}
return $classes;
}
示例3: _getNodesArray
/**
* Convert categories tree to array recursively
*
* @param Varien_Data_Tree_Node $node
* @return array
*/
protected function _getNodesArray($node)
{
$result = array('id' => (int) $node->getId(), 'parent_id' => (int) $node->getParentId(), 'children_count' => (int) $node->getChildrenCount(), 'is_active' => (bool) $node->getIsActive(), 'name' => $node->getName(), 'level' => (int) $node->getLevel(), 'product_count' => (int) $node->getProductCount());
if (is_array($this->_allowedCategoryIds) && !in_array($result['id'], $this->_allowedCategoryIds)) {
$result['disabled'] = true;
}
if ($node->hasChildren()) {
$result['children'] = array();
foreach ($node->getChildren() as $childNode) {
$result['children'][] = $this->_getNodesArray($childNode);
}
}
$result['cls'] = ($result['is_active'] ? '' : 'no-') . 'active-category';
$result['expanded'] = !empty($result['children']);
return $result;
}
示例4: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if (Mage::helper('core/url')->getCurrentUrl() == str_replace(Mage::helper('catalog/product')->getProductUrlSuffix(), "", $item->getUrl())) {
$classes[] = 'custom-active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'parent';
}
return $classes;
}
示例5: _getMenuItemClasses
/**
* Returns array of menu item's classes
*
* @param Varien_Data_Tree_Node $item
* @return array
*/
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
if (Mage::getStoreConfig('mpanel/general/enabled')) {
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
if ($item->getLevel() == 0) {
$classes[] = 'dropdown';
} else {
$classes[] = 'dropdown-submenu';
}
}
return $classes;
} else {
$classes = array();
if ($item->getIsFirst()) {
$classes[] = '';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = '';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'dropdown';
}
return $classes;
}
}
示例6: _getMenuItemClasses
/**
* Returns string of menu item's classes
*
* @param Varien_Data_Tree_Node $item
* @return string
*/
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
$classes = 'level' . $item->getLevel() . ' ';
if ($item->getIsFirst()) {
$classes .= 'first ';
}
if ($item->getIsActive()) {
$classes .= 'active ';
}
if ($item->getIsLast()) {
$classes .= 'last ';
}
if (!$item->getFullUrl()) {
$classes .= 'title ';
}
if ($item->getCssClass()) {
$classes .= $item->getCssClass();
}
if ($item->hasChildren()) {
$classes .= ' parent';
}
return $classes;
}
示例7: _getMenuItemClasses
protected function _getMenuItemClasses(Varien_Data_Tree_Node $item)
{
Mage::log('hi', null, 'nil.log');
$classes = array();
$classes[] = 'level' . $item->getLevel();
$classes[] = $item->getPositionClass();
if ($item->getIsFirst()) {
$classes[] = 'first';
}
if ($item->getIsActive()) {
$classes[] = 'active';
}
if ($item->getIsLast()) {
$classes[] = 'last';
}
if ($item->getClass()) {
$classes[] = $item->getClass();
}
if ($item->hasChildren()) {
$classes[] = 'dropdown';
}
return $classes;
}