Mage_Adminhtml_Block_Catalog_Category_Checkboxes_Tree Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Category_Checkboxes_Tree:

Mage_Adminhtml_Block_Catalog_Category_Tree Mage_Adminhtml_Block_Catalog_Category_Abstract Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getCategoryIds ()
 setCategoryIds ($ids)
 getRoot ($parentNodeCategory=null, $recursionLevel=3)

Protected Member Functions

 _prepareLayout ()
 _getNodeJson ($node, $level=1)

Protected Attributes

 $_selectedIds = array()


Detailed Description

Categories tree with checkboxes

Author:
Magento Core Team <core@magentocommerce.com>

Definition at line 32 of file Tree.php.


Member Function Documentation

_getNodeJson ( node,
level = 1 
) [protected]

Get JSON of a tree node or an associative array

Parameters:
Varien_Data_Tree_Node|array $node
int $level
Returns:
string

Reimplemented from Mage_Adminhtml_Block_Catalog_Category_Tree.

Definition at line 58 of file Tree.php.

00059     {
00060         $item = array();
00061         $item['text']= $this->htmlEscape($node->getName());
00062 
00063         if ($this->_withProductCount) {
00064              $item['text'].= ' ('.$node->getProductCount().')';
00065         }
00066         $item['id']  = $node->getId();
00067         $item['path'] = $node->getData('path');
00068         $item['cls'] = 'folder ' . ($node->getIsActive() ? 'active-category' : 'no-active-category');
00069         $item['allowDrop'] = false;
00070         $item['allowDrag'] = false;
00071 
00072         if ($node->hasChildren()) {
00073             $item['children'] = array();
00074             foreach ($node->getChildren() as $child) {
00075                 $item['children'][] = $this->_getNodeJson($child, $level + 1);
00076             }
00077         }
00078 
00079         if (empty($item['children']) && (int)$node->getChildrenCount() > 0) {
00080             $item['children'] = array();
00081         }
00082 
00083         if (!empty($item['children'])) {
00084             $item['expanded'] = true;
00085         }
00086 
00087         if (in_array($node->getId(), $this->getCategoryIds())) {
00088             $item['checked'] = true;
00089         }
00090 
00091         return $item;
00092     }

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Adminhtml_Block_Catalog_Category_Tree.

Definition at line 36 of file Tree.php.

00037     {
00038         $this->setTemplate('catalog/category/checkboxes/tree.phtml');
00039     }

getCategoryIds (  ) 

Definition at line 41 of file Tree.php.

00042     {
00043         return $this->_selectedIds;
00044     }

getRoot ( parentNodeCategory = null,
recursionLevel = 3 
)

Reimplemented from Mage_Adminhtml_Block_Catalog_Category_Abstract.

Definition at line 94 of file Tree.php.

00095     {
00096         return $this->getRootByIds($this->getCategoryIds());
00097     }

setCategoryIds ( ids  ) 

Definition at line 46 of file Tree.php.

00047     {
00048         if (empty($ids)) {
00049             $ids = array();
00050         }
00051         elseif (!is_array($ids)) {
00052             $ids = array((int)$ids);
00053         }
00054         $this->_selectedIds = $ids;
00055         return $this;
00056     }


Member Data Documentation

$_selectedIds = array() [protected]

Definition at line 34 of file Tree.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:42 2009 for Magento by  doxygen 1.5.8