16 class Grid extends \Magento\Backend\Block\Widget\Grid
44 protected $_defaultFilters = [
'report_from' =>
'',
'report_to' =>
'',
'report_period' =>
'day'];
84 if (
null === $filter) {
88 if (is_string($filter)) {
90 $filter = base64_decode($filter);
91 parse_str(urldecode($filter),
$data);
93 if (!isset(
$data[
'report_from'])) {
95 $date = (new \DateTime())->setTimestamp(mktime(0, 0, 0, 1, 1, 2001));
96 $data[
'report_from'] = $this->_localeDate->formatDateTime(
98 \IntlDateFormatter::SHORT,
99 \IntlDateFormatter::NONE
103 if (!isset(
$data[
'report_to'])) {
105 $date = new \DateTime();
106 $data[
'report_to'] = $this->_localeDate->formatDateTime(
108 \IntlDateFormatter::SHORT,
109 \IntlDateFormatter::NONE
114 }
elseif ($filter && is_array($filter)) {
116 }
elseif (0 !==
sizeof($this->_defaultFilter)) {
130 $from = $this->_localeDate->date($this->
getFilter(
'report_from'),
null,
false,
false);
131 $to = $this->_localeDate->date($this->
getFilter(
'report_to'),
null,
false,
false);
134 }
catch (\Exception $e) {
135 $this->_errors[] =
__(
'Invalid date specified');
145 $this->_eventManager->dispatch(
146 'adminhtml_widget_grid_filter_collection',
147 [
'collection' => $this->
getCollection(),
'filter_values' => $this->_filterValues]
166 $storeIds = [$this->
getParam(
'store')];
168 $storeIds = $this->_storeManager->getWebsite($this->
getRequest()->
getParam(
'website'))->getStoreIds();
170 $storeIds = $storeIds = $this->_storeManager->getGroup(
176 $allowedStoreIds = array_keys($this->_storeManager->getStores());
178 $storeIds = array_intersect($allowedStoreIds, $storeIds);
180 if (empty($storeIds)) {
181 $storeIds = $allowedStoreIds;
184 $storeIds = array_values($storeIds);
213 $this->_storeSwitcherVisibility = $visible;
248 $this->_dateFilterVisibility = $visible;
291 return $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
328 if (isset($this->_filters[
$name])) {
329 return $this->_filters[
$name];
344 $this->_subReportSize = $size;
378 \
Magento\Backend\Block\Widget\Button::class,
379 [
'label' =>
__(
'Refresh'),
'onclick' =>
"{$this->getJsObjectName()}.doFilter();",
'class' =>
'task']
elseif(isset( $params[ 'redirect_parent']))
addChild($alias, $block, $data=[])
setStoreSwitcherVisibility($visible=true)
getStoreSwitcherVisibility()
$_storeSwitcherVisibility
getDateFilterVisibility()
setDateFilterVisibility($visible=true)
getChildHtml($alias='', $useCache=true)
if(!isset($_GET['name'])) $name