straker-translations-easy-translation-platform - Version 1.3.6

Version Notes

Bug fix when applying attributes translations

Download this release

Release Info

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


Code changes from version 1.3.5 to 1.3.6

Files changed (146) hide show
  1. app/code/community/StrakerTranslations/EasyTranslationPlatform/.DS_Store +0 -0
  2. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php +48 -0
  3. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Page/Grid.php +49 -0
  4. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job.php +19 -0
  5. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute.php +41 -0
  6. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute/Grid.php +201 -0
  7. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category.php +41 -0
  8. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php +196 -0
  9. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block.php +41 -0
  10. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php +141 -0
  11. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page.php +41 -0
  12. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php +141 -0
  13. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php +140 -0
  14. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product.php +41 -0
  15. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php +196 -0
  16. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute.php +29 -0
  17. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm.php +41 -0
  18. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm/Grid.php +107 -0
  19. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Grid.php +197 -0
  20. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Attribute.php +6 -0
  21. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm.php +40 -0
  22. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php +180 -0
  23. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php +252 -0
  24. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block.php +47 -0
  25. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Attribute.php +17 -0
  26. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm.php +48 -0
  27. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php +102 -0
  28. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php +124 -0
  29. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page.php +47 -0
  30. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Attribute.php +20 -0
  31. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm.php +48 -0
  32. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php +109 -0
  33. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php +136 -0
  34. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm.php +42 -0
  35. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php +150 -0
  36. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products.php +53 -0
  37. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Attribute.php +33 -0
  38. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm.php +41 -0
  39. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php +150 -0
  40. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php +277 -0
  41. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Register.php +31 -0
  42. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Selectstore.php +6 -0
  43. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Setupstore.php +24 -0
  44. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php +20 -0
  45. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Backupbutton.php +50 -0
  46. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Button.php +50 -0
  47. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Restorebutton.php +50 -0
  48. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Store.php +48 -0
  49. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php +15 -0
  50. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalLabel.php +18 -0
  51. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalOption.php +19 -0
  52. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateLabel.php +18 -0
  53. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateOption.php +19 -0
  54. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Backend.php +40 -0
  55. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsOriginTitle.php +10 -0
  56. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php +20 -0
  57. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateLabel.php +28 -0
  58. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateOptions.php +33 -0
  59. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Dispute.php +11 -0
  60. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php +35 -0
  61. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Path.php +17 -0
  62. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Quote.php +22 -0
  63. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Refresh.php +12 -0
  64. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Selected.php +65 -0
  65. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php +33 -0
  66. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/StrakerTranslated.php +14 -0
  67. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/TranslateOptions.php +17 -0
  68. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Translated.php +14 -0
  69. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Update.php +12 -0
  70. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Version.php +14 -0
  71. app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php +89 -0
  72. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Actionlog.php +39 -0
  73. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php +242 -0
  74. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Attribute/Translate.php +145 -0
  75. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Attributes.php +16 -0
  76. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Translate.php +45 -0
  77. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Attributes.php +16 -0
  78. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Translate.php +51 -0
  79. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Attributes.php +16 -0
  80. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php +54 -0
  81. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php +1043 -0
  82. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Attribute.php +16 -0
  83. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Category.php +16 -0
  84. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Block.php +16 -0
  85. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Page.php +16 -0
  86. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Product.php +16 -0
  87. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php +16 -0
  88. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php +16 -0
  89. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Attributes.php +16 -0
  90. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Translate.php +51 -0
  91. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog.php +16 -0
  92. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog/Collection.php +17 -0
  93. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate.php +16 -0
  94. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate/Collection.php +16 -0
  95. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes.php +16 -0
  96. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes/Collection.php +16 -0
  97. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate.php +16 -0
  98. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate/Collection.php +16 -0
  99. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes.php +16 -0
  100. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes/Collection.php +16 -0
  101. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate.php +16 -0
  102. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate/Collection.php +16 -0
  103. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes.php +16 -0
  104. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes/Collection.php +16 -0
  105. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate.php +16 -0
  106. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate/Collection.php +16 -0
  107. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job.php +47 -0
  108. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute.php +16 -0
  109. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute/Collection.php +16 -0
  110. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category.php +16 -0
  111. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category/Collection.php +27 -0
  112. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block.php +16 -0
  113. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block/Collection.php +16 -0
  114. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page.php +16 -0
  115. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page/Collection.php +16 -0
  116. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Collection.php +16 -0
  117. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product.php +16 -0
  118. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product/Collection.php +27 -0
  119. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status.php +16 -0
  120. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status/Collection.php +16 -0
  121. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type.php +16 -0
  122. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type/Collection.php +16 -0
  123. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes.php +16 -0
  124. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes/Collection.php +16 -0
  125. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate.php +16 -0
  126. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate/Collection.php +16 -0
  127. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/System/Config/Source/SiteMode.php +59 -0
  128. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/AttributeController.php +201 -0
  129. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php +219 -0
  130. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/BlockController.php +186 -0
  131. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/PageController.php +186 -0
  132. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php +131 -0
  133. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php +240 -0
  134. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php +207 -0
  135. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/CallbackController.php +45 -0
  136. app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-install-1.2.0.php +22 -0
  137. app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-upgrade-1.2.0-1.3.0.php +11 -0
  138. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/.DS_Store +0 -0
  139. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/adminhtml.xml +76 -0
  140. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml +156 -0
  141. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml +150 -0
  142. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/install-1.2.0.php +752 -0
  143. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.2.0-1.3.0.php +358 -0
  144. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.0-1.3.1.php +91 -0
  145. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.3-1.3.4.php +80 -0
  146. package.xml +5 -5
app/code/community/StrakerTranslations/EasyTranslationPlatform/.DS_Store ADDED
Binary file
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php ADDED
@@ -0,0 +1,48 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Block_Grid extends Mage_Adminhtml_Block_Cms_Block_Grid {
3
+ protected function _prepareCollection()
4
+ {
5
+ /* @var $collection Mage_Cms_Model_Resource_Block_Collection */
6
+ $collection = Mage::getModel('cms/block')->getCollection();
7
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
8
+ $collection->getSelect()->joinLeft(
9
+ array('straker' => $collection->getTable('strakertranslations_easytranslationplatform/job_cmsblock')),
10
+ 'straker.new_entity_id = main_table.block_id',
11
+ array('straker_translated' => 'straker.version')
12
+ );
13
+ $this->setCollection($collection);
14
+
15
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
16
+ }
17
+
18
+ protected function _prepareColumns()
19
+ {
20
+ if (!Mage::app()->isSingleStoreMode()) {
21
+ $this->addColumnAfter('straker_translated', array(
22
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created by Straker'),
23
+ 'type' => 'options',
24
+ 'options' => array('0' => 'No', '1' => 'Yes'),
25
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_StrakerTranslated',
26
+ 'index' => 'straker_translated',
27
+ 'filter_index' => 'straker.version',
28
+ 'filter_condition_callback' => array($this, '_filterStrakerVersion')
29
+ ), 'update_time');
30
+ }
31
+ return parent::_prepareColumns();
32
+ }
33
+
34
+ protected function _filterStrakerVersion($collection, $column)
35
+ {
36
+ $value = $column->getFilter()->getValue();
37
+ if ($value == 0) {
38
+ $this->getCollection()->getSelect()->where(
39
+ "straker.version IS NULL");
40
+ }
41
+ else {
42
+ $this->getCollection()->getSelect()->where(
43
+ "straker.version = ".$value);
44
+ }
45
+
46
+ return $this;
47
+ }
48
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Page/Grid.php ADDED
@@ -0,0 +1,49 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Page_Grid extends Mage_Adminhtml_Block_Cms_Page_Grid {
3
+ protected function _prepareCollection()
4
+ {
5
+ /* @var $collection Mage_Cms_Model_Resource_Page_Collection */
6
+ $collection = Mage::getModel('cms/page')->getCollection();
7
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
8
+ $collection->getSelect()->joinLeft(
9
+ array('straker' => $collection->getTable('strakertranslations_easytranslationplatform/job_cmspage')),
10
+ 'straker.new_entity_id = main_table.page_id',
11
+ array('straker_translated' => 'straker.version')
12
+ );
13
+ $collection->setFirstStoreFlag(true);
14
+ $this->setCollection($collection);
15
+
16
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
17
+ }
18
+
19
+ protected function _prepareColumns()
20
+ {
21
+ if (!Mage::app()->isSingleStoreMode()) {
22
+ $this->addColumnAfter('straker_translated', array(
23
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created by Straker'),
24
+ 'type' => 'options',
25
+ 'options' => array('0' => 'No', '1' => 'Yes'),
26
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_StrakerTranslated',
27
+ 'index' => 'straker_translated',
28
+ 'filter_index' => 'straker.version',
29
+ 'filter_condition_callback' => array($this, '_filterStrakerVersion')
30
+ ), 'page_actions');
31
+ }
32
+ return parent::_prepareColumns();
33
+ }
34
+
35
+ protected function _filterStrakerVersion($collection, $column)
36
+ {
37
+ $value = $column->getFilter()->getValue();
38
+ if ($value == 0) {
39
+ $this->getCollection()->getSelect()->where(
40
+ "straker.version IS NULL");
41
+ }
42
+ else {
43
+ $this->getCollection()->getSelect()->where(
44
+ "straker.version = ".$value);
45
+ }
46
+
47
+ return $this;
48
+ }
49
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job.php ADDED
@@ -0,0 +1,19 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job extends Mage_Adminhtml_Block_Widget_Container{
3
+ public function __construct()
4
+ {
5
+ parent::__construct();
6
+ $this->setTemplate('straker/job.phtml');
7
+ }
8
+
9
+ protected function _prepareLayout()
10
+ {
11
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid', 'job.grid'));
12
+ return parent::_prepareLayout();
13
+ }
14
+
15
+ public function getGridHtml()
16
+ {
17
+ return $this->getChildHtml('grid');
18
+ }
19
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_job;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/job/attribute.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $jobId = $this->getRequest()->getParam('job_id');
15
+ $jobStatus = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId)->getStatusId();
16
+ if ( $jobStatus == '4'){
17
+ $this->_addButton('publish', array(
18
+ 'label' => Mage::helper('catalog')->__('Publish All Translations'),
19
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
20
+ 'class' => 'task'
21
+ ));
22
+ }
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_attribute_grid', 'job_attribute.grid'));
25
+ $this->getChild('grid')->setStatusId($jobStatus);
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGridHtml()
30
+ {
31
+ return $this->getChildHtml('grid');
32
+ }
33
+
34
+ public function getJob(){
35
+ if(!$this->_job) {
36
+ $jobId = $this->getRequest()->getParam('job_id');
37
+ $this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
38
+ }
39
+ return $this->_job;
40
+ }
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute/Grid.php ADDED
@@ -0,0 +1,201 @@
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ public function __construct() {
6
+ parent::__construct();
7
+ $this->setId('strakerJobAttributeGrid');
8
+ $this->setSaveParametersInSession(true);
9
+ }
10
+
11
+ protected function _prepareLayout()
12
+ {
13
+ $this->setChild('dispute_button',
14
+ $this->getLayout()->createBlock('adminhtml/widget_button')
15
+ ->setData(array(
16
+ 'label' => Mage::helper('catalog')->__('Feedback'),
17
+ 'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
18
+ 'class' => 'feedback'
19
+ ))
20
+ );
21
+
22
+ return parent::_prepareLayout();
23
+ }
24
+
25
+ protected function _prepareCollection() {
26
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
27
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
28
+
29
+ /** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Attribute_Collection $collection */
30
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_attribute')->getCollection()
31
+ ->addFieldToFilter('main_table.job_id', $job->getId());
32
+
33
+ $collection->getSelect()
34
+ ->joinLeft(
35
+ array('ea' => $collection->getTable('eav/attribute')),
36
+ 'ea.attribute_id = main_table.attribute_id',
37
+ array('attribute_code' => 'attribute_code')
38
+ )->joinLeft(
39
+ array('translate' => $collection->getTable('strakertranslations_easytranslationplatform/straker_attribute_translate')),
40
+ 'translate.attribute_id = main_table.attribute_id AND translate.job_id = '.$job->getId(),
41
+ array('original' => 'original', 'translate' => 'translate')
42
+ );
43
+
44
+
45
+ //echo $collection->getSelect();
46
+ //die();
47
+ $this->setCollection($collection);
48
+ return parent::_prepareCollection();
49
+ }
50
+
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(
66
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
67
+ 'align' => 'left',
68
+ 'index' => 'attribute_code',
69
+ ));
70
+
71
+
72
+ $this->addColumn('label_original', array(
73
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Label - Source'),
74
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeOriginalLabel',
75
+ 'align' => 'center',
76
+ 'index' => false,
77
+ 'sortable'=> false,
78
+ 'filter' => false,
79
+ ));
80
+
81
+ $this->addColumn('option_original', array(
82
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Option - Source'),
83
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeOriginalOption',
84
+ 'align' => 'center',
85
+ 'index' => false,
86
+ 'sortable'=> false,
87
+ 'filter' => false,
88
+ ));
89
+
90
+ $this->addColumn('label_translate', array(
91
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Label - Target'),
92
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeTranslateLabel',
93
+ 'align' => 'center',
94
+ 'index' => false,
95
+ 'sortable'=> false,
96
+ 'filter' => false,
97
+ ));
98
+
99
+ $this->addColumn('option_translate', array(
100
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Option - Target'),
101
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeTranslateOption',
102
+ 'align' => 'center',
103
+ 'index' => false,
104
+ 'sortable'=> false,
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
+
118
+ // $this->addColumn('view_backend', array(
119
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Backend'),
120
+ // 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend',
121
+ // 'align' => 'center',
122
+ // 'index' => false,
123
+ // 'filter' => false,
124
+ // ));
125
+
126
+ return parent::_prepareColumns();
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') {
137
+
138
+ $this->setMassactionIdField('attribute_id');
139
+ $this->getMassactionBlock()->setFormFieldName('attribute');
140
+
141
+ $this->getMassactionBlock()->addItem('add', array(
142
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
143
+ 'url' => $this->getUrl('*/*/applyTranslation'),
144
+ 'selected' => 1
145
+ ));
146
+
147
+ $this->getMassactionBlock()->setTemplate('straker/job/attribute/massaction.phtml');
148
+
149
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
150
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
151
+
152
+
153
+ // Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
154
+ return $this;
155
+ }
156
+ }
157
+
158
+ protected function _prepareMassactionColumn()
159
+ {
160
+ if ($this->getStatusId() == '4') {
161
+ $columnId = 'massaction';
162
+ $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
163
+ ->setData(array(
164
+ 'index' => $this->getMassactionIdField(),
165
+ 'use_index' => $this->getMassactionIdField(),
166
+ 'filter_index' => $this->getMassactionIdFilter(),
167
+ 'type' => 'massaction',
168
+ 'name' => $this->getMassactionBlock()->getFormFieldName(),
169
+ 'align' => 'center',
170
+ 'is_system' => true
171
+ ));
172
+
173
+ if ($this->getNoFilterMassactionColumn()) {
174
+ $massactionColumn->setData('filter', false);
175
+ }
176
+
177
+ $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
178
+ ->setGrid($this)
179
+ ->setId($columnId);
180
+
181
+ $oldColumns = $this->_columns;
182
+ $this->_columns = array();
183
+ $this->_columns[$columnId] = $massactionColumn;
184
+ $this->_columns = array_merge($this->_columns, $oldColumns);
185
+ return $this;
186
+ }
187
+ }
188
+
189
+ public function getMainButtonsHtml()
190
+ {
191
+ $html = '';
192
+ if ($this->getStatusId() == '4') {
193
+ $html .= $this->getChildHtml('dispute_button');
194
+ }
195
+ if($this->getFilterVisibility()){
196
+ $html.= $this->getResetFilterButtonHtml();
197
+ $html.= $this->getSearchButtonHtml();
198
+ }
199
+ return $html;
200
+ }
201
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_job;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/job/category.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $jobId = $this->getRequest()->getParam('job_id');
15
+ $jobStatus = $this->getJob()->getStatusId();
16
+ if ( $jobStatus == '4'){
17
+ $this->_addButton('publish', array(
18
+ 'label' => Mage::helper('catalog')->__('Publish All Translations'),
19
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
20
+ 'class' => 'task'
21
+ ));
22
+ }
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_category_grid', 'job_category.grid'));
25
+ $this->getChild('grid')->setStatusId($jobStatus);
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGridHtml()
30
+ {
31
+ return $this->getChildHtml('grid');
32
+ }
33
+
34
+ public function getJob(){
35
+ if(!$this->_job) {
36
+ $jobId = $this->getRequest()->getParam('job_id');
37
+ $this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
38
+ }
39
+ return $this->_job;
40
+ }
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php ADDED
@@ -0,0 +1,196 @@
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('strakerJobCategoryGrid');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $this->setChild('dispute_button',
16
+ $this->getLayout()->createBlock('adminhtml/widget_button')
17
+ ->setData(array(
18
+ 'label' => Mage::helper('catalog')->__('Feedback'),
19
+ 'onclick' => 'disputeForm.show(\'' . $this->getRequest()->getParam('job_id') . '\')',
20
+ 'class' => 'feedback'
21
+ ))
22
+ );
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('adminhtml/catalog_category_grid', 'category.grid'));
25
+ return parent::_prepareLayout();
26
+ }
27
+
28
+ protected function _prepareCollection()
29
+ {
30
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
31
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
32
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
33
+
34
+ /** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Category_Collection $collection */
35
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_category')->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();
40
+ $collection->getSelect()->joinLeft(
41
+ array($attributeCode => $collection->getTable('strakertranslations_easytranslationplatform/category_translate')),
42
+ $attributeCode . '.category_id = main_table.category_id
43
+ AND ' . $attributeCode . '.attribute_id = ' . $jobAttribute->getAttributeId() . '
44
+ AND ' . $attributeCode . '.job_id = ' . $job->getId(),
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
+ }
53
+
54
+ protected function _prepareColumns()
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('category_id', array(
64
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Category ID'),
65
+ 'align' => 'left',
66
+ 'index' => 'category_id',
67
+ ));
68
+
69
+ // $this->addColumn('job_id', array(
70
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Job ID'),
71
+ // 'align' => 'left',
72
+ // 'index' => 'job_id',
73
+ // ));
74
+
75
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
76
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
77
+
78
+ //loop through this job's attributes and add columns to the grid
79
+ foreach ($jobAttributes as $jobAttribute) {
80
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
81
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(3, $attributeCode);
82
+ $this->addColumn($attributeCode . '_original', array(
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
+
105
+ $this->addColumn('view_frontend', array(
106
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Frontend'),
107
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend',
108
+ 'align' => 'center',
109
+ 'index' => false,
110
+ 'filter' => false,
111
+ ));
112
+
113
+ $this->addColumn('view_backend', array(
114
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Backend'),
115
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend',
116
+ 'align' => 'center',
117
+ 'index' => false,
118
+ 'filter' => false,
119
+ ));
120
+
121
+ return parent::_prepareColumns();
122
+ }
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') {
133
+
134
+ $this->setMassactionIdField('category_id');
135
+ $this->getMassactionBlock()->setFormFieldName('category');
136
+
137
+ $this->getMassactionBlock()->addItem('add', array(
138
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
139
+ 'url' => $this->getUrl('*/*/applyTranslation'),
140
+ 'selected' => 1
141
+ ));
142
+ $this->getMassactionBlock()->setTemplate('straker/job/category/massaction.phtml');
143
+
144
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
145
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
146
+
147
+
148
+ Mage::dispatchEvent('adminhtml_strakertranslation_job_category_grid_prepare_massaction', array('block' => $this));
149
+ return $this;
150
+ }
151
+ }
152
+
153
+ protected function _prepareMassactionColumn()
154
+ {
155
+ if ($this->getStatusId() == '4') {
156
+ $columnId = 'massaction';
157
+ $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
158
+ ->setData(array(
159
+ 'index' => $this->getMassactionIdField(),
160
+ 'use_index' => $this->getMassactionIdField(),
161
+ 'filter_index' => $this->getMassactionIdFilter(),
162
+ 'type' => 'massaction',
163
+ 'name' => $this->getMassactionBlock()->getFormFieldName(),
164
+ 'align' => 'center',
165
+ 'is_system' => true
166
+ ));
167
+
168
+ if ($this->getNoFilterMassactionColumn()) {
169
+ $massactionColumn->setData('filter', false);
170
+ }
171
+
172
+ $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
173
+ ->setGrid($this)
174
+ ->setId($columnId);
175
+
176
+ $oldColumns = $this->_columns;
177
+ $this->_columns = array();
178
+ $this->_columns[$columnId] = $massactionColumn;
179
+ $this->_columns = array_merge($this->_columns, $oldColumns);
180
+ return $this;
181
+ }
182
+ }
183
+
184
+ public function getMainButtonsHtml()
185
+ {
186
+ $html = '';
187
+ if ($this->getStatusId() == '4') {
188
+ $html .= $this->getChildHtml('dispute_button');
189
+ }
190
+ if ($this->getFilterVisibility()) {
191
+ $html .= $this->getResetFilterButtonHtml();
192
+ $html .= $this->getSearchButtonHtml();
193
+ }
194
+ return $html;
195
+ }
196
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_job;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/job/cms/block.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $jobId = $this->getRequest()->getParam('job_id');
15
+ $jobStatus = $this->getJob()->getStatusId();
16
+ if ( $jobStatus == '4'){
17
+ $this->_addButton('publish', array(
18
+ 'label' => Mage::helper('catalog')->__('Publish All Translations'),
19
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
20
+ 'class' => 'task'
21
+ ));
22
+ }
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_cms_block_grid', 'job_cms_block.grid'));
25
+ $this->getChild('grid')->setStatusId($jobStatus);
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGridHtml()
30
+ {
31
+ return $this->getChildHtml('grid');
32
+ }
33
+
34
+ public function getJob(){
35
+ if(!$this->_job) {
36
+ $jobId = $this->getRequest()->getParam('job_id');
37
+ $this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
38
+ }
39
+ return $this->_job;
40
+ }
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php ADDED
@@ -0,0 +1,141 @@
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ protected $_attributes;
6
+
7
+ public function __construct() {
8
+ parent::__construct();
9
+ $this->setId('strakerJobCmsBlockGrid');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $this->setChild('dispute_button',
16
+ $this->getLayout()->createBlock('adminhtml/widget_button')
17
+ ->setData(array(
18
+ 'label' => Mage::helper('catalog')->__('Feedback'),
19
+ 'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
20
+ 'class' => 'feedback'
21
+ ))
22
+ );
23
+
24
+ return parent::_prepareLayout();
25
+ }
26
+
27
+ protected function _prepareCollection() {
28
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
29
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
30
+
31
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_block')->getCollection()
32
+ ->addFieldToFilter('main_table.job_id', $job->getId());
33
+
34
+ //echo $collection->getSelect(); die();
35
+ $this->setCollection($collection);
36
+ return parent::_prepareCollection();
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
+
59
+ return parent::_prepareColumns();
60
+ }
61
+
62
+ public function getRowUrl($row) {
63
+ // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
64
+ return '';
65
+ }
66
+
67
+ protected function _prepareMassaction()
68
+ {
69
+ if ($this->getStatusId() == '4') {
70
+
71
+ $this->setMassactionIdField('block_id');
72
+ $this->getMassactionBlock()->setFormFieldName('block_id');
73
+
74
+ $this->getMassactionBlock()->addItem('add', array(
75
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
76
+ 'url' => $this->getUrl('*/*/applyTranslation'),
77
+ 'selected' => 1
78
+ ));
79
+
80
+ $this->getMassactionBlock()->setTemplate('straker/job/cms/page/massaction.phtml');
81
+
82
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
83
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
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
+ {
124
+ $html = '';
125
+ if ($this->getStatusId() == '4') {
126
+ $html .= $this->getChildHtml('dispute_button');
127
+ }
128
+ if($this->getFilterVisibility()){
129
+ $html.= $this->getResetFilterButtonHtml();
130
+ $html.= $this->getSearchButtonHtml();
131
+ }
132
+ return $html;
133
+ }
134
+
135
+ protected function getAttributes(){
136
+ if(!$this->_attributes){
137
+ $this->_attributes = Mage::getModel('strakertranslations_easytranslationplatform/cms_block_attributes')->getCollection()->addFieldToFilter('job_id',$this->getRequest()->getParam('job_id'));
138
+ }
139
+ return $this->_attributes;
140
+ }
141
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_job;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/job/cms/page.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $jobId = $this->getRequest()->getParam('job_id');
15
+ $jobStatus = $this->getJob()->getStatusId();
16
+ if ( $jobStatus == '4'){
17
+ $this->_addButton('publish', array(
18
+ 'label' => Mage::helper('catalog')->__('Publish All Translations'),
19
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
20
+ 'class' => 'task'
21
+ ));
22
+ }
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_cms_page_grid', 'job_cms_page.grid'));
25
+ $this->getChild('grid')->setStatusId($jobStatus);
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGridHtml()
30
+ {
31
+ return $this->getChildHtml('grid');
32
+ }
33
+
34
+ public function getJob(){
35
+ if(!$this->_job) {
36
+ $jobId = $this->getRequest()->getParam('job_id');
37
+ $this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
38
+ }
39
+ return $this->_job;
40
+ }
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php ADDED
@@ -0,0 +1,141 @@
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_Grid extends Mage_Adminhtml_Block_Widget_Grid {
4
+
5
+ protected $_attributes;
6
+
7
+ public function __construct() {
8
+ parent::__construct();
9
+ $this->setId('strakerJobCmsPageGrid');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $this->setChild('dispute_button',
16
+ $this->getLayout()->createBlock('adminhtml/widget_button')
17
+ ->setData(array(
18
+ 'label' => Mage::helper('catalog')->__('Feedback'),
19
+ 'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
20
+ 'class' => 'feedback'
21
+ ))
22
+ );
23
+
24
+ return parent::_prepareLayout();
25
+ }
26
+
27
+ protected function _prepareCollection() {
28
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
29
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
30
+
31
+ $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_page')->getCollection()
32
+ ->addFieldToFilter('main_table.job_id', $job->getId());
33
+
34
+ $this->setCollection($collection);
35
+ return parent::_prepareCollection();
36
+ }
37
+
38
+ protected function _prepareColumns() {
39
+
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
+
59
+ return parent::_prepareColumns();
60
+ }
61
+
62
+ public function getRowUrl($row) {
63
+ // return $this->getUrl('*/*/edit', array('id' => $row->getId()));
64
+ return '';
65
+ }
66
+
67
+ protected function _prepareMassaction()
68
+ {
69
+ if ($this->getStatusId() == '4') {
70
+
71
+ $this->setMassactionIdField('page_id');
72
+ $this->getMassactionBlock()->setFormFieldName('page_id');
73
+
74
+ $this->getMassactionBlock()->addItem('add', array(
75
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
76
+ 'url' => $this->getUrl('*/*/applyTranslation'),
77
+ 'selected' => 1
78
+ ));
79
+
80
+ $this->getMassactionBlock()->setTemplate('straker/job/cms/page/massaction.phtml');
81
+
82
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
83
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
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
+ {
124
+ $html = '';
125
+ if ($this->getStatusId() == '4') {
126
+ $html .= $this->getChildHtml('dispute_button');
127
+ }
128
+ if($this->getFilterVisibility()){
129
+ $html.= $this->getResetFilterButtonHtml();
130
+ $html.= $this->getSearchButtonHtml();
131
+ }
132
+ return $html;
133
+ }
134
+
135
+ protected function getAttributes(){
136
+ if(!$this->_attributes){
137
+ $this->_attributes = Mage::getModel('strakertranslations_easytranslationplatform/cms_page_attributes')->getCollection()->addFieldToFilter('job_id',$this->getRequest()->getParam('job_id'));
138
+ }
139
+ return $this->_attributes;
140
+ }
141
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php ADDED
@@ -0,0 +1,140 @@
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()){
28
+ $collection->addFieldToFilter('is_test_job', ['eq' => true]);
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
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ protected $_job;
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/job/product.phtml');
10
+ }
11
+
12
+ protected function _prepareLayout()
13
+ {
14
+ $jobId = $this->getRequest()->getParam('job_id');
15
+ $jobStatus = $this->getJob()->getStatusId();
16
+ if ( $jobStatus == '4'){
17
+ $this->_addButton('publish', array(
18
+ 'label' => Mage::helper('catalog')->__('Publish All Translations'),
19
+ 'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
20
+ 'class' => 'task'
21
+ ));
22
+ }
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_product_grid', 'job_product.grid'));
25
+ $this->getChild('grid')->setStatusId($jobStatus);
26
+ return parent::_prepareLayout();
27
+ }
28
+
29
+ public function getGridHtml()
30
+ {
31
+ return $this->getChildHtml('grid');
32
+ }
33
+
34
+ public function getJob(){
35
+ if(!$this->_job) {
36
+ $jobId = $this->getRequest()->getParam('job_id');
37
+ $this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
38
+ }
39
+ return $this->_job;
40
+ }
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php ADDED
@@ -0,0 +1,196 @@
1
+ <?php
2
+
3
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('strakerJobProductGrid');
10
+ $this->setSaveParametersInSession(true);
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $this->setChild('dispute_button',
16
+ $this->getLayout()->createBlock('adminhtml/widget_button')
17
+ ->setData(array(
18
+ 'label' => Mage::helper('catalog')->__('Feedback'),
19
+ 'onclick' => 'disputeForm.show(\'' . $this->getRequest()->getParam('job_id') . '\')',
20
+ 'class' => 'feedback'
21
+ ))
22
+ );
23
+
24
+ $this->setChild('grid', $this->getLayout()->createBlock('adminhtml/catalog_product_grid', 'product.grid'));
25
+ return parent::_prepareLayout();
26
+ }
27
+
28
+ protected function _prepareCollection()
29
+ {
30
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
31
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
32
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
33
+
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();
40
+ $collection->getSelect()->joinLeft(
41
+ array($attributeCode => $collection->getTable('strakertranslations_easytranslationplatform/product_translate')),
42
+ $attributeCode . '.product_id = main_table.product_id
43
+ AND ' . $attributeCode . '.attribute_id = ' . $jobAttribute->getAttributeId() . '
44
+ AND ' . $attributeCode . '.job_id = ' . $job->getId(),
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
+ }
53
+
54
+ protected function _prepareColumns()
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(
70
+ // 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Job ID'),
71
+ // 'align' => 'left',
72
+ // 'index' => 'job_id',
73
+ // ));
74
+
75
+ $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
76
+ $jobAttributes = Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')->getCollection()->addFieldToFilter('job_id', $job->getId());
77
+
78
+ //loop through this job's attributes and add columns to the grid
79
+ foreach ($jobAttributes as $jobAttribute) {
80
+ $attributeCode = Mage::getModel('eav/entity_attribute')->load($jobAttribute->getAttributeId())->getAttributeCode();
81
+ $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attributeCode);
82
+ $this->addColumn($attributeCode . '_original', array(
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
+
105
+ $this->addColumn('view_frontend', array(
106
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Frontend'),
107
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend',
108
+ 'align' => 'center',
109
+ 'index' => false,
110
+ 'filter' => false,
111
+ ));
112
+
113
+ $this->addColumn('view_backend', array(
114
+ 'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('View Backend'),
115
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend',
116
+ 'align' => 'center',
117
+ 'index' => false,
118
+ 'filter' => false,
119
+ ));
120
+
121
+ return parent::_prepareColumns();
122
+ }
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') {
133
+
134
+ $this->setMassactionIdField('product_id');
135
+ $this->getMassactionBlock()->setFormFieldName('product');
136
+
137
+ $this->getMassactionBlock()->addItem('add', array(
138
+ 'label' => Mage::helper('catalog')->__('Publish Translation'),
139
+ 'url' => $this->getUrl('*/*/applyTranslation'),
140
+ 'selected' => 1
141
+ ));
142
+ $this->getMassactionBlock()->setTemplate('straker/job/product/massaction.phtml');
143
+
144
+ $hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
145
+ $this->getMassactionBlock()->setHiddenParams($hiddenParams);
146
+
147
+
148
+ // Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
149
+ return $this;
150
+ }
151
+ }
152
+
153
+ protected function _prepareMassactionColumn()
154
+ {
155
+ if ($this->getStatusId() == '4') {
156
+ $columnId = 'massaction';
157
+ $massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
158
+ ->setData(array(
159
+ 'index' => $this->getMassactionIdField(),
160
+ 'use_index' => $this->getMassactionIdField(),
161
+ 'filter_index' => $this->getMassactionIdFilter(),
162
+ 'type' => 'massaction',
163
+ 'name' => $this->getMassactionBlock()->getFormFieldName(),
164
+ 'align' => 'center',
165
+ 'is_system' => true
166
+ ));
167
+
168
+ if ($this->getNoFilterMassactionColumn()) {
169
+ $massactionColumn->setData('filter', false);
170
+ }
171
+
172
+ $massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
173
+ ->setGrid($this)
174
+ ->setId($columnId);
175
+
176
+ $oldColumns = $this->_columns;
177
+ $this->_columns = array();
178
+ $this->_columns[$columnId] = $massactionColumn;
179
+ $this->_columns = array_merge($this->_columns, $oldColumns);
180
+ return $this;
181
+ }
182
+ }
183
+
184
+ public function getMainButtonsHtml()
185
+ {
186
+ $html = '';
187
+ if ($this->getStatusId() == '4') {
188
+ $html .= $this->getChildHtml('dispute_button');
189
+ }
190
+ if ($this->getFilterVisibility()) {
191
+ $html .= $this->getResetFilterButtonHtml();
192
+ $html .= $this->getSearchButtonHtml();
193
+ }
194
+ return $html;
195
+ }
196
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+
4
+ /**
5
+ * Set template
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('straker/new/attribute.phtml');
11
+ }
12
+
13
+ protected function _prepareLayout()
14
+ {
15
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute_grid', 'attribute.grid', array('setup_store_id' => $this->getSetupStoreId() )));
16
+ return parent::_prepareLayout();
17
+ }
18
+
19
+
20
+ /**
21
+ * Render grid
22
+ *
23
+ * @return string
24
+ */
25
+ public function getGridHtml()
26
+ {
27
+ return $this->getChildHtml('grid');
28
+ }
29
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_Confirm extends Mage_Adminhtml_Block_Widget_Container
3
+ {
4
+ /**
5
+ * Set template
6
+ */
7
+ public function __construct()
8
+ {
9
+ parent::__construct();
10
+ $this->setTemplate('straker/new/attribute/confirm.phtml');
11
+ }
12
+
13
+ /**
14
+ * Prepare button and grid
15
+ *
16
+ * @return Mage_Adminhtml_Block_Catalog_Product
17
+ */
18
+ protected function _prepareLayout()
19
+ {
20
+ $this->_addButton('submit', array(
21
+ 'label' => Mage::helper('catalog')->__('Submit'),
22
+ 'onclick' => "$('submit-new-job-form').submit();",
23
+ 'class' => 'task'
24
+ ));
25
+
26
+ $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute_confirm_grid', 'product.grid', array('store' => $this->getStore(), 'attribute' => $this->getAttribute(), 'option' => $this->getOption())));
27
+ return parent::_prepareLayout();
28
+ }
29
+
30
+
31
+ /**
32
+ * Render grid
33
+ *
34
+ * @return string
35
+ */
36
+ public function getGridHtml()
37
+ {
38
+ return $this->getChildHtml('grid');
39
+ }
40
+
41
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm/Grid.php ADDED
@@ -0,0 +1,107 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
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()
16
+ {
17
+ return $this;
18
+ }
19
+
20
+ protected function _prepareColumns()
21
+ {
22
+ parent::_prepareColumns();
23
+
24
+
25
+ $this->addColumn('attribute_code', array(
26
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Code'),
27
+ 'sortable'=>true,
28
+ 'filter' => false,
29
+ 'index'=>'attribute_code'
30
+ ));
31
+
32
+ $this->addColumn('frontend_label', array(
33
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Attribute Label'),
34
+ 'sortable'=>true,
35
+ 'filter' => false,
36
+ 'index'=>'frontend_label'
37
+ ));
38
+
39
+ $this->addColumn('translate_label', array(
40
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Translate Attribute Label'),
41
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_ConfirmTranslateLabel',
42
+ 'align' => 'center',
43
+ 'index' => false,
44
+ 'sortable'=> false,
45
+ 'filter' => false,
46
+ ));
47
+
48
+ $this->addColumn('translate_options', array(
49
+ 'header'=>Mage::helper('strakertranslations_easytranslationplatform')->__('Translate Attribute Options'),
50
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_ConfirmTranslateOptions',
51
+ 'align' => 'center',
52
+ 'index' => false,
53
+ 'sortable'=> false,
54
+ 'filter' => false,
55
+ ));
56
+
57
+ $this->addColumn('is_visible', array(
58
+ 'header'=>Mage::helper('catalog')->__('Visible'),
59
+ 'sortable'=>true,
60
+ 'index'=>'is_visible_on_front',
61
+ 'type' => 'options',
62
+ 'filter' => false,
63
+ 'options' => array(
64
+ '1' => Mage::helper('catalog')->__('Yes'),
65
+ '0' => Mage::helper('catalog')->__('No'),
66
+ ),
67
+ 'align' => 'center',
68
+ ));
69
+
70
+ return $this;
71
+ }
72
+
73
+ protected function _prepareCollection()
74
+ {
75
+ if ($this->getOption()) {
76
+ $attributeIds = array_unique(
77
+ array_merge(
78
+ $this->getAttribute(),
79
+ explode(',', $this->getOption())
80
+ )
81
+ );
82
+ }
83
+ else {
84
+ $attributeIds = $this->getAttribute();
85
+ }
86
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
87
+ ->addFieldToFilter('main_table.attribute_id', $attributeIds)
88
+ ->addVisibleFilter();
89
+ $this->setCollection($collection);
90
+
91
+ return parent::_prepareCollection();
92
+ }
93
+
94
+ public function getGridUrl()
95
+ {
96
+ return $this->getUrl('*/*/addtoconfirm', array('_current'=>true));
97
+ }
98
+
99
+ public function getRowUrl($row)
100
+ {
101
+ return '';
102
+ }
103
+
104
+ public function getAttrArray(){
105
+ return explode(',', $this->getAttr());
106
+ }
107
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Grid.php ADDED
@@ -0,0 +1,197 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('attributeGrid');
8
+ $this->setDefaultSort('attribute_code');
9
+ $this->setDefaultDir('ASC');
10
+ }
11
+
12
+ protected function _getStore()
13
+ {
14
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
15
+ return Mage::app()->getStore($storeId);
16
+ }
17
+
18
+ /**
19
+ * Prepare product attributes grid collection object
20
+ *
21
+ * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Grid
22
+ */
23
+ protected function _prepareCollection()
24
+ {
25
+ /** @var \Mage_Catalog_Model_Resource_Product_Attribute_Collection $collection */
26
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')
27
+ ->addVisibleFilter();
28
+
29
+ $store = $this->_getStore();
30
+ // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
31
+ // $jobAttributeQuery = 'select a.`version`, a.`attribute_id` from `'.$prefix.'straker_job_attribute` as a
32
+ // left join `'.$prefix.'straker_job` as b on a.`job_id`=b.`id`
33
+ // where b.`store_id` ='.$store->getId().' and a.`version` =1
34
+ // GROUP BY a.`attribute_id`';
35
+ //
36
+ // //join straker job product table to get version for each product
37
+ // $collection->getSelect()->joinLeft(
38
+ //
39
+ // new Zend_Db_Expr('('.$jobAttributeQuery.')'),
40
+ // 'main_table.attribute_id = t.attribute_id',
41
+ // array('version')
42
+ //
43
+ // );
44
+ /** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Attribute_Collection $strakerJobProductCollection */
45
+ $strakerJobAttributeCollection = Mage::getModel('strakertranslations_easytranslationplatform/job_attribute')->getCollection();
46
+ $strakerJobAttributeCollection->getSelect()
47
+ ->reset(Zend_Db_Select::COLUMNS)
48
+ ->joinLeft(
49
+ ['b' => $strakerJobAttributeCollection->getTable('strakertranslations_easytranslationplatform/job')],
50
+ '`main_table`.`job_id` = `b`.`id`',
51
+ []
52
+ )->where(
53
+ '`b`.`store_id` = ?', $store->getId()
54
+ )->where(
55
+ '`main_table`.`version` = ?', 1
56
+ )->group(
57
+ 'main_table.attribute_id'
58
+ )->columns(
59
+ ['version' => 'version', 'attribute_id' => 'attribute_id']
60
+ );
61
+
62
+ $jobAttributeQuery = $strakerJobAttributeCollection->getSelect();
63
+
64
+ $collection->getSelect()->joinLeft(
65
+ $jobAttributeQuery,
66
+ 'main_table.attribute_id = t.attribute_id',
67
+ array('version')
68
+ );
69
+
70
+ $this->setCollection($collection);
71
+
72
+ return parent::_prepareCollection();
73
+ }
74
+
75
+
76
+ /**
77
+ * Prepare product attributes grid columns
78
+ *
79
+ * @return Mage_Adminhtml_Block_Catalog_Product_Attribute_Grid
80
+ */
81
+ protected function _prepareColumns()
82
+ {
83
+ parent::_prepareColumns();
84
+
85
+
86
+ $this->addColumn('attribute_code', array(
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(
109
+ 'header'=>Mage::helper('catalog')->__('Visible'),
110
+ 'sortable'=>true,
111
+ 'index'=>'is_visible_on_front',
112
+ 'type' => 'options',
113
+ 'options' => array(
114
+ '1' => Mage::helper('catalog')->__('Yes'),
115
+ '0' => Mage::helper('catalog')->__('No'),
116
+ ),
117
+ 'align' => 'center',
118
+ ));
119
+
120
+ $this->addColumn('version',
121
+ array(
122
+ 'header'=> Mage::helper('catalog')->__('Translated'),
123
+ 'width' => '70px',
124
+ 'index' => 'version',
125
+ 'type' => 'options',
126
+ 'options' => array(
127
+ 'Translated' => Mage::helper('catalog')->__('Translated'),
128
+ 'Not Translated' => Mage::helper('catalog')->__('Not Translated')
129
+ ),
130
+ 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Translated',
131
+ 'filter_condition_callback' => array($this, '_versionFilter'),
132
+ ));
133
+
134
+ return $this;
135
+ }
136
+
137
+ protected function _versionFilter($collection, $column)
138
+ {
139
+ if (!$value = $column->getFilter()->getValue()) {
140
+ return $this;
141
+ }
142
+
143
+ if ($value == 'Translated' ){
144
+ $collection->getSelect()->where('t.version is not null');
145
+ // print $this->getCollection()->getSelect(); exit;
146
+
147
+ } elseif ($value == 'Not Translated'){
148
+ $collection->getSelect()->where('t.version is null');
149
+ }
150
+
151
+ return $this;
152
+ }
153
+
154
+ protected function _prepareMassaction()
155
+ {
156
+ $this->setMassactionIdField('attribute_id');
157
+ $this->setMassactionIdFilter('main_table.attribute_id');
158
+ $this->getMassactionBlock()->setFormFieldName('attribute');
159
+
160
+ $this->getMassactionBlock()->addItem('add', array(
161
+ 'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
162
+ 'url' => $this->getUrl('*/*/addtoconfirm'),
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));
172
+ return $this;
173
+
174
+ }
175
+
176
+ public function getAttributesWithOption(){
177
+ $AttributeIdsWithOption = clone $this->getCollection()->getSelect();
178
+ $AttributeIdsWithOption->reset(Zend_Db_Select::ORDER);
179
+ $AttributeIdsWithOption->reset(Zend_Db_Select::LIMIT_COUNT);
180
+ $AttributeIdsWithOption->reset(Zend_Db_Select::LIMIT_OFFSET);
181
+ $AttributeIdsWithOption->reset(Zend_Db_Select::COLUMNS);
182
+ $AttributeIdsWithOption->reset(Zend_Db_Select::COLUMNS);
183
+ $AttributeIdsWithOption->where('frontend_input=?','select');
184
+ $AttributeIdsWithOption->columns('attribute_id', 'main_table');
185
+ return Mage::getSingleton('core/resource')->getConnection('core_read')->fetchCol($AttributeIdsWithOption);
186
+ }
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
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Attribute.php ADDED
@@ -0,0 +1,6 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
+ protected function _beforeToHtml(){
4
+ $this->setTemplate('straker/new/category/attributes.phtml');
5
+ }
6
+ }
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm.php ADDED
@@ -0,0 +1,40 @@
1
+ <?php
2
+ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Confirm extends Mage_Adminhtml_Block_Widget_Container{
3
+ /**
4
+ * Set template
5
+ */
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('straker/new/category/confirm.phtml');
10
+ }