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_Report_TagController extends Mage_Adminhtml_Controller_Action
35: {
36: public function _initAction()
37: {
38: $act = $this->getRequest()->getActionName();
39: if(!$act)
40: $act = 'default';
41:
42: $this->loadLayout()
43: ->_addBreadcrumb(Mage::helper('reports')->__('Reports'), Mage::helper('reports')->__('Reports'))
44: ->_addBreadcrumb(Mage::helper('reports')->__('Tag'), Mage::helper('reports')->__('Tag'));
45: return $this;
46: }
47:
48: public function customerAction()
49: {
50: $this->_title($this->__('Reports'))
51: ->_title($this->__('Tags'))
52: ->_title($this->__('Customers'));
53:
54: $this->_initAction()
55: ->_setActiveMenu('report/tag/customer')
56: ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report'))
57: ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_customer'))
58: ->renderLayout();
59: }
60:
61: 62: 63:
64: public function exportCustomerCsvAction()
65: {
66: $fileName = 'tag_customer.csv';
67: $content = $this->getLayout()->createBlock('adminhtml/report_tag_customer_grid')
68: ->getCsvFile();
69:
70: $this->_prepareDownloadResponse($fileName, $content);
71: }
72:
73: 74: 75:
76: public function exportCustomerExcelAction()
77: {
78: $fileName = 'tag_customer.xml';
79: $content = $this->getLayout()->createBlock('adminhtml/report_tag_customer_grid')
80: ->getExcelFile($fileName);
81:
82: $this->_prepareDownloadResponse($fileName, $content);
83: }
84:
85: public function productAction()
86: {
87: $this->_title($this->__('Reports'))
88: ->_title($this->__('Tags'))
89: ->_title($this->__('Products'));
90:
91: $this->_initAction()
92: ->_setActiveMenu('report/tag/product')
93: ->_addBreadcrumb(Mage::helper('reports')->__('Poducts Report'), Mage::helper('reports')->__('Products Report'))
94: ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_product'))
95: ->renderLayout();
96: }
97:
98: 99: 100:
101: public function exportProductCsvAction()
102: {
103: $fileName = 'tag_product.csv';
104: $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')
105: ->getCsvFile();
106:
107: $this->_prepareDownloadResponse($fileName, $content);
108: }
109:
110: 111: 112:
113: public function exportProductExcelAction()
114: {
115: $fileName = 'tag_product.xml';
116: $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_grid')
117: ->getExcelFile($fileName);
118:
119: $this->_prepareDownloadResponse($fileName, $content);
120: }
121:
122:
123: public function popularAction()
124: {
125: $this->_title($this->__('Reports'))
126: ->_title($this->__('Tags'))
127: ->_title($this->__('Popular'));
128:
129: $this->_initAction()
130: ->_setActiveMenu('report/tag/popular')
131: ->_addBreadcrumb(Mage::helper('reports')->__('Popular Tags'), Mage::helper('reports')->__('Popular Tags'))
132: ->_addContent($this->getLayout()->createBlock('adminhtml/report_tag_popular'))
133: ->renderLayout();
134: }
135:
136: 137: 138:
139: public function exportPopularCsvAction()
140: {
141: $fileName = 'tag_popular.csv';
142: $content = $this->getLayout()->createBlock('adminhtml/report_tag_popular_grid')
143: ->getCsvFile();
144:
145: $this->_prepareDownloadResponse($fileName, $content);
146: }
147:
148: 149: 150:
151: public function exportPopularExcelAction()
152: {
153: $fileName = 'tag_popular.xml';
154: $content = $this->getLayout()->createBlock('adminhtml/report_tag_popular_grid')
155: ->getExcelFile($fileName);
156:
157: $this->_prepareDownloadResponse($fileName, $content);
158: }
159:
160: public function customerDetailAction()
161: {
162: $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_customer_detail');
163:
164: $this->_title($this->__('Reports'))
165: ->_title($this->__('Tags'))
166: ->_title($this->__('Customers'))
167: ->_title($detailBlock->getHeaderText());
168:
169: $this->_initAction()
170: ->_setActiveMenu('report/tag/customerDetail')
171: ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report'))
172: ->_addBreadcrumb(Mage::helper('reports')->__('Customer Tags'), Mage::helper('reports')->__('Customer Tags'))
173: ->_addContent($detailBlock)
174: ->renderLayout();
175: }
176:
177: 178: 179:
180: public function exportCustomerDetailCsvAction()
181: {
182: $fileName = 'tag_customer_detail.csv';
183: $content = $this->getLayout()->createBlock('adminhtml/report_tag_customer_detail_grid')
184: ->getCsvFile();
185:
186: $this->_prepareDownloadResponse($fileName, $content);
187: }
188:
189: 190: 191:
192: public function exportCustomerDetailExcelAction()
193: {
194: $fileName = 'tag_customer_detail.xml';
195: $content = $this->getLayout()->createBlock('adminhtml/report_tag_customer_detail_grid')
196: ->getExcelFile($fileName);
197:
198: $this->_prepareDownloadResponse($fileName, $content);
199: }
200:
201: public function productDetailAction()
202: {
203: $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail');
204:
205: $this->_title($this->__('Reports'))
206: ->_title($this->__('Tags'))
207: ->_title($this->__('Products'))
208: ->_title($detailBlock->getHeaderText());
209:
210: $this->_initAction()
211: ->_setActiveMenu('report/tag/productDetail')
212: ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
213: ->_addBreadcrumb(Mage::helper('reports')->__('Product Tags'), Mage::helper('reports')->__('Product Tags'))
214: ->_addContent($detailBlock)
215: ->renderLayout();
216: }
217:
218: 219: 220:
221: public function exportProductDetailCsvAction()
222: {
223: $fileName = 'tag_product_detail.csv';
224: $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail_grid')
225: ->getCsvFile();
226:
227: $this->_prepareDownloadResponse($fileName, $content);
228: }
229:
230: 231: 232:
233: public function exportProductDetailExcelAction()
234: {
235: $fileName = 'tag_product_detail.xml';
236: $content = $this->getLayout()->createBlock('adminhtml/report_tag_product_detail_grid')
237: ->getExcelFile($fileName);
238:
239: $this->_prepareDownloadResponse($fileName, $content);
240: }
241:
242: public function tagDetailAction()
243: {
244: $detailBlock = $this->getLayout()->createBlock('adminhtml/report_tag_popular_detail');
245:
246: $this->_title($this->__('Reports'))
247: ->_title($this->__('Tags'))
248: ->_title($this->__('Popular'))
249: ->_title($detailBlock->getHeaderText());
250:
251: $this->_initAction()
252: ->_setActiveMenu('report/tag/tagDetail')
253: ->_addBreadcrumb(Mage::helper('reports')->__('Popular Tags'), Mage::helper('reports')->__('Popular Tags'))
254: ->_addBreadcrumb(Mage::helper('reports')->__('Tag Detail'), Mage::helper('reports')->__('Tag Detail'))
255: ->_addContent($detailBlock)
256: ->renderLayout();
257: }
258:
259: 260: 261:
262: public function exportTagDetailCsvAction()
263: {
264: $fileName = 'tag_detail.csv';
265: $content = $this->getLayout()->createBlock('adminhtml/report_tag_popular_detail_grid')
266: ->getCsvFile();
267:
268: $this->_prepareDownloadResponse($fileName, $content);
269: }
270:
271: 272: 273:
274: public function exportTagDetailExcelAction()
275: {
276: $fileName = 'tag_detail.xml';
277: $content = $this->getLayout()->createBlock('adminhtml/report_tag_popular_detail_grid')
278: ->getExcelFile($fileName);
279:
280: $this->_prepareDownloadResponse($fileName, $content);
281: }
282:
283: protected function _isAllowed()
284: {
285: switch ($this->getRequest()->getActionName()) {
286: case 'customer':
287: return Mage::getSingleton('admin/session')->isAllowed('report/tags/customer');
288: break;
289: case 'product':
290: return Mage::getSingleton('admin/session')->isAllowed('report/tags/product');
291: break;
292: case 'productAll':
293: return Mage::getSingleton('admin/session')->isAllowed('report/tags/product');
294: break;
295: case 'popular':
296: return Mage::getSingleton('admin/session')->isAllowed('report/tags/popular');
297: break;
298: default:
299: return Mage::getSingleton('admin/session')->isAllowed('report/tags');
300: break;
301: }
302: }
303: }
304: