straker-translations-easy-translation-platform - Version 1.3.7

Version Notes

1) add 'sku' and 'attribute set' to product grid
2) fix bugs in job management page

Download this release

Release Info

Developer Chris
Extension straker-translations-easy-translation-platform
Version 1.3.7
Comparing to
See all releases


Code changes from version 1.3.6 to 1.3.7

Files changed (63) hide show
  1. app/code/community/StrakerTranslations/EasyTranslationPlatform/.DS_Store +0 -0
  2. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute/Grid.php +32 -5
  3. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php +33 -4
  4. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php +39 -11
  5. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php +66 -38
  6. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php +51 -45
  7. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php +50 -7
  8. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm/Grid.php +25 -5
  9. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Grid.php +51 -8
  10. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php +26 -5
  11. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php +5 -2
  12. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php +44 -8
  13. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php +18 -5
  14. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php +23 -8
  15. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php +19 -4
  16. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php +0 -1
  17. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php +51 -5
  18. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php +38 -5
  19. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php +2 -1
  20. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php +1 -1
  21. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php +2 -2
  22. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Language.php +13 -0
  23. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/PageGridAction.php +37 -0
  24. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php +2 -4
  25. app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php +10 -0
  26. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php +81 -7
  27. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Attribute/Translate.php +3 -3
  28. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php +4 -6
  29. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php +25 -17
  30. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php +1 -1
  31. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php +7 -0
  32. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/AttributeController.php +100 -3
  33. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php +76 -12
  34. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/BlockController.php +87 -9
  35. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/PageController.php +89 -9
  36. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php +12 -0
  37. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php +88 -9
  38. app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-upgrade-1.3.6-1.3.7.php +19 -0
  39. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml +7 -7
  40. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml +117 -100
  41. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.0-1.3.1.php +2 -0
  42. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.3-1.3.4.php +2 -0
  43. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.6-1.3.7.php +36 -0
  44. app/design/adminhtml/default/straker/template/straker/new/attribute.phtml +7 -2
  45. app/design/adminhtml/default/straker/template/straker/new/attribute/confirm.phtml +6 -4
  46. app/design/adminhtml/default/straker/template/straker/new/attribute/massaction.phtml +145 -80
  47. app/design/adminhtml/default/straker/template/straker/new/category/attributes.phtml +1 -1
  48. app/design/adminhtml/default/straker/template/straker/new/category/confirm.phtml +4 -3
  49. app/design/adminhtml/default/straker/template/straker/new/category/tree.phtml +1 -1
  50. app/design/adminhtml/default/straker/template/straker/new/cms/block.phtml +7 -2
  51. app/design/adminhtml/default/straker/template/straker/new/cms/block/attributes.phtml +1 -1
  52. app/design/adminhtml/default/straker/template/straker/new/cms/block/confirm.phtml +4 -3
  53. app/design/adminhtml/default/straker/template/straker/new/cms/page.phtml +6 -1
  54. app/design/adminhtml/default/straker/template/straker/new/cms/page/attributes.phtml +1 -1
  55. app/design/adminhtml/default/straker/template/straker/new/cms/page/confirm.phtml +4 -3
  56. app/design/adminhtml/default/straker/template/straker/new/products.phtml +6 -1
  57. app/design/adminhtml/default/straker/template/straker/new/products/attributes.phtml +1 -1
  58. app/design/adminhtml/default/straker/template/straker/new/products/confirm.phtml +3 -3
  59. app/design/adminhtml/default/straker/template/straker/new/type.phtml +1 -1
  60. package.xml +7 -6
  61. skin/adminhtml/default/straker/.DS_Store +0 -0
  62. skin/adminhtml/default/straker/css/straker.css +14 -0
  63. skin/adminhtml/default/straker/css/straker.less +16 -0
