Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Adminhtml_Cms_PageController
  • Mage_Adminhtml_Model_System_Config_Source_Cms_Wysiwyg_Enabled
  • Mage_Cms_Block_Block
  • Mage_Cms_Block_Page
  • Mage_Cms_Block_Widget_Block
  • Mage_Cms_Block_Widget_Page_Link
  • Mage_Cms_Controller_Router
  • Mage_Cms_Helper_Data
  • Mage_Cms_Helper_Page
  • Mage_Cms_Helper_Wysiwyg_Images
  • Mage_Cms_IndexController
  • Mage_Cms_Model_Block
  • Mage_Cms_Model_Mysql4_Block
  • Mage_Cms_Model_Mysql4_Block_Collection
  • Mage_Cms_Model_Mysql4_Page
  • Mage_Cms_Model_Mysql4_Page_Collection
  • Mage_Cms_Model_Mysql4_Page_Service
  • Mage_Cms_Model_Observer
  • Mage_Cms_Model_Page
  • Mage_Cms_Model_Resource_Block
  • Mage_Cms_Model_Resource_Block_Collection
  • Mage_Cms_Model_Resource_Page
  • Mage_Cms_Model_Resource_Page_Collection
  • Mage_Cms_Model_Resource_Page_Service
  • Mage_Cms_Model_Template_Filter
  • Mage_Cms_Model_Wysiwyg_Config
  • Mage_Cms_Model_Wysiwyg_Images_Storage
  • Mage_Cms_Model_Wysiwyg_Images_Storage_Collection
  • Mage_Cms_PageController
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Cms
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * CMS block model
 30:  *
 31:  * @category    Mage
 32:  * @package     Mage_Cms
 33:  * @author      Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Cms_Model_Resource_Block_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
 36: {
 37:     /**
 38:      * Define resource model
 39:      *
 40:      */
 41:     protected function _construct()
 42:     {
 43:         $this->_init('cms/block');
 44:         $this->_map['fields']['store'] = 'store_table.store_id';
 45:     }
 46: 
 47:     /**
 48:      * Returns pairs block_id - title
 49:      *
 50:      * @return array
 51:      */
 52:     public function toOptionArray()
 53:     {
 54:         return $this->_toOptionArray('block_id', 'title');
 55:     }
 56: 
 57:     /**
 58:      * Add filter by store
 59:      *
 60:      * @param int|Mage_Core_Model_Store $store
 61:      * @param bool $withAdmin
 62:      * @return Mage_Cms_Model_Resource_Block_Collection
 63:      */
 64:     public function addStoreFilter($store, $withAdmin = true)
 65:     {
 66:         if ($store instanceof Mage_Core_Model_Store) {
 67:             $store = array($store->getId());
 68:         }
 69: 
 70:         if (!is_array($store)) {
 71:             $store = array($store);
 72:         }
 73: 
 74:         if ($withAdmin) {
 75:             $store[] = Mage_Core_Model_App::ADMIN_STORE_ID;
 76:         }
 77: 
 78:         $this->addFilter('store', array('in' => $store), 'public');
 79: 
 80:         return $this;
 81:     }
 82: 
 83:     /**
 84:      * Get SQL for get record count.
 85:      * Extra GROUP BY strip added.
 86:      *
 87:      * @return Varien_Db_Select
 88:      */
 89:     public function getSelectCountSql()
 90:     {
 91:         $countSelect = parent::getSelectCountSql();
 92: 
 93:         $countSelect->reset(Zend_Db_Select::GROUP);
 94: 
 95:         return $countSelect;
 96:     }
 97: 
 98:     /**
 99:      * Join store relation table if there is store filter
100:      */
101:     protected function _renderFiltersBefore()
102:     {
103:         if ($this->getFilter('store')) {
104:             $this->getSelect()->join(
105:                 array('store_table' => $this->getTable('cms/block_store')),
106:                 'main_table.block_id = store_table.block_id',
107:                 array()
108:             )->group('main_table.block_id');
109: 
110:             /*
111:              * Allow analytic functions usage because of one field grouping
112:              */
113:             $this->_useAnalyticFunction = true;
114:         }
115:         return parent::_renderFiltersBefore();
116:     }
117: 
118: }
119: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0