8
8
/**
9
9
* @var $block \Magento\Reports\Block\Adminhtml\Grid
10
10
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
11
+ * @var $escaper \Magento\Framework\Escaper
11
12
*/
12
13
?>
13
14
<?php if ($ block ->getCollection ()): ?>
14
15
<?php if ($ block ->canDisplayContainer ()): ?>
15
- <div id="<?= $ block ->escapeHtmlAttr ($ block ->getId ()) ?> ">
16
+ <div id="<?= $ escaper ->escapeHtmlAttr ($ block ->getId ()) ?> ">
16
17
<?php else : ?>
17
18
<?= $ block ->getLayout ()->getMessagesBlock ()->getGroupedHtml () ?>
18
19
<?php endif ; ?>
21
22
<div class="admin__data-grid-header-row">
22
23
<?php if ($ block ->getDateFilterVisibility ()): ?>
23
24
<div class="admin__filter-actions" data-role="filter-form"
24
- id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_range ' )) ?> ">
25
+ id="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_range ' )) ?> ">
25
26
<span class="field-row">
26
- <label for="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from ' )) ?> "
27
+ <label for="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from ' )) ?> "
27
28
class="admin__control-support-text">
28
- <span><?= $ block ->escapeHtml (__ ('From ' )) ?> :</span>
29
+ <span><?= $ escaper ->escapeHtml (__ ('From ' )) ?> :</span>
29
30
</label>
30
31
<input class="input-text no-changes required-entry admin__control-text"
31
32
type="text"
32
- id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from ' )) ?> "
33
+ id="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from ' )) ?> "
33
34
name="report_from"
34
- value="<?= $ block ->escapeHtmlAttr ($ block ->getFilter ('report_from ' )) ?> ">
35
- <span id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from_advice ' ))?> ">
35
+ value="<?= $ escaper ->escapeHtmlAttr ($ block ->getFilter ('report_from ' )) ?> ">
36
+ <span id="<?= $ escaper
37
+ ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_from_advice ' ))?> ">
36
38
</span>
37
39
</span>
38
40
39
41
<span class="field-row">
40
- <label for="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to ' )) ?> "
42
+ <label for="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to ' )) ?> "
41
43
class="admin__control-support-text">
42
- <span><?= $ block ->escapeHtml (__ ('To ' )) ?> :</span>
44
+ <span><?= $ escaper ->escapeHtml (__ ('To ' )) ?> :</span>
43
45
</label>
44
46
<input class="input-text no-changes required-entry admin__control-text"
45
47
type="text"
46
- id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to ' )) ?> "
48
+ id="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to ' )) ?> "
47
49
name="report_to"
48
- value="<?= $ block ->escapeHtmlAttr ($ block ->getFilter ('report_to ' )) ?> "/>
49
- <span id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to_advice ' )) ?> ">
50
+ value="<?= $ escaper ->escapeHtmlAttr ($ block ->getFilter ('report_to ' )) ?> "/>
51
+ <span id="<?= $ escaper
52
+ ->escapeHtmlAttr ($ block ->getSuffixId ('period_date_to_advice ' )) ?> ">
50
53
</span>
51
54
</span>
52
55
53
56
<span class="field-row admin__control-filter">
54
- <label for="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('report_period ' )) ?> "
57
+ <label for="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('report_period ' )) ?> "
55
58
class="admin__control-support-text">
56
- <span><?= $ block ->escapeHtml (__ ('Show By ' )) ?> :</span>
59
+ <span><?= $ escaper ->escapeHtml (__ ('Show By ' )) ?> :</span>
57
60
</label>
58
61
<select name="report_period"
59
- id="<?= $ block ->escapeHtmlAttr ($ block ->getSuffixId ('report_period ' )) ?> "
62
+ id="<?= $ escaper ->escapeHtmlAttr ($ block ->getSuffixId ('report_period ' )) ?> "
60
63
class="admin__control-select">
61
64
<?php foreach ($ block ->getPeriods () as $ _value => $ _label ): ?>
62
- <option value="<?= $ block ->escapeHtmlAttr ($ _value ) ?> "
65
+ <option value="<?= $ escaper ->escapeHtmlAttr ($ _value ) ?> "
63
66
<?php if ($ block ->getFilter ('report_period ' ) == $ _value ):
64
- ?> selected<?php endif ; ?> ><?= $ block ->escapeHtml ($ _label ) ?>
67
+ ?> selected<?php endif ; ?> ><?= $ escaper ->escapeHtml ($ _label ) ?>
65
68
</option>
66
69
<?php endforeach ; ?>
67
70
</select>
71
74
72
75
require([
73
76
"jquery",
74
- "mage/calendar"
77
+ "mage/calendar",
78
+ "uiParseDataDateRange"
75
79
], function($){
76
80
77
- $("# {$ block ->escapeJs ($ block ->getSuffixId ('period_date_range ' ))}").dateRange({
78
- dateFormat:" {$ block ->escapeJs ($ block ->getDateFormat ())}",
81
+ $("# {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_range ' ))}").dateRange({
82
+ dateFormat:" {$ escaper ->escapeJs ($ block ->getDateFormat ())}",
79
83
buttonText:"",
80
84
from:{
81
- id:" {$ block ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}"
85
+ id:" {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}"
82
86
},
83
87
to:{
84
- id:" {$ block ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}"
88
+ id:" {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}"
85
89
}
86
90
});
87
91
});
@@ -98,15 +102,15 @@ script;
98
102
</div>
99
103
<?php endif ; ?>
100
104
<div class="admin__data-grid-wrap admin__data-grid-wrap-static">
101
- <table class="data-grid" id="<?= $ block ->escapeHtmlAttr ($ block ->getId ()) ?> _table">
105
+ <table class="data-grid" id="<?= $ escaper ->escapeHtmlAttr ($ block ->getId ()) ?> _table">
102
106
<?= $ block ->getChildHtml ('grid.columnSet ' ) ?>
103
107
</table>
104
108
</div>
105
109
</div>
106
110
<?php if ($ block ->canDisplayContainer ()): ?>
107
111
<?php $ useAjax = '' ;
108
112
if ($ block ->getUseAjax ()):
109
- $ useAjax = $ block ->escapeJs ($ block ->getUseAjax ());
113
+ $ useAjax = $ escaper ->escapeJs ($ block ->getUseAjax ());
110
114
endif ;
111
115
$ scriptString = <<<script
112
116
@@ -118,24 +122,25 @@ script;
118
122
], function(jQuery){
119
123
120
124
//<![CDATA[
121
- {$ block ->escapeJs ($ block ->getJsObjectName ())} = new varienGrid(' {$ block ->escapeJs ($ block ->getId ())}',
122
- ' {$ block ->escapeJs ($ block ->getGridUrl ())}', ' {$ block ->escapeJs ($ block ->getVarNamePage ())}',
123
- ' {$ block ->escapeJs ($ block ->getVarNameSort ())}', ' {$ block ->escapeJs ($ block ->getVarNameDir ())}',
124
- ' {$ block ->escapeJs ($ block ->getVarNameFilter ())}');
125
- {$ block ->escapeJs ($ block ->getJsObjectName ())}.useAjax = ' {$ useAjax }';
125
+ {$ escaper ->escapeJs ($ block ->getJsObjectName ())} = new varienGrid(' {$ escaper ->escapeJs (
126
+ $ block ->getId ())}',
127
+ ' {$ escaper ->escapeJs ($ block ->getGridUrl ())}', ' {$ escaper ->escapeJs ($ block ->getVarNamePage ())}',
128
+ ' {$ escaper ->escapeJs ($ block ->getVarNameSort ())}', ' {$ escaper ->escapeJs ($ block ->getVarNameDir ())}',
129
+ ' {$ escaper ->escapeJs ($ block ->getVarNameFilter ())}');
130
+ {$ escaper ->escapeJs ($ block ->getJsObjectName ())}.useAjax = ' {$ useAjax }';
126
131
127
132
script ;
128
133
?>
129
134
<?php if ($ block ->getDateFilterVisibility ()): ?>
130
135
<?php $ scriptString .= <<<script
131
136
132
- {$ block ->escapeJs ($ block ->getJsObjectName ())}.doFilterCallback = validateFilterDate;
133
- var period_date_from = $(' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}');
134
- var period_date_to = $(' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}');
137
+ {$ escaper ->escapeJs ($ block ->getJsObjectName ())}.doFilterCallback = validateFilterDate;
138
+ var period_date_from = $(' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}');
139
+ var period_date_to = $(' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}');
135
140
period_date_from.adviceContainer =
136
- $(' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_from_advice ' ))}');
141
+ $(' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_from_advice ' ))}');
137
142
period_date_to.adviceContainer =
138
- $(' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_to_advice ' ))}');
143
+ $(' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_to_advice ' ))}');
139
144
140
145
var validateFilterDate = function() {
141
146
if (period_date_from && period_date_to) {
@@ -169,11 +174,11 @@ script;
169
174
if (obj.switchParams) {
170
175
storeParam += obj.switchParams;
171
176
}
172
- var formParam = new Array(' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}',
173
- ' {$ block ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}',
174
- ' {$ block ->escapeJs ($ block ->getSuffixId ('report_period ' ))}');
177
+ var formParam = new Array(' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_from ' ))}',
178
+ ' {$ escaper ->escapeJs ($ block ->getSuffixId ('period_date_to ' ))}',
179
+ ' {$ escaper ->escapeJs ($ block ->getSuffixId ('report_period ' ))}');
175
180
var paramURL = '';
176
- var switchURL = ' {$ block ->escapeJs ($ block ->getAbsoluteGridUrl (['_current ' => false ]))}'
181
+ var switchURL = ' {$ escaper ->escapeJs ($ block ->getAbsoluteGridUrl (['_current ' => false ]))}'
177
182
.replace(/(store|group|website)\/\d+\//, '');
178
183
179
184
for (var i = 0; i < formParam.length; i++) {
0 commit comments