Mage_Adminhtml_Block_System_Config_Switcher Class Reference

Inheritance diagram for Mage_Adminhtml_Block_System_Config_Switcher:

Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getStoreSelectOptions ()

Protected Member Functions

 _prepareLayout ()


Detailed Description

Definition at line 28 of file Switcher.php.


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 30 of file Switcher.php.

00031     {
00032         $this->setTemplate('system/config/switcher.phtml');
00033         return parent::_prepareLayout();
00034     }

getStoreSelectOptions (  ) 

Enter description here...

Returns:
array

Definition at line 41 of file Switcher.php.

00042     {
00043         $section = $this->getRequest()->getParam('section');
00044 
00045         $curWebsite = $this->getRequest()->getParam('website');
00046         $curStore   = $this->getRequest()->getParam('store');
00047 
00048         $storeModel = Mage::getSingleton('adminhtml/system_store');
00049         /* @var $storeModel Mage_Adminhtml_Model_System_Store */
00050 
00051         $url = Mage::getModel('adminhtml/url');
00052 
00053         $options = array();
00054         $options['default'] = array(
00055             'label'    => Mage::helper('adminhtml')->__('Default Config'),
00056             'url'      => $url->getUrl('*/*/*', array('section'=>$section)),
00057             'selected' => !$curWebsite && !$curStore,
00058             'style'    => 'background:#ccc; font-weight:bold;',
00059         );
00060 
00061         foreach ($storeModel->getWebsiteCollection() as $website) {
00062             $websiteShow = false;
00063             foreach ($storeModel->getGroupCollection() as $group) {
00064                 if ($group->getWebsiteId() != $website->getId()) {
00065                     continue;
00066                 }
00067                 $groupShow = false;
00068                 foreach ($storeModel->getStoreCollection() as $store) {
00069                     if ($store->getGroupId() != $group->getId()) {
00070                         continue;
00071                     }
00072                     if (!$websiteShow) {
00073                         $websiteShow = true;
00074                         $options['website_' . $website->getCode()] = array(
00075                             'label'    => $website->getName(),
00076                             'url'      => $url->getUrl('*/*/*', array('section'=>$section, 'website'=>$website->getCode())),
00077                             'selected' => !$curStore && $curWebsite == $website->getCode(),
00078                             'style'    => 'padding-left:16px; background:#DDD; font-weight:bold;',
00079                         );
00080                     }
00081                     if (!$groupShow) {
00082                         $groupShow = true;
00083                         $options['group_' . $group->getId() . '_open'] = array(
00084                             'is_group'  => true,
00085                             'is_close'  => false,
00086                             'label'     => $group->getName(),
00087                             'style'     => 'padding-left:32px;'
00088                         );
00089                     }
00090                     $options['store_' . $store->getCode()] = array(
00091                         'label'    => $store->getName(),
00092                         'url'      => $url->getUrl('*/*/*', array('section'=>$section, 'website'=>$website->getCode(), 'store'=>$store->getCode())),
00093                         'selected' => $curStore == $store->getCode(),
00094                         'style'    => '',
00095                     );
00096                 }
00097                 if ($groupShow) {
00098                     $options['group_' . $group->getId() . '_close'] = array(
00099                         'is_group'  => true,
00100                         'is_close'  => true,
00101                     );
00102                 }
00103             }
00104         }
00105 
00106         return $options;
00107     }


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

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