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_Report_ReviewController extends Mage_Adminhtml_Controller_Action
00035 {
00036 public function _initAction()
00037 {
00038 $act = $this->getRequest()->getActionName();
00039 if(!$act)
00040 $act = 'default';
00041
00042 $this->loadLayout()
00043 ->_addBreadcrumb(Mage::helper('reports')->__('Reports'), Mage::helper('reports')->__('Reports'))
00044 ->_addBreadcrumb(Mage::helper('reports')->__('Review'), Mage::helper('reports')->__('Reviews'));
00045 return $this;
00046 }
00047
00048 public function customerAction()
00049 {
00050 $this->_initAction()
00051 ->_setActiveMenu('report/review/customer')
00052 ->_addBreadcrumb(Mage::helper('reports')->__('Customers Report'), Mage::helper('reports')->__('Customers Report'))
00053 ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_customer'))
00054 ->renderLayout();
00055 }
00056
00057
00058
00059
00060 public function exportCustomerCsvAction()
00061 {
00062 $fileName = 'review_customer.csv';
00063 $content = $this->getLayout()->createBlock('adminhtml/report_review_customer_grid')
00064 ->getCsv();
00065
00066 $this->_prepareDownloadResponse($fileName, $content);
00067 }
00068
00069
00070
00071
00072 public function exportCustomerExcelAction()
00073 {
00074 $fileName = 'review_customer.xml';
00075 $content = $this->getLayout()->createBlock('adminhtml/report_review_customer_grid')
00076 ->getExcel($fileName);
00077
00078 $this->_prepareDownloadResponse($fileName, $content);
00079 }
00080
00081 public function productAction()
00082 {
00083 $this->_initAction()
00084 ->_setActiveMenu('report/review/product')
00085 ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
00086 ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_product'))
00087 ->renderLayout();
00088 }
00089
00090
00091
00092
00093 public function exportProductCsvAction()
00094 {
00095 $fileName = 'review_product.csv';
00096 $content = $this->getLayout()->createBlock('adminhtml/report_review_product_grid')
00097 ->getCsv();
00098
00099 $this->_prepareDownloadResponse($fileName, $content);
00100 }
00101
00102
00103
00104
00105 public function exportProductExcelAction()
00106 {
00107 $fileName = 'review_product.xml';
00108 $content = $this->getLayout()->createBlock('adminhtml/report_review_product_grid')
00109 ->getExcel($fileName);
00110
00111 $this->_prepareDownloadResponse($fileName, $content);
00112 }
00113
00114 public function productDetailAction()
00115 {
00116 $this->_initAction()
00117 ->_setActiveMenu('report/review/productDetail')
00118 ->_addBreadcrumb(Mage::helper('reports')->__('Products Report'), Mage::helper('reports')->__('Products Report'))
00119 ->_addBreadcrumb(Mage::helper('reports')->__('Product Reviews'), Mage::helper('reports')->__('Product Reviews'))
00120 ->_addContent($this->getLayout()->createBlock('adminhtml/report_review_detail'))
00121 ->renderLayout();
00122 }
00123
00124
00125
00126
00127 public function exportProductDetailCsvAction()
00128 {
00129 $fileName = 'review_product_detail.csv';
00130 $content = $this->getLayout()->createBlock('adminhtml/report_review_detail_grid')
00131 ->getCsv();
00132
00133 $this->_prepareDownloadResponse($fileName, $content);
00134 }
00135
00136
00137
00138
00139 public function exportProductDetailExcelAction()
00140 {
00141 $fileName = 'review_product_detail.xml';
00142 $content = $this->getLayout()->createBlock('adminhtml/report_review_detail_grid')
00143 ->getExcel($fileName);
00144
00145 $this->_prepareDownloadResponse($fileName, $content);
00146 }
00147
00148 protected function _isAllowed()
00149 {
00150 switch ($this->getRequest()->getActionName()) {
00151 case 'customer':
00152 return Mage::getSingleton('admin/session')->isAllowed('report/review/customer');
00153 break;
00154 case 'product':
00155 return Mage::getSingleton('admin/session')->isAllowed('report/review/product');
00156 break;
00157 default:
00158 return Mage::getSingleton('admin/session')->isAllowed('report/review');
00159 break;
00160 }
00161 }
00162 }