/**
  * Recursively apply custom design settings to category if it's option
  * custom_use_parent_settings is setted to 1 while parent option is not
  *
  * @deprecated after 1.4.2.0-beta1, functionality moved to Mage_Catalog_Model_Design
  * @param EM_Blog_Model_Category $category
  *
  * @return EM_Blog_CategoryController
  */
 protected function _applyCustomDesignSettings($category)
 {
     if ($category->getCustomUseParentSettings() && $category->getLevel() > 1) {
         $parentCategory = $category->getParentCategory();
         if ($parentCategory && $parentCategory->getId()) {
             return $this->_applyCustomDesignSettings($parentCategory);
         }
     }
     $validityDate = $category->getCustomDesignDate();
     if (array_key_exists('from', $validityDate) && array_key_exists('to', $validityDate) && Mage::app()->getLocale()->isStoreDateInInterval(null, $validityDate['from'], $validityDate['to'])) {
         Mage::helper('blog')->setTheme($category->getData('custom_design'), $category->getData('custom_layout_update_xml'), $category->getData('custom_layout'), $this);
     } else {
         $this->loadLayout();
     }
     return $this;
 }
 /**
  * Return children ids of category
  *
  * @param EM_Blog_Model_Category $category
  * @param boolean $recursive
  * @return array
  */
 public function getChildren($category, $recursive = true)
 {
     $attributeId = (int) $this->_getIsActiveAttributeId();
     $backendTable = $this->getTable(array($this->getEntityTablePrefix(), 'int'));
     $adapter = $this->_getReadAdapter();
     $checkSql = $adapter->getCheckSql('c.value_id > 0', 'c.value', 'd.value');
     $bind = array('attribute_id' => $attributeId, 'store_id' => $category->getStoreId(), 'scope' => 1, 'c_path' => $category->getPath() . '/%');
     $select = $this->_getReadAdapter()->select()->from(array('m' => $this->getEntityTable()), 'entity_id')->joinLeft(array('d' => $backendTable), 'd.attribute_id = :attribute_id AND d.store_id = 0 AND d.entity_id = m.entity_id', array())->joinLeft(array('c' => $backendTable), 'c.attribute_id = :attribute_id AND c.store_id = :store_id AND c.entity_id = m.entity_id', array())->where($checkSql . ' = :scope')->where($adapter->quoteIdentifier('path') . ' LIKE :c_path');
     if (!$recursive) {
         $select->where($adapter->quoteIdentifier('level') . ' <= :c_level');
         $bind['c_level'] = $category->getLevel() + 1;
     }
     return $adapter->fetchCol($select, $bind);
 }