Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Statistics.php
Go to the documentation of this file.
1 <?php
13 
14 use Magento\Backend\Model\Auth\Session as AuthSession;
16 
22 {
28  const ADMIN_RESOURCE = 'Magento_Reports::statistics';
29 
35  protected $_adminSession = null;
36 
40  protected $_dateFilter;
41 
47  protected $reportTypes;
48 
54  public function __construct(
55  \Magento\Backend\App\Action\Context $context,
56  \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
57  array $reportTypes
58  ) {
59  $this->_dateFilter = $dateFilter;
60  $this->reportTypes = $reportTypes;
61  parent::__construct($context);
62  }
63 
69  public function _initAction()
70  {
71  $this->_view->loadLayout();
72  $this->_addBreadcrumb(__('Reports'), __('Reports'));
73  $this->_addBreadcrumb(__('Statistics'), __('Statistics'));
74  return $this;
75  }
76 
83  protected function _getCollectionNames()
84  {
85  $codes = $this->getRequest()->getParam('code');
86  if (!$codes) {
87  throw new \Exception(__('No report code is specified.'));
88  }
89 
90  if (!is_array($codes) && strpos($codes, ',') === false) {
91  $codes = [$codes];
92  } elseif (!is_array($codes)) {
93  $codes = explode(',', $codes);
94  }
95 
96  $out = [];
97  foreach ($codes as $code) {
98  $out[] = $this->reportTypes[$code];
99  }
100  return $out;
101  }
102 
108  protected function _getSession()
109  {
110  if ($this->_adminSession === null) {
111  $this->_adminSession = $this->_objectManager->get(\Magento\Backend\Model\Auth\Session::class);
112  }
113  return $this->_adminSession;
114  }
115 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__()
Definition: __.php:13
_addBreadcrumb($label, $title, $link=null)
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter, array $reportTypes)
Definition: Statistics.php:54
$code
Definition: info.phtml:12