1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Backend Catalog Price Rules controller
*
* @author Magento Core Team <core@magentocommerce.com>
*/
namespace Magento\CatalogRule\Controller\Adminhtml\Promo;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
use Magento\Framework\Stdlib\DateTime\Filter\Date;
abstract class Catalog extends Action
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_CatalogRule::promo_catalog';
/**
* Dirty rules notice message
*
*
* @var string
*/
protected $_dirtyRulesNoticeMessage;
/**
* Core registry
*
* @var Registry
*/
protected $_coreRegistry = null;
/**
* Date filter instance
*
* @var \Magento\Framework\Stdlib\DateTime\Filter\Date
*/
protected $_dateFilter;
/**
* Constructor
*
* @param Context $context
* @param Registry $coreRegistry
* @param Date $dateFilter
*/
public function __construct(Context $context, Registry $coreRegistry, Date $dateFilter)
{
parent::__construct($context);
$this->_coreRegistry = $coreRegistry;
$this->_dateFilter = $dateFilter;
}
/**
* Init action
*
* @return $this
*/
protected function _initAction()
{
$this->_view->loadLayout();
$this->_setActiveMenu(
'Magento_CatalogRule::promo_catalog'
)->_addBreadcrumb(
__('Promotions'),
__('Promotions')
);
return $this;
}
/**
* Set dirty rules notice message
*
* @param string $dirtyRulesNoticeMessage
* @return void
* @codeCoverageIgnore
*/
public function setDirtyRulesNoticeMessage($dirtyRulesNoticeMessage)
{
$this->_dirtyRulesNoticeMessage = $dirtyRulesNoticeMessage;
}
/**
* Get dirty rules notice message
*
* @return string
*/
public function getDirtyRulesNoticeMessage()
{
$defaultMessage = __(
'We found updated rules that are not applied. Please click "Apply Rules" to update your catalog.'
);
return $this->_dirtyRulesNoticeMessage ? $this->_dirtyRulesNoticeMessage : $defaultMessage;
}
}