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_Cache_Edit extends Mage_Adminhtml_Block_Widget
00035 {
00036 public function __construct()
00037 {
00038 parent::__construct();
00039 $this->setTemplate('system/cache/edit.phtml');
00040 $this->setTitle('Cache Management');
00041 }
00042
00043 protected function _prepareLayout()
00044 {
00045 $this->setChild('save_button',
00046 $this->getLayout()->createBlock('adminhtml/widget_button')
00047 ->setData(array(
00048 'label' => Mage::helper('adminhtml')->__('Save cache settings'),
00049 'onclick' => 'configForm.submit()',
00050 'class' => 'save',
00051 ))
00052 );
00053 return parent::_prepareLayout();
00054 }
00055
00056 public function getSaveButtonHtml()
00057 {
00058 return $this->getChildHtml('save_button');
00059 }
00060
00061 public function getSaveUrl()
00062 {
00063 return $this->getUrl('*/*/save', array('_current'=>true));
00064 }
00065
00066 public function initForm()
00067 {
00068 $this->setChild('form',
00069 $this->getLayout()->createBlock('adminhtml/system_cache_form')
00070 ->initForm()
00071 );
00072 return $this;
00073 }
00074
00075
00076
00077
00078
00079
00080 public function getCatalogData()
00081 {
00082 $layeredIsDisabled = false;
00083 $warning = '';
00084
00085 $flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
00086 switch ($flag->getState()) {
00087 case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED:
00088 $layeredAction = Mage::helper('adminhtml')->__('Queued... Cancel');
00089
00090 break;
00091 case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING:
00092 $layeredAction = Mage::helper('adminhtml')->__('Running... Kill');
00093 $warning = Mage::helper('adminhtml')->__('Do you really want to KILL parallel process and start new indexing process?');
00094
00095
00096 break;
00097 default:
00098 $layeredAction = Mage::helper('adminhtml')->__('Queue Refresh');
00099
00100 break;
00101 }
00102
00103 return array(
00104 'refresh_catalog_rewrites' => array(
00105 'label' => Mage::helper('adminhtml')->__('Catalog Rewrites'),
00106 'buttons' => array(
00107 array(
00108 'name' => 'refresh_catalog_rewrites',
00109 'action' => Mage::helper('adminhtml')->__('Refresh'),
00110 )
00111 ),
00112 ),
00113 'clear_images_cache' => array(
00114 'label' => Mage::helper('adminhtml')->__('Images Cache'),
00115 'buttons' => array(
00116 array(
00117 'name' => 'clear_images_cache',
00118 'action' => Mage::helper('adminhtml')->__('Clear'),
00119 )
00120 ),
00121 ),
00122 'refresh_layered_navigation' => array(
00123 'label' => Mage::helper('adminhtml')->__('Layered Navigation Indices'),
00124 'buttons' => array(
00125 array(
00126 'name' => 'refresh_layered_navigation',
00127 'action' => $layeredAction,
00128 'disabled' => $layeredIsDisabled,
00129 ),
00130 array(
00131 'name' => 'refresh_layered_navigation_now',
00132 'action' => Mage::helper('adminhtml')->__('Refresh Now*'),
00133 'comment' => Mage::helper('adminhtml')->__('* - If indexing is in progress, it will be killed and new indexing process will start'),
00134 'warning' => $warning,
00135 )
00136 ),
00137 ),
00138 'rebuild_search_index' => array(
00139 'label' => Mage::helper('adminhtml')->__('Search Index'),
00140 'buttons' => array(
00141 array(
00142 'name' => 'rebuild_search_index',
00143 'action' => Mage::helper('adminhtml')->__('Rebuild'),
00144 )
00145 ),
00146 ),
00147 'rebuild_inventory_stock_status' => array(
00148 'label' => Mage::helper('adminhtml')->__('Inventory Stock Status'),
00149 'buttons' => array(
00150 array(
00151 'name' => 'rebuild_inventory_stock_status',
00152 'action' => Mage::helper('adminhtml')->__('Refresh'),
00153 )
00154 ),
00155 ),
00156 'rebuild_catalog_index' => array(
00157 'label' => Mage::helper('adminhtml')->__('Rebuild Catalog Index'),
00158 'buttons' => array(
00159 array(
00160 'name' => 'rebuild_catalog_index',
00161 'action' => Mage::helper('adminhtml')->__('Rebuild'),
00162 )
00163 ),
00164 ),
00165 'rebuild_flat_catalog_category' => array(
00166 'label' => Mage::helper('adminhtml')->__('Rebuild Flat Catalog Category'),
00167 'buttons' => array(
00168 array(
00169 'name' => 'rebuild_flat_catalog_category',
00170 'action' => Mage::helper('adminhtml')->__('Rebuild'),
00171 )
00172 ),
00173 ),
00174 'rebuild_flat_catalog_product' => array(
00175 'label' => Mage::helper('adminhtml')->__('Rebuild Flat Catalog Product'),
00176 'buttons' => array(
00177 array(
00178 'name' => 'rebuild_flat_catalog_product',
00179 'action' => Mage::helper('adminhtml')->__('Rebuild'),
00180 )
00181 ),
00182 ),
00183 );
00184 }
00185 }