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_ReportController extends Mage_Adminhtml_Controller_Action
00035 {
00036 public function _initAction()
00037 {
00038 $this->loadLayout()
00039 ->_addBreadcrumb(Mage::helper('adminhtml')->__('Reports'), Mage::helper('adminhtml')->__('Reports'));
00040 return $this;
00041 }
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 public function searchAction()
00079 {
00080 Mage::dispatchEvent('on_view_report', array('report' => 'search'));
00081
00082 $this->_initAction()
00083 ->_setActiveMenu('report/search')
00084 ->_addBreadcrumb(Mage::helper('adminhtml')->__('Search Terms'), Mage::helper('adminhtml')->__('Search Terms'))
00085 ->_addContent($this->getLayout()->createBlock('adminhtml/report_search'))
00086 ->renderLayout();
00087 }
00088
00089
00090
00091
00092 public function exportSearchCsvAction()
00093 {
00094 $fileName = 'search.csv';
00095 $content = $this->getLayout()->createBlock('adminhtml/report_search_grid')
00096 ->getCsv();
00097
00098 $this->_prepareDownloadResponse($fileName, $content);
00099 }
00100
00101
00102
00103
00104 public function exportSearchExcelAction()
00105 {
00106 $fileName = 'search.xml';
00107 $content = $this->getLayout()->createBlock('adminhtml/report_search_grid')
00108 ->getExcel($fileName);
00109
00110 $this->_prepareDownloadResponse($fileName, $content);
00111 }
00112 /*
00113 public function ordersAction()
00114 {
00115 $this->_initAction()
00116 ->_setActiveMenu('report/orders')
00117 ->_addBreadcrumb(Mage::helper('adminhtml')->__('Recent Orders'), Mage::helper('adminhtml')->__('Recent Orders'))
00118 ->renderLayout();
00119 }
00120
00121 public function totalsAction()
00122 {
00123 $this->_initAction()
00124 ->_setActiveMenu('report/totals')
00125 ->_addBreadcrumb(Mage::helper('adminhtml')->__('Order Totals'), Mage::helper('adminhtml')->__('Order Totals'))
00126 ->renderLayout();
00127 }
00128 */
00129
00130 protected function _isAllowed()
00131 {
00132 switch ($this->getRequest()->getActionName()) {
00133 case 'search':
00134 return Mage::getSingleton('admin/session')->isAllowed('report/search');
00135 break;
00136 /*
00137 case 'customers':
00138 return Mage::getSingleton('admin/session')->isAllowed('report/shopcart');
00139 break;
00140 */
00141 default:
00142 return Mage::getSingleton('admin/session')->isAllowed('report');
00143 break;
00144 }
00145 }
00146 }