1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * sales admin controller
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Adminhtml_ReportController extends Mage_Adminhtml_Controller_Action
35: {
36: public function _initAction()
37: {
38: $this->loadLayout()
39: ->_addBreadcrumb(Mage::helper('adminhtml')->__('Reports'), Mage::helper('adminhtml')->__('Reports'));
40: return $this;
41: }
42:
43:
44: /*
45: public function wishlistAction()
46: {
47: $this->_initAction()
48: ->_setActiveMenu('report/wishlist')
49: ->_addBreadcrumb(Mage::helper('adminhtml')->__('Wishlist Report'), Mage::helper('adminhtml')->__('Wishlist Report'))
50: ->_addContent($this->getLayout()->createBlock('adminhtml/report_wishlist'))
51: ->renderLayout();
52: }
53:
54: /**
55: * Export wishlist report grid to CSV format
56: * /
57: public function exportWishlistCsvAction()
58: {
59: $fileName = 'wishlist.csv';
60: $content = $this->getLayout()->createBlock('adminhtml/report_wishlist_grid')
61: ->getCsvFile();
62:
63: $this->_prepareDownloadResponse($fileName, $content);
64: }
65:
66: /**
67: * Export wishlist report to Excel XML format
68: * /
69: public function exportWishlistExcelAction()
70: {
71: $fileName = 'wishlist.xml';
72: $content = $this->getLayout()->createBlock('adminhtml/report_wishlist_grid')
73: ->getExcelFile($fileName);
74:
75: $this->_prepareDownloadResponse($fileName, $content);
76: }
77: */
78: public function searchAction()
79: {
80: $this->_title($this->__('Reports'))->_title($this->__('Search Terms'));
81:
82: Mage::dispatchEvent('on_view_report', array('report' => 'search'));
83:
84: $this->_initAction()
85: ->_setActiveMenu('report/search')
86: ->_addBreadcrumb(Mage::helper('adminhtml')->__('Search Terms'), Mage::helper('adminhtml')->__('Search Terms'))
87: ->_addContent($this->getLayout()->createBlock('adminhtml/report_search'))
88: ->renderLayout();
89: }
90:
91: /**
92: * Export search report grid to CSV format
93: */
94: public function exportSearchCsvAction()
95: {
96: $fileName = 'search.csv';
97: $content = $this->getLayout()->createBlock('adminhtml/report_search_grid')
98: ->getCsvFile();
99:
100: $this->_prepareDownloadResponse($fileName, $content);
101: }
102:
103: /**
104: * Export search report to Excel XML format
105: */
106: public function exportSearchExcelAction()
107: {
108: $fileName = 'search.xml';
109: $content = $this->getLayout()->createBlock('adminhtml/report_search_grid')
110: ->getExcelFile($fileName);
111:
112: $this->_prepareDownloadResponse($fileName, $content);
113: }
114: /*
115: public function ordersAction()
116: {
117: $this->_initAction()
118: ->_setActiveMenu('report/orders')
119: ->_addBreadcrumb(Mage::helper('adminhtml')->__('Recent Orders'), Mage::helper('adminhtml')->__('Recent Orders'))
120: ->renderLayout();
121: }
122:
123: public function totalsAction()
124: {
125: $this->_initAction()
126: ->_setActiveMenu('report/totals')
127: ->_addBreadcrumb(Mage::helper('adminhtml')->__('Order Totals'), Mage::helper('adminhtml')->__('Order Totals'))
128: ->renderLayout();
129: }
130: */
131:
132: protected function _isAllowed()
133: {
134: switch ($this->getRequest()->getActionName()) {
135: case 'search':
136: return Mage::getSingleton('admin/session')->isAllowed('report/search');
137: break;
138: /*
139: case 'customers':
140: return Mage::getSingleton('admin/session')->isAllowed('report/shopcart');
141: break;
142: */
143: default:
144: return Mage::getSingleton('admin/session')->isAllowed('report');
145: break;
146: }
147: }
148: }
149: