00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_System_Config_Dwstree extends Mage_Adminhtml_Block_Widget_Tabs
00035 {
00036 public function __construct()
00037 {
00038 parent::__construct();
00039 #$this->setTemplate('widget/tabs.phtml');
00040 $this->setId('system_config_dwstree');
00041 $this->setDestElementId('system_config_form');
00042 }
00043
00044 public function initTabs()
00045 {
00046 $section = $this->getRequest()->getParam('section');
00047
00048 $curWebsite = $this->getRequest()->getParam('website');
00049 $curStore = $this->getRequest()->getParam('store');
00050
00051 $websitesConfig = Mage::getConfig()->getNode('websites');
00052 $storesConfig = Mage::getConfig()->getNode('stores');
00053
00054 $this->addTab('default', array(
00055 'label' => Mage::helper('adminhtml')->__('Default Config'),
00056 'url' => $this->getUrl('*/*/*', array('section'=>$section)),
00057 'class' => 'default',
00058 ));
00059
00060 foreach ($websitesConfig->children() as $wCode=>$wConfig) {
00061 $wName = (string)$wConfig->descend('system/website/name');
00062 $wUrl = $this->getUrl('*/*/*', array('section'=>$section, 'website'=>$wCode));
00063 $this->addTab('website_'.$wCode, array(
00064 'label' => $wName,
00065 'url' => $wUrl,
00066 'class' => 'website',
00067 ));
00068 if ($curWebsite===$wCode) {
00069 if ($curStore) {
00070 $this->_addBreadcrumb($wName, '', $wUrl);
00071 } else {
00072 $this->_addBreadcrumb($wName);
00073 }
00074 }
00075 foreach ($wConfig->descend('system/stores')->children() as $sCode=>$sId) {
00076 $sName = (string)$storesConfig->descend($sCode.'/system/store/name');
00077 $this->addTab('store_'.$sCode, array(
00078 'label' => $sName,
00079 'url' => $this->getUrl('*/*/*', array('section'=>$section, 'website'=>$wCode, 'store'=>$sCode)),
00080 'class' => 'store',
00081 ));
00082 if ($curStore===$sCode) {
00083 $this->_addBreadcrumb($sName);
00084 }
00085 }
00086 }
00087 if ($curStore) {
00088 $this->setActiveTab('store_'.$curStore);
00089 } elseif ($curWebsite) {
00090 $this->setActiveTab('website_'.$curWebsite);
00091 } else {
00092 $this->setActiveTab('default');
00093 }
00094
00095 return $this;
00096 }
00097 }