app/code/community/StrakerTranslations/EasyTranslationPlatform/.DS_Store CHANGED
Binary file
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute/Grid.php CHANGED
@@ -5,7 +5,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_
5
public function __construct() {
6
parent::__construct();
7
$this->setId('strakerJobAttributeGrid');
8
- $this->setSaveParametersInSession(true);
9
}
10
11
protected function _prepareLayout()
@@ -51,15 +52,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_
51
protected function _prepareColumns() {
52
$this->addColumn('id', array(
53
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
54
'align' => 'right',
55
'width' => '50px',
56
'index' => 'id',
57
));
58
59
$this->addColumn('attribute_id', array(
60
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute ID'),
61
'align' => 'left',
62
'index' => 'attribute_id',
63
));
64
65
$this->addColumn('attribute_code', array(
@@ -105,13 +110,18 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_
105
'filter' => false,
106
));
107
108
- if ($this->getStatusId() == '4'){
109
$this->addColumn('version', array(
110
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
111
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
112
'align' => 'center',
113
- 'index' => false,
114
- 'filter' => false,
115
));
116
}
117
@@ -127,10 +137,22 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_
127
}
128
129
public function getRowUrl($row) {
130
- // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
131
return '';
132
}
133
134
protected function _prepareMassaction()
135
{
136
if ($this->getStatusId() == '4') {
@@ -198,4 +220,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_
198
}
199
return $html;
200
}
201
}
5
public function __construct() {
6
parent::__construct();
7
$this->setId('strakerJobAttributeGrid');
8
+ $this->setUseAjax(true);
9
+ $this->setVarNameFilter('straker_job_attribute_filter');
10
}
11
12
protected function _prepareLayout()
52
protected function _prepareColumns() {
53
$this->addColumn('id', array(
54
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
55
+ 'type' => 'number',
56
'align' => 'right',
57
'width' => '50px',
58
'index' => 'id',
59
+ 'filter_index' => 'main_table.id'
60
));
61
62
$this->addColumn('attribute_id', array(
63
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute ID'),
64
+ 'type' => 'number',
65
'align' => 'left',
66
'index' => 'attribute_id',
67
+ 'filter_index' => 'main_table.attribute_id'
68
));
69
70
$this->addColumn('attribute_code', array(
110
'filter' => false,
111
));
112
113
+ if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
114
$this->addColumn('version', array(
115
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
116
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
117
'align' => 'center',
118
+ 'index' => 'version',
119
+ 'filter_condition_callback' => [$this, '_filterVersion'],
120
+ 'options' => [
121
+ '0' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
122
+ '1' => Mage::helper('strakertranslations_easytranslationplatform')->__('Not Published')
123
+ ],
124
+ 'width' => '20%'
125
));
126
}
127
137
}
138
139
public function getRowUrl($row) {
140
return '';
141
}
142
143
+ protected function _filterVersion($collection, $column)
144
+ {
145
+ if ( ($value = $column->getFilter()->getValue()) === FALSE ) {
146
+ return $this;
147
+ }
148
+ if ($value === '1' ){
149
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NULL');
150
+ } else {
151
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NOT NULL');
152
+ }
153
+ return $this;
154
+ }
155
+
156
protected function _prepareMassaction()
157
{
158
if ($this->getStatusId() == '4') {
220
}
221
return $html;
222
}
223
+
224
+ public function getGridUrl()
225
+ {
226
+ return $this->getUrl('*/*/jobGrid', array('_current' => true));
227
+ }
228
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php CHANGED
@@ -7,7 +7,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_G
7
{
8
parent::__construct();
9
$this->setId('strakerJobCategoryGrid');
10
- $this->setSaveParametersInSession(true);
11
}
12
13
protected function _prepareLayout()
@@ -64,6 +65,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_G
64
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Category ID'),
65
'align' => 'left',
66
'index' => 'category_id',
67
));
68
69
// $this->addColumn('job_id', array(
@@ -83,22 +86,30 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_G
83
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Source', $attrModel->getFrontendLabel()),
84
'align' => 'left',
85
'index' => $attributeCode . '_original',
86
));
87
88
$this->addColumn($attributeCode . '_translate', array(
89
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Target', $attrModel->getFrontendLabel()),
90
'align' => 'left',
91
'index' => $attributeCode . '_translate',
92
));
93
}
94
95
- if ($this->getStatusId() == '4') {
96
$this->addColumn('version', array(
97
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
98
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
99
'align' => 'center',
100
- 'index' => false,
101
- 'filter' => false,
102
));
103
}
104
@@ -127,6 +138,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_G
127
return '';
128
}
129
130
protected function _prepareMassaction()
131
{
132
if ($this->getStatusId() == '4') {
@@ -193,4 +217,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_G
193
}
194
return $html;
195
}
196
}
7
{
8
parent::__construct();
9
$this->setId('strakerJobCategoryGrid');
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('straker_job_category_filter');
12
}
13
14
protected function _prepareLayout()
65
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Category ID'),
66
'align' => 'left',
67
'index' => 'category_id',
68
+ 'type' => 'number',
69
+ 'filter_index' => 'main_table.category_id'
70
));
71
72
// $this->addColumn('job_id', array(
86
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Source', $attrModel->getFrontendLabel()),
87
'align' => 'left',
88
'index' => $attributeCode . '_original',
89
+ 'filter_index' => $attributeCode.'.original'
90
));
91
92
$this->addColumn($attributeCode . '_translate', array(
93
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Target', $attrModel->getFrontendLabel()),
94
'align' => 'left',
95
'index' => $attributeCode . '_translate',
96
+ 'filter_index' => $attributeCode.'.translate'
97
));
98
}
99
100
+ if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
101
$this->addColumn('version', array(
102
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
103
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
104
'align' => 'center',
105
+ 'type' => 'options',
106
+ 'index' => 'version',
107
+ 'filter_condition_callback' => [$this, '_filterVersion'],
108
+ 'options' => [
109
+ '0' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
110
+ '1' => Mage::helper('strakertranslations_easytranslationplatform')->__('Not Published')
111
+ ],
112
+ 'width' => '20%'
113
));
114
}
115
138
return '';
139
}
140
141
+ protected function _filterVersion($collection, $column)
142
+ {
143
+ if ( ($value = $column->getFilter()->getValue()) === FALSE ) {
144
+ return $this;
145
+ }
146
+ if ($value === '1' ){
147
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NULL');
148
+ } else {
149
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NOT NULL');
150
+ }
151
+ return $this;
152
+ }
153
+
154
protected function _prepareMassaction()
155
{
156
if ($this->getStatusId() == '4') {
217
}
218
return $html;
219
}
220
+
221
+ public function getGridUrl()
222
+ {
223
+ return $this->getUrl('*/*/jobGrid', array('_current' => true));
224
+ }
225
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php CHANGED
@@ -7,7 +7,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_
7
public function __construct() {
8
parent::__construct();
9
$this->setId('strakerJobCmsBlockGrid');
10
- $this->setSaveParametersInSession(true);
11
}
12
13
protected function _prepareLayout()
@@ -37,22 +38,31 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_
37
}
38
39
protected function _prepareColumns() {
40
- $this->addColumn('title', array(
41
- 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
42
- 'align' => 'center',
43
- 'index' => 'origin',
44
- 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsOriginTitle',
45
- 'sortable' => false,
46
- 'filter' => false,
47
- ));
48
49
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
50
$this->addColumn('version', array(
51
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
52
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
53
'align' => 'center',
54
- 'index' => false,
55
- 'filter' => false,
56
));
57
}
58
@@ -64,6 +74,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_
64
return '';
65
}
66
67
protected function _prepareMassaction()
68
{
69
if ($this->getStatusId() == '4') {
@@ -138,4 +161,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_
138
}
139
return $this->_attributes;
140
}
141
}
7
public function __construct() {
8
parent::__construct();
9
$this->setId('strakerJobCmsBlockGrid');
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('straker_job_cms_block_filter');
12
}
13
14
protected function _prepareLayout()
38
}
39
40
protected function _prepareColumns() {
41
+ $this->addColumn('title', array(
42
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
43
+ 'align' => 'center',
44
+ 'index' => 'title'
45
+ ));
46
+
47
+ $this->addColumn('identifier', array(
48
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Identifier'),
49
+ 'align' => 'center',
50
+ 'index' => 'identifier'
51
+ ));
52
53
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
54
$this->addColumn('version', array(
55
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
56
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
57
'align' => 'center',
58
+ 'type' => 'options',
59
+ 'index' => 'version',
60
+ 'filter_condition_callback' => [$this, '_filterVersion'],
61
+ 'options' => [
62
+ '0' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
63
+ '1' => Mage::helper('strakertranslations_easytranslationplatform')->__('Not Published')
64
+ ],
65
+ 'width' => '20%'
66
));
67
}
68
74
return '';
75
}
76
77
+ protected function _filterVersion($collection, $column)
78
+ {
79
+ if ( ($value = $column->getFilter()->getValue()) === FALSE ) {
80
+ return $this;
81
+ }
82
+ if ($value === '1' ){
83
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NULL');
84
+ } else {
85
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NOT NULL');
86
+ }
87
+ return $this;
88
+ }
89
+
90
protected function _prepareMassaction()
91
{
92
if ($this->getStatusId() == '4') {
161
}
162
return $this->_attributes;
163
}
164
+
165
+ public function getGridUrl()
166
+ {
167
+ return $this->getUrl('*/*/jobGrid', array('_current' => true));
168
+ }
169
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php CHANGED
@@ -7,7 +7,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
7
public function __construct() {
8
parent::__construct();
9
$this->setId('strakerJobCmsPageGrid');
10
- $this->setSaveParametersInSession(true);
11
}
12
13
protected function _prepareLayout()
@@ -40,10 +41,13 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
40
$this->addColumn('title', array(
41
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
42
'align' => 'center',
43
- 'index' => 'origin',
44
- 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsOriginTitle',
45
- 'sortable' => false,
46
- 'filter' => false,
47
));
48
49
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
@@ -51,8 +55,14 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
51
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
52
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
53
'align' => 'center',
54
- 'index' => false,
55
- 'filter' => false,
56
));
57
}
58
@@ -64,6 +74,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
64
return '';
65
}
66
67
protected function _prepareMassaction()
68
{
69
if ($this->getStatusId() == '4') {
@@ -84,40 +107,40 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
84
85
86
// Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
87
- return $this;
88
}
89
}
90
91
- protected function _prepareMassactionColumn()
92
- {
93
- if ($this->getStatusId() == '4') {
94
- $columnId = 'massaction';
95
- $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
96
- ->setData(array(
97
- 'index' => $this->getMassactionIdField(),
98
- 'use_index' => $this->getMassactionIdField(),
99
- 'filter_index' => $this->getMassactionIdFilter(),
100
- 'type' => 'massaction',
101
- 'name' => $this->getMassactionBlock()->getFormFieldName(),
102
- 'align' => 'center',
103
- 'is_system' => true
104
- ));
105
-
106
- if ($this->getNoFilterMassactionColumn()) {
107
- $massactionColumn->setData('filter', false);
108
- }
109
-
110
- $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
111
- ->setGrid($this)
112
- ->setId($columnId);
113
-
114
- $oldColumns = $this->_columns;
115
- $this->_columns = array();
116
- $this->_columns[$columnId] = $massactionColumn;
117
- $this->_columns = array_merge($this->_columns, $oldColumns);
118
- return $this;
119
- }
120
- }
121
122
public function getMainButtonsHtml()
123
{
@@ -138,4 +161,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_G
138
}
139
return $this->_attributes;
140
}
141
}
7
public function __construct() {
8
parent::__construct();
9
$this->setId('strakerJobCmsPageGrid');
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('straker_job_cms_page_filter');
12
}
13
14
protected function _prepareLayout()
41
$this->addColumn('title', array(
42
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
43
'align' => 'center',
44
+ 'index' => 'title'
45
+ ));
46
+
47
+ $this->addColumn('identifier', array(
48
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Identifier'),
49
+ 'align' => 'center',
50
+ 'index' => 'identifier'
51
));
52
53
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
55
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
56
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
57
'align' => 'center',
58
+ 'type' => 'options',
59
+ 'index' => 'version',
60
+ 'filter_condition_callback' => [$this, '_filterVersion'],
61
+ 'options' => [
62
+ '0' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
63
+ '1' => Mage::helper('strakertranslations_easytranslationplatform')->__('Not Published')
64
+ ],
65
+ 'width' => '20%'
66
));
67
}
68
74
return '';
75
}
76
77
+ protected function _filterVersion($collection, $column)
78
+ {
79
+ if ( ($value = $column->getFilter()->getValue()) === FALSE ) {
80
+ return $this;
81
+ }
82
+ if ($value === '1' ){
83
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NULL');
84
+ } else {
85
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NOT NULL');
86
+ }
87
+ return $this;
88
+ }
89
+
90
protected function _prepareMassaction()
91
{
92
if ($this->getStatusId() == '4') {
107
108
109
// Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
110
}
111
+ return $this;
112
}
113
114
+ // protected function _prepareMassactionColumn()
115
+ // {
116
+ // if ($this->getStatusId() == '4') {
117
+ // $columnId = 'massaction';
118
+ // $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
119
+ // ->setData(array(
120
+ // 'index' => $this->getMassactionIdField(),
121
+ // 'use_index' => $this->getMassactionIdField(),
122
+ // 'filter_index' => $this->getMassactionIdFilter(),
123
+ // 'type' => 'massaction',
124
+ // 'name' => $this->getMassactionBlock()->getFormFieldName(),
125
+ // 'align' => 'center',
126
+ // 'is_system' => true
127
+ // ));
128
+ //
129
+ // if ($this->getNoFilterMassactionColumn()) {
130
+ // $massactionColumn->setData('filter', false);
131
+ // }
132
+ //
133
+ // $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
134
+ // ->setGrid($this)
135
+ // ->setId($columnId);
136
+ //
137
+ // $oldColumns = $this->_columns;
138
+ // $this->_columns = array();
139
+ // $this->_columns[$columnId] = $massactionColumn;
140
+ // $this->_columns = array_merge($this->_columns, $oldColumns);
141
+ // return $this;
142
+ // }
143
+ // }
144
145
public function getMainButtonsHtml()
146
{
161
}
162
return $this->_attributes;
163
}
164
+
165
+ public function getGridUrl()
166
+ {
167
+ return $this->getUrl('*/*/jobGrid', array('_current' => true));
168
+ }
169
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php CHANGED
@@ -1,27 +1,27 @@
1
<?php
2
3
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
-
5
- public function __construct() {
6
parent::__construct();
7
$this->setId('strakerJobGrid');
8
$this->setDefaultSort('id');
9
$this->setDefaultDir('DESC');
10
- $this->setSaveParametersInSession(true);
11
}
12
13
- protected function _prepareCollection() {
14
- /** @var $collection StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Collection*/
15
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job')->getCollection();
16
-
17
foreach($collection as $jobModel){
18
if($jobModel->getStatusId() == 4){
19
$jobModel->load($jobModel->getId())->isPublished();
20
}
21
}
22
-
23
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job')->getCollection();
24
-
25
/** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
26
$helper = Mage::helper('strakertranslations_easytranslationplatform');
27
if($helper->isSandboxMode()){
@@ -29,112 +29,118 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Grid exten
29
}else{
30
$collection->addFieldToFilter('is_test_job', ['eq' => false]);
31
}
32
-
33
$collection->getSelect()->joinLeft(
34
Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_type'),
35
- Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_type').'.type_id = main_table.type_id',
36
'type_name'
37
);
38
$collection->getSelect()->joinLeft(
39
Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_status'),
40
- Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_status').'.status_id = main_table.status_id',
41
'status_name'
42
);
43
$collection->getSelect()->joinLeft(
44
Mage::getSingleton('core/resource')->getTableName('core/store'),
45
- Mage::getSingleton('core/resource')->getTableName('core/store').'.store_id = main_table.store_id',
46
'name'
47
);
48
$this->setCollection($collection);
49
return parent::_prepareCollection();
50
}
51
52
- protected function _prepareColumns() {
53
$this->addColumn('id', array(
54
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
55
'align' => 'right',
56
'width' => '50px',
57
'index' => 'id',
58
));
59
-
60
$this->addColumn('tj_number', array(
61
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Straker Ref.'),
62
'align' => 'left',
63
'index' => 'tj_number',
64
));
65
-
66
$this->addColumn('created_at', array(
67
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created At'),
68
'align' => 'left',
69
'type' => 'datetime',
70
'index' => 'created_at',
71
));
72
-
73
$this->addColumn('updated_at', array(
74
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Updated At'),
75
'align' => 'left',
76
'type' => 'datetime',
77
'index' => 'updated_at',
78
));
79
-
80
- $this->addColumn('type_name', array(
81
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Content Type'),
82
'align' => 'left',
83
- 'index' => 'type_name',
84
));
85
-
86
$this->addColumn('selected', array(
87
- 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Content Selected'),
88
- 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Selected',
89
- 'align' => 'center',
90
- 'filter' => false,
91
));
92
-
93
- $this->addColumn('name', array(
94
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Store View'),
95
'align' => 'left',
96
- 'index' => 'name',
97
- 'filter_index' => Mage::getSingleton('core/resource')->getTableName('core/store').'.name',
98
));
99
-
100
$this->addColumn('sl', array(
101
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Source Language'),
102
'align' => 'left',
103
'index' => 'sl',
104
));
105
-
106
$this->addColumn('tl', array(
107
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Target Language'),
108
'align' => 'left',
109
'index' => 'tl',
110
));
111
-
112
$this->addColumn('refresh', array(
113
- 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Refresh'),
114
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Refresh',
115
- 'align' => 'center',
116
- 'filter' => false,
117
));
118
-
119
$this->addColumn('status', array(
120
- 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Status'),
121
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Status',
122
- 'align' => 'center',
123
- 'filter' => false,
124
));
125
-
126
$this->addColumn('action', array(
127
- 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Action'),
128
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Action',
129
- 'align' => 'center',
130
- 'filter' => false,
131
));
132
-
133
return parent::_prepareColumns();
134
}
135
136
- public function getRowUrl($row) {
137
return '';
138
}
139
140
}
1
<?php
2
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
parent::__construct();
8
$this->setId('strakerJobGrid');
9
$this->setDefaultSort('id');
10
$this->setDefaultDir('DESC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('straker_job_filter');
13
}
14
15
+ protected function _prepareCollection()
16
+ {
17
+ /** @var $collection StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Collection */
18
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job')->getCollection();
19
foreach($collection as $jobModel){
20
if($jobModel->getStatusId() == 4){
21
$jobModel->load($jobModel->getId())->isPublished();
22
}
23
}
24
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job')->getCollection();
25
/** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
26
$helper = Mage::helper('strakertranslations_easytranslationplatform');
27
if($helper->isSandboxMode()){
29
}else{
30
$collection->addFieldToFilter('is_test_job', ['eq' => false]);
31
}
32
$collection->getSelect()->joinLeft(
33
Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_type'),
34
+ Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_type') . '.type_id = main_table.type_id',
35
'type_name'
36
);
37
$collection->getSelect()->joinLeft(
38
Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_status'),
39
+ Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_status') . '.status_id = main_table.status_id',
40
'status_name'
41
);
42
$collection->getSelect()->joinLeft(
43
Mage::getSingleton('core/resource')->getTableName('core/store'),
44
+ Mage::getSingleton('core/resource')->getTableName('core/store') . '.store_id = main_table.store_id',
45
'name'
46
);
47
$this->setCollection($collection);
48
return parent::_prepareCollection();
49
}
50
51
+ protected function _prepareColumns()
52
+ {
53
$this->addColumn('id', array(
54
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
55
'align' => 'right',
56
'width' => '50px',
57
+ 'type' => 'number',
58
'index' => 'id',
59
));
60
$this->addColumn('tj_number', array(
61
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Straker Ref.'),
62
'align' => 'left',
63
'index' => 'tj_number',
64
));
65
$this->addColumn('created_at', array(
66
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created At'),
67
'align' => 'left',
68
'type' => 'datetime',
69
'index' => 'created_at',
70
));
71
$this->addColumn('updated_at', array(
72
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Updated At'),
73
'align' => 'left',
74
'type' => 'datetime',
75
'index' => 'updated_at',
76
));
77
+ $this->addColumn('type_id', array(
78
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Content Type'),
79
'align' => 'left',
80
+ 'index' => 'type_id',
81
+ 'filter_index' => 'main_table.type_id',
82
+ 'type' => 'options',
83
+ 'options' => Mage::getModel('strakertranslations_easytranslationplatform/job_type')->getOptionArray()
84
));
85
$this->addColumn('selected', array(
86
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Content Selected'),
87
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Selected',
88
+ 'align' => 'center',
89
+ 'filter' => false,
90
+ 'sortable' => false
91
));
92
+ $this->addColumn('store_id', array(
93
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Store View'),
94
'align' => 'left',
95
+ 'index' => 'store_id',
96
+ 'filter_index' => Mage::getSingleton('core/resource')->getTableName('core/store') . '.store_id',
97
+ 'type' => 'options',
98
+ 'options' => Mage::getModel('strakertranslations_easytranslationplatform/job')->_getStoreOptionArray()
99
));
100
$this->addColumn('sl', array(
101
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Source Language'),
102
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Language',
103
'align' => 'left',
104
'index' => 'sl',
105
+ 'type' => 'options',
106
+ 'options' => Mage::getModel('strakertranslations_easytranslationplatform/job')->languageOptionArray('sl')
107
));
108
$this->addColumn('tl', array(
109
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Target Language'),
110
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Language',
111
'align' => 'left',
112
'index' => 'tl',
113
+ 'type' => 'options',
114
+ 'options' => Mage::getModel('strakertranslations_easytranslationplatform/job')->languageOptionArray('tl')
115
));
116
$this->addColumn('refresh', array(
117
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Refresh'),
118
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Refresh',
119
+ 'align' => 'center',
120
+ 'filter' => false,
121
));
122
$this->addColumn('status', array(
123
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Status'),
124
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Status',
125
+ 'align' => 'center',
126
+ 'filter' => false,
127
));
128
$this->addColumn('action', array(
129
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Action'),
130
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Action',
131
+ 'align' => 'center',
132
+ 'filter' => false,
133
));
134
return parent::_prepareColumns();
135
}
136
137
+ public function getRowUrl($row)
138
+ {
139
return '';
140
}
141
142
+ public function getGridUrl()
143
+ {
144
+ return $this->getUrl('*/*/grid', array('_current' => true));
145
+ }
146
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php CHANGED
@@ -7,7 +7,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
7
{
8
parent::__construct();
9
$this->setId('strakerJobProductGrid');
10
- $this->setSaveParametersInSession(true);
11
}
12
13
protected function _prepareLayout()
@@ -34,6 +35,12 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
34
/** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product_Collection $collection */
35
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job_product')->getCollection()->addFieldToFilter('main_table.job_id', $job->getId());
36
37
//loop through this job's attributes and join them to the collection
38
foreach ($jobAttributes as $jobAttribute) {
39
$attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
@@ -45,8 +52,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
45
array($attributeCode . '_original' => 'original', $attributeCode . '_translate' => 'translate')
46
);
47
}
48
- //echo $collection->getSelect()->__toString();
49
- //die();
50
$this->setCollection($collection);
51
return parent::_prepareCollection();
52
}
@@ -55,15 +63,25 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
55
{
56
$this->addColumn('id', array(
57
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
58
'align' => 'right',
59
'width' => '50px',
60
'index' => 'id',
61
));
62
63
$this->addColumn('product_id', array(
64
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Product ID'),
65
'align' => 'left',
66
'index' => 'product_id',
67
));
68
69
// $this->addColumn('job_id', array(
@@ -83,22 +101,30 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
83
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Source', $attrModel->getFrontendLabel()),
84
'align' => 'left',
85
'index' => $attributeCode . '_original',
86
));
87
88
$this->addColumn($attributeCode . '_translate', array(
89
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Target', $attrModel->getFrontendLabel()),
90
'align' => 'left',
91
'index' => $attributeCode . '_translate',
92
));
93
}
94
95
- if ($this->getStatusId() == '4') {
96
$this->addColumn('version', array(
97
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
98
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
99
'align' => 'center',
100
- 'index' => false,
101
- 'filter' => false,
102
));
103
}
104
@@ -123,10 +149,22 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
123
124
public function getRowUrl($row)
125
{
126
- // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
127
return '';
128
}
129
130
protected function _prepareMassaction()
131
{
132
if ($this->getStatusId() == '4') {
@@ -193,4 +231,9 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Gr
193
}
194
return $html;
195
}
196
}
7
{
8
parent::__construct();
9
$this->setId('strakerJobProductGrid');
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('straker_job_product_filter');
12
}
13
14
protected function _prepareLayout()
35
/** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product_Collection $collection */
36
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job_product')->getCollection()->addFieldToFilter('main_table.job_id', $job->getId());
37
38
+ $collection->getSelect()
39
+ ->joinLeft(
40
+ ['product' => $collection->getTable('catalog/product') ],
41
+ 'product.entity_id = main_table.product_id',
42
+ ['sku']
43
+ );
44
//loop through this job's attributes and join them to the collection
45
foreach ($jobAttributes as $jobAttribute) {
46
$attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
52
array($attributeCode . '_original' => 'original', $attributeCode . '_translate' => 'translate')
53
);
54
}
55
+ // $collection->loadData();
56
+ // echo $collection->getSelect()->__toString();
57
+ // die();
58
$this->setCollection($collection);
59
return parent::_prepareCollection();
60
}
63
{
64
$this->addColumn('id', array(
65
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('ID'),
66
+ 'type' => 'number',
67
'align' => 'right',
68
'width' => '50px',
69
'index' => 'id',
70
+ 'filter_index' => 'main_table.id'
71
));
72
73
$this->addColumn('product_id', array(
74
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Product ID'),
75
+ 'type' => 'number',
76
'align' => 'left',
77
'index' => 'product_id',
78
+ 'filter_index' => 'main_table.product_id'
79
+ ));
80
+
81
+ $this->addColumn('sku', array(
82
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Sku'),
83
+ 'align' => 'left',
84
+ 'index' => 'sku',
85
));
86
87
// $this->addColumn('job_id', array(
101
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Source', $attrModel->getFrontendLabel()),
102
'align' => 'left',
103
'index' => $attributeCode . '_original',
104
+ 'filter_index' => $attributeCode.'.original',
105
));
106
107
$this->addColumn($attributeCode . '_translate', array(
108
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('%s - Target', $attrModel->getFrontendLabel()),
109
'align' => 'left',
110
'index' => $attributeCode . '_translate',
111
+ 'filter_index' => $attributeCode.'.translate'
112
));
113
}
114
115
+ if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
116
$this->addColumn('version', array(
117
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
118
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version',
119
'align' => 'center',
120
+ 'type' => 'options',
121
+ 'index' => 'version',
122
+ 'filter_condition_callback' => [$this, '_filterVersion'],
123
+ 'options' => [
124
+ '0' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
125
+ '1' => Mage::helper('strakertranslations_easytranslationplatform')->__('Not Published')
126
+ ],
127
+ 'width' => '20%'
128
));
129
}
130
149
150
public function getRowUrl($row)
151
{
152
return '';
153
}
154
155
+ protected function _filterVersion($collection, $column)
156
+ {
157
+ if ( ($value = $column->getFilter()->getValue()) === FALSE ) {
158
+ return $this;
159
+ }
160
+ if ($value === '1' ){
161
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NULL');
162
+ } else {
163
+ $this->getCollection()->getSelect()->where('`main_table`.`version` IS NOT NULL');
164
+ }
165
+ return $this;
166
+ }
167
+
168
protected function _prepareMassaction()
169
{
170
if ($this->getStatusId() == '4') {
231
}
232
return $html;
233
}
234
+
235
+ public function getGridUrl()
236
+ {
237
+ return $this->getUrl('*/*/jobGrid', array('_current' => true));
238
+ }
239
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm/Grid.php CHANGED
@@ -5,11 +5,11 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
5
public function __construct()
6
{
7
parent::__construct();
8
- $this->setId('strakerAttribute');
9
$this->setDefaultSort('attribute_code');
10
$this->setDefaultDir('ASC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
}
14
15
protected function _prepareLayout()
@@ -21,7 +21,6 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
21
{
22
parent::_prepareColumns();
23
24
-
25
$this->addColumn('attribute_code', array(
26
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
27
'sortable'=>true,
@@ -67,6 +66,27 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
67
'align' => 'center',
68
));
69
70
return $this;
71
}
72
@@ -93,7 +113,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
93
94
public function getGridUrl()
95
{
96
- return $this->getUrl('*/*/addtoconfirm', array('_current'=>true));
97
}
98
99
public function getRowUrl($row)
5
public function __construct()
6
{
7
parent::__construct();
8
+ $this->setId('strakerAttributeConfirm');
9
$this->setDefaultSort('attribute_code');
10
$this->setDefaultDir('ASC');
11
+ $this->setVarNameFilter('attribute_confirm_filter');
12
+ $this->setUseAjax(true);
13
}
14
15
protected function _prepareLayout()
21
{
22
parent::_prepareColumns();
23
24
$this->addColumn('attribute_code', array(
25
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
26
'sortable'=>true,
66
'align' => 'center',
67
));
68
69
+ $this->addColumn(
70
+ 'action',
71
+ [
72
+ 'header' => Mage::helper('catalog')->__('Action'),
73
+ 'width' => '50px',
74
+ 'type' => 'action',
75
+ 'getter' => 'getAttributeId',
76
+ 'actions' => array(
77
+ array(
78
+ 'caption' => $this->__('Remove'),
79
+ 'url' => [
80
+ 'base'=>'*/*/removeFromCart',
81
+ ],
82
+ 'field' => 'attribute_id'
83
+ )
84
+ ),
85
+ 'filter' => false,
86
+ 'sortable' => false,
87
+ 'index' => 'attribute_id'
88
+ ]
89
+ );
90
return $this;
91
}
92
113
114
public function getGridUrl()
115
{
116
+ return $this->getUrl('*/*/confirmGrid', array('_current'=>true));
117
}
118
119
public function getRowUrl($row)
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Grid.php CHANGED
@@ -7,6 +7,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
7
$this->setId('attributeGrid');
8
$this->setDefaultSort('attribute_code');
9
$this->setDefaultDir('ASC');
10
}
11
12
protected function _getStore()
@@ -76,7 +78,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
76
/**
77
* Prepare product attributes grid columns
78
*
79
- * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Grid
80
*/
81
protected function _prepareColumns()
82
{
@@ -87,22 +89,29 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
87
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
88
'sortable'=>true,
89
'index'=>'attribute_code',
90
- 'filter' => false
91
));
92
93
$this->addColumn('frontend_label', array(
94
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Label'),
95
'sortable'=>true,
96
- 'index'=>'frontend_label'
97
));
98
99
$this->addColumn('translate_options', array(
100
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Translate Attribute Options'),
101
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_TranslateOptions',
102
'align' => 'center',
103
- 'index' => false,
104
'sortable'=> false,
105
- 'filter' => false,
106
));
107
108
$this->addColumn('is_visible', array(
@@ -115,6 +124,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
115
'0' => Mage::helper('catalog')->__('No'),
116
),
117
'align' => 'center',
118
));
119
120
$this->addColumn('version',
@@ -151,6 +161,21 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
151
return $this;
152
}
153
154
protected function _prepareMassaction()
155
{
156
$this->setMassactionIdField('attribute_id');
@@ -163,9 +188,17 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
163
'selected' => 1
164
));
165
$this->getMassactionBlock()->setTemplate('straker/new/attribute/massaction.phtml');
166
-
167
//todo: refine this
168
- $hiddenParams = '<input type="hidden" name="store" value="'.$this->getRequest()->getParam('store').'" /><input type="hidden" name="option" value="'.$this->getRequest()->getParam('internal_option').'" />';
169
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
170
171
Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
@@ -187,11 +220,21 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_
187
188
public function getGridUrl()
189
{
190
- return $this->getUrl('*/*/new', array('_current'=>true));
191
}
192
193
public function getRowUrl($row)
194
{
195
return '';
196
}
197
}
7
$this->setId('attributeGrid');
8
$this->setDefaultSort('attribute_code');
9
$this->setDefaultDir('ASC');
10
+ $this->setUseAjax(true);
11
+ $this->setVarNameFilter('straker_attribute_filter');
12
}
13
14
protected function _getStore()
78
/**
79
* Prepare product attributes grid columns
80
*
81
+ * @return StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_Grid
82
*/
83
protected function _prepareColumns()
84
{
89
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
90
'sortable'=>true,
91
'index'=>'attribute_code',
92
+ 'width' => '22%'
93
));
94
95
$this->addColumn('frontend_label', array(
96
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Label'),
97
'sortable'=>true,
98
+ 'index'=>'frontend_label',
99
+ 'width' => '22%'
100
));
101
102
$this->addColumn('translate_options', array(
103
'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Translate Attribute Options'),
104
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_TranslateOptions',
105
'align' => 'center',
106
+ 'index' => 'frontend_input',
107
'sortable'=> false,
108
+ 'type' => 'options',
109
+ 'options' => [
110
+ 'no' => Mage::helper('catalog')->__('No Options'),
111
+ 'select' => Mage::helper('catalog')->__('Has Options')
112
+ ],
113
+ 'filter_condition_callback' => array($this, '_optionsFilter'),
114
+ 'width' => '22%'
115
));
116
117
$this->addColumn('is_visible', array(
124
'0' => Mage::helper('catalog')->__('No'),
125
),
126
'align' => 'center',
127
+ 'width' => '22%'
128
));
129
130
$this->addColumn('version',
161
return $this;
162
}
163
164
+ protected function _optionsFilter($collection, $column)
165
+ {
166
+ if (!$value = $column->getFilter()->getValue()) {
167
+ return $this;
168
+ }
169
+
170
+ if ($value == 'select' ){
171
+ $collection->getSelect()->where('frontend_input=?', 'select');
172
+ } else {
173
+ $collection->getSelect()->where('frontend_input<>?', 'select');
174
+ }
175
+
176
+ return $this;
177
+ }
178
+
179
protected function _prepareMassaction()
180
{
181
$this->setMassactionIdField('attribute_id');
188
'selected' => 1
189
));
190
$this->getMassactionBlock()->setTemplate('straker/new/attribute/massaction.phtml');
191
+ $data['attribute'] = Mage::getSingleton('adminhtml/session')->getData('straker_new_attribute');
192
+ $optionParam = $this->getRequest()->getParam('internal_option');
193
+ if( !empty($optionParam) ){
194
+ Mage::getSingleton('adminhtml/session')->setData('straker_new_option', $optionParam);
195
+ }
196
+ $internalOption = Mage::getSingleton('adminhtml/session')->getData('straker_new_option');
197
+ $internalOption = empty($internalOption) ? '' : $internalOption;
198
//todo: refine this
199
+ // $hiddenParams = '<input type="hidden" name="store" value="'.$this->getRequest()->getParam('store').'" /><input type="hidden" name="option" value="'.$this->getRequest()->getParam('internal_option').'" />';
200
+ $hiddenParams = '<input type="hidden" name="store" value="'.$this->getRequest()->getParam('store').'" /><input type="hidden" name="option" value="'. $internalOption .'" />';
201
+
202
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
203
204
Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
220
221
public function getGridUrl()
222
{
223
+ return $this->getUrl('*/*/grid', array('_current'=>true));
224
}
225
226
public function getRowUrl($row)
227
{
228
return '';
229
}
230
+
231
+ public function getMassactionBlockJsObjName()
232
+ {
233
+ return $this->getMassactionBlock()->getJsObjectName(); // TODO: Change the autogenerated stub
234
+ }
235
+
236
+ public function getSelectedIds(){
237
+ $selectedIds = Mage::getSingleton('adminhtml/session')->getData('straker_new_attribute');
238
+ return empty($selectedIds) ? [] : $selectedIds;
239
+ }
240
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php CHANGED
@@ -5,12 +5,11 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_C
5
public function __construct()
6
{
7
parent::__construct();
8
- $this->setId('strakerCategories');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
- $this->setVarNameFilter('category_filter');
14
$this->setTemplate('straker/new/category/confirm/grid.phtml');
15
}
16
@@ -19,6 +18,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_C
19
$storeId = (int) $this->getRequest()->getParam('store', 0);
20
return Mage::app()->getStore($storeId);
21
}
22
protected function _prepareLayout()
23
{
24
return $this;
@@ -160,13 +160,34 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_C
160
)
161
));
162
163
164
return parent::_prepareColumns();
165
}
166
167
public function getGridUrl()
168
{
169
- return $this->getUrl('*/*/confirmCategory', array('_current'=>true));
170
}
171
172
public function getRowUrl($row)
5
public function __construct()
6
{
7
parent::__construct();
8
+ $this->setId('strakerCategoriesConfirm');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('category_confirm_filter');
13
$this->setTemplate('straker/new/category/confirm/grid.phtml');
14
}
15
18
$storeId = (int) $this->getRequest()->getParam('store', 0);
19
return Mage::app()->getStore($storeId);
20
}
21
+
22
protected function _prepareLayout()
23
{
24
return $this;
160
)
161
));
162
163
+ $this->addColumn(
164
+ 'action',
165
+ [
166
+ 'header' => Mage::helper('catalog')->__('Action'),
167
+ 'width' => '50px',
168
+ 'type' => 'action',
169
+ 'getter' => 'getEntityId',
170
+ 'actions' => array(
171
+ array(
172
+ 'caption' => $this->__('Remove'),
173
+ 'url' => [
174
+ 'base'=>'*/*/removeFromCart'
175
+ ],
176
+ 'field' => 'entity_id'
177
+ )
178
+ ),
179
+ 'filter' => false,
180
+ 'sortable' => false,
181
+ 'index' => 'entity_id'
182
+ ]
183
+ );
184
185
return parent::_prepareColumns();
186
}
187
188
public function getGridUrl()
189
{
190
+ return $this->getUrl('*/*/confirmGrid', array('_current'=>true));
191
}
192
193
public function getRowUrl($row)
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php CHANGED
@@ -27,11 +27,14 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_T
27
*/
28
protected function getCategoryIds()
29
{
30
- $categories = $this->getRequest()->getParam('internal_category');
31
if (empty($categories)){
32
return array();
33
}
34
- else {
35
return explode(',', $categories);
36
}
37
// return $this->getProduct()->getCategoryIds();
27
*/
28
protected function getCategoryIds()
29
{
30
+ // $categories = $this->getRequest()->getParam('internal_category');
31
+ $categories = Mage::getSingleton('adminhtml/session')->getData('straker_new_category');
32
if (empty($categories)){
33
return array();
34
}
35
+ else if(is_array($categories)){
36
+ return $categories;
37
+ }else{
38
return explode(',', $categories);
39
}
40
// return $this->getProduct()->getCategoryIds();
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php CHANGED
@@ -5,13 +5,18 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
5
public function __construct()
6
{
7
parent::__construct();
8
- $this->setId('strakerCmsBlocks');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
- $this->setUseAjax(false);
12
- $this->setFilterVisibility(false);
13
}
14
15
16
protected function _prepareCollection()
17
{
@@ -23,18 +28,18 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
23
24
protected function _prepareColumns()
25
{
26
- $baseUrl = $this->getUrl();
27
-
28
$this->addColumn('title', array(
29
'header' => Mage::helper('cms')->__('Title'),
30
'align' => 'left',
31
'index' => 'title',
32
));
33
34
$this->addColumn('identifier', array(
35
'header' => Mage::helper('cms')->__('Identifier'),
36
'align' => 'left',
37
- 'index' => 'identifier'
38
));
39
40
if (!Mage::app()->isSingleStoreMode()) {
@@ -45,8 +50,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
45
'store_all' => true,
46
'store_view' => true,
47
'sortable' => false,
48
- 'filter_condition_callback'
49
- => array($this, '_filterStoreCondition'),
50
));
51
}
52
@@ -58,20 +63,45 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
58
0 => Mage::helper('cms')->__('Disabled'),
59
1 => Mage::helper('cms')->__('Enabled')
60
),
61
));
62
63
$this->addColumn('creation_time', array(
64
'header' => Mage::helper('cms')->__('Date Created'),
65
'index' => 'creation_time',
66
'type' => 'datetime',
67
));
68
69
$this->addColumn('update_time', array(
70
'header' => Mage::helper('cms')->__('Last Modified'),
71
'index' => 'update_time',
72
'type' => 'datetime',
73
));
74
75
return parent::_prepareColumns();
76
}
77
@@ -89,6 +119,12 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
89
90
$this->getCollection()->addStoreFilter($value);
91
}
92
public function getRowUrl($row)
93
{
94
return '';
5
public function __construct()
6
{
7
parent::__construct();
8
+ $this->setId('strakerCmsBlocksConfirm');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('cms_block_confirm_filter');
13
+ // $this->setFilterVisibility(false);
14
}
15
16
+ protected function _prepareLayout()
17
+ {
18
+ return $this;
19
+ }
20
21
protected function _prepareCollection()
22
{
28
29
protected function _prepareColumns()
30
{
31
$this->addColumn('title', array(
32
'header' => Mage::helper('cms')->__('Title'),
33
'align' => 'left',
34
'index' => 'title',
35
+ 'filter' => false,
36
));
37
38
$this->addColumn('identifier', array(
39
'header' => Mage::helper('cms')->__('Identifier'),
40
'align' => 'left',
41
+ 'index' => 'identifier',
42
+ 'filter' => false,
43
));
44
45
if (!Mage::app()->isSingleStoreMode()) {
50
'store_all' => true,
51
'store_view' => true,
52
'sortable' => false,
53
+ // 'filter_condition_callback'
54
+ // => array($this, '_filterStoreCondition'),
55
));
56
}
57
63
0 => Mage::helper('cms')->__('Disabled'),
64
1 => Mage::helper('cms')->__('Enabled')
65
),
66
+ 'filter' => false,
67
));
68
69
$this->addColumn('creation_time', array(
70
'header' => Mage::helper('cms')->__('Date Created'),
71
'index' => 'creation_time',
72
'type' => 'datetime',
73
+ 'filter' => false,
74
));
75
76
$this->addColumn('update_time', array(
77
'header' => Mage::helper('cms')->__('Last Modified'),
78
'index' => 'update_time',
79
'type' => 'datetime',
80
+ 'filter' => false,
81
));
82
83
+ $this->addColumn(
84
+ 'action',
85
+ [
86
+ 'header' => Mage::helper('catalog')->__('Action'),
87
+ 'width' => '50px',
88
+ 'type' => 'action',
89
+ 'getter' => 'getBlockId',
90
+ 'actions' => array(
91
+ array(
92
+ 'caption' => $this->__('Remove'),
93
+ 'url' => [
94
+ 'base'=>'*/*/removeFromCart'
95
+ ],
96
+ 'field' => 'block_id'
97
+ )
98
+ ),
99
+ 'filter' => false,
100
+ 'sortable' => false,
101
+ 'index' => 'block_id'
102
+ ]
103
+ );
104
+
105
return parent::_prepareColumns();
106
}
107
119
120
$this->getCollection()->addStoreFilter($value);
121
}
122
+
123
+ public function getGridUrl()
124
+ {
125
+ return $this->getUrl('*/*/ConfirmGrid', array('_current'=>true));
126
+ }
127
+
128
public function getRowUrl($row)
129
{
130
return '';
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php CHANGED
@@ -8,8 +8,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
8
$this->setId('strakerCmsBlocks');
9
$this->setDefaultSort('block_identifier');
10
$this->setDefaultDir('ASC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
}
14
15
protected function _prepareCollection()
@@ -22,8 +22,6 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
22
23
protected function _prepareColumns()
24
{
25
- $baseUrl = $this->getUrl();
26
-
27
$this->addColumn('title', array(
28
'header' => Mage::helper('cms')->__('Title'),
29
'align' => 'left',
@@ -99,7 +97,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
99
'url' => $this->getUrl('*/*/addtoconfirm'),
100
'selected' => 1
101
));
102
- $this->getMassactionBlock()->setTemplate('straker/new/cms/page/massaction.phtml');
103
104
//todo: refine this
105
$hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
@@ -121,4 +119,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_
121
$storeId = (int) $this->getRequest()->getParam('store', 0);
122
return Mage::app()->getStore($storeId);
123
}
124
}
8
$this->setId('strakerCmsBlocks');
9
$this->setDefaultSort('block_identifier');
10
$this->setDefaultDir('ASC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('straker_cmd_block_filter');
13
}
14
15
protected function _prepareCollection()
22
23
protected function _prepareColumns()
24
{
25
$this->addColumn('title', array(
26
'header' => Mage::helper('cms')->__('Title'),
27
'align' => 'left',
97
'url' => $this->getUrl('*/*/addtoconfirm'),
98
'selected' => 1
99
));
100
+ $this->getMassactionBlock()->setTemplate('straker/new/cms/block/massaction.phtml');
101
102
//todo: refine this
103
$hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
119
$storeId = (int) $this->getRequest()->getParam('store', 0);
120
return Mage::app()->getStore($storeId);
121
}
122
+
123
+ public function getGridUrl()
124
+ {
125
+ return $this->getUrl('*/*/grid', array('_current'=>true));
126
+ }
127
+
128
+ public function getMassactionBlockJsObjName()
129
+ {
130
+ return $this->getMassactionBlock()->getJsObjectName(); // TODO: Change the autogenerated stub
131
+ }
132
+
133
+ public function getSelectedIds(){
134
+ $selectedIds = Mage::getSingleton('adminhtml/session')->getData('straker_new_cms_block');
135
+ return empty($selectedIds) ? [] : $selectedIds;
136
+ }
137
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php CHANGED
@@ -5,11 +5,17 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_C
5
public function __construct()
6
{
7
parent::__construct();
8
- $this->setId('strakerCmsPages');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
- $this->setUseAjax(false);
12
- $this->setFilterVisibility(false);
13
}
14
15
protected function _prepareCollection()
@@ -18,24 +24,23 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_C
18
/* @var $collection Mage_Cms_Model_Mysql4_Page_Collection */
19
$collection->setFirstStoreFlag(true);
20
$this->setCollection($collection);
21
-
22
return parent::_prepareCollection();
23
}
24
25
protected function _prepareColumns()
26
{
27
- $baseUrl = $this->getUrl();
28
-
29
$this->addColumn('title', array(
30
'header' => Mage::helper('cms')->__('Title'),
31
'align' => 'left',
32
'index' => 'title',
33
));
34
35
$this->addColumn('identifier', array(
36
'header' => Mage::helper('cms')->__('URL Key'),
37
'align' => 'left',
38
'index' => 'identifier',
39
));
40
41
/**
@@ -48,7 +53,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_C
48
'type' => 'store',
49
'store_all' => true,
50
'store_view' => true,
51
- 'sortable' => false,
52
));
53
}
54
@@ -57,25 +62,30 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_C
57
'index' => 'is_active',
58
'type' => 'options',
59
'options' => Mage::getSingleton('cms/page')->getAvailableStatuses(),
60
));
61
62
$this->addColumn('creation_time', array(
63
'header' => Mage::helper('cms')->__('Date Created'),
64
'index' => 'creation_time',
65
'type' => 'datetime',
66
));
67
68
$this->addColumn('update_time', array(
69
'header' => Mage::helper('cms')->__('Last Modified'),
70
'index' => 'update_time',
71
'type' => 'datetime',
72
));
73
74
$this->addColumn('page_actions', array(
75
'header' => Mage::helper('cms')->__('Action'),
76
'width' => 10,
77
'sortable' => false,
78
- 'renderer' => 'adminhtml/cms_page_grid_renderer_action',
79
));
80
81
return parent::_prepareColumns();
@@ -96,6 +106,11 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_C
96
$this->getCollection()->addStoreFilter($value);
97
}
98
99
public function getRowUrl($row)
100
{
101
return '';
5
public function __construct()
6
{
7
parent::__construct();
8
+ $this->setId('strakerCmsPagesConfirm');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('cms_page_confirm_filter');
13
+ // $this->setFilterVisibility(false);
14
+ }
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ return $this;
19
}
20
21
protected function _prepareCollection()
24
/* @var $collection Mage_Cms_Model_Mysql4_Page_Collection */
25
$collection->setFirstStoreFlag(true);
26
$this->setCollection($collection);
27
return parent::_prepareCollection();
28
}
29
30
protected function _prepareColumns()
31
{
32
$this->addColumn('title', array(
33
'header' => Mage::helper('cms')->__('Title'),
34
'align' => 'left',
35
'index' => 'title',
36
+ 'filter' => false
37
));
38
39
$this->addColumn('identifier', array(
40
'header' => Mage::helper('cms')->__('URL Key'),
41
'align' => 'left',
42
'index' => 'identifier',
43
+ 'filter' => false
44
));
45
46
/**
53
'type' => 'store',
54
'store_all' => true,
55
'store_view' => true,
56
+ 'filter' => false
57
));
58
}
59
62
'index' => 'is_active',
63
'type' => 'options',
64
'options' => Mage::getSingleton('cms/page')->getAvailableStatuses(),
65
+ 'filter' => false
66
));
67
68
$this->addColumn('creation_time', array(
69
'header' => Mage::helper('cms')->__('Date Created'),
70
'index' => 'creation_time',
71
'type' => 'datetime',
72
+ 'filter' => false
73
));
74
75
$this->addColumn('update_time', array(
76
'header' => Mage::helper('cms')->__('Last Modified'),
77
'index' => 'update_time',
78
'type' => 'datetime',
79
+ 'filter' => false
80
));
81
82
$this->addColumn('page_actions', array(
83
'header' => Mage::helper('cms')->__('Action'),
84
'width' => 10,
85
'sortable' => false,
86
+ 'filter' => false,
87
+ // 'renderer' => 'adminhtml/cms_page_grid_renderer_action',
88
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_PageGridAction'
89
));
90
91
return parent::_prepareColumns();
106
$this->getCollection()->addStoreFilter($value);
107
}
108
109
+ public function getGridUrl()
110
+ {
111
+ return $this->getUrl('*/*/ConfirmGrid', array('_current'=>true));
112
+ }
113
+
114
public function getRowUrl($row)
115
{
116
return '';
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php CHANGED
@@ -8,8 +8,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_G
8
$this->setId('strakerCmsPages');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
}
14
15
protected function _prepareCollection()
@@ -26,8 +26,6 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_G
26
27
protected function _prepareColumns()
28
{
29
- $baseUrl = $this->getUrl();
30
-
31
$this->addColumn('title', array(
32
'header' => Mage::helper('cms')->__('Title'),
33
'align' => 'left',
@@ -81,6 +79,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_G
81
'sortable' => false,
82
'filter' => false,
83
'renderer' => 'adminhtml/cms_page_grid_renderer_action',
84
));
85
86
return parent::_prepareColumns();
@@ -133,4 +133,19 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_G
133
$storeId = (int) $this->getRequest()->getParam('store', 0);
134
return Mage::app()->getStore($storeId);
135
}
136
}
8
$this->setId('strakerCmsPages');
9
$this->setDefaultSort('identifier');
10
$this->setDefaultDir('ASC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('straker_cmd_page_filter');
13
}
14
15
protected function _prepareCollection()
26
27
protected function _prepareColumns()
28
{
29
$this->addColumn('title', array(
30
'header' => Mage::helper('cms')->__('Title'),
31
'align' => 'left',
79
'sortable' => false,
80
'filter' => false,
81
'renderer' => 'adminhtml/cms_page_grid_renderer_action',
82
+ // 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_PageGridAction'
83
+
84
));
85
86
return parent::_prepareColumns();
133
$storeId = (int) $this->getRequest()->getParam('store', 0);
134
return Mage::app()->getStore($storeId);
135
}
136
+
137
+ public function getGridUrl()
138
+ {
139
+ return $this->getUrl('*/*/grid', array('_current'=>true));
140
+ }
141
+
142
+ public function getMassactionBlockJsObjName()
143
+ {
144
+ return $this->getMassactionBlock()->getJsObjectName(); // TODO: Change the autogenerated stub
145
+ }
146
+
147
+ public function getSelectedIds(){
148
+ $selectedIds = Mage::getSingleton('adminhtml/session')->getData('straker_new_cms_page');
149
+ return empty($selectedIds) ? [] : $selectedIds;
150
+ }
151
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php CHANGED
@@ -8,7 +8,6 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Confirm_Gr
8
$this->setId('strakerProducts');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
$this->setUseAjax(false);
13
$this->setVarNameFilter('product_filter');
14
}
8
$this->setId('strakerProducts');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
$this->setUseAjax(false);
12
$this->setVarNameFilter('product_filter');
13
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php CHANGED
@@ -5,12 +5,11 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_C
5
public function __construct()
6
{
7
parent::__construct();
8
- $this->setId('strakerProducts');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
- $this->setVarNameFilter('product_filter');
14
}
15
16
protected function _getStore()
@@ -119,6 +118,31 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_C
119
));
120
}
121
122
foreach ($this->getAttrArray() as $attr){
123
if ($attr!='name') {
124
$attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
@@ -131,12 +155,34 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_C
131
}
132
}
133
134
return parent::_prepareColumns();
135
}
136
137
public function getGridUrl()
138
{
139
- return $this->getUrl('*/*/addtoconfirm', array('_current'=>true));
140
}
141
142
public function getRowUrl($row)
5
public function __construct()
6
{
7
parent::__construct();
8
+ $this->setId('strakerProductsConfirm');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('product_confirm_filter');
13
}
14
15
protected function _getStore()
118
));
119
}
120
121
+ // required by IMA-159
122
+ $this->addColumn(
123
+ 'sku',
124
+ array(
125
+ 'header' => Mage::helper('catalog')->__('Sku'),
126
+ 'index' => 'sku',
127
+ 'filter' => false
128
+ )
129
+ );
130
+
131
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
132
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
133
+ ->load()
134
+ ->toOptionHash();
135
+
136
+ $this->addColumn('set_name',
137
+ array(
138
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
139
+ 'width' => '100px',
140
+ 'index' => 'attribute_set_id',
141
+ 'type' => 'options',
142
+ 'options' => $sets,
143
+ 'filter' => false
144
+ ));
145
+
146
foreach ($this->getAttrArray() as $attr){
147
if ($attr!='name') {
148
$attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
155
}
156
}
157
158
+ $this->addColumn(
159
+ 'action',
160
+ [
161
+ 'header' => Mage::helper('catalog')->__('Action'),
162
+ 'width' => '50px',
163
+ 'type' => 'action',
164
+ 'getter' => 'getEntityId',
165
+ 'actions' => array(
166
+ array(
167
+ 'caption' => $this->__('Remove'),
168
+ 'url' => [
169
+ 'base'=>'*/*/removeFromCart'
170
+ ],
171
+ 'field' => 'entity_id'
172
+ )
173
+ ),
174
+ 'filter' => false,
175
+ 'sortable' => false,
176
+ 'index' => 'entity_id'
177
+ ]
178
+ );
179
+
180
return parent::_prepareColumns();
181
}
182
183
public function getGridUrl()
184
{
185
+ return $this->getUrl('*/*/confirmGrid', array('_current'=>true));
186
}
187
188
public function getRowUrl($row)
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php CHANGED
@@ -8,9 +8,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_G
8
$this->setId('strakerProducts');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
- $this->setUseAjax(false);
13
- $this->setVarNameFilter('product_filter');
14
}
15
16
protected function _getStore()
@@ -157,6 +156,30 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_G
157
'index' => 'name',
158
));
159
}
160
foreach ($this->getAttrArray() as $attr){
161
if ($attr!='name') {
162
$attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
@@ -249,6 +272,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_G
249
'url' => $this->getUrl('*/*/addtoconfirm'),
250
'selected' => 1
251
));
252
$this->getMassactionBlock()->setTemplate('straker/new/products/massaction.phtml');
253
254
//todo: refine this
@@ -256,14 +280,13 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_G
256
$hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
257
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
258
259
-
260
Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
261
return $this;
262
}
263
264
public function getGridUrl()
265
{
266
- return $this->getUrl('*/*/new', array('_current'=>true));
267
}
268
269
public function getRowUrl($row)
@@ -274,4 +297,14 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_G
274
public function getAttrArray(){
275
return explode(',', $this->getAttr());
276
}
277
}
8
$this->setId('strakerProducts');
9
$this->setDefaultSort('entity_id');
10
$this->setDefaultDir('DESC');
11
+ $this->setUseAjax(true);
12
+ $this->setVarNameFilter('straker_product_filter');
13
}
14
15
protected function _getStore()
156
'index' => 'name',
157
));
158
}
159
+
160
+ // required by IMA-159
161
+ $this->addColumn(
162
+ 'sku',
163
+ array(
164
+ 'header' => Mage::helper('catalog')->__('Sku'),
165
+ 'index' => 'sku'
166
+ )
167
+ );
168
+
169
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
170
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
171
+ ->load()
172
+ ->toOptionHash();
173
+
174
+ $this->addColumn('set_name',
175
+ array(
176
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
177
+ 'width' => '100px',
178
+ 'index' => 'attribute_set_id',
179
+ 'type' => 'options',
180
+ 'options' => $sets,
181
+ ));
182
+
183
foreach ($this->getAttrArray() as $attr){
184
if ($attr!='name') {
185
$attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
272
'url' => $this->getUrl('*/*/addtoconfirm'),
273
'selected' => 1
274
));
275
+
276
$this->getMassactionBlock()->setTemplate('straker/new/products/massaction.phtml');
277
278
//todo: refine this
280
$hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
281
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
282
283
Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
284
return $this;
285
}
286
287
public function getGridUrl()
288
{
289
+ return $this->getUrl('*/*/grid', array('_current'=>true));
290
}
291
292
public function getRowUrl($row)
297
public function getAttrArray(){
298
return explode(',', $this->getAttr());
299
}
300
+
301
+ public function getMassactionBlockJsObjName()
302
+ {
303
+ return $this->getMassactionBlock()->getJsObjectName(); // TODO: Change the autogenerated stub
304
+ }
305
+
306
+ public function getSelectedIds(){
307
+ $selectedIds = Mage::getSingleton('adminhtml/session')->getData('straker_new_product');
308
+ return empty($selectedIds) ? [] : $selectedIds;
309
+ }
310
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php CHANGED
@@ -4,12 +4,13 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
4
{
5
public function render(Varien_Object $row)
6
{
7
if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
9
$buttonText = $row->getStatusId() == 4 ? $this->__('Confirm') : $this->__('View');
10
11
$out = '<button id="button-update-'.$row->getId().'" style="margin: 5px; display: block;" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_".str_replace(' ', '_', strtolower($row->getTypeName())).'/', array('job_id' => $row->getId())) . '\')" title="View" type="button" style="">'.$buttonText.'</button>';
12
- return $out;
13
}
14
}
15
}
4
{
5
public function render(Varien_Object $row)
6
{
7
+ $out = '';
8
if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
9
10
$buttonText = $row->getStatusId() == 4 ? $this->__('Confirm') : $this->__('View');
11
12
$out = '<button id="button-update-'.$row->getId().'" style="margin: 5px; display: block;" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_".str_replace(' ', '_', strtolower($row->getTypeName())).'/', array('job_id' => $row->getId())) . '\')" title="View" type="button" style="">'.$buttonText.'</button>';
13
}
14
+ return $out;
15
}
16
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php CHANGED
@@ -11,7 +11,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
11
else{
12
$link = Mage::helper("adminhtml")->getUrl("adminhtml/cms_page/edit",array("page_id"=>$row->getNewEntityId()));
13
}
14
- return '<a href="'.$link.'">View Published</a>';
15
}
16
else{
17
return 'Not Published';
11
else{
12
$link = Mage::helper("adminhtml")->getUrl("adminhtml/cms_page/edit",array("page_id"=>$row->getNewEntityId()));
13
}
14
+ return '<a href="'.$link.'" target="_blank">View Published</a>';
15
}
16
else{
17
return 'Not Published';
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php CHANGED
@@ -18,8 +18,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
18
}
19
}
20
elseif($row->getCategoryId()){
21
- $category = Mage::getModel('catalog/category')->setStoreId($this->getStoreId($row))->load($row->getCategoryId());
22
- $html .= '<a target="_blank" href="' . $category->getUrl() . '">' . $this->__('View Category in Frontend') . '</a>';
23
}
24
return $html;
25
}
18
}
19
}
20
elseif($row->getCategoryId()){
21
+ $url = $this->getUrl('catalog/category/view', ['id' => $row->getCategoryId(), '_nosid' => true, '_query' => ['___store' => $this->getStoreId($row) ]]);
22
+ $html .= '<a target="_blank" href="' . $url . '">' . $this->__('View Category in Frontend') . '</a>';
23
}
24
return $html;
25
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Language.php ADDED
@@ -0,0 +1,13 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Language
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+ public function render(Varien_Object $row)
6
+ {
7
+ $index = $this->getColumn()->getIndex();
8
+ $languageCode = $row->getData($index);
9
+ /** @var $helper StrakerTranslations_EasyTranslationPlatform_Model_Api */
10
+ $helper = Mage::getModel('strakertranslations_easytranslationplatform/api');
11
+ return $helper->_getLanguageName($languageCode);
12
+ }
13
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/PageGridAction.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_PageGridAction
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
4
+ // extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
5
+ {
6
+ public function render(Varien_Object $row)
7
+ {
8
+ // $actions = [];
9
+ Mage::dispatchEvent('adminhtml_cms_page_grid_renderer_action_before_render', array('row' => $row));
10
+ if ($row->getPreviewUrl()) {
11
+ $href = $row->getPreviewUrl();
12
+ } else {
13
+ $urlModel = Mage::getModel('core/url')->setStore($row->getData('_first_store_id'));
14
+ $href = $urlModel->getUrl(
15
+ $row->getIdentifier(), array(
16
+ '_current' => false,
17
+ '_query' => '___store=' . $row->getStoreCode(),
18
+ )
19
+ );
20
+ }
21
+
22
+ // $actions[] = [
23
+ // 'url' => $href,
24
+ // 'target' => '_blank',
25
+ // 'caption' => Mage::helper('newsletter')->__('Preview')
26
+ // ];
27
+
28
+ $actions[] = [
29
+ 'url' => $this->getUrl('*/*/removeFromCart', ['page_id' => $row->getPageId()] ),
30
+ 'caption' => Mage::helper('newsletter')->__('Remove')
31
+ ];
32
+
33
+ $this->getColumn()->setActions($actions);
34
+ return parent::render($row);
35
+ // return '<a href="' . $href . '" target="_blank">' . $this->__('Preview') . '</a>';
36
+ }
37
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php CHANGED
@@ -3,9 +3,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
3
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
{
5
public function render(Varien_Object $row){
6
if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
7
- $html = '';
8
-
9
//if status is QUEUED
10
if ($row->getStatusName() == 'QUEUED') {
11
$quote = $row->getQuote();
@@ -26,8 +25,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
26
elseif ($row->getStatusName() == 'PUBLISHED') {
27
$html = $this->__('Published');
28
}
29
- return $html;
30
}
31
-
32
}
33
}
3
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
{
5
public function render(Varien_Object $row){
6
+ $html = '';
7
if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
8
//if status is QUEUED
9
if ($row->getStatusName() == 'QUEUED') {
10
$quote = $row->getQuote();
25
elseif ($row->getStatusName() == 'PUBLISHED') {
26
$html = $this->__('Published');
27
}
28
}
29
+ return $html;
30
}
31
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php CHANGED
@@ -86,4 +86,14 @@ class StrakerTranslations_EasyTranslationPlatform_Helper_Data extends Mage_Core_
86
public function clearSiteMode(){
87
return Mage::getModel('core/config')->deleteConfig('straker/general/site_mode', 'default', 0);
88
}
89
}
86
public function clearSiteMode(){
87
return Mage::getModel('core/config')->deleteConfig('straker/general/site_mode', 'default', 0);
88
}
89
+
90
+ public function getDataFilePath()
91
+ {
92
+ return $this->getStrakerPath(). DIRECTORY_SEPARATOR . 'data';
93
+ }
94
+
95
+ public function getStrakerPath()
96
+ {
97
+ return Mage::getBaseDir('var').DIRECTORY_SEPARATOR.'straker';
98
+ }
99
}
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php CHANGED
@@ -156,7 +156,7 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Api extends Mage_Core_Mo
156
return Mage::getStoreConfig('straker/api_url/languages');
157
}
158
159
- protected function _getCountiresUrl(){
160
return Mage::getStoreConfig('straker/api_url/countries');
161
}
162
@@ -211,14 +211,88 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Api extends Mage_Core_Mo
211
return $this->_call($downloadUrl,'get',array(),true);
212
}
213
214
- public function getCountries(){
215
- $result = $this->_call($this->_getCountiresUrl());
216
- return $result->country ? $result->country : false;
217
}
218
219
- public function getLanguages(){
220
- $result = $this->_call($this->_getLanguagesUrl());
221
- return $result->languages ? $result->languages : false;
222
}
223
224
public function saveAppKey($appKey){
156
return Mage::getStoreConfig('straker/api_url/languages');
157
}
158
159
+ protected function _getCountriesUrl(){
160
return Mage::getStoreConfig('straker/api_url/countries');
161
}
162
211
return $this->_call($downloadUrl,'get',array(),true);
212
}
213
214
+ // public function getCountries(){
215
+ // $result = $this->_call($this->_getCountiresUrl());
216
+ // return $result->country ? $result->country : false;
217
+ // }
218
+ //
219
+ // public function getLanguages(){
220
+ // $result = $this->_call($this->_getLanguagesUrl());
221
+ // return $result->languages ? $result->languages : false;
222
+ // }
223
+
224
+ public function getCountries()
225
+ {
226
+ /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
227
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
228
+ $filePath = $helper->getDataFilePath();
229
+ $fileName = 'countries.json';
230
+
231
+ if (!file_exists($filePath)) {
232
+ mkdir($filePath, 0777, true);
233
+ }
234
+
235
+ $fileFullPath = $filePath . DIRECTORY_SEPARATOR . $fileName;
236
+
237
+ if (file_exists($fileFullPath)) {
238
+ $result = json_decode(file_get_contents($fileFullPath));
239
+ } else {
240
+ $result = $this->_call($this->_getCountriesUrl());
241
+ if (!empty($result)) {
242
+ file_put_contents($fileFullPath, json_encode($result));
243
+ }
244
+ }
245
+ return isset($result->country) ? $result->country : [];
246
+ }
247
+
248
+ public function getLanguages()
249
+ {
250
+ /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
251
+ $helper = Mage::helper('strakertranslations_easytranslationplatform');
252
+ $filePath = $helper->getDataFilePath();
253
+ $fileName = 'languages.json';
254
+
255
+ if (!file_exists($filePath)) {
256
+ mkdir($filePath, 0777, true);
257
+ }
258
+
259
+ $fileFullPath = $filePath . DIRECTORY_SEPARATOR . $fileName;
260
+
261
+ if (file_exists($fileFullPath)) {
262
+ $result = json_decode(file_get_contents($fileFullPath));
263
+ } else {
264
+ $result = $this->_call($this->_getLanguagesUrl());
265
+ if (!empty($result)) {
266
+ file_put_contents($fileFullPath, json_encode($result));
267
+ }
268
+ }
269
+ return isset($result->languages) ? $result->languages : [];
270
}
271
272
+ public function _getLanguageName($code = '')
273
+ {
274
+ $languages = $this->getLanguages();
275
+ $languageName = '';
276
+ $isArray = is_array($code) ? true : false;
277
+ foreach ($languages as $k => $val) {
278
+ if( $isArray ){
279
+ if ( ($key = array_search($val->code, $code)) !== false ) {
280
+ $languageName[$val->code] = $val->name;
281
+ unset($code[$key]);
282
+ }else{
283
+ continue;
284
+ }
285
+ if( count($code) <= 0 ){
286
+ break;
287
+ }
288
+ }else{
289
+ if ($val->code == $code) {
290
+ $languageName = $val->name;
291
+ break;
292
+ }
293
+ }
294
+ }
295
+ return $languageName;
296
}
297
298
public function saveAppKey($appKey){
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Attribute/Translate.php CHANGED
@@ -115,9 +115,9 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Attribute_Translate exte
115
$newOptionData = [];
116
foreach ($attribute as $optionId => $optionValue) {
117
$optionId = str_replace('id_', '',$optionId);
118
- /** @var Mage_Eav_Model_Entity_Attribute_Option $optionModel */
119
- $optionModel = Mage::getModel('eav/entity_attribute_option');
120
- $optionModel->load($optionId);
121
if( !in_array($optionId, $optionIds)){
122
array_push(
123
$newOptionData,
115
$newOptionData = [];
116
foreach ($attribute as $optionId => $optionValue) {
117
$optionId = str_replace('id_', '',$optionId);
118
+ // /** @var Mage_Eav_Model_Entity_Attribute_Option $optionModel */
119
+ // $optionModel = Mage::getModel('eav/entity_attribute_option');
120
+ // $optionModel->load($optionId);
121
if( !in_array($optionId, $optionIds)){
122
array_push(
123
$newOptionData,
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php CHANGED
@@ -33,18 +33,16 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Cms_Page_Translate exten
33
// }
34
//
35
// $this->setIsImported(1)->save();
36
-
37
- if ($this->getTranslate()){
38
-
39
$model = Mage::getModel('cms/page')->load($newEntityId);
40
if($model->getId()){
41
- $model->setData($this->getColumnName(), $this->getTranslate());
42
$model->save();
43
}
44
}
45
-
46
$this->setIsImported(1)->save();
47
-
48
}
49
//
50
// private function _getConnection() {
33
// }
34
//
35
// $this->setIsImported(1)->save();
36
+ $translation = $this->getTranslate();
37
+ if( !empty($translation) ){
38
$model = Mage::getModel('cms/page')->load($newEntityId);
39
if($model->getId()){
40
+ $model->setData($this->getColumnName(), $translation );
41
$model->save();
42
+ $model->unsetData();
43
}
44
}
45
$this->setIsImported(1)->save();
46
}
47
//
48
// private function _getConnection() {
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php CHANGED
@@ -411,7 +411,6 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
411
// }
412
//
413
// $writeConnection->query($query . implode(',', $queryVals));
414
-
415
$model = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_' . $type);
416
//. '` (`' . $type . '_id`, `job_id` , `origin`) VALUES ';
417
@@ -421,6 +420,8 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
421
$model->setData($type.'_id', $id);
422
$model->setJobId($this->getId());
423
$model->setOrigin(json_encode($cmsData));
424
$model->save();
425
$model->unsetData();
426
}
@@ -912,7 +913,6 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
912
913
public function applyTranslation($entityIds = array())
914
{
915
-
916
$collection = Mage::getModel('strakertranslations_easytranslationplatform/' . $this->_getType() . '_translate')->getCollection()->addFieldToFilter('job_id', $this->getId());
917
918
if ($entityIds) {
@@ -928,9 +928,7 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
928
929
foreach ($collection as $translation) {
930
$translation->setStoreId($this->getStoreId())->importTranslation();
931
-
932
$entityId = call_user_func(array($translation, 'getData'), strtolower(str_replace(' ', '_', $this->getTypeName() . '_id')));
933
-
934
if (empty($updatedIds[$entityId])) {
935
$updatedIds[$entityId] = true;
936
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
@@ -944,21 +942,15 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
944
}
945
}
946
}
947
-
948
return true;
949
}
950
951
protected function createNewCms($entityIds)
952