本文整理汇总了PHP中Varien_Data_Tree_Node::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Tree_Node::getName方法的具体用法?PHP Varien_Data_Tree_Node::getName怎么用?PHP Varien_Data_Tree_Node::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Tree_Node
的用法示例。
在下文中一共展示了Varien_Data_Tree_Node::getName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _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;
}
示例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;
}
示例4: 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;
}
示例5: 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;
}
示例6: _nodeToArrayPath
/**
* Convert node to array with path information.
* Path information skips the 'Root Catalog' (level=0) and 'Default Category' (level=1) levels.
*
* @param Varien_Data_Tree_Node $node
* @return array
*/
protected function _nodeToArrayPath(Varien_Data_Tree_Node $node, $parentPath)
{
// Only basic category data
$categories = array();
$category = array();
$category['category_id'] = $node->getId();
$category['parent_id'] = $node->getParentId();
$category['name'] = $node->getName();
$category['path'] = !empty($parentPath) && $node->getLevel() > 2 ? $parentPath . '/' . $node->getName() : $node->getName();
$category['is_active'] = $node->getIsActive();
$category['position'] = $node->getPosition();
$category['level'] = $node->getLevel();
$categories[] = $category;
foreach ($node->getChildren() as $child) {
$children = $this->_nodeToArrayPath($child, $category['path']);
$categories = array_merge($categories, $children);
}
return $categories;
}
示例7: _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;
}
示例8: buildCategoriesMultiselectValues
public function buildCategoriesMultiselectValues(Varien_Data_Tree_Node $node, $values, $level = 0)
{
$nonEscapableNbspChar = html_entity_decode(' ', 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
示例9: 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;
}
示例10: 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;
}
示例11: nodeToArray
private function nodeToArray(Varien_Data_Tree_Node $node)
{
$result = array();
$category = Mage::getModel('catalog/category')->load($node->getId());
if ($category->getAvailableForSupplier() == 1) {
$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;
}
示例12: _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;
}
示例13: _treeNodeToOption
/**
* Convert tree node to dropdown option
*
* @return array
*/
protected function _treeNodeToOption(Varien_Data_Tree_Node $node, $without)
{
$option = array();
$option['label'] = $node->getName();
if ($node->getLevel() < 2) {
$option['value'] = array();
foreach ($node->getChildren() as $childNode) {
if (!in_array($childNode->getId(), $without)) {
$option['value'][] = $this->_treeNodeToOption($childNode, $without);
}
}
} else {
$option['value'] = $node->getId();
}
return $option;
}
示例14: _nodeToArray
protected function _nodeToArray(Varien_Data_Tree_Node $node)
{
if (empty($node)) {
return array();
}
$result = $node->debug();
$result['category_id'] = $node->getId();
$result['parent_id'] = $node->getParentId();
$result['name'] = $node->getName();
$result['is_active'] = $node->getIsActive();
$result['is_anchor'] = $node->getIsAnchor();
$result['url_key'] = $node->getUrlKey();
$result['url'] = $node->getRequestPath();
$result['position'] = $node->getPosition();
$result['level'] = $node->getLevel();
$result['products'] = $node->getProducts();
$result['children'] = array();
foreach ($node->getChildren() as $child) {
$result['children'][] = $this->_nodeToArray($child);
}
return $result;
}