Mage_Adminhtml_Block_Store_Switcher Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Store_Switcher:

Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Websites Mage_Adminhtml_Block_Sales_Order_Create_Store_Select Mage_GoogleBase_Block_Adminhtml_Store_Switcher

List of all members.

Public Member Functions

 __construct ()
 getWebsiteCollection ()
 getWebsites ()
 getGroupCollection ($website)
 getStoreGroups ($website)
 getStoreCollection ($group)
 getStores ($group)
 getSwitchUrl ()
 getStoreId ()
 setStoreIds ($storeIds)
 getStoreIds ()
 isShow ()
 hasDefaultOption ($hasDefaultOption=null)

Protected Member Functions

 _toHtml ()

Protected Attributes

 $_storeIds
 $_hasDefaultOption = true


Detailed Description

Definition at line 34 of file Switcher.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Websites, Mage_Adminhtml_Block_Sales_Order_Create_Store_Select, and Mage_GoogleBase_Block_Adminhtml_Store_Switcher.

Definition at line 46 of file Switcher.php.

00047     {
00048         parent::__construct();
00049         $this->setTemplate('store/switcher.phtml');
00050         $this->setUseConfirm(true);
00051         $this->setUseAjax(true);
00052         $this->setDefaultStoreName($this->__('All Store Views'));
00053     }


Member Function Documentation

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 180 of file Switcher.php.

00181     {
00182         if (!Mage::app()->isSingleStoreMode()) {
00183             return parent::_toHtml();
00184         }
00185         return '';
00186     }

getGroupCollection ( website  ) 

Deprecated

Definition at line 91 of file Switcher.php.

00092     {
00093         if (!$website instanceof Mage_Core_Model_Website) {
00094             $website = Mage::getModel('core/website')->load($website);
00095         }
00096         return $website->getGroupCollection();
00097     }

getStoreCollection ( group  ) 

Deprecated

Definition at line 116 of file Switcher.php.

00117     {
00118         if (!$group instanceof Mage_Core_Model_Store_Group) {
00119             $group = Mage::getModel('core/store_group')->load($group);
00120         }
00121         $stores = $group->getStoreCollection();
00122         $_storeIds = $this->getStoreIds();
00123         if (!empty($_storeIds)) {
00124             $stores->addIdFilter($_storeIds);
00125         }
00126         return $stores;
00127     }

getStoreGroups ( website  ) 

Get store groups for specified website

Parameters:
Mage_Core_Model_Website $website
Returns:
array

Definition at line 105 of file Switcher.php.

00106     {
00107         if (!$website instanceof Mage_Core_Model_Website) {
00108             $website = Mage::app()->getWebsite($website);
00109         }
00110         return $website->getGroups();
00111     }

getStoreId (  ) 

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Websites.

Definition at line 159 of file Switcher.php.

00160     {
00161         return $this->getRequest()->getParam('store');
00162     }

getStoreIds (  ) 

Definition at line 170 of file Switcher.php.

00171     {
00172         return $this->_storeIds;
00173     }

getStores ( group  ) 

Get store views for specified store group

Parameters:
Mage_Core_Model_Store_Group $group
Returns:
array

Definition at line 135 of file Switcher.php.

00136     {
00137         if (!$group instanceof Mage_Core_Model_Store_Group) {
00138             $group = Mage::app()->getGroup($group);
00139         }
00140         $stores = $group->getStores();
00141         if ($storeIds = $this->getStoreIds()) {
00142             foreach ($stores as $storeId => $store) {
00143                 if (!in_array($storeId, $storeIds)) {
00144                     unset($stores[$storeId]);
00145                 }
00146             }
00147         }
00148         return $stores;
00149     }

getSwitchUrl (  ) 

Definition at line 151 of file Switcher.php.

00152     {
00153         if ($url = $this->getData('switch_url')) {
00154             return $url;
00155         }
00156         return $this->getUrl('*/*/*', array('_current' => true, 'store' => null));
00157     }

getWebsiteCollection (  ) 

Deprecated

Definition at line 58 of file Switcher.php.

00059     {
00060         $collection = Mage::getModel('core/website')->getResourceCollection();
00061 
00062         $websiteIds = $this->getWebsiteIds();
00063         if (!is_null($websiteIds)) {
00064             $collection->addIdFilter($this->getWebsiteIds());
00065         }
00066 
00067         return $collection->load();
00068     }

getWebsites (  ) 

Get websites

Returns:
array

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Websites.

Definition at line 75 of file Switcher.php.

00076     {
00077         $websites = Mage::app()->getWebsites();
00078         if ($websiteIds = $this->getWebsiteIds()) {
00079             foreach ($websites as $websiteId => $website) {
00080                 if (!in_array($websiteId, $websiteIds)) {
00081                     unset($websites[$websiteId]);
00082                 }
00083             }
00084         }
00085         return $websites;
00086     }

hasDefaultOption ( hasDefaultOption = null  ) 

Set/Get whether the switcher should show default option

Parameters:
bool $hasDefaultOption
Returns:
bool

Definition at line 194 of file Switcher.php.

00195     {
00196         if (null !== $hasDefaultOption) {
00197             $this->_hasDefaultOption = $hasDefaultOption;
00198         }
00199         return $this->_hasDefaultOption;
00200     }

isShow (  ) 

Definition at line 175 of file Switcher.php.

00176     {
00177         return !Mage::app()->isSingleStoreMode();
00178     }

setStoreIds ( storeIds  ) 

Definition at line 164 of file Switcher.php.

00165     {
00166         $this->_storeIds = $storeIds;
00167         return $this;
00168     }


Member Data Documentation

$_hasDefaultOption = true [protected]

Reimplemented in Mage_GoogleBase_Block_Adminhtml_Store_Switcher.

Definition at line 44 of file Switcher.php.

$_storeIds [protected]

Definition at line 39 of file Switcher.php.


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

Generated on Sat Jul 4 17:23:02 2009 for Magento by  doxygen 1.5.8