1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_System_Cache_Edit extends Mage_Adminhtml_Block_Widget
35: {
36: public function __construct()
37: {
38: parent::__construct();
39: $this->setTemplate('system/cache/edit.phtml');
40: $this->setTitle('Cache Management');
41: }
42:
43: protected function _prepareLayout()
44: {
45: $this->setChild('save_button',
46: $this->getLayout()->createBlock('adminhtml/widget_button')
47: ->setData(array(
48: 'label' => Mage::helper('adminhtml')->__('Save Cache Settings'),
49: 'onclick' => 'configForm.submit()',
50: 'class' => 'save',
51: ))
52: );
53: return parent::_prepareLayout();
54: }
55:
56: public function getSaveButtonHtml()
57: {
58: return $this->getChildHtml('save_button');
59: }
60:
61: public function getSaveUrl()
62: {
63: return $this->getUrl('*/*/save', array('_current'=>true));
64: }
65:
66: public function initForm()
67: {
68: $this->setChild('form',
69: $this->getLayout()->createBlock('adminhtml/system_cache_form')
70: ->initForm()
71: );
72: return $this;
73: }
74:
75: 76: 77: 78: 79:
80: public function getCatalogData()
81: {
82: $layeredIsDisabled = false;
83: $warning = '';
84:
85: $flag = Mage::getModel('catalogindex/catalog_index_flag')->loadSelf();
86: switch ($flag->getState()) {
87: case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_QUEUED:
88: $layeredAction = Mage::helper('adminhtml')->__('Queued... Cancel');
89:
90: break;
91: case Mage_CatalogIndex_Model_Catalog_Index_Flag::STATE_RUNNING:
92: $layeredAction = Mage::helper('adminhtml')->__('Running... Kill');
93: $warning = Mage::helper('adminhtml')->__('Do you really want to KILL parallel process and start new indexing process?');
94:
95:
96: break;
97: default:
98: $layeredAction = Mage::helper('adminhtml')->__('Queue Refresh');
99:
100: break;
101: }
102:
103: return array(
104: 'refresh_catalog_rewrites' => array(
105: 'label' => Mage::helper('adminhtml')->__('Catalog Rewrites'),
106: 'buttons' => array(
107: array(
108: 'name' => 'refresh_catalog_rewrites',
109: 'action' => Mage::helper('adminhtml')->__('Refresh'),
110: )
111: ),
112: ),
113: 'clear_images_cache' => array(
114: 'label' => Mage::helper('adminhtml')->__('Images Cache'),
115: 'buttons' => array(
116: array(
117: 'name' => 'clear_images_cache',
118: 'action' => Mage::helper('adminhtml')->__('Clear'),
119: )
120: ),
121: ),
122: 'refresh_layered_navigation' => array(
123: 'label' => Mage::helper('adminhtml')->__('Layered Navigation Indices'),
124: 'buttons' => array(
125: array(
126: 'name' => 'refresh_layered_navigation',
127: 'action' => $layeredAction,
128: 'disabled' => $layeredIsDisabled,
129: ),
130: array(
131: 'name' => 'refresh_layered_navigation_now',
132: 'action' => Mage::helper('adminhtml')->__('Refresh Now*'),
133: 'comment' => Mage::helper('adminhtml')->__('* - If indexing is in progress, it will be killed and new indexing process will start.'),
134: 'warning' => $warning,
135: )
136: ),
137: ),
138: 'rebuild_search_index' => array(
139: 'label' => Mage::helper('adminhtml')->__('Search Index'),
140: 'buttons' => array(
141: array(
142: 'name' => 'rebuild_search_index',
143: 'action' => Mage::helper('adminhtml')->__('Rebuild'),
144: )
145: ),
146: ),
147: 'rebuild_inventory_stock_status' => array(
148: 'label' => Mage::helper('adminhtml')->__('Inventory Stock Status'),
149: 'buttons' => array(
150: array(
151: 'name' => 'rebuild_inventory_stock_status',
152: 'action' => Mage::helper('adminhtml')->__('Refresh'),
153: )
154: ),
155: ),
156: 'rebuild_catalog_index' => array(
157: 'label' => Mage::helper('adminhtml')->__('Rebuild Catalog Index'),
158: 'buttons' => array(
159: array(
160: 'name' => 'rebuild_catalog_index',
161: 'action' => Mage::helper('adminhtml')->__('Rebuild'),
162: )
163: ),
164: ),
165: 'rebuild_flat_catalog_category' => array(
166: 'label' => Mage::helper('adminhtml')->__('Rebuild Flat Catalog Category'),
167: 'buttons' => array(
168: array(
169: 'name' => 'rebuild_flat_catalog_category',
170: 'action' => Mage::helper('adminhtml')->__('Rebuild'),
171: )
172: ),
173: ),
174: 'rebuild_flat_catalog_product' => array(
175: 'label' => Mage::helper('adminhtml')->__('Rebuild Flat Catalog Product'),
176: 'buttons' => array(
177: array(
178: 'name' => 'rebuild_flat_catalog_product',
179: 'action' => Mage::helper('adminhtml')->__('Rebuild'),
180: )
181: ),
182: ),
183: );
184: }
185: }
186: