コード例 #1
0
ファイル: Default.php プロジェクト: Bananamoon/aimeos-core
 /**
  * Builds the tree of catalog items.
  *
  * @param MW_Tree_Node_Interface $node Parent tree node
  * @param MShop_Catalog_Item_Interface $item Parent tree catalog Item
  * @param array $listItemMap Associative list of parent-item-ID / list items for the catalog item
  * @param array $refItemMap Associative list of parent-item-ID/domain/items key/value pairs
  */
 protected function _createTree(MW_Tree_Node_Interface $node, MShop_Catalog_Item_Interface $item, array $listItemMap, array $refItemMap)
 {
     foreach ($node->getChildren() as $idx => $child) {
         $listItems = array();
         if (array_key_exists($child->getId(), $listItemMap)) {
             $listItems = $listItemMap[$child->getId()];
         }
         $refItems = array();
         if (array_key_exists($child->getId(), $refItemMap)) {
             $refItems = $refItemMap[$child->getId()];
         }
         $newItem = $this->_createItem(array(), $listItems, $refItems, array(), $child);
         $result = true;
         foreach ($this->_filter as $fcn) {
             $result = $result && $fcn($newItem, $idx);
         }
         if ($result === true) {
             $item->addChild($newItem);
             $this->_createTree($child, $newItem, $listItemMap, $refItemMap);
         }
     }
 }