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_ReviewController 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')->__('Review'), Mage::helper('reports')->__('Reviews'));
45: return $this;
46: }
47:
48: public function customerAction()
49: {
50: $this->_title($this->__('Reports'))
51: ->_title($this->__('Reviews'))
52: ->_title($this->__('Customer Reviews'));
53:
54: $this->_initAction()
55: ->_setActiveMenu('report/review/customer')
56: ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report'))
57: ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_customer'))
58: ->renderLayout();
59: }
60:
61: 62: 63:
64: public function exportCustomerCsvAction()
65: {
66: $fileName = 'review_customer.csv';
67: $content = $this->getLayout()->createBlock('adminhtml/report_review_customer_grid')
68: ->getCsv();
69:
70: $this->_prepareDownloadResponse($fileName, $content);
71: }
72:
73: 74: 75:
76: public function exportCustomerExcelAction()
77: {
78: $fileName = 'review_customer.xml';
79: $content = $this->getLayout()->createBlock('adminhtml/report_review_customer_grid')
80: ->getExcel($fileName);
81:
82: $this->_prepareDownloadResponse($fileName, $content);
83: }
84:
85: public function productAction()
86: {
87: $this->_title($this->__('Reports'))
88: ->_title($this->__('Reviews'))
89: ->_title($this->__('Product Reviews'));
90:
91: $this->_initAction()
92: ->_setActiveMenu('report/review/product')
93: ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
94: ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_product'))
95: ->renderLayout();
96: }
97:
98: 99: 100:
101: public function exportProductCsvAction()
102: {
103: $fileName = 'review_product.csv';
104: $content = $this->getLayout()->createBlock('adminhtml/report_review_product_grid')
105: ->getCsv();
106:
107: $this->_prepareDownloadResponse($fileName, $content);
108: }
109:
110: 111: 112:
113: public function exportProductExcelAction()
114: {
115: $fileName = 'review_product.xml';
116: $content = $this->getLayout()->createBlock('adminhtml/report_review_product_grid')
117: ->getExcel($fileName);
118:
119: $this->_prepareDownloadResponse($fileName, $content);
120: }
121:
122: public function productDetailAction()
123: {
124: $this->_title($this->__('Reports'))
125: ->_title($this->__('Reviews'))
126: ->_title($this->__('Product Reviews'))
127: ->_title($this->__('Details'));
128:
129: $this->_initAction()
130: ->_setActiveMenu('report/review/productDetail')
131: ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
132: ->_addBreadcrumb(Mage::helper('reports')->__('Product Reviews'), Mage::helper('reports')->__('Product Reviews'))
133: ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_detail'))
134: ->renderLayout();
135: }
136:
137: 138: 139:
140: public function exportProductDetailCsvAction()
141: {
142: $fileName = 'review_product_detail.csv';
143: $content = $this->getLayout()->createBlock('adminhtml/report_review_detail_grid')
144: ->getCsv();
145:
146: $this->_prepareDownloadResponse($fileName, $content);
147: }
148:
149: 150: 151:
152: public function exportProductDetailExcelAction()
153: {
154: $fileName = 'review_product_detail.xml';
155: $content = $this->getLayout()->createBlock('adminhtml/report_review_detail_grid')
156: ->getExcel($fileName);
157:
158: $this->_prepareDownloadResponse($fileName, $content);
159: }
160:
161: protected function _isAllowed()
162: {
163: switch ($this->getRequest()->getActionName()) {
164: case 'customer':
165: return Mage::getSingleton('admin/session')->isAllowed('report/review/customer');
166: break;
167: case 'product':
168: return Mage::getSingleton('admin/session')->isAllowed('report/review/product');
169: break;
170: default:
171: return Mage::getSingleton('admin/session')->isAllowed('report/review');
172: break;
173: }
174: }
175: }
176: