straker-translations-easy-translation-platform - Version 1.3.5

Version Notes

Fix bug when applying attribute translation.

Download this release

Release Info

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


Code changes from version 1.3.4 to 1.3.5

Files changed (144) hide show
  1. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php +0 -48
  2. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Page/Grid.php +0 -49
  3. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job.php +0 -19
  4. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute.php +0 -41
  5. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Attribute/Grid.php +0 -201
  6. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category.php +0 -41
  7. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Category/Grid.php +0 -196
  8. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block.php +0 -41
  9. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php +0 -141
  10. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page.php +0 -41
  11. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php +0 -141
  12. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Grid.php +0 -140
  13. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product.php +0 -41
  14. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Product/Grid.php +0 -196
  15. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute.php +0 -29
  16. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm.php +0 -41
  17. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Confirm/Grid.php +0 -107
  18. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Attribute/Grid.php +0 -197
  19. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Attribute.php +0 -6
  20. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm.php +0 -40
  21. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php +0 -180
  22. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php +0 -252
  23. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block.php +0 -47
  24. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Attribute.php +0 -17
  25. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm.php +0 -48
  26. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php +0 -102
  27. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php +0 -124
  28. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page.php +0 -47
  29. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Attribute.php +0 -20
  30. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm.php +0 -48
  31. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php +0 -109
  32. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php +0 -136
  33. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm.php +0 -42
  34. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php +0 -150
  35. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products.php +0 -53
  36. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Attribute.php +0 -33
  37. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm.php +0 -41
  38. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm/Grid.php +0 -150
  39. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php +0 -277
  40. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Register.php +0 -31
  41. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Selectstore.php +0 -6
  42. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Setupstore.php +0 -24
  43. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php +0 -20
  44. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Backupbutton.php +0 -50
  45. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Button.php +0 -50
  46. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Restorebutton.php +0 -50
  47. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Store.php +0 -48
  48. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php +0 -15
  49. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalLabel.php +0 -18
  50. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalOption.php +0 -19
  51. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateLabel.php +0 -18
  52. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateOption.php +0 -19
  53. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Backend.php +0 -40
  54. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsOriginTitle.php +0 -10
  55. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php +0 -20
  56. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateLabel.php +0 -28
  57. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateOptions.php +0 -33
  58. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Dispute.php +0 -11
  59. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php +0 -35
  60. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Path.php +0 -17
  61. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Quote.php +0 -22
  62. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Refresh.php +0 -12
  63. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Selected.php +0 -65
  64. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php +0 -33
  65. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/StrakerTranslated.php +0 -14
  66. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/TranslateOptions.php +0 -17
  67. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Translated.php +0 -14
  68. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Update.php +0 -12
  69. app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Version.php +0 -14
  70. app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php +0 -89
  71. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Actionlog.php +0 -39
  72. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php +0 -242
  73. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Attribute/Translate.php +0 -146
  74. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Attributes.php +0 -16
  75. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Translate.php +0 -45
  76. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Attributes.php +0 -16
  77. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Translate.php +0 -51
  78. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Attributes.php +0 -16
  79. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php +0 -54
  80. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php +0 -1043
  81. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Attribute.php +0 -16
  82. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Category.php +0 -16
  83. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Block.php +0 -16
  84. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Page.php +0 -16
  85. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Product.php +0 -16
  86. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php +0 -16
  87. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php +0 -16
  88. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Attributes.php +0 -16
  89. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Translate.php +0 -51
  90. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog.php +0 -16
  91. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog/Collection.php +0 -17
  92. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate.php +0 -16
  93. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate/Collection.php +0 -16
  94. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes.php +0 -16
  95. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes/Collection.php +0 -16
  96. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate.php +0 -16
  97. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate/Collection.php +0 -16
  98. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes.php +0 -16
  99. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes/Collection.php +0 -16
  100. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate.php +0 -16
  101. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate/Collection.php +0 -16
  102. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes.php +0 -16
  103. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes/Collection.php +0 -16
  104. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate.php +0 -16
  105. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate/Collection.php +0 -16
  106. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job.php +0 -47
  107. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute.php +0 -16
  108. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute/Collection.php +0 -16
  109. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category.php +0 -16
  110. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category/Collection.php +0 -27
  111. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block.php +0 -16
  112. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block/Collection.php +0 -16
  113. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page.php +0 -16
  114. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page/Collection.php +0 -16
  115. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Collection.php +0 -16
  116. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product.php +0 -16
  117. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product/Collection.php +0 -27
  118. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status.php +0 -16
  119. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status/Collection.php +0 -16
  120. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type.php +0 -16
  121. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type/Collection.php +0 -16
  122. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes.php +0 -16
  123. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes/Collection.php +0 -16
  124. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate.php +0 -16
  125. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate/Collection.php +0 -16
  126. app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/System/Config/Source/SiteMode.php +0 -59
  127. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/AttributeController.php +0 -201
  128. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php +0 -219
  129. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/BlockController.php +0 -186
  130. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/PageController.php +0 -186
  131. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php +0 -131
  132. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php +0 -240
  133. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php +0 -207
  134. app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/CallbackController.php +0 -45
  135. app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-install-1.2.0.php +0 -22
  136. app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-upgrade-1.2.0-1.3.0.php +0 -11
  137. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/adminhtml.xml +0 -76
  138. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml +0 -156
  139. app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml +0 -167
  140. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/install-1.2.0.php +0 -752
  141. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.2.0-1.3.0.php +0 -358
  142. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.0-1.3.1.php +0 -91
  143. app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.3-1.3.4.php +0 -80
  144. package.xml +6 -6
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php DELETED
@@ -1,48 +0,0 @@
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 DELETED
@@ -1,49 +0,0 @@
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 DELETED
@@ -1,19 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,201 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,196 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,141 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,141 +0,0 @@
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 DELETED
@@ -1,140 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,196 +0,0 @@
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 DELETED
@@ -1,29 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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 DELETED
@@ -1,107 +0,0 @@
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 DELETED
@@ -1,197 +0,0 @@
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 DELETED
@@ -1,6 +0,0 @@
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 DELETED
@@ -1,40 +0,0 @@
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
- }
11
-
12
- /**
13
- * Prepare button and grid
14
- *
15
- * @return Mage_Adminhtml_Block_Catalog_Product
16
- */
17
- protected function _prepareLayout()
18
- {
19
- $this->_addButton('submit', array(
20
- 'label' => Mage::helper('catalog')->__('Submit'),
21
- 'onclick' => "$('submit-new-job-form').submit();",
22
- 'class' => 'task'
23
- ));
24
-
25
- $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_confirm_grid', 'category.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'category' => $this->getCategory())));
26
- return parent::_prepareLayout();
27
- }
28
-
29
-
30
- /**
31
- * Render grid
32
- *
33
- * @return string
34
- */
35
- public function getGridHtml()
36
- {
37
- return $this->getChildHtml('grid');
38
- }
39
-
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Confirm/Grid.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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
-
17
- protected function _getStore()
18
- {
19
- $storeId = (int) $this->getRequest()->getParam('store', 0);
20
- return Mage::app()->getStore($storeId);
21
- }
22
- protected function _prepareLayout()
23
- {
24
- return $this;
25
- }
26
- // protected function _prepareCollection()
27
- // {
28
- // $collection = Mage::getModel('catalog/category')->getCollection()
29
- // ->addAttributeToSelect('path')
30
- // ->addAttributeToSelect('name');
31
- // $collection->addAttributeToFilter('entity_id', array('in' => $this->getCategory()));
32
- //
33
- // foreach ($this->getAttrArray() as $attr){
34
- // $collection->addAttributeToSelect($attr);
35
- // }
36
- //
37
- // //join straker job product table to get version for each product
38
- // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
39
- // $collection->getSelect()->joinLeft(
40
- // $prefix.'straker_job_category',
41
- // $prefix.'straker_job_category.category_id = e.entity_id',
42
- // 'version'
43
- // );
44
- //
45
- // $this->setCollection($collection);
46
- //
47
- // parent::_prepareCollection();
48
- //// $this->getCollection()->addWebsiteNamesToResult();
49
- // return $this;
50
- // }
51
-
52
- protected function _prepareCollection()
53
- {
54
- /** @var Mage_Catalog_Model_Resource_Category_Collection $collection */
55
- $collection = Mage::getModel('catalog/category')->getCollection()
56
- ->addAttributeToSelect('path')
57
- ->addAttributeToSelect('name');
58
- $collection->addAttributeToFilter('entity_id', array('in' => $this->getCategory()));
59
-
60
- foreach ($this->getAttrArray() as $attr){
61
- $collection->addAttributeToSelect($attr);
62
- }
63
-
64
- $strakerJobCategoryTable = $collection->getResource()->getTable('strakertranslations_easytranslationplatform/job_category');
65
-
66
- //join straker job product table to get version for each product
67
-
68
- $collection->getSelect()->joinLeft(
69
- ['a' => $strakerJobCategoryTable ],
70
- 'a.category_id = e.entity_id AND a.version = 1',
71
- 'version'
72
- );
73
-
74
- $this->setCollection($collection);
75
-
76
- parent::_prepareCollection();
77
- // $this->getCollection()->addWebsiteNamesToResult();
78
- return $this;
79
- }
80
-
81
- // protected function _addColumnFilterToCollection($column)
82
- // {
83
- //
84
- // if ($column->getId() == 'version') {
85
- // $this->getCollection()->joinField('version',
86
- // 'straker_job_category',
87
- // 'version',
88
- // 'category_id=entity_id',
89
- // null,
90
- // 'left');
91
- // }
92
- //
93
- // }
94
-
95
- protected function _prepareColumns()
96
- {
97
-
98
- $this->addColumn('entity_id',
99
- array(
100
- 'header'=> Mage::helper('catalog')->__('ID'),
101
- 'width' => '50px',
102
- 'type' => 'number',
103
- 'index' => 'entity_id',
104
- 'filter' => false,
105
- 'sortable' => false
106
- ));
107
-
108
- if (in_array('name',$this->getAttrArray())) {
109
- $this->addColumn('name',
110
- array(
111
- 'header' => Mage::helper('catalog')->__('Name to Translate'),
112
- 'index' => 'name',
113
- 'filter' => false,
114
- 'sortable' => false
115
- ));
116
- }
117
- else{
118
- $this->addColumn('name',
119
- array(
120
- 'header' => Mage::helper('catalog')->__('Name'),
121
- 'index' => 'name',
122
- 'filter' => false,
123
- 'sortable' => false
124
- ));
125
- }
126
-
127
- $this->addColumn('path',
128
- array(
129
- 'header' => Mage::helper('catalog')->__('Path'),
130
- 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Path',
131
- 'index' => 'path',
132
- 'filter' => false,
133
- 'sortable' => false
134
- ));
135
-
136
- foreach ($this->getAttrArray() as $attr){
137
- if ($attr != 'name' && $attr != '') {
138
- $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(3, $attr);
139
- $this->addColumn($attr,
140
- array(
141
- 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
142
- 'index' => $attr,
143
- 'filter' => false,
144
- 'sortable' => false
145
- ));
146
- }
147
- }
148
-
149
- $this->addColumn('version',
150
- array(
151
- 'header'=> Mage::helper('catalog')->__('Translated'),
152
- 'width' => '70px',
153
- 'index' => 'version',
154
- 'type' => 'options',
155
- 'filter' => false,
156
- 'sortable' => false,
157
- 'options' => array(
158
- 1 => Mage::helper('catalog')->__('Translated'),
159
- '' => Mage::helper('catalog')->__('Not Translated')
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)
173
- {
174
- return '';
175
- }
176
-
177
- public function getAttrArray(){
178
- return explode(',', $this->getAttr());
179
- }
180
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Category/Tree.php DELETED
@@ -1,252 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Category_Tree extends Mage_Adminhtml_Block_Catalog_Category_Tree{
3
- public function __construct()
4
- {
5
- parent::__construct();
6
- $this->setTemplate('straker/new/category/tree.phtml');
7
- }
8
-
9
- protected $_categoryIds;
10
- protected $_selectedNodes = null;
11
-
12
- /**
13
- * Checks when this block is readonly
14
- *
15
- * @return boolean
16
- */
17
- public function isReadonly()
18
- {
19
- return false;
20
- // return $this->getProduct()->getCategoriesReadonly();
21
- }
22
-
23
- /**
24
- * Return array with category IDs which the product is assigned to
25
- *
26
- * @return array
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();
38
- }
39
-
40
- /**
41
- * Forms string out of getCategoryIds()
42
- *
43
- * @return string
44
- */
45
- public function getIdsString()
46
- {
47
- return implode(',', $this->getCategoryIds());
48
- }
49
-
50
- /**
51
- * Returns root node and sets 'checked' flag (if necessary)
52
- *
53
- * @return Varien_Data_Tree_Node
54
- */
55
- public function getRootNode()
56
- {
57
- $root = $this->getRoot();
58
- if ($root && in_array($root->getId(), $this->getCategoryIds())) {
59
- $root->setChecked(true);
60
- }
61
- return $root;
62
- }
63
-
64
- /**
65
- * Returns root node
66
- *
67
- * @param Mage_Catalog_Model_Category|null $parentNodeCategory
68
- * @param int $recursionLevel
69
- * @return Varien_Data_Tree_Node
70
- */
71
- public function getRoot($parentNodeCategory = null, $recursionLevel = 3)
72
- {
73
- if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
74
- return $this->getNode($parentNodeCategory, $recursionLevel);
75
- }
76
- $root = Mage::registry('root');
77
- if (is_null($root)) {
78
- $storeId = (int) $this->getRequest()->getParam('store');
79
-
80
- if ($storeId) {
81
- $store = Mage::app()->getStore($storeId);
82
- $rootId = $store->getRootCategoryId();
83
- }
84
- else {
85
- $rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
86
- }
87
-
88
- $ids = $this->getSelectedCategoriesPathIds($rootId);
89
- $tree = Mage::getResourceSingleton('catalog/category_tree')
90
- ->loadByIds($ids, false, false);
91
-
92
- if ($this->getCategory()) {
93
- $tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
94
- }
95
-
96
- $tree->addCollectionData($this->getCategoryCollection());
97
-
98
- $root = $tree->getNodeById($rootId);
99
-
100
- if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
101
- $root->setIsVisible(true);
102
- if ($this->isReadonly()) {
103
- $root->setDisabled(true);
104
- }
105
- }
106
- elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
107
- $root->setName(Mage::helper('catalog')->__('Root'));
108
- }
109
-
110
- Mage::register('root', $root);
111
- }
112
-
113
- return $root;
114
- }
115
-
116
- /**
117
- * Returns array with configuration of current node
118
- *
119
- * @param Varien_Data_Tree_Node $node
120
- * @param int $level How deep is the node in the tree
121
- * @return array
122
- */
123
- protected function _getNodeJson($node, $level = 1)
124
- {
125
- $item = parent::_getNodeJson($node, $level);
126
-
127
- if ($this->_isParentSelectedCategory($node)) {
128
- $item['expanded'] = true;
129
- }
130
-
131
- if (in_array($node->getId(), $this->getCategoryIds())) {
132
- $item['checked'] = true;
133
- }
134
-
135
- if ($this->isReadonly()) {
136
- $item['disabled'] = true;
137
- }
138
-
139
- return $item;
140
- }
141
-
142
- /**
143
- * Returns whether $node is a parent (not exactly direct) of a selected node
144
- *
145
- * @param Varien_Data_Tree_Node $node
146
- * @return bool
147
- */
148
- protected function _isParentSelectedCategory($node)
149
- {
150
- foreach ($this->_getSelectedNodes() as $selected) {
151
- if ($selected) {
152
- $pathIds = explode('/', $selected->getPathId());
153
- if (in_array($node->getId(), $pathIds)) {
154
- return true;
155
- }
156
- }
157
- }
158
-
159
- return false;
160
- }
161
-
162
- /**
163
- * Returns array with nodes those are selected (contain current product)
164
- *
165
- * @return array
166
- */
167
- protected function _getSelectedNodes()
168
- {
169
- if ($this->_selectedNodes === null) {
170
- $this->_selectedNodes = array();
171
- $root = $this->getRoot();
172
- foreach ($this->getCategoryIds() as $categoryId) {
173
- if ($root) {
174
- $this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
175
- }
176
- }
177
- }
178
-
179
- return $this->_selectedNodes;
180
- }
181
-
182
- /**
183
- * Returns JSON-encoded array of category children
184
- *
185
- * @param int $categoryId
186
- * @return string
187
- */
188
- public function getCategoryChildrenJson($categoryId)
189
- {
190
- $category = Mage::getModel('catalog/category')->load($categoryId);
191
- $node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
192
-
193
- if (!$node || !$node->hasChildren()) {
194
- return '[]';
195
- }
196
-
197
- $children = array();
198
- foreach ($node->getChildren() as $child) {
199
- $children[] = $this->_getNodeJson($child);
200
- }
201
-
202
- return Mage::helper('core')->jsonEncode($children);
203
- }
204
-
205
- /**
206
- * Returns URL for loading tree
207
- *
208
- * @param null $expanded
209
- * @return string
210
- */
211
- public function getLoadTreeUrl($expanded = null)
212
- {
213
- return $this->getUrl('*/*/categoriesJson', array('_current' => true));
214
- }
215
-
216
- /**
217
- * Return distinct path ids of selected categories
218
- *
219
- * @param mixed $rootId Root category Id for context
220
- * @return array
221
- */
222
- public function getSelectedCategoriesPathIds($rootId = false)
223
- {
224
- $ids = array();
225
- $categoryIds = $this->getCategoryIds();
226
- if (empty($categoryIds)) {
227
- return array();
228
- }
229
- $collection = Mage::getResourceModel('catalog/category_collection');
230
-
231
- if ($rootId) {
232
- $collection->addFieldToFilter(array(
233
- array('attribute' => 'parent_id', 'eq' => $rootId),
234
- array('attribute' => 'entity_id', 'in' => $categoryIds)
235
- ));
236
- } else {
237
- $collection->addFieldToFilter('entity_id', array('in' => $categoryIds));
238
- }
239
-
240
- foreach ($collection as $item) {
241
- if ($rootId && !in_array($rootId, $item->getPathIds())) {
242
- continue;
243
- }
244
- foreach ($item->getPathIds() as $id) {
245
- if (!in_array($id, $ids)) {
246
- $ids[] = $id;
247
- }
248
- }
249
- }
250
- return $ids;
251
- }
252
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block 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/cms/block.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->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block_grid', 'cms_block.grid', array('setup_store_id' => $this->getSetupStoreId(), 'attr' => $this->getAttr())));
21
- return parent::_prepareLayout();
22
- }
23
-
24
-
25
- /**
26
- * Render grid
27
- *
28
- * @return string
29
- */
30
- public function getGridHtml()
31
- {
32
- return $this->getChildHtml('grid');
33
- }
34
-
35
- /**
36
- * Check whether it is single store mode
37
- *
38
- * @return bool
39
- */
40
- public function isSingleStoreMode()
41
- {
42
- if (!Mage::app()->isSingleStoreMode()) {
43
- return false;
44
- }
45
- return true;
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Attribute.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- private static $_cmsBlockAttributes = array(
5
- 'title' => 'Title',
6
- 'content' => 'Content',
7
- );
8
-
9
- protected function _beforeToHtml(){
10
- $this->setTemplate('straker/new/cms/block/attributes.phtml');
11
- }
12
-
13
- public function getAttributes(){
14
- return self::$_cmsBlockAttributes;
15
- }
16
-
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_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/cms/block/confirm.phtml');
11
- }
12
-
13
-
14
- protected function _prepareLayout()
15
- {
16
- $this->_addButton('submit', array(
17
- 'label' => Mage::helper('catalog')->__('Submit'),
18
- 'onclick' => "$('submit-new-job-form').submit();",
19
- 'class' => 'task'
20
- ));
21
-
22
- $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block_confirm_grid', 'cms_block.grid', array('store' => $this->getStore(), 'cms_block' => $this->getCmsBlock())));
23
- return parent::_prepareLayout();
24
- }
25
-
26
- /**
27
- * Render grid
28
- *
29
- * @return string
30
- */
31
- public function getGridHtml()
32
- {
33
- return $this->getChildHtml('grid');
34
- }
35
-
36
- /**
37
- * Check whether it is single store mode
38
- *
39
- * @return bool
40
- */
41
- public function isSingleStoreMode()
42
- {
43
- if (!Mage::app()->isSingleStoreMode()) {
44
- return false;
45
- }
46
- return true;
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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
- {
18
- $collection = Mage::getModel('cms/block')->getCollection()->addFieldToFilter('block_id', $this->getCmsBlock());
19
- /* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
20
- $this->setCollection($collection);
21
- return parent::_prepareCollection();
22
- }
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()) {
41
- $this->addColumn('store_id', array(
42
- 'header' => Mage::helper('cms')->__('Store View'),
43
- 'index' => 'store_id',
44
- 'type' => 'store',
45
- 'store_all' => true,
46
- 'store_view' => true,
47
- 'sortable' => false,
48
- 'filter_condition_callback'
49
- => array($this, '_filterStoreCondition'),
50
- ));
51
- }
52
-
53
- $this->addColumn('is_active', array(
54
- 'header' => Mage::helper('cms')->__('Status'),
55
- 'index' => 'is_active',
56
- 'type' => 'options',
57
- 'options' => array(
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
-
78
- protected function _afterLoadCollection()
79
- {
80
- $this->getCollection()->walk('afterLoad');
81
- parent::_afterLoadCollection();
82
- }
83
-
84
- protected function _filterStoreCondition($collection, $column)
85
- {
86
- if (!$value = $column->getFilter()->getValue()) {
87
- return;
88
- }
89
-
90
- $this->getCollection()->addStoreFilter($value);
91
- }
92
- public function getRowUrl($row)
93
- {
94
- return '';
95
- }
96
-
97
- protected function _getStore()
98
- {
99
- $storeId = (int) $this->getRequest()->getParam('store', 0);
100
- return Mage::app()->getStore($storeId);
101
- }
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Block_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
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()
16
- {
17
- $collection = Mage::getModel('cms/block')->getCollection();
18
- /* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
19
- $this->setCollection($collection);
20
- return parent::_prepareCollection();
21
- }
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',
30
- 'index' => 'title',
31
- ));
32
-
33
- $this->addColumn('identifier', array(
34
- 'header' => Mage::helper('cms')->__('Identifier'),
35
- 'align' => 'left',
36
- 'index' => 'identifier'
37
- ));
38
-
39
- if (!Mage::app()->isSingleStoreMode()) {
40
- $this->addColumn('store_id', array(
41
- 'header' => Mage::helper('cms')->__('Store View'),
42
- 'index' => 'store_id',
43
- 'type' => 'store',
44
- 'store_all' => true,
45
- 'store_view' => true,
46
- 'sortable' => false,
47
- 'filter_condition_callback'
48
- => array($this, '_filterStoreCondition'),
49
- ));
50
- }
51
-
52
- $this->addColumn('is_active', array(
53
- 'header' => Mage::helper('cms')->__('Status'),
54
- 'index' => 'is_active',
55
- 'type' => 'options',
56
- 'options' => array(
57
- 0 => Mage::helper('cms')->__('Disabled'),
58
- 1 => Mage::helper('cms')->__('Enabled')
59
- ),
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
- return parent::_prepareColumns();
75
- }
76
-
77
- protected function _afterLoadCollection()
78
- {
79
- $this->getCollection()->walk('afterLoad');
80
- parent::_afterLoadCollection();
81
- }
82
-
83
- protected function _filterStoreCondition($collection, $column)
84
- {
85
- if (!$value = $column->getFilter()->getValue()) {
86
- return;
87
- }
88
-
89
- $this->getCollection()->addStoreFilter($value);
90
- }
91
-
92
- protected function _prepareMassaction()
93
- {
94
- $this->setMassactionIdField('entity_id');
95
- $this->getMassactionBlock()->setFormFieldName('cms_block');
96
-
97
- $this->getMassactionBlock()->addItem('add', array(
98
- 'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
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().'" />';
106
- $hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
107
- $this->getMassactionBlock()->setHiddenParams($hiddenParams);
108
-
109
-
110
- Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
111
- return $this;
112
- }
113
-
114
- public function getRowUrl($row)
115
- {
116
- return '';
117
- }
118
-
119
- protected function _getStore()
120
- {
121
- $storeId = (int) $this->getRequest()->getParam('store', 0);
122
- return Mage::app()->getStore($storeId);
123
- }
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page 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/cms/page.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->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page_grid', 'cms_page.grid', array('setup_store_id' => $this->getSetupStoreId(), 'attr' => $this->getAttr())));
21
- return parent::_prepareLayout();
22
- }
23
-
24
-
25
- /**
26
- * Render grid
27
- *
28
- * @return string
29
- */
30
- public function getGridHtml()
31
- {
32
- return $this->getChildHtml('grid');
33
- }
34
-
35
- /**
36
- * Check whether it is single store mode
37
- *
38
- * @return bool
39
- */
40
- public function isSingleStoreMode()
41
- {
42
- if (!Mage::app()->isSingleStoreMode()) {
43
- return false;
44
- }
45
- return true;
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Attribute.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- private static $_cmsPageAttributes = array(
5
- 'title' => 'Title',
6
- 'meta_keywords' => 'Meta Keywords',
7
- 'meta_description' => 'Meta Description',
8
- 'content_heading' => 'Content Heading',
9
- 'content' => 'Content',
10
- );
11
-
12
- protected function _beforeToHtml(){
13
- $this->setTemplate('straker/new/cms/page/attributes.phtml');
14
- }
15
-
16
- public function getAttributes(){
17
- return self::$_cmsPageAttributes;
18
- }
19
-
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_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/cms/page/confirm.phtml');
11
- }
12
-
13
-
14
- protected function _prepareLayout()
15
- {
16
- $this->_addButton('submit', array(
17
- 'label' => Mage::helper('catalog')->__('Submit'),
18
- 'onclick' => "$('submit-new-job-form').submit();",
19
- 'class' => 'task'
20
- ));
21
-
22
- $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page_confirm_grid', 'cms_page.grid', array('store' => $this->getStore(), 'cms_page' => $this->getCmsPage(), 'attr' => $this->getAttr())));
23
- return parent::_prepareLayout();
24
- }
25
-
26
- /**
27
- * Render grid
28
- *
29
- * @return string
30
- */
31
- public function getGridHtml()
32
- {
33
- return $this->getChildHtml('grid');
34
- }
35
-
36
- /**
37
- * Check whether it is single store mode
38
- *
39
- * @return bool
40
- */
41
- public function isSingleStoreMode()
42
- {
43
- if (!Mage::app()->isSingleStoreMode()) {
44
- return false;
45
- }
46
- return true;
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php DELETED
@@ -1,109 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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()
16
- {
17
- $collection = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('page_id', array('in' => $this->getCmsPage()));
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
- /**
42
- * Check is single store mode
43
- */
44
- if (!Mage::app()->isSingleStoreMode()) {
45
- $this->addColumn('store_id', array(
46
- 'header' => Mage::helper('cms')->__('Store View'),
47
- 'index' => 'store_id',
48
- 'type' => 'store',
49
- 'store_all' => true,
50
- 'store_view' => true,
51
- 'sortable' => false,
52
- ));
53
- }
54
-
55
- $this->addColumn('is_active', array(
56
- 'header' => Mage::helper('cms')->__('Status'),
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();
82
- }
83
-
84
- protected function _afterLoadCollection()
85
- {
86
- $this->getCollection()->walk('afterLoad');
87
- parent::_afterLoadCollection();
88
- }
89
-
90
- protected function _filterStoreCondition($collection, $column)
91
- {
92
- if (!$value = $column->getFilter()->getValue()) {
93
- return;
94
- }
95
-
96
- $this->getCollection()->addStoreFilter($value);
97
- }
98
-
99
- public function getRowUrl($row)
100
- {
101
- return '';
102
- }
103
-
104
- protected function _getStore()
105
- {
106
- $storeId = (int) $this->getRequest()->getParam('store', 0);
107
- return Mage::app()->getStore($storeId);
108
- }
109
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php DELETED
@@ -1,136 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Cms_Page_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
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()
16
- {
17
- /* @var $collection Mage_Cms_Model_Mysql4_Page_Collection */
18
- $collection = Mage::getModel('cms/page')->getCollection();
19
- //todo: should add $collection->addStoreFilter(sourceStoreId);
20
- $collection->setFirstStoreFlag(true);
21
- //var_dump($collection->getSelect()->__toString());exit;
22
- $this->setCollection($collection);
23
-
24
- return parent::_prepareCollection();
25
- }
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',
34
- 'index' => 'title',
35
- ));
36
-
37
- $this->addColumn('identifier', array(
38
- 'header' => Mage::helper('cms')->__('URL Key'),
39
- 'align' => 'left',
40
- 'index' => 'identifier'
41
- ));
42
-
43
- /**
44
- * Check is single store mode
45
- */
46
- if (!Mage::app()->isSingleStoreMode()) {
47
- $this->addColumn('store_id', array(
48
- 'header' => Mage::helper('cms')->__('Store View'),
49
- 'index' => 'store_id',
50
- 'type' => 'store',
51
- 'store_all' => true,
52
- 'store_view' => true,
53
- 'sortable' => false,
54
- 'filter_condition_callback'
55
- => array($this, '_filterStoreCondition'),
56
- ));
57
- }
58
-
59
- $this->addColumn('is_active', array(
60
- 'header' => Mage::helper('cms')->__('Status'),
61
- 'index' => 'is_active',
62
- 'type' => 'options',
63
- 'options' => Mage::getSingleton('cms/page')->getAvailableStatuses()
64
- ));
65
-
66
- $this->addColumn('creation_time', array(
67
- 'header' => Mage::helper('cms')->__('Date Created'),
68
- 'index' => 'creation_time',
69
- 'type' => 'datetime',
70
- ));
71
-
72
- $this->addColumn('update_time', array(
73
- 'header' => Mage::helper('cms')->__('Last Modified'),
74
- 'index' => 'update_time',
75
- 'type' => 'datetime',
76
- ));
77
-
78
- $this->addColumn('page_actions', array(
79
- 'header' => Mage::helper('cms')->__('Action'),
80
- 'width' => 10,
81
- 'sortable' => false,
82
- 'filter' => false,
83
- 'renderer' => 'adminhtml/cms_page_grid_renderer_action',
84
- ));
85
-
86
- return parent::_prepareColumns();
87
- }
88
-
89
- protected function _afterLoadCollection()
90
- {
91
- $this->getCollection()->walk('afterLoad');
92
- parent::_afterLoadCollection();
93
- }
94
-
95
- protected function _filterStoreCondition($collection, $column)
96
- {
97
- if (!$value = $column->getFilter()->getValue()) {
98
- return;
99
- }
100
-
101
- $this->getCollection()->addStoreFilter($value);
102
- }
103
-
104
- protected function _prepareMassaction()
105
- {
106
- $this->setMassactionIdField('entity_id');
107
- $this->getMassactionBlock()->setFormFieldName('cms_page');
108
-
109
- $this->getMassactionBlock()->addItem('add', array(
110
- 'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
111
- 'url' => $this->getUrl('*/*/addtoconfirm'),
112
- 'selected' => 1
113
- ));
114
- $this->getMassactionBlock()->setTemplate('straker/new/cms/page/massaction.phtml');
115
-
116
- //todo: refine this
117
- $hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
118
- $hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
119
- $this->getMassactionBlock()->setHiddenParams($hiddenParams);
120
-
121
-
122
- Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
123
- return $this;
124
- }
125
-
126
- public function getRowUrl($row)
127
- {
128
- return '';
129
- }
130
-
131
- protected function _getStore()
132
- {
133
- $storeId = (int) $this->getRequest()->getParam('store', 0);
134
- return Mage::app()->getStore($storeId);
135
- }
136
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_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/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
- // 'onclick' => "setLocation('{$this->getUrl('*/*/submit')}')",
24
- 'class' => 'task'
25
- ));
26
-
27
- $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_confirm_grid', 'product.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'product' => $this->getProduct())));
28
- return parent::_prepareLayout();
29
- }
30
-
31
-
32
- /**
33
- * Render grid
34
- *
35
- * @return string
36
- */
37
- public function getGridHtml()
38
- {
39
- return $this->getChildHtml('grid');
40
- }
41
-
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Confirm/Grid.php DELETED
@@ -1,150 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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()
17
- {
18
- $storeId = (int) $this->getRequest()->getParam('store', 0);
19
- return Mage::app()->getStore($storeId);
20
- }
21
- protected function _prepareLayout()
22
- {
23
- return $this;
24
- }
25
- protected function _prepareCollection()
26
- {
27
- $store = $this->_getStore();
28
- $collection = Mage::getModel('catalog/product')->getCollection()
29
- ->addAttributeToSelect('sku')
30
- ->addAttributeToSelect('name')
31
- ->addAttributeToSelect('type_id');
32
- $collection->addAttributeToFilter('entity_id', array('in' => $this->getProduct()));
33
-
34
- foreach ($this->getAttrArray() as $attr){
35
- $collection->addAttributeToSelect($attr);
36
- }
37
- if ($store->getId()) {
38
- //$collection->setStoreId($store->getId());
39
- $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
- $collection->addStoreFilter($store);
41
- $collection->joinAttribute(
42
- 'name',
43
- 'catalog_product/name',
44
- 'entity_id',
45
- null,
46
- 'inner',
47
- $adminStore
48
- );
49
- $collection->joinAttribute(
50
- 'status',
51
- 'catalog_product/status',
52
- 'entity_id',
53
- null,
54
- 'inner',
55
- $store->getId()
56
- );
57
- $collection->joinAttribute(
58
- 'visibility',
59
- 'catalog_product/visibility',
60
- 'entity_id',
61
- null,
62
- 'inner',
63
- $store->getId()
64
- );
65
- }
66
- else {
67
- $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
68
- $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
69
- }
70
-
71
- $this->setCollection($collection);
72
-
73
- parent::_prepareCollection();
74
- $this->getCollection()->addWebsiteNamesToResult();
75
- return $this;
76
- }
77
-
78
- protected function _addColumnFilterToCollection($column)
79
- {
80
- if ($this->getCollection()) {
81
- if ($column->getId() == 'websites') {
82
- $this->getCollection()->joinField('websites',
83
- 'catalog/product_website',
84
- 'website_id',
85
- 'product_id=entity_id',
86
- null,
87
- 'left');
88
- }
89
- }
90
- return parent::_addColumnFilterToCollection($column);
91
- }
92
-
93
- protected function _prepareColumns()
94
- {
95
-
96
- $this->addColumn('entity_id',
97
- array(
98
- 'header'=> Mage::helper('catalog')->__('ID'),
99
- 'width' => '50px',
100
- 'type' => 'number',
101
- 'index' => 'entity_id',
102
- 'filter' => false,
103
- ));
104
-
105
- if (in_array('name',$this->getAttrArray())) {
106
- $this->addColumn('name',
107
- array(
108
- 'header' => Mage::helper('catalog')->__('Name to translate'),
109
- 'index' => 'name',
110
- 'filter' => false,
111
- ));
112
- }
113
- else{
114
- $this->addColumn('name',
115
- array(
116
- 'header' => Mage::helper('catalog')->__('Name'),
117
- 'index' => 'name',
118
- 'filter' => false,
119
- ));
120
- }
121
-
122
- foreach ($this->getAttrArray() as $attr){
123
- if ($attr!='name') {
124
- $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
125
- $this->addColumn($attr,
126
- array(
127
- 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
128
- 'index' => $attr,
129
- 'filter' => false,
130
- ));
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)
143
- {
144
- return '';
145
- }
146
-
147
- public function getAttrArray(){
148
- return explode(',', $this->getAttr());
149
- }
150
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products 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/products.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('add_new', array(
21
- // 'label' => Mage::helper('catalog')->__('Add Product'),
22
- // 'onclick' => "setLocation('{$this->getUrl('*/*/new')}')",
23
- // 'class' => 'add'
24
- // ));
25
-
26
- $this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_grid', 'product.grid', array('setup_store_id' => $this->getSetupStoreId(), 'attr' => $this->getAttr())));
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
- /**
42
- * Check whether it is single store mode
43
- *
44
- * @return bool
45
- */
46
- public function isSingleStoreMode()
47
- {
48
- if (!Mage::app()->isSingleStoreMode()) {
49
- return false;
50
- }
51
- return true;
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Attribute.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Attribute extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- private static $_excludeAttributes = array(
5
- 'name',
6
- 'short_description',
7
- 'description',
8
- 'meta_title',
9
- 'meta_description',
10
- 'meta_keyword',
11
- 'image_label',
12
- 'small_image_label',
13
- 'thumbnail_label',
14
- 'url_path',
15
- 'custom_layout_update',
16
- 'email_template',
17
- 'url_key'
18
- );
19
-
20
- protected function _beforeToHtml(){
21
- $this->setTemplate('straker/new/products/attributes.phtml');
22
- }
23
-
24
- public function getAttributes(){
25
- $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
26
- ->setEntityTypeFilter(4)
27
- ->addFieldToFilter('backend_type', array('in' => array('varchar', 'text')))
28
- ->setFrontendInputTypeFilter(array('in' => array('text', 'textarea')))
29
- ->addFieldToFilter('attribute_code', array('nin' => self::$_excludeAttributes));
30
- return $attributes;
31
- }
32
-
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Confirm.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_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/products/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_products_confirm_grid', 'product.grid', array('store' => $this->getStore(), 'attr' => $this->getAttr(), 'product' => $this->getProduct())));
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/Products/Confirm/Grid.php DELETED
@@ -1,150 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Confirm_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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()
17
- {
18
- $storeId = (int) $this->getRequest()->getParam('store', 0);
19
- return Mage::app()->getStore($storeId);
20
- }
21
- protected function _prepareLayout()
22
- {
23
- return $this;
24
- }
25
- protected function _prepareCollection()
26
- {
27
- $store = $this->_getStore();
28
- $collection = Mage::getModel('catalog/product')->getCollection()
29
- ->addAttributeToSelect('sku')
30
- ->addAttributeToSelect('name')
31
- ->addAttributeToSelect('type_id');
32
- $collection->addAttributeToFilter('entity_id', array('in' => $this->getProduct()));
33
-
34
- foreach ($this->getAttrArray() as $attr){
35
- $collection->addAttributeToSelect($attr);
36
- }
37
- if ($store->getId()) {
38
- //$collection->setStoreId($store->getId());
39
- $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
40
- $collection->addStoreFilter($store);
41
- $collection->joinAttribute(
42
- 'name',
43
- 'catalog_product/name',
44
- 'entity_id',
45
- null,
46
- 'inner',
47
- $adminStore
48
- );
49
- $collection->joinAttribute(
50
- 'status',
51
- 'catalog_product/status',
52
- 'entity_id',
53
- null,
54
- 'inner',
55
- $store->getId()
56
- );
57
- $collection->joinAttribute(
58
- 'visibility',
59
- 'catalog_product/visibility',
60
- 'entity_id',
61
- null,
62
- 'inner',
63
- $store->getId()
64
- );
65
- }
66
- else {
67
- $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
68
- $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
69
- }
70
-
71
- $this->setCollection($collection);
72
-
73
- parent::_prepareCollection();
74
- $this->getCollection()->addWebsiteNamesToResult();
75
- return $this;
76
- }
77
-
78
- protected function _addColumnFilterToCollection($column)
79
- {
80
- if ($this->getCollection()) {
81
- if ($column->getId() == 'websites') {
82
- $this->getCollection()->joinField('websites',
83
- 'catalog/product_website',
84
- 'website_id',
85
- 'product_id=entity_id',
86
- null,
87
- 'left');
88
- }
89
- }
90
- return parent::_addColumnFilterToCollection($column);
91
- }
92
-
93
- protected function _prepareColumns()
94
- {
95
-
96
- $this->addColumn('entity_id',
97
- array(
98
- 'header'=> Mage::helper('catalog')->__('ID'),
99
- 'width' => '50px',
100
- 'type' => 'number',
101
- 'index' => 'entity_id',
102
- 'filter' => false,
103
- ));
104
-
105
- if (in_array('name',$this->getAttrArray())) {
106
- $this->addColumn('name',
107
- array(
108
- 'header' => Mage::helper('catalog')->__('Name to Translate'),
109
- 'index' => 'name',
110
- 'filter' => false,
111
- ));
112
- }
113
- else{
114
- $this->addColumn('name',
115
- array(
116
- 'header' => Mage::helper('catalog')->__('Name'),
117
- 'index' => 'name',
118
- 'filter' => false,
119
- ));
120
- }
121
-
122
- foreach ($this->getAttrArray() as $attr){
123
- if ($attr!='name') {
124
- $attrModel = Mage::getModel('eav/entity_attribute')->loadByCode(4, $attr);
125
- $this->addColumn($attr,
126
- array(
127
- 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()) .' to Translate',
128
- 'index' => $attr,
129
- 'filter' => false,
130
- ));
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)
143
- {
144
- return '';
145
- }
146
-
147
- public function getAttrArray(){
148
- return explode(',', $this->getAttr());
149
- }
150
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Products/Grid.php DELETED
@@ -1,277 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Products_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
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()
17
- {
18
- $storeId = (int) $this->getRequest()->getParam('store', 0);
19
- return Mage::app()->getStore($storeId);
20
- }
21
-
22
- protected function _prepareCollection()
23
- {
24
- $store = $this->_getStore();
25
- /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
26
- $collection = Mage::getModel('catalog/product')->getCollection()
27
- ->addAttributeToSelect('sku')
28
- ->addAttributeToSelect('name')
29
- ->addAttributeToSelect('type_id');
30
-
31
- foreach ($this->getAttrArray() as $attr){
32
- $collection->addAttributeToSelect($attr);
33
- }
34
- if ($store->getId()) {
35
- //$collection->setStoreId($store->getId());
36
- $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
37
- $collection->addStoreFilter($store);
38
- $collection->joinAttribute(
39
- 'name',
40
- 'catalog_product/name',
41
- 'entity_id',
42
- null,
43
- 'inner',
44
- $adminStore
45
- );
46
- $collection->joinAttribute(
47
- 'status',
48
- 'catalog_product/status',
49
- 'entity_id',
50
- null,
51
- 'inner',
52
- $store->getId()
53
- );
54
- $collection->joinAttribute(
55
- 'visibility',
56
- 'catalog_product/visibility',
57
- 'entity_id',
58
- null,
59
- 'inner',
60
- $store->getId()
61
- );
62
- }
63
- else {
64
- $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
65
- $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
66
- }
67
- // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
68
- // $jobProductQuery = 'select a.`version`, a.`product_id` from `'.$prefix.'straker_job_product` as a
69
- // left join `'.$prefix.'straker_job` as b on a.`job_id`=b.`id`
70
- // where b.`store_id` = '.$store->getId().' and a.`version` =1
71
- // GROUP BY a.`product_id`';
72
-
73
- //join straker job product table to get version for each product
74
- // $collection->getSelect()->joinLeft(
75
- //
76
- // new Zend_Db_Expr('('.$jobProductQuery.')'),
77
- // 'e.entity_id = t.product_id',
78
- // array('version')
79
- //
80
- // );
81
- /** @var StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product_Collection $strakerJobProductCollection */
82
- $strakerJobProductCollection = Mage::getModel('strakertranslations_easytranslationplatform/job_product')->getCollection();
83
- $strakerJobProductCollection->getSelect()
84
- ->reset(Zend_Db_Select::COLUMNS)
85
- ->joinLeft(
86
- ['b' => $collection->getTable('strakertranslations_easytranslationplatform/job')],
87
- '`main_table`.`job_id` = `b`.`id`',
88
- []
89
- )->where(
90
- '`b`.`store_id` = ?', $store->getId()
91
- )->where(
92
- '`main_table`.`version` = ?', 1
93
- )->group(
94
- 'main_table.product_id'
95
- )->columns(
96
- ['version' => 'version', 'product_id' => 'product_id']
97
- );
98
- $jobProductQuery = $strakerJobProductCollection->getSelect();
99
- $collection->getSelect()->joinLeft(
100
- $jobProductQuery,
101
- 'e.entity_id = t.product_id',
102
- array('version')
103
- );
104
-
105
- $this->setCollection($collection);
106
-
107
- parent::_prepareCollection();
108
- $this->getCollection()->addWebsiteNamesToResult();
109
- return $this;
110
- }
111
-
112
- protected function _addColumnFilterToCollection($column)
113
- {
114
- if ($this->getCollection()) {
115
- if ($column->getId() == 'websites') {
116
- $this->getCollection()->joinField('websites',
117
- 'catalog/product_website',
118
- 'website_id',
119
- 'product_id=entity_id',
120
- null,
121
- 'left');
122
- }
123
- //
124
- // if ($column->getId() == 'version') {
125
- // $this->getCollection()->joinField('version',
126
- // 'straker_job_product',
127
- // 'version',
128
- // 'product_id=entity_id',
129
- // null,
130
- // 'left');
131
- // }
132
-
133
- }
134
- return parent::_addColumnFilterToCollection($column);
135
- }
136
-
137
- protected function _prepareColumns()
138
- {
139
- $this->addColumn('entity_id',
140
- array(
141
- 'header'=> Mage::helper('catalog')->__('ID'),
142
- 'width' => '50px',
143
- 'type' => 'number',
144
- 'index' => 'entity_id',
145
- ));
146
- if (in_array('name',$this->getAttrArray())) {
147
- $this->addColumn('name',
148
- array(
149
- 'header' => Mage::helper('catalog')->__('Name to Translate'),
150
- 'index' => 'name',
151
- ));
152
- }
153
- else{
154
- $this->addColumn('name',
155
- array(
156
- 'header' => Mage::helper('catalog')->__('Name'),
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);
163
- $this->addColumn($attr,
164
- array(
165
- 'header' => Mage::helper('catalog')->__($attrModel->getFrontendLabel()).' To Translate',
166
- 'index' => $attr,
167
- ));
168
- }
169
- }
170
-
171
- $this->addColumn('type',
172
- array(
173
- 'header'=> Mage::helper('catalog')->__('Type'),
174
- 'width' => '60px',
175
- 'index' => 'type_id',
176
- 'type' => 'options',
177
- 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
178
- ));
179
- $this->addColumn('visibility',
180
- array(
181
- 'header'=> Mage::helper('catalog')->__('Visibility'),
182
- 'width' => '70px',
183
- 'index' => 'visibility',
184
- 'type' => 'options',
185
- 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
186
- ));
187
-
188
- $this->addColumn('status',
189
- array(
190
- 'header'=> Mage::helper('catalog')->__('Status'),
191
- 'width' => '70px',
192
- 'index' => 'status',
193
- 'type' => 'options',
194
- 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
195
- ));
196
-
197
- $this->addColumn('version',
198
- array(
199
- 'header'=> Mage::helper('catalog')->__('Translated'),
200
- 'width' => '70px',
201
- 'index' => 'version',
202
- 'type' => 'options',
203
- 'options' => array(
204
- 'Translated' => Mage::helper('catalog')->__('Translated'),
205
- 'Not Translated' => Mage::helper('catalog')->__('Not Translated')
206
- ),
207
- 'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Translated',
208
- 'filter_condition_callback' => array($this, '_versionFilter'),
209
- ));
210
-
211
- if (!Mage::app()->isSingleStoreMode()) {
212
- $this->addColumn('websites',
213
- array(
214
- 'header'=> Mage::helper('catalog')->__('Websites'),
215
- 'width' => '100px',
216
- 'sortable' => false,
217
- 'index' => 'websites',
218
- 'type' => 'options',
219
- 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
220
- ));
221
- }
222
-
223
- return parent::_prepareColumns();
224
- }
225
-
226
- protected function _versionFilter($collection, $column)
227
- {
228
- if (!$value = $column->getFilter()->getValue()) {
229
- return $this;
230
- }
231
-
232
- if ($value == 'Translated' ){
233
- $this->getCollection()->getSelect()->where('t.version is not null');
234
-
235
- } elseif ($value == 'Not Translated'){
236
- $this->getCollection()->getSelect()->where('t.version is null');
237
- }
238
-
239
- return $this;
240
- }
241
-
242
- protected function _prepareMassaction()
243
- {
244
- $this->setMassactionIdField('entity_id');
245
- $this->getMassactionBlock()->setFormFieldName('product');
246
-
247
- $this->getMassactionBlock()->addItem('add', array(
248
- 'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
249
- 'url' => $this->getUrl('*/*/addtoconfirm'),
250
- 'selected' => 1
251
- ));
252
- $this->getMassactionBlock()->setTemplate('straker/new/products/massaction.phtml');
253
-
254
- //todo: refine this
255
- $hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
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)
270
- {
271
- return '';
272
- }
273
-
274
- public function getAttrArray(){
275
- return explode(',', $this->getAttr());
276
- }
277
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Register.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Register extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- protected $_countires;
5
-
6
- protected function _beforeToHtml(){
7
- $this->setTemplate('straker/new/register.phtml');
8
- }
9
-
10
- public function renderWelcomeIframe(){
11
- // return '<div id="white-iframe" style="background: white; border: 5px solid black; min-height: 200px; padding:20px; margin-bottom: 20px;">
12
- // <h3>First time iFrame provided by Straker</h3>
13
- // </div>';
14
- return '<div class="magento-banner-wrap"><img src="/skin/adminhtml/default/straker/images/magento-banner.jpg"></div>';
15
- }
16
-
17
- public function renderCountriesSelect($name){
18
- if (!$this->_countires) {
19
- $this->_countires = Mage::getModel('strakertranslations_easytranslationplatform/api')->getCountries();
20
- }
21
- $html = '<select class="validate-select" name="'.$name.'">';
22
- $html .= '<option value="">' . $this->__('Select a country') . '</option>';
23
- if ($this->_countires) {
24
- foreach ($this->_countires as $country) {
25
- $html .= '<option value="' . $country->code . '">' . $country->name . '</option>';
26
- }
27
- }
28
- $html .= '</select>';
29
- return $html;
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Selectstore.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Selectstore extends Mage_Adminhtml_Block_Widget_Container{
3
- protected function _beforeToHtml(){
4
- $this->setTemplate('straker/new/selectstore.phtml');
5
- }
6
- }
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Setupstore.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Setupstore extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- protected $_languages;
5
-
6
- protected function _beforeToHtml(){
7
- $this->setTemplate('straker/new/setupstore.phtml');
8
- }
9
-
10
- public function renderLanguageSelect($name){
11
- if (!$this->_languages) {
12
- $this->_languages = Mage::getModel('strakertranslations_easytranslationplatform/api', array('store' => $this->getSetupStoreId()))->getLanguages();
13
- }
14
- $html = '<select class="validate-select" name="'.$name.'">';
15
- $html .= '<option value="">' . $this->__('Select a language') . '</option>';
16
- if ($this->_languages) {
17
- foreach ($this->_languages as $language) {
18
- $html .= '<option value="' . $language->code . '">' . $language->name . '</option>';
19
- }
20
- }
21
- $html .= '</select>';
22
- return $html;
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Type extends Mage_Adminhtml_Block_Widget_Container{
3
-
4
- protected $_languages;
5
-
6
- protected function _beforeToHtml(){
7
- $this->setTemplate('straker/new/type.phtml');
8
- }
9
-
10
- public function renderTypes(){
11
- $storeId = $this->getRequest()->getParam('store');
12
- $types = Mage::getModel('strakertranslations_easytranslationplatform/job_type')->getCollection();
13
- $html = '';
14
- foreach ($types as $type){
15
- $html .= '<div><a class="job-type-btn" href="' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_".str_replace(' ','_',strtolower($type->getTypeName()))."/new", array("store" => $storeId)) . '">' . $type->getTypeName() . '</a></div>';
16
-
17
- }
18
- return $html;
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Backupbutton.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_BackupButton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set template
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- $this->setTemplate('straker/system/config/button.phtml');
11
- }
12
-
13
- /**
14
- * Return element html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- return $this->_toHtml();
22
- }
23
-
24
- /**
25
- * Return ajax url for button
26
- *
27
- * @return string
28
- */
29
- public function getAjaxCheckUrl()
30
- {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
- }
33
-
34
- /**
35
- * Generate button html
36
- *
37
- * @return string
38
- */
39
- public function getButtonHtml()
40
- {
41
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
- ->setData(array(
43
- 'id' => 'straker_clear_button',
44
- 'label' => $this->helper('adminhtml')->__('Backup Product Data'),
45
- 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/copyProdcutTable').'\');'
46
- ));
47
-
48
- return $button->toHtml();
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Button.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set template
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- $this->setTemplate('straker/system/config/button.phtml');
11
- }
12
-
13
- /**
14
- * Return element html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- return $this->_toHtml();
22
- }
23
-
24
- /**
25
- * Return ajax url for button
26
- *
27
- * @return string
28
- */
29
- public function getAjaxCheckUrl()
30
- {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
- }
33
-
34
- /**
35
- * Generate button html
36
- *
37
- * @return string
38
- */
39
- public function getButtonHtml()
40
- {
41
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
- ->setData(array(
43
- 'id' => 'straker_clear_button',
44
- 'label' => $this->helper('adminhtml')->__('Clear All Language Settings'),
45
- 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/clearSettings').'\');'
46
- ));
47
-
48
- return $button->toHtml();
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Restorebutton.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_RestoreButton extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set template
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- $this->setTemplate('straker/system/config/button.phtml');
11
- }
12
-
13
- /**
14
- * Return element html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- return $this->_toHtml();
22
- }
23
-
24
- /**
25
- * Return ajax url for button
26
- *
27
- * @return string
28
- */
29
- public function getAjaxCheckUrl()
30
- {
31
- return Mage::helper('adminhtml')->getUrl('adminhtml/adminhtml_atwixtweaks/check');
32
- }
33
-
34
- /**
35
- * Generate button html
36
- *
37
- * @return string
38
- */
39
- public function getButtonHtml()
40
- {
41
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
42
- ->setData(array(
43
- 'id' => 'straker_clear_button',
44
- 'label' => $this->helper('adminhtml')->__('Restore Product Data'),
45
- 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl('adminhtml/straker_new/restoreProdcutTable').'\');'
46
- ));
47
-
48
- return $button->toHtml();
49
- }
50
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/System/Config/Form/Store.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_System_Config_Form_Store extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- /*
5
- * Set template
6
- */
7
- protected function _construct()
8
- {
9
- parent::_construct();
10
- $this->setTemplate('straker/system/config/store.phtml');
11
- }
12
-
13
- /**
14
- * Return element html
15
- *
16
- * @param Varien_Data_Form_Element_Abstract $element
17
- * @return string
18
- */
19
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
20
- {
21
- return $this->_toHtml();
22
- }
23
-
24
- /**
25
- * Generate button html
26
- *
27
- * @return string
28
- */
29
- public function getClearStoreButtonHtml($store)
30
- {
31
- if ($store->getId() && Mage::helper('strakertranslations_easytranslationplatform')->getStoreSetup($store->getId())) {
32
- $button = $this->getLayout()->createBlock('adminhtml/widget_button')
33
- ->setData(array(
34
- 'id' => 'straker_clear_store_button_' . $store->getCode(),
35
- 'label' => $this->helper('adminhtml')->__('Clear'),
36
- 'onclick' => 'setLocation(\'' . Mage::helper('adminhtml')->getUrl(
37
- 'adminhtml/straker_new/resetStoreSettings',
38
- array('store' => $store->getId())
39
- ) . '\');'
40
- ));
41
- return $button->toHtml();
42
- }
43
- else{
44
-
45
- return '<div class="empty-button">'.$this->__('No language settings applied').'</div>';
46
- }
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Action
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalLabel.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeOriginalLabel
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row){
6
- $original = $this->xml2array(simplexml_load_string($row->getOriginal()));
7
-
8
- return !empty($original['title']) ? $original['title'] : 'N/A';
9
- }
10
-
11
- public function xml2array ( $xmlObject, $out = array () )
12
- {
13
- foreach ( (array) $xmlObject as $index => $node )
14
- $out[$index] = ( is_object ( $node ) ) ? $this->xml2array ( $node ) : $node;
15
-
16
- return $out;
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeOriginalOption.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeOriginalOption
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
-
6
- public function render(Varien_Object $row){
7
- $original = $this->xml2array(simplexml_load_string($row->getOriginal()));
8
-
9
- return !empty($original['option']) ? implode(', ', $original['option']) : 'N/A';
10
- }
11
-
12
- public function xml2array ( $xmlObject, $out = array () )
13
- {
14
- foreach ( (array) $xmlObject as $index => $node )
15
- $out[$index] = ( is_object ( $node ) ) ? $this->xml2array ( $node ) : $node;
16
-
17
- return $out;
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateLabel.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeTranslateLabel
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row){
6
- $original = $this->xml2array(simplexml_load_string($row->getTranslate()));
7
-
8
- return !empty($original['title']) ? $original['title'] : 'N/A';
9
- }
10
-
11
- public function xml2array ( $xmlObject, $out = array () )
12
- {
13
- foreach ( (array) $xmlObject as $index => $node )
14
- $out[$index] = ( is_object ( $node ) ) ? $this->xml2array ( $node ) : $node;
15
-
16
- return $out;
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/AttributeTranslateOption.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_AttributeTranslateOption
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
-
6
- public function render(Varien_Object $row){
7
- $original = $this->xml2array(simplexml_load_string($row->getTranslate()));
8
-
9
- return !empty($original['option']) ? implode(', ', $original['option']) : 'N/A';
10
- }
11
-
12
- public function xml2array ( $xmlObject, $out = array () )
13
- {
14
- foreach ( (array) $xmlObject as $index => $node )
15
- $out[$index] = ( is_object ( $node ) ) ? $this->xml2array ( $node ) : $node;
16
-
17
- return $out;
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Backend.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Backend
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- protected $_storeId;
6
-
7
- public function render(Varien_Object $row){
8
- $html = '';
9
- if(!$row->getVersion()){
10
- $html .= '<p class="inactive">' . $this->__('View Product in Backend') . '</p>';
11
- }
12
- elseif ($row->getProductId()) {
13
- $product = Mage::getModel('catalog/product')->load($row->getProductId());
14
- $url = $this->getUrl('adminhtml/catalog_product/edit', array(
15
- 'store' => $this->getStoreId($row),
16
- 'id' => $product->getId())
17
- );
18
- $html .= '<a target="_blank" href="' . $url . '">' . $this->__('View Product in Backend') . '</a>';
19
- }
20
- elseif($row->getCategoryId()) {
21
- $category = Mage::getModel('catalog/category')->load($row->getCategoryId());
22
- $url = $this->getUrl('adminhtml/catalog_category/edit', array(
23
- 'store' => $this->getStoreId($row),
24
- 'id' => $category->getId())
25
- );
26
- $html .= '<a target="_blank" href="' . $url . '">' . $this->__('View Category in Backend') . '</a>';
27
- }
28
- return $html;
29
- }
30
-
31
- protected function getStoreId($row){
32
- if (!$this->_storeId){
33
- $this->_storeId = Mage::getModel('strakertranslations_easytranslationplatform/job')
34
- ->load($row->getjobId())
35
- ->getStoreId();
36
- }
37
- return $this->_storeId;
38
- }
39
-
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsOriginTitle.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsOriginTitle
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- $origin = $row->getOrigin() ? json_decode($row->getOrigin(), true): array();
8
- return $origin['title'] ? $origin['title']:'';
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if($row->getVersion()){
8
- if($row->getBlockId()){
9
- $link = Mage::helper("adminhtml")->getUrl("adminhtml/cms_block/edit",array("block_id"=>$row->getNewEntityId()));
10
- }
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';
18
- }
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateLabel.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_ConfirmTranslateLabel
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- protected $_storeId;
6
-
7
- protected $_label;
8
-
9
- public function render(Varien_Object $row){
10
- $id = $row->getAttributeId();
11
- $html = '<input disabled type="checkbox" name="option" value="' . $id . '" class="checkbox-option"';
12
- if (in_array($id, $this->_getLabel())) {
13
- $html .= ' checked="checked" >';
14
- }
15
- else{
16
- $html .= ' >';
17
- }
18
- return $html;
19
- }
20
-
21
- protected function _getLabel(){
22
- if(!$this->_label){
23
- $this->_label = Mage::getSingleton('adminhtml/session')->getData('straker_new_attribute');
24
- }
25
- return $this->_label;
26
- }
27
-
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/ConfirmTranslateOptions.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_ConfirmTranslateOptions
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- protected $_storeId;
6
-
7
- protected $_option;
8
-
9
- public function render(Varien_Object $row){
10
- $id = $row->getAttributeId();
11
- if ($row->getFrontendInput()=='select') {
12
- $html = '<input disabled type="checkbox" name="option" value="' . $id . '" class="checkbox-option"';
13
- if (in_array($id, $this->_getOption())) {
14
- $html .= ' checked="checked" >';
15
- }
16
- else{
17
- $html .= ' >';
18
- }
19
- }
20
- else{
21
- $html = 'N/A';
22
- }
23
- return $html;
24
- }
25
-
26
- protected function _getOption(){
27
- if(!$this->_option){
28
- $this->_option = explode(',' ,Mage::getSingleton('adminhtml/session')->getData('straker_new_option'));
29
- }
30
- return $this->_option;
31
- }
32
-
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Dispute.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Dispute
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row){
6
- $quotes = json_decode($row->getQuote(), true);
7
- $html = '<button style="margin: 5px; display: block;" onclick="disputeForm.show(\''.$row->getJobId().'\',\''.$row->getProductId().'\')" title="Update" type="button" style=""><span><span><span>Dispute</span></span></span></button>';
8
- return $html;
9
- }
10
-
11
- }
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Frontend.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Frontend
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- protected $_storeId;
6
-
7
- public function render(Varien_Object $row){
8
- $html = '';
9
- if(!$row->getVersion()){
10
- $html .= '<p class="inactive">' . $this->__('View Product in Frontend') . '</p>';
11
- }
12
- elseif ($row->getProductId()) {
13
- $product = Mage::getModel('catalog/product')->setStoreId($this->getStoreId($row))->load($row->getProductId());
14
- if (!$product->isDisabled() && $product->isVisibleInSiteVisibility()) {
15
- $html .= '<a target="_blank" href="' . $product->getProductUrl() . '">' . $this->__('View Product in Frontend') . '</a>';
16
- } else {
17
- $html .= 'Product is not visible in frontend';
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
- }
26
-
27
- protected function getStoreId($row){
28
- if (!$this->_storeId){
29
- $this->_storeId = Mage::getModel('strakertranslations_easytranslationplatform/job')
30
- ->load($row->getjobId())
31
- ->getStoreId();
32
- }
33
- return $this->_storeId;
34
- }
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Path.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Path
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- $cats = explode('/',$row->getPath());
8
- $catNames = array();
9
- foreach($cats as $catId){
10
- if ($catId == '1'){
11
- continue;
12
- }
13
- $catNames[] = Mage::getModel('catalog/category')->load($catId)->getName();
14
- }
15
- return implode(' / ', $catNames);
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Quote.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Quote
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
- $quotes = json_decode($row->getQuote(), true);
9
- if(is_array($quotes)) {
10
- foreach ($quotes as $quote) {
11
- $html .= "<div class='quote-workflow'>";
12
- foreach ($quote as $k => $v) {
13
- $html .= ($k == 'workflow') ? "<h4>{$v}</h4>" : "<label>{$k}: </label><span>{$v}</span><br />";
14
- }
15
- $html .= "</div>";
16
- }
17
- }
18
- }
19
- return $html;
20
- }
21
-
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Refresh.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Refresh
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
- $out = '<button class="straker-refresh-button" id="button-update-'.$row->getId().'" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("adminhtml/straker_job/updateJob", array('job_id' => $row->getId())) . '\')" title="Refresh" type="button">Refresh</button>';
9
- return $out;
10
- }
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Selected.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Selected
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row){
6
-
7
- if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
8
-
9
- switch ($row->getTypeName()) {
10
- case 'Product':
11
-
12
- $productAttrubuteCollection =
13
- Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')
14
- ->getCollection()->addFieldToFilter('job_id', $row->getId());
15
-
16
- $output =array();
17
-
18
- foreach ($productAttrubuteCollection as $productAttrubute) {
19
- $output[] = $this->_getAttributeLabel($productAttrubute->getAttributeId());
20
- }
21
- $html = implode(', ', $output);
22
-
23
- break;
24
-
25
- case 'Category':
26
-
27
- $categoryAttrubuteCollection =
28
- Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')
29
- ->getCollection()->addFieldToFilter('job_id', $row->getId());
30
-
31
- $output =array();
32
-
33
- foreach ($categoryAttrubuteCollection as $categoryAttrubute) {
34
- $output[] = $this->_getAttributeLabel($categoryAttrubute->getAttributeId());
35
- }
36
- $html = implode(', ', $output);
37
-
38
- break;
39
-
40
- case 'Attribute':
41
-
42
- $AttributeCollection =
43
- Mage::getModel('strakertranslations_easytranslationplatform/job_attribute')
44
- ->getCollection()->addFieldToFilter('job_id', $row->getId());
45
-
46
- $output = count($AttributeCollection);
47
-
48
- $html = $output > 1 ? "$output Attributes" : '1 Attribute';
49
-
50
- break;
51
-
52
- default:
53
- $html = '';
54
-
55
- }
56
-
57
- return $html;
58
- }
59
-
60
- }
61
-
62
- private function _getAttributeLabel($attributeId) {
63
- return Mage::getModel('eav/entity_attribute')->load($attributeId)->getFrontendLabel();
64
- }
65
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Status
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();
12
- $html = $this->__('Waiting for Quote');
13
- if ('READY' === $quote && $row->getStatusId() == 2) {
14
- $html = '<button onclick="viewStrakerQuote('.$row->getId().',\'' . $row->getJobKey() . '\')" style="margin: 5px;" title="View Quote" type="button" style="">'.$this->__('View Quote').'</button>';
15
- }
16
- }
17
- //else if status is IN_PROGRESS
18
- elseif ($row->getStatusName() == 'IN_PROGRESS') {
19
- $html = $this->__('In Progress');
20
- }
21
- //else if status is COMPLETED
22
- elseif ($row->getStatusName() == 'COMPLETED') {
23
- $html = $this->__('Ready to Publish');
24
- }
25
- //else if status is PUBLISHED
26
- elseif ($row->getStatusName() == 'PUBLISHED') {
27
- $html = $this->__('Published');
28
- }
29
- return $html;
30
- }
31
-
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/StrakerTranslated.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_StrakerTranslated
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if($row->getStrakerTranslated()){
8
- return 'Yes';
9
- }
10
- else{
11
- return 'No';
12
- }
13
- }
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/TranslateOptions.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_TranslateOptions
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- protected $_storeId;
6
-
7
- public function render(Varien_Object $row){
8
- if ($row->getFrontendInput()=='select') {
9
- $html = '<input type="checkbox" name="option" value="' . $row->getAttributeId() . '" class="checkbox-option">';
10
- }
11
- else{
12
- $html = 'N/A';
13
- }
14
- return $html;
15
- }
16
-
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Translated.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Translated
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if($row->getVersion()){
8
- return 'Translated';
9
- }
10
- else{
11
- return 'Not Translated';
12
- }
13
- }
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Update.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Update
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job'))) {
8
- $out = '<button id="button-update-'.$row->getId().'" style="margin: 5px; display: block;" onclick="event.stopPropagation(); setLocation(\'' . Mage::helper("adminhtml")->getUrl("straker/adminhtml_job/updateJob", array('job_id' => $row->getId())) . '\')" title="Update" type="button" style=""><span><span><span>Update</span></span></span></button>';
9
- return $out;
10
- }
11
- }
12
- }
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Version.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_Version
3
- extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
- {
5
- public function render(Varien_Object $row)
6
- {
7
- if($row->getVersion()){
8
- return 'Published';
9
- }
10
- else{
11
- return 'Not Published';
12
- }
13
- }
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Helper_Data extends Mage_Core_Helper_Abstract {
3
- public function getAppKey($store = null){
4
- return Mage::getStoreConfig('straker/general/application_key') ? Mage::getStoreConfig('straker/general/application_key') : false;
5
- }
6
-
7
- public function getAccessToken($store = null){
8
- return Mage::getStoreConfig('straker/general/access_token') ? Mage::getStoreConfig('straker/general/access_token') : false;
9
- }
10
-
11
- public function saveStoreSetup($storeId, $source, $from, $to){
12
- Mage::getModel('core/config')->saveConfig('straker/general/source', $source, 'stores', $storeId);
13
- Mage::getModel('core/config')->saveConfig('straker/general/from', $from, 'stores', $storeId);
14
- Mage::getModel('core/config')->saveConfig('straker/general/to', $to, 'stores', $storeId);
15
- }
16
-
17
- public function getStoreSetup($storeId){
18
- $result['source'] = Mage::getStoreConfig('straker/general/source', $storeId);
19
- $result['from'] = Mage::getStoreConfig('straker/general/from', $storeId);
20
- $result['to'] = Mage::getStoreConfig('straker/general/to', $storeId);
21
- return ($result['source'] && $result['from'] && $result['to']) ? $result : false;
22
- }
23
-
24
- public function renderNewJobHeading($storeId){
25
- $destinationStore = Mage::getModel('core/store')->load($storeId);
26
- $destinationText = $destinationStore->getFrontendName().' ('.$destinationStore->getName().')';
27
-
28
- $config = $this->getStoreSetup($storeId);
29
- $sourceStore = Mage::getModel('core/store')->load($config['source']);
30
- $sourceText = $sourceStore->getFrontendName().' ('.$sourceStore->getName().')';
31
-
32
- return $sourceText . ' > ' . $destinationText;
33
- }
34
-
35
- public function getCmsCreatedMessage(){
36
- $message = '';
37
- if (Mage::registry('cms_block')){
38
- $strakerCmsBlockModel = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_block')->load(Mage::registry('cms_block')->getId(), 'new_entity_id');
39
- if($strakerCmsBlockModel->getId()) {
40
- $message = '<div id="straker-cms-title-message">Created by<span id="straker-icon">Straker Translations</span>';
41
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($strakerCmsBlockModel->getJobId());
42
- if ($job->getTl()) {
43
- $message.= ', Target Language: '.$job->getTl();
44
- }
45
- $message .= '</div>';
46
- }
47
- }
48
- elseif(Mage::registry('cms_page')) {
49
- $strakerCmsPageModel = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_page')->load(Mage::registry('cms_page')->getId(), 'new_entity_id');
50
- if($strakerCmsPageModel->getId()){
51
- $message = '<div id="straker-cms-title-message">Created by<span id="straker-icon">Straker Translations</span>';
52
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($strakerCmsPageModel->getJobId());
53
- if ($job->getTl()) {
54
- $message.= ', Target Language: '.$job->getTl();
55
- }
56
- $message .= '</div>';
57
- }
58
- }
59
- return $message;
60
- }
61
-
62
- public function isSandboxMode(){
63
- // return (Mage::getStoreConfig('straker/general/site_mode') == 0);
64
- return false;
65
- }
66
-
67
- public function getSandboxMessage(){
68
- return
69
- '<p>
70
- <h1>Sandbox Mode Enabled.</h1>
71
- </p>
72
- <p>
73
- Thank you for installing our plugin. We have enabled the Sandbox testing mode for you. Jobs you create while this is enabled
74
- will not be received by Straker Translations, and content will not be translated by a human - rather it will only be sample
75
- text. To change the Sandbox Mode, go to
76
- <a href="'. Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit', ['section' => 'straker']).'">Straker Configuration</a>
77
- </p>';
78
- }
79
-
80
- public function checkSiteMode(){
81
- if($this->isSandboxMode()){
82
- Mage::getSingleton('adminhtml/session')->addNotice($this->getSandboxMessage());
83
- }
84
- }
85
-
86
- public function clearSiteMode(){
87
- return Mage::getModel('core/config')->deleteConfig('straker/general/site_mode', 'default', 0);
88
- }
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Actionlog.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Actionlog extends Mage_Core_Model_Abstract
9
- {
10
- private $_added = false;
11
-
12
- protected function _construct()
13
- {
14
- $this->_init('strakertranslations_easytranslationplatform/actionlog');
15
- }
16
-
17
- public function addLog($action='', $message='', $extra='' ) {
18
-
19
- if (!$this->_added) { // should be only one log per action
20
-
21
- $_action = $action ? $action : Mage::app()->getRequest()->getControllerName() . ':' . Mage::app()->getRequest()->getActionName();
22
-
23
- $this->setUserId($this->_getAdminUser())
24
- ->setAction($_action)
25
- ->setMessage($message)
26
- ->setExtra($extra)
27
- ->save();
28
- $this->_added = true;
29
- }
30
-
31
- }
32
-
33
- protected function _getAdminUser(){
34
-
35
- return Mage::getSingleton('admin/session')->getUser()->getId();
36
- }
37
-
38
-
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Api.php DELETED
@@ -1,242 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_Model_Api extends Mage_Core_Model_Abstract
3
- {
4
- /**
5
- * Error codes recollected after each API call
6
- *
7
- * @var array
8
- */
9
- protected $_callErrors = array();
10
-
11
- protected $_storeId;
12
-
13
- /**
14
- * Headers for each API call
15
- *
16
- * @var array
17
- */
18
- protected $_headers = array();
19
-
20
- protected $_options = array();
21
-
22
- protected function _construct()
23
- {
24
-
25
- $this->_storeId = ($this->getStore()) ? $this->getStore() : 0;
26
- $this->_init('strakertranslations_easytranslationplatform/api');
27
- $this->_headers[] = 'Authorization: Bearer '. Mage::getStoreConfig('straker/general/access_token', $this->_storeId);
28
- $this->_headers[] = 'X-Auth-App: '. Mage::getStoreConfig('straker/general/application_key', $this->_storeId);
29
- }
30
-
31
- protected function _call($url, $method = 'get', array $request = array(), $raw = false)
32
- {
33
- switch ($method) {
34
- case 'post':
35
- $method = Zend_Http_Client::POST;
36
- break;
37
-
38
- case 'get' :
39
- $method = Zend_Http_Client::GET;
40
- break;
41
- }
42
-
43
- try {
44
- $http = new Varien_Http_Adapter_Curl();
45
- $config = array(
46
- 'timeout' => 60,
47
- 'verifypeer' => 0,
48
- );
49
-
50
- $http->setConfig($config);
51
- $http->write(
52
- $method,
53
- $url,
54
- '1.1',
55
- $this->_headers,
56
- $request //$this->_buildQuery($request)
57
- );
58
- $response = $http->read();
59
-
60
- } catch (Exception $e) {
61
- $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
62
- $this->_debug($debugData);
63
- throw $e;
64
- }
65
-
66
- $debugData['response'] = $response;
67
-
68
-
69
- // handle transport error
70
- if ($http->getErrno()) {
71
- Mage::logException(new Exception(
72
- sprintf('CURL connection error #%s: %s', $http->getErrno(), $http->getError())
73
- ));
74
- $http->close();
75
-
76
- Mage::throwException(Mage::helper('strakertranslations_easytranslationplatform')->__('Unable to communicate with the Straker Translations Api.'));
77
- }
78
-
79
- // cUrl resource must be closed after checking it for errors
80
- $http->close();
81
-
82
- $response = preg_split('/^\r?$/m', $response, 2);
83
- $response = trim($response[1]);
84
-
85
- if ($raw) {
86
- return $response;
87
- }
88
-
89
- $response = json_decode($response);
90
- $this->_callErrors = array();
91
- if ($this->_isCallSuccessful($response)) {
92
- return $response;
93
- }
94
- $this->_handleCallErrors($response);
95
- return $response;
96
- }
97
-
98
- protected function _buildQuery($request)
99
- {
100
- return http_build_query($request);
101
- }
102
-
103
- /**
104
- * Set array of additional cURL options
105
- *
106
- * @param array $options
107
- * @return Varien_Http_Adapter_Curl
108
- */
109
- public function setOptions(array $options = array())
110
- {
111
- $this->_options = $options;
112
- return $this;
113
- }
114
-
115
- protected function _debug($debugData){
116
-
117
- // to be added
118
-
119
- }
120
-
121
- protected function _isCallSuccessful($response)
122
- {
123
- if (isset($response->code)) {
124
- return false;
125
- }
126
-
127
- if (isset($response->success) || isset($response->languages) || isset($response->country)) {
128
- return true;
129
- }
130
- return false;
131
- }
132
-
133
- /**
134
- * Handle logical errors
135
- *
136
- * @param array $response
137
- * @throws Mage_Core_Exception
138
- */
139
- protected function _handleCallErrors($response)
140
- {
141
- if(empty($response)){
142
- return;
143
- }
144
- if (isset($response->message) && strpos($response->message,'Authentication failed') !== false){
145
- $response->magentoMessage = $response->message;
146
- }
147
- return;
148
- // to be added
149
- }
150
-
151
- protected function _getRegisterUrl(){
152
- return Mage::getStoreConfig('straker/api_url/register');
153
- }
154
-
155
- protected function _getLanguagesUrl(){
156
- return Mage::getStoreConfig('straker/api_url/languages');
157
- }
158
-
159
- protected function _getCountiresUrl(){
160
- return Mage::getStoreConfig('straker/api_url/countries');
161
- }
162
-
163
- protected function _getTranslateUrl(){
164
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
165
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
166
- if( $helper->isSandboxMode() ){
167
- return Mage::getStoreConfig('straker/api_url/translate_sandbox');
168
- }else{
169
- return Mage::getStoreConfig('straker/api_url/translate');
170
- }
171
- }
172
-
173
- protected function _getQuoteUrl(){
174
- return Mage::getStoreConfig('straker/api_url/quote');
175
- }
176
-
177
- protected function _getPaymentUrl(){
178
- return Mage::getStoreConfig('straker/api_url/payment');
179
- }
180
-
181
- protected function _getSupportUrl(){
182
- return Mage::getStoreConfig('straker/api_url/support');
183
- }
184
-
185
- public function callRegister($data){
186
- return $this->_call($this->_getRegisterUrl(), 'post', $data);
187
- }
188
-
189
- public function callTranslate($data){
190
- $this->_headers[] = 'Content-Type:multipart/form-data';
191
- return $this->_call($this->_getTranslateUrl(), 'post', $data);
192
- }
193
-
194
- public function callSupport($data){
195
- return $this->_call($this->_getSupportUrl(), 'post', $data);
196
- }
197
-
198
- public function getQuote($data){
199
- return $this->_call($this->_getQuoteUrl().'?'. $this->_buildQuery($data));
200
- }
201
-
202
- public function getPayment($data){
203
- return $this->_call($this->_getPaymentUrl().'?'. $this->_buildQuery($data));
204
- }
205
-
206
- public function getTranslation($data){
207
- return $this->_call($this->_getTranslateUrl().'?'. $this->_buildQuery($data));
208
- }
209
-
210
- public function getTranslatedFile($downloadUrl){
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){
225
- if ($this->_storeId === 0) {
226
- Mage::getModel('core/config')->saveConfig('straker/general/application_key', $appKey);
227
- }
228
- else {
229
- Mage::getModel('core/config')->saveConfig('straker/general/application_key', $appKey, 'website', $this->_storeId);
230
- }
231
- }
232
-
233
- public function saveAccessToken($accessToken){
234
- if ($this->_storeId === 0) {
235
- Mage::getModel('core/config')->saveConfig('straker/general/access_token', $accessToken);
236
- }
237
- else {
238
- Mage::getModel('core/config')->saveConfig('straker/general/access_token', $accessToken, 'website', $this->_storeId);
239
- }
240
- }
241
-
242
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Attribute/Translate.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Attribute_Translate extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/attribute_translate');
14
- }
15
-
16
- public function importTranslation(){
17
- // if ($this->getTranslate()){
18
- //
19
- // $dataInJson = json_encode(simplexml_load_string($this->getTranslate()));
20
- // $data = json_decode($dataInJson,true);
21
- //
22
- // $writeConnection = $this->_getConnection();
23
- // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
24
- // $storeId = (int) $this->getStoreId();
25
- //
26
- // foreach ($data as $k => $attribute ){
27
- // if ($k == 'title' && $attribute){
28
- //
29
- // $attributeId = (int) $this->getAttributeId();
30
- //
31
- // $writeConnection->query("
32
- // INSERT INTO `" . $prefix . "eav_attribute_label` ( `attribute_id`, `store_id`, `value`)
33
- // SELECT {$attributeId}, {$storeId}, '{$attribute}'
34
- // FROM (select 1) as a
35
- // WHERE NOT EXISTS(
36
- // select `attribute_label_id`
37
- // from `" . $prefix . "eav_attribute_label`
38
- // where `attribute_id`={$attributeId} and `store_id` ={$storeId});");
39
- //
40
- // $writeConnection->query("
41
- // UPDATE `" . $prefix . "eav_attribute_label` SET `value` = '{$attribute}'
42
- // where `attribute_id`={$attributeId} and `store_id` ={$storeId} limit 1;");
43
- //
44
- // }
45
- //
46
- // if ($k = 'option'){
47
- // foreach ($attribute as $optionId => $optionValue) {
48
- //
49
- // $optionId = str_replace('id_', '',$optionId);
50
- //
51
- // $writeConnection->query("
52
- // INSERT INTO `" . $prefix . "eav_attribute_option_value` ( `option_id`, `store_id`, `value`)
53
- // SELECT {$optionId}, {$storeId}, '{$optionValue}'
54
- // FROM (select 1) as a
55
- // WHERE NOT EXISTS(
56
- // select `value_id`
57
- // from `" . $prefix . "eav_attribute_option_value`
58
- // where `option_id`={$optionId} and `store_id` ={$storeId});");
59
- //
60
- //
61
- // $writeConnection->query("
62
- // UPDATE `" . $prefix . "eav_attribute_option_value` SET `value` = '{$optionValue}'
63
- // where `option_id`={$optionId} and `store_id` ={$storeId} limit 1;");
64
- //
65
- // }
66
- //
67
- // }
68
- //
69
- // }
70
- //
71
- //
72
- // }
73
-
74
- if ($this->getTranslate()){
75
- $dataInJson = json_encode(simplexml_load_string($this->getTranslate()));
76
- $data = json_decode($dataInJson,true);
77
- $storeId = (int) $this->getStoreId();
78
- /** @var Mage_Eav_Model_Attribute $eavAttributeModel */
79
- $eavAttributeModel = Mage::getModel('eav/entity_attribute');
80
- foreach ($data as $k => $attribute ){
81
- if ($k == 'title' && $attribute){
82
- $attributeId = (int) $this->getAttributeId();
83
- $newLabel = [$storeId => $attribute];
84
- $eavAttributeModel->load($attributeId);
85
- if(!empty($eavAttributeModel->getId())){
86
- $storeLabels = $eavAttributeModel->getStoreLabels();
87
- if(is_array($storeLabels)){
88
- //get all current stores
89
- $stores = array_keys($storeLabels);
90
- if(!in_array($storeId, $stores)){
91
- array_push($storeLabels, $newLabel);
92
- $eavAttributeModel->setData('store_labels', $storeLabels)->save();
93
- }
94
- }
95
- }
96
- }
97
-
98
- if ($k == 'option' && $attribute){
99
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
100
-
101
- /* @var $model Mage_Catalog_Model_Entity_Attribute */
102
- $attrModel = Mage::getModel('catalog/resource_eav_attribute');
103
- $attrModel->load($this->getAttributeId());
104
-
105
- /** @var $valuesCollection Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection */
106
- $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
107
- ->setStoreFilter(4, false)
108
- ->setAttributeFilter($attrModel->getId());
109
-
110
- //0 => ['option_id' => '20', 'attribute_id' => '92', 'sort_order' => '0', 'value' => 'Black' ]
111
- $optionData = $valuesCollection->getData();
112
- $optionIds = array_column($optionData, 'option_id');
113
-
114
- $optionValueTable = $setup->getTable('eav/attribute_option_value');
115
-
116
- $newOptionData = [];
117
- foreach ($attribute as $optionId => $optionValue) {
118
- $optionId = str_replace('id_', '',$optionId);
119
- /** @var Mage_Eav_Model_Entity_Attribute_Option $optionModel */
120
- $optionModel = Mage::getModel('eav/entity_attribute_option');
121
- $optionModel->load($optionId);
122
- if( !in_array($optionId, $optionIds)){
123
- array_push(
124
- $newOptionData,
125
- [
126
- 'option_id' => $optionId,
127
- 'store_id' => $storeId,
128
- 'value' => $optionValue
129
- ]
130
- );
131
- }
132
- }
133
- if($newOptionData){
134
- $setup->getConnection()->insertMultiple($optionValueTable, $newOptionData);
135
- }
136
- }
137
- }
138
- }
139
- $this->setIsImported(1)->save();
140
- }
141
-
142
- // private function _getConnection() {
143
- // return Mage::getSingleton('core/resource')->getConnection('core_write');
144
- // }
145
-
146
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:55 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Category_Attributes extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Category/Translate.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:53 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Category_Translate extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_translate');
14
- }
15
-
16
- public function importTranslation(){
17
-
18
- $category = Mage::getModel('catalog/category')->setStoreId($this->getStoreId())->load($this->getCategoryId());
19
-
20
- $categoryAttributeCode = $this->_getAttributeCode($this->getAttributeId());
21
-
22
- $this->setBackup($category->getData($categoryAttributeCode));
23
-
24
- $category->setData($categoryAttributeCode, $this->getTranslate())
25
- ->getResource()
26
- ->saveAttribute($category, $categoryAttributeCode);
27
- $this->setIsImported(1)->save();
28
-
29
- $category->clearInstance();
30
-
31
- }
32
-
33
- protected function _getAttributeCode($attributeId){
34
-
35
- if (!Mage::registry('attributeCodeCache_'.$attributeId)){
36
- $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($attributeId)->getAttributeCode();
37
- Mage::register('attributeCodeCache_'.$attributeId,$categoryAttributeCode);
38
- }else{
39
- $categoryAttributeCode = Mage::registry('attributeCodeCache_'.$attributeId);
40
- }
41
- return $categoryAttributeCode;
42
-
43
- }
44
-
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:28 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Cms_Block_Attributes extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Translate.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:07 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Cms_Block_Translate extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_translate');
14
- }
15
-
16
- public function importTranslation(){
17
-
18
- $newEntityId =Mage::getModel('strakertranslations_easytranslationplatform/job_cms_block')->load($this->getJobCmsId())
19
- ->getNewEntityId();
20
-
21
-
22
- // if ($this->getTranslate()){
23
- //
24
- // $writeConnection = $this->_getConnection();
25
- //
26
- // $query = 'UPDATE `'.Mage::getSingleton('core/resource')->getTableName('cms/block')
27
- // . '` SET '.$this->getColumnName() .' = \''.addslashes($this->getTranslate()).' \' WHERE block_id = '.$newEntityId;
28
- //
29
- //
30
- // $writeConnection->query($query);
31
- //
32
- //
33
- // }
34
-
35
- if ($this->getTranslate()){
36
- $model = Mage::getModel('cms/block')->load($newEntityId);
37
- if($model->getId()){
38
- $model->setData($this->getColumnName(), $this->getTranslate());
39
- $model->save();
40
- }
41
- }
42
-
43
- $this->setIsImported(1)->save();
44
-
45
- }
46
- //
47
- // private function _getConnection() {
48
- // return Mage::getSingleton('core/resource')->getConnection('core_write');
49
- // }
50
-
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:28 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Cms_Page_Attributes extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Cms_Page_Translate extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_translate');
14
- }
15
-
16
- public function importTranslation(){
17
-
18
- $newEntityId =Mage::getModel('strakertranslations_easytranslationplatform/job_cms_page')->load($this->getJobCmsId())
19
- ->getNewEntityId();
20
-
21
-
22
- // if ($this->getTranslate()){
23
- //
24
- // $writeConnection = $this->_getConnection();
25
- //
26
- // $query = 'UPDATE `'.Mage::getSingleton('core/resource')->getTableName('cms/page')
27
- // . '` SET '.$this->getColumnName() .' = \''.addslashes($this->getTranslate()).' \' WHERE page_id = '.$newEntityId;
28
- //
29
- //
30
- // $writeConnection->query($query);
31
- //
32
- //
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() {
51
- // return Mage::getSingleton('core/resource')->getConnection('core_write');
52
- // }
53
-
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php DELETED
@@ -1,1043 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Created by PhpStorm.
5
- * User: WlliamZhao
6
- * Date: 30/09/15
7
- * Time: 4:37 PM
8
- */
9
- class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Model_Abstract
10
- {
11
- protected $_attributes = array();
12
-
13
- protected $_translateFilePath = '/var/straker/';
14
-
15
- protected function _construct()
16
- {
17
- $this->_init('strakertranslations_easytranslationplatform/job');
18
- }
19
-
20
- protected function addProductAttributes($productAttributeIds)
21
- {
22
- foreach ($productAttributeIds as $productAttributeId) {
23
- $this->_attributes[] =
24
- Mage::getModel('strakertranslations_easytranslationplatform/product_attributes')
25
- ->setJobId($this->getId())
26
- ->setAttributeId((int)$productAttributeId)
27
- ->save();
28
- }
29
- return $this;
30
- }
31
-
32
- protected function addProductIds($productIds)
33
- {
34
- $model = Mage::getModel('strakertranslations_easytranslationplatform/job_product');
35
- foreach ($productIds as $productId) {
36
- $model->setProductId($productId);
37
- $model->setJobId($this->getId());
38
- $model->save();
39
- $model->unsetData();
40
- }
41
- return $this;
42
- }
43
-
44
- protected function addProductTranslateOriginal($productAttributeId, $productCollection)
45
- {
46
- $model = Mage::getModel('strakertranslations_easytranslationplatform/product_translate');
47
- $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($productAttributeId)->getAttributeCode();
48
- foreach ($productCollection as $product) {
49
- $model->setJobId($this->getId());
50
- $model->setProductId($product->getId());
51
- $model->setAttributeId($productAttributeId);
52
- $model->setOriginal($product->getData($productAttributeCode));
53
- $model->save();
54
- $model->unsetData();
55
- }
56
- return $this;
57
- }
58
-
59
- protected function addCategoryAttributes($categoryAttributeIds)
60
- {
61
- foreach ($categoryAttributeIds as $categoryAttributeId) {
62
- $this->_attributes[] =
63
- Mage::getModel('strakertranslations_easytranslationplatform/category_attributes')
64
- ->setJobId($this->getId())
65
- ->setAttributeId((int)$categoryAttributeId)
66
- ->save();
67
- }
68
- return $this;
69
- }
70
-
71
-
72
- protected function addCategoryIds($categoryIds)
73
- {
74
- $model = Mage::getModel('strakertranslations_easytranslationplatform/job_category');
75
- //. '` (`category_id`, `job_id`) VALUES ';
76
- foreach ($categoryIds as $categoryId) {
77
- $model->setCategoryId($categoryId);
78
- $model->setJobId($this->getId());
79
- $model->save();
80
- $model->unsetData();
81
- }
82
- return $this;
83
- }
84
-
85
- protected function addCategoryTranslateOriginal($categoryAttributeId, $categoryCollection)
86
- {
87
- $model = Mage::getModel('strakertranslations_easytranslationplatform/category_translate');
88
- $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($categoryAttributeId)->getAttributeCode();
89
- foreach ($categoryCollection as $category) {
90
- $model->setJobId($this->getId());
91
- $model->setCategoryId($category->getId());
92
- $model->setAttributeId($categoryAttributeId);
93
- $model->setOriginal($category->getData($categoryAttributeCode));
94
- $model->save();
95
- $model->unsetData();
96
- }
97
- return $this;
98
- }
99
-
100
- protected function addCmsTranslateOriginal($Column, $cmsDataCollection, $type = 'page', $jobCmsIds)
101
- {
102
-
103
- // $writeConnection = $this->getWriteAdapter();
104
- //
105
- // $query = 'INSERT INTO `' . Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/cms_' . $type . '_translate') . '` (`job_id`, `cms_' . $type . '_id`, `column_name`, `original` , `job_cms_id`) VALUES ';
106
- // $queryVals = array();
107
- // foreach ($cmsDataCollection as $cmsData) {
108
- //
109
- // foreach ($jobCmsIds as $k => $v) {
110
- // if ($cmsData[$type . '_id'] == $v) {
111
- // $jobCmsId = $k;
112
- // break;
113
- // }
114
- // }
115
- //
116
- // $queryVals[] = '(' . $this->getId() . ', ' . $cmsData[$type . '_id'] . ', \'' . addslashes($Column) . '\', \'' . addslashes($cmsData[$Column]) . '\', ' . $jobCmsId . ')';
117
- // }
118
- //
119
- // $writeConnection->query($query . implode(',', $queryVals));
120
-
121
- $model = Mage::getModel('strakertranslations_easytranslationplatform/cms_' . $type . '_translate');
122
- //. '` (`job_id`, `cms_' . $type . '_id`, `column_name`, `original` , `job_cms_id`) VALUES ';
123
- $jobCmsId = 0;
124
- foreach ($cmsDataCollection as $cmsData) {
125
- foreach ($jobCmsIds as $jobCmsIdArray) {
126
- if ($cmsData[$type . '_id'] == $jobCmsIdArray[$type.'_id']) {
127
- $jobCmsId = $jobCmsIdArray['id'];
128
- break;
129
- }
130
- }
131
- $model->setJobId($this->getId());
132
- $model->setData('cms_'.$type.'_id', $cmsData[$type . '_id']);
133
- $model->setcolumnName($Column);
134
- $model->setOriginal($cmsData[$Column]);
135
- $model->setJobCmsId($jobCmsId);
136
- $model->save();
137
- $model->unsetData();
138
- }
139
-
140
- return $this;
141
- }
142
-
143
- public function array_to_xml($data, &$xml_data)
144
- {
145
- foreach ($data as $key => $value) {
146
- if (is_array($value)) {
147
- if (is_numeric($key)) {
148
- $key = 'item' . $key; //dealing with <0/>..<n/> issues
149
- }
150
- $subnode = $xml_data->addChild($key);
151
- $this->array_to_xml($value, $subnode);
152
- } else {
153
- $xml_data->addChild("$key", htmlspecialchars("$value"));
154
- }
155
- }
156
- }
157
-
158
- protected function addAttributeTranslateOriginal($attributeData)
159
- {
160
-
161
- // $writeConnection = $this->getWriteAdapter();
162
- //
163
- // $query = 'INSERT INTO `' . Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/straker_attribute_translate') . '` (`job_id`, `attribute_id`, `original`) VALUES ';
164
- // $queryVals = array();
165
- //
166
- // foreach ($attributeData as $attributeId => $translate) {
167
- //
168
- // $original = array();
169
- //
170
- // $original['title'] = $translate['label'] ? Mage::getModel('catalog/resource_eav_attribute')->load($attributeId)->getStoreLabel($this->getSourceStore()) : '';
171
- //
172
- //
173
- // if ($translate['option']) {
174
- // $attributeOptioinCollection = Mage::getModel('eav/entity_attribute_option')
175
- // ->getCollection()
176
- // ->setStoreFilter($this->getSourceStore())
177
- // ->setAttributeFilter($attributeId);
178
- //
179
- // foreach ($attributeOptioinCollection as $attributeOptioin) {
180
- // $original['option']['id_' . $attributeOptioin->getoptionId()] = $attributeOptioin->getValue();
181
- // }
182
- // }
183
- //
184
- // $xml = new SimpleXMLElement('<attribute/>');
185
- //
186
- // $this->array_to_xml($original, $xml);
187
- //
188
- //
189
- // $queryVals[] = '(' . $this->getId() . ', ' . $attributeId . ', \'' . addslashes($xml->asXML()) . '\')';
190
- //
191
- //
192
- // }
193
- //
194
- // $writeConnection->query($query . implode(',', $queryVals));
195
-
196
- $model = Mage::getModel('strakertranslations_easytranslationplatform/attribute_translate');
197
- // . '` (`job_id`, `attribute_id`, `original`) VALUES ';
198
-
199
- foreach ($attributeData as $attributeId => $translate) {
200
- $original = array();
201
- $original['title'] = $translate['label'] ? Mage::getModel('catalog/resource_eav_attribute')->load($attributeId)->getStoreLabel($this->getSourceStore()) : '';
202
- if ($translate['option']) {
203
- $attributeOptioinCollection = Mage::getModel('eav/entity_attribute_option')
204
- ->getCollection()
205
- ->setStoreFilter($this->getSourceStore())
206
- ->setAttributeFilter($attributeId);
207
- foreach ($attributeOptioinCollection as $attributeOptioin) {
208
- $original['option']['id_' . $attributeOptioin->getoptionId()] = $attributeOptioin->getValue();
209
- }
210
- }
211
- $xml = new SimpleXMLElement('<attribute/>');
212
- $this->array_to_xml($original, $xml);
213
- //$queryVals[] = '(' . $this->getId() . ', ' . $attributeId . ', \'' . addslashes($xml->asXML()) . '\')';
214
- $model->setJobId($this->getId());
215
- $model->setAttributeId($attributeId);
216
- $model->setOriginal($xml->asXML());
217
- $model->save();
218
- $model->unsetData();
219
- }
220
-
221
- // $writeConnection->query($query . implode(',', $queryVals));
222
-
223
- return $this;
224
-
225
-
226
- }
227
-
228
-
229
- protected function addAttributeIds($attributeData)
230
- {
231
-
232
-
233
- // $writeConnection = $this->getWriteAdapter();
234
- //
235
- // $query = 'INSERT INTO `' . Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_attribute') . '` (`attribute_id`, `translate_label`, `translate_option`, `job_id` ) VALUES ';
236
- // $queryVals = array();
237
- //
238
- // foreach ($attributeData as $attributeId => $translate) {
239
- //
240
- // $queryVals[] = '(' . (int)$attributeId . ', ' . $translate['label'] . ', ' . $translate['option'] . ', ' . $this->getId() . ')';
241
- // }
242
- //
243
- // $writeConnection->query($query . implode(',', $queryVals));
244
-
245
-
246
- $model = Mage::getModel('strakertranslations_easytranslationplatform/job_attribute');
247
- // . '` (`attribute_id`, `translate_label`, `translate_option`, `job_id` ) VALUES ';
248
-
249
- foreach ($attributeData as $attributeId => $translate) {
250
- $model->setAttributeId($attributeId);
251
- $model->setTranslateLabel($translate['label']);
252
- $model->setTranslateOption($translate['option']);
253
- $model->setJobId($this->getId());
254
- $model->save();
255
- $model->unsetData();
256
- }
257
-
258
- return $this;
259
-
260
- }
261
-
262
-
263
- public function addProducts($productAttributeIds, $productIds)
264
- {
265
-
266
- if (!$this->getId()) {
267
- if (!$this->getStoreId()) {
268
- Mage::throwException('Error: Missing Store Id');
269
- }
270
- $this->setSourceStore(Mage::getStoreConfig('straker/general/source', $this->getStoreId()));
271
- $this->save();
272
- }
273
-
274
- $this->addProductAttributes($productAttributeIds);
275
-
276
- $countProducts = sizeof($productIds);
277
- $buffer = 1000;
278
- $_productIdSet = array();
279
- for ($i = 0; $i < $countProducts; $i = $i + $buffer) {
280
- $_productIdSet[] = array_slice($productIds, $i, $buffer);
281
- }
282
-
283
- foreach ($_productIdSet as $_productIds) {
284
- $this->addProductIds($_productIds);
285
- }
286
-
287
- foreach ($_productIdSet as $_productIds) {
288
-
289
- $productCollection = Mage::getModel('catalog/product')->getCollection()->setStore($this->getSourceStore());
290
-
291
- foreach ($productAttributeIds as $productAttributeId) {
292
-
293
- $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($productAttributeId)->getAttributeCode();
294
- $productCollection->addAttributeToSelect($productAttributeCode);
295
- }
296
-
297
- $productCollection->addFieldToFilter('entity_id', array('in' => $_productIds));
298
-
299
- foreach ($productAttributeIds as $productAttributeId) {
300
- $this->addProductTranslateOriginal($productAttributeId, $productCollection);
301
- }
302
- }
303
- return $this;
304
- }
305
-
306
- public function addCategories($categoryAttributeIds, $categoryIds)
307
- {
308
-
309
- if (!$this->getId()) {
310
- if (!$this->getStoreId()) {
311
- Mage::throwException('Error: Missing Store Id');
312
- }
313
- $this->setSourceStore(Mage::getStoreConfig('straker/general/source', $this->getStoreId()));
314
- $this->save();
315
- }
316
-
317
- $this->addCategoryAttributes($categoryAttributeIds);
318
-
319
- $countCategories = sizeof($categoryIds);
320
- $buffer = 1000;
321
- $_categoryIdSet = array();
322
- for ($i = 0; $i < $countCategories; $i = $i + $buffer) {
323
- $_categoryIdSet[] = array_slice($categoryIds, $i, $buffer);
324
- }
325
-
326
- foreach ($_categoryIdSet as $_categoryIds) {
327
- $this->addCategoryIds($_categoryIds);
328
- }
329
-
330
- foreach ($_categoryIdSet as $_categoryIds) {
331
-
332
- $categoryCollection = Mage::getModel('catalog/category')->getCollection()->setStore($this->getSourceStore());
333
-
334
- foreach ($categoryAttributeIds as $categoryAttributeId) {
335
-
336
- $categoryAttributeCode = Mage::getModel('eav/entity_attribute')->load($categoryAttributeId)->getAttributeCode();
337
- $categoryCollection->addAttributeToSelect($categoryAttributeCode);
338
- }
339
-
340
- $categoryCollection->addFieldToFilter('entity_id', array('in' => $_categoryIds));
341
-
342
- foreach ($categoryAttributeIds as $categoryAttributeId) {
343
- $this->addCategoryTranslateOriginal($categoryAttributeId, $categoryCollection);
344
- }
345
- }
346
- return $this;
347
- }
348
-
349
- public function addAttributes($attributeData)
350
- {
351
-
352
- if (!$this->getId()) {
353
- if (!$this->getStoreId()) {
354
- Mage::throwException('Error: Missing Store Id');
355
- }
356
- $this->setSourceStore(Mage::getStoreConfig('straker/general/source', $this->getStoreId()));
357
- $this->save();
358
- }
359
-
360
- $this->addAttributeIds($attributeData);
361
-
362
- $this->addAttributeTranslateOriginal($attributeData);
363
-
364
- return $this;
365
- }
366
-
367
-
368
- public function addCmsEntities($ids, $Columns = array(), $type = 'page')
369
- {
370
-
371
- if (!$this->getId()) {
372
- if (!$this->getStoreId()) {
373
- Mage::throwException('Error: Missing Store Id');
374
- }
375
- $this->setSourceStore(Mage::getStoreConfig('straker/general/source', $this->getStoreId()));
376
- $this->save();
377
- }
378
-
379
- foreach ($Columns as $Column) {
380
- $this->_attributes[] =
381
- Mage::getModel('strakertranslations_easytranslationplatform/cms_' . $type . '_attributes')
382
- ->setJobId($this->getId())
383
- ->setColumnName($Column)
384
- ->save();
385
- }
386
-
387
- // $writeConnection = $this->getWriteAdapter();
388
- //
389
- // $searchQuery = 'SELECT * FROM ' . Mage::getSingleton('core/resource')->getTableName('cms/' . $type)
390
- // . ' WHERE ' . $type . '_id IN (' . implode(',', $ids) . ')';
391
- //
392
- // $cmsDataCollection = $writeConnection->fetchAll($searchQuery);
393
-
394
- $cmsDataCollection = Mage::getResourceModel('cms/' . $type.'_collection')
395
- ->addFieldToFilter($type.'_id', ['in' => $ids])
396
- ->getData();
397
-
398
- // $query = 'INSERT INTO `'
399
- // . Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_cms' . $type)
400
- // . '` (`' . $type . '_id`, `job_id` , `origin`) VALUES ';
401
- //
402
- // $queryVals = array();
403
- //
404
- // foreach ($cmsDataCollection as $cmsData) {
405
- // $id = $cmsData[$type . '_id'];
406
- //
407
- // unset($cmsData[$type . '_id']);
408
- //
409
- //
410
- // $queryVals[] = "(" . (int)$id . ", " . $this->getId() . ", '" . addslashes(json_encode($cmsData)) . "')";
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
-
418
- foreach ($cmsDataCollection as $cmsData) {
419
- $id = $cmsData[$type . '_id'];
420
- unset($cmsData[$type . '_id']);
421
- $model->setData($type.'_id', $id);
422
- $model->setJobId($this->getId());
423
- $model->setOrigin(json_encode($cmsData));
424
- $model->save();
425
- $model->unsetData();
426
- }
427
-
428
- $writeConnection = $this->getWriteAdapter();
429
-
430
- // $query = 'SELECT id, ' . $type . '_id FROM ' . Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_cms' . $type)
431
- // . ' WHERE job_id = ' . $this->getId();
432
- //
433
- // $jobCmsIds = $writeConnection->fetchPairs($query);
434
-
435
- $jobCmsIds = Mage::getResourceModel('strakertranslations_easytranslationplatform/job_cms_' . $type . '_collection')
436
- ->addFieldToSelect('id')
437
- ->addFieldToSelect($type.'_id')
438
- ->addFieldToFilter('job_id', ['eq' => $this->getId()])
439
- ->getData();
440
-
441
- foreach ($Columns as $Column) {
442
- $this->addCmsTranslateOriginal($Column, $cmsDataCollection, $type, $jobCmsIds);
443
- }
444
-
445
- $this->_createCMSTranslateFile($type);
446
- return $this;
447
- }
448
-
449
- protected function _createCMSTranslateFile($type)
450
- {
451
-
452
- $_xml = new DOMDocument('1.0', 'utf-8');
453
- $_xml->formatOutput = true;
454
-
455
- $rootElement = $_xml->createElement('root');
456
-
457
- $cmsTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/cms_' . $type . '_translate')->getCollection($this->getWriteAdapter());
458
- $cmsTranslateCollection->addFieldToFilter('job_id', $this->getId());
459
- foreach ($cmsTranslateCollection as $cmsTranslate) {
460
- $dataElement = $_xml->createElement('data');
461
- $dataElement->setAttribute('name', 'cms_' . $type . '_' . $cmsTranslate->getJobCmsId() . '_' . $cmsTranslate->getColumnName());
462
- $dataElement->setAttribute('content_context', $cmsTranslate->getColumnName());
463
- $dataElement->setAttribute('content_id', $cmsTranslate->getId());
464
-
465
- $valueElement = $_xml->createElement('value');
466
- $CDATAValueNode = $_xml->createCDATASection($cmsTranslate->getOriginal());
467
- $valueElement->appendChild($CDATAValueNode);
468
-
469
- $dataElement->appendChild($valueElement);
470
- $rootElement->appendChild($dataElement);
471
- }
472
- $_xml->appendChild($rootElement);
473
- file_put_contents(MAGENTO_ROOT . $this->_translateFilePath . 'job' . $this->getId() . '.xml', $_xml->saveXML());
474
- $this->setSourceFile('job' . $this->getId() . '.xml')->save();
475
-
476
- return $this;
477
-
478
-
479
- }
480
-
481
- // protected function _createProductTranslateFile() {
482
- //
483
- // $_xml = '/</?xml version="1.0" encoding="utf-8"/?/>/<root//>';
484
- //
485
- // $productTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/product_translate')->getCollection($this->getWriteAdapter());
486
- // $productTranslateCollection->addFieldToFilter('job_id',$this->getId());
487
- //
488
- // $attributeFrontLabel = array();
489
- //
490
- // foreach ($productTranslateCollection as $productTranslate ){
491
- // if (!isset($attributeFrontLabel[$productTranslate->getAttributeId()])){
492
- // $attributeFrontLabel[$productTranslate->getAttributeId()] =
493
- // Mage::getModel('eav/entity_attribute')->load($productTranslate->getAttributeId())->getFrontendLabel();
494
- // }
495
- //
496
- // $_xml .= '<data name="' .$this->getTypeId(). '_' . $this->getStoreId().'_'. $productTranslate->getAttributeId().'_'. $productTranslate->getProductId().'" ' ;
497
- // $_xml .= 'content_context="' . $attributeFrontLabel[$productTranslate->getAttributeId()] . '" ';
498
- // $_xml .= 'content_context_url="'.Mage::getStoreConfig('web/unsecure/base_link_url',$this->getStoreId()).'catalog/category/view/id/'.$productTranslate->getProductId().'" ';
499
- // $_xml .= 'content_id="'. $productTranslate->getId() .'">';
500
- // $_xml .= '<value><![CDATA['.$productTranslate->getOriginal().']]></value></data>';
501
- // }
502
- // $_xml .='</root>';
503
- //
504
- // file_put_contents(MAGENTO_ROOT.$this->_translateFilePath.'job'.$this->getId().'.xml',$_xml);
505
- // $this->setSourceFile('job'.$this->getId().'.xml')->save() ;
506
- //
507
- // return $this;
508
- // }
509
-
510
- protected function _createProductTranslateFile()
511
- {
512
- $_xml = new DOMDocument('1.0', 'utf-8');
513
- $_xml->formatOutput = true;
514
-
515
- $rootElement = $_xml->createElement('root');
516
-
517
- $productTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/product_translate')->getCollection($this->getWriteAdapter());
518
- $productTranslateCollection->addFieldToFilter('job_id', $this->getId());
519
-
520
- $attributeFrontLabel = array();
521
-
522
- foreach ($productTranslateCollection as $productTranslate) {
523
- if (!isset($attributeFrontLabel[$productTranslate->getAttributeId()])) {
524
- $attributeFrontLabel[$productTranslate->getAttributeId()] =
525
- Mage::getModel('eav/entity_attribute')->load($productTranslate->getAttributeId())->getFrontendLabel();
526
- }
527
-
528
- $dataElement = $_xml->createElement('data');
529
- $dataElement->setAttribute('name', $this->getTypeId() . '_' . $this->getStoreId() . '_' . $productTranslate->getAttributeId() . '_' . $productTranslate->getProductId());
530
- $dataElement->setAttribute('content_context', $attributeFrontLabel[$productTranslate->getAttributeId()]);
531
- $dataElement->setAttribute('content_context_url',Mage::getStoreConfig('web/unsecure/base_link_url', $this->getStoreId()) . 'catalog/category/view/id/' . $productTranslate->getProductId());
532
- $dataElement->setAttribute('content_id', $productTranslate->getId());
533
-
534
- $valueElement = $_xml->createElement('value');
535
- $CDATAValueNode = $_xml->createCDATASection($productTranslate->getOriginal());
536
- $valueElement->appendChild($CDATAValueNode);
537
-
538
- $dataElement->appendChild($valueElement);
539
- $rootElement->appendChild($dataElement);
540
- }
541
-
542
- $_xml->appendChild($rootElement);
543
- file_put_contents(Mage::getBaseDir() . $this->_translateFilePath . 'job' . $this->getId() . '.xml', $_xml->saveXML());
544
- $this->setSourceFile('job' . $this->getId() . '.xml')->save();
545
-
546
- return $this;
547
- }
548
-
549
- protected function _createCategoryTranslateFile()
550
- {
551
-
552
- $_xml = new DOMDocument('1.0', 'utf-8');
553
- $_xml->formatOutput = true;
554
-
555
- $rootElement = $_xml->createElement('root');
556
-
557
- $categoryTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/category_translate')->getCollection();
558
- $categoryTranslateCollection->addFieldToFilter('job_id', $this->getId());
559
-
560
- $attributeFrontLabel = array();
561
-
562
- foreach ($categoryTranslateCollection as $categoryTranslate) {
563
- if (!isset($attributeFrontLabel[$categoryTranslate->getAttributeId()])) {
564
- $attributeFrontLabel[$categoryTranslate->getAttributeId()] =
565
- Mage::getModel('eav/entity_attribute')->load($categoryTranslate->getAttributeId())->getFrontendLabel();
566
- }
567
-
568
- $dataElement = $_xml->createElement('data');
569
- $dataElement->setAttribute('name', $this->getTypeId() . '_' . $this->getStoreId() . '_' . $categoryTranslate->getAttributeId() . '_' . $categoryTranslate->getCategoryId());
570
- $dataElement->setAttribute('content_context',$attributeFrontLabel[$categoryTranslate->getAttributeId()]);
571
- $dataElement->setAttribute('content_context_url', Mage::getStoreConfig('web/unsecure/base_link_url', $this->getStoreId()) . 'catalog/category/view/id/' . $categoryTranslate->getCategoryId());
572
- $dataElement->setAttribute('content_id', $categoryTranslate->getId());
573
-
574
- $valueElement = $_xml->createElement('value');
575
- $CDATAValueNode = $_xml->createCDATASection($categoryTranslate->getOriginal());
576
- $valueElement->appendChild($CDATAValueNode);
577
-
578
- $dataElement->appendChild($valueElement);
579
- $rootElement->appendChild($dataElement);
580
- }
581
-
582
- $_xml->appendChild($rootElement);
583
- file_put_contents(Mage::getBaseDir() . $this->_translateFilePath . 'job' . $this->getId() . '.xml', $_xml->saveXML());
584
- $this->setSourceFile('job' . $this->getId() . '.xml')->save();
585
-
586
- return $this;
587
- }
588
-
589
- protected function _createAttributeTranslateFile()
590
- {
591
-
592
- $_xml = new DOMDocument('1.0', 'utf-8');
593
- $_xml->formatOutput = true;
594
-
595
- $rootElement = $_xml->createElement('root');
596
-
597
- $attributeTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/attribute_translate')->getCollection();
598
- $attributeTranslateCollection->addFieldToFilter('job_id', $this->getId());
599
-
600
- foreach ($attributeTranslateCollection as $attributeTranslate) {
601
-
602
- $dataInJson = json_encode(simplexml_load_string($attributeTranslate->getOriginal()));
603
- $data = json_decode($dataInJson, true);
604
-
605
- foreach ($data as $k => $attribute) {
606
- if ($k == 'title' && $attribute) {
607
- $dataElement = $_xml->createElement('data');
608
- $dataElement->setAttribute('name', $this->getTypeId() . '_' . $this->getStoreId() . '_' . $attributeTranslate->getAttributeId());
609
- $dataElement->setAttribute('content_context', 'product attribute title');
610
- $dataElement->setAttribute('content_id', $attributeTranslate->getId());
611
-
612
- $valueElement = $_xml->createElement('value');
613
- $CDATAValueNode = $_xml->createCDATASection($attribute);
614
- $valueElement->appendChild($CDATAValueNode);
615
-
616
- $dataElement->appendChild($valueElement);
617
- $rootElement->appendChild($dataElement);
618
- }
619
-
620
- if ($k = 'option') {
621
- foreach ($attribute as $optionId => $optionValue) {
622
- $dataElement = $_xml->createElement('data');
623
- $dataElement->setAttribute('name', $this->getTypeId() . '_' . $this->getStoreId() . '_' . $attributeTranslate->getAttributeId());
624
- $dataElement->setAttribute('content_context', 'product attribute option');
625
- $dataElement->setAttribute('option_id', $optionId);
626
- $dataElement->setAttribute('content_id', $attributeTranslate->getId());
627
-
628
- $valueElement = $_xml->createElement('value');
629
- $CDATAValueNode = $_xml->createCDATASection($optionValue);
630
- $valueElement->appendChild($CDATAValueNode);
631
-
632
- $dataElement->appendChild($valueElement);
633
- $rootElement->appendChild($dataElement);
634
- }
635
-
636
- }
637
-
638
- }
639
- }
640
- $_xml->appendChild($rootElement);
641
- file_put_contents(Mage::getBaseDir() . $this->_translateFilePath . 'job' . $this->getId() . '.xml', $_xml->saveXML());
642
- $this->setSourceFile('job' . $this->getId() . '.xml')->save();
643
-
644
- return $this;
645
- }
646
-
647
- protected function _summitJob()
648
- {
649
-
650
- $request = array();
651
-
652
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
653
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
654
- if ($helper->isSandboxMode()) {
655
- $this->setIsTestJob(true);
656
- }
657
-
658
- if (!$this->getTitle()) {
659
- $store = Mage::getModel('core/store')->load($this->getStoreId());
660
- $defaultTitle = $store->getFrontendName() . '_' . $store->getName() . '_' . Mage::getModel('core/date')->timestamp();
661
- $this->setTitle($defaultTitle);
662
- }
663
- $request['title'] = $this->getTitle();
664
- $request['sl'] = $this->getSl();
665
- $request['tl'] = $this->getTl();
666
-
667
- $filePath = MAGENTO_ROOT . $this->_translateFilePath . $this->getSourceFile();
668
-
669
- $request['source_file'] = function_exists('curl_file_create') ? curl_file_create($filePath) : '@' . $filePath;
670
- $request['callback_uri'] = Mage::getStoreConfig('web/unsecure/base_link_url', $this->getStoreId()) . 'straker/callback';
671
- $request['token'] = $this->getId();
672
- /** @var StrakerTranslations_EasyTranslationPlatform_Model_Api $api */
673
- $api = $this->_getApi();
674
- $response = $api->callTranslate($request);
675
- if ($response->job_key) {
676
- $this->setStatusId(2)
677
- ->setJobKey($response->job_key)
678
- ->setTjNumber($response->tj_number)
679
- ->save();
680
- $this->setLastStatus(1);
681
- } else {
682
- $this->setLastStatus(0);
683
- $message = $response->magentoMessage ? $response->magentoMessage : 'Unknown Error.';
684
- $this->setLastMessage($message);
685
- }
686
- return $this;
687
-
688
- }
689
-
690
- public function submitProducts($productAttributeIds, $productIds)
691
- {
692
-
693
- //product
694
- $this->setTypeId(1);
695
- $this->addProducts($productAttributeIds, $productIds)
696
- ->_createProductTranslateFile()
697
- ->_summitJob();
698
- return $this;
699
- }
700
-
701
- public function submitCategories($categoryAttributeIds, $categoryIds)
702
- {
703
-
704
- //category
705
- $this->setTypeId(3);
706
- $this->addCategories($categoryAttributeIds, $categoryIds)
707
- ->_createCategoryTranslateFile()
708
- ->_summitJob();
709
- return $this;
710
- }
711
-
712
- public function submitAttributes($attributeData)
713
- {
714
-
715
- //category
716
- $this->setTypeId(4);
717
- $this->addAttributes($attributeData)
718
- ->_createAttributeTranslateFile()
719
- ->_summitJob();
720
- return $this;
721
- }
722
-
723
- public function submitCmsPage($cmsIds, $columns = array('title', 'content'))
724
- {
725
-
726
- $this->setTypeId(5);
727
- $this->addCmsEntities($cmsIds, $columns, 'page')
728
- ->_summitJob();
729
- return $this;
730
- }
731
-
732
- public function submitCmsblock($cmsIds, $columns = array('title', 'content'))
733
- {
734
-
735
- $this->setTypeId(6);
736
- $this->addCmsEntities($cmsIds, $columns, 'block')
737
- ->_summitJob();
738
- return $this;
739
- }
740
-
741
- public function updateQuote()
742
- {
743
-
744
- if ($this->getJobKey()) {
745
- $request = array();
746
- $request['job_key'] = $this->getJobKey();
747
- $api = $this->_getApi();
748
- $response = $api->getTranslation($request);
749
-
750
- if ($response->job) {
751
- foreach ($response->job as $job) {
752
- if ($job->token == $this->getId()) {
753
- $quote = $job->quotation;
754
- if ($quote && $quote != $this->getQuote()) {
755
- $this->setQuote($quote)->save();
756
- return true;
757
- }
758
- }
759
- }
760
- }
761
- }
762
- return false;
763
-
764
- }
765
-
766
- public function updateTranslation()
767
- {
768
- $updateFlag = false;
769
- if ($this->getJobKey()) {
770
- $request = array();
771
- $request['job_key'] = $this->getJobKey();
772
- $api = $this->_getApi();
773
- $response = $api->getTranslation($request);
774
- if ($response->job) {
775
- foreach ($response->job as $job) {
776
- if ($job->token == $this->getId()) {
777
- $updateFlag = $this->updateJob($job);
778
- }
779
- }
780
- $this->setLastStatus(1);
781
- }
782
- else{
783
- $this->setLastStatus(0);
784
- $message = $response->magentoMessage?$this->setLastMessage($response->magentoMessage):'Unknown Error.';
785
- $this->setLastMessage($message);
786
- }
787
-
788
- }
789
- return $updateFlag;
790
- }
791
-
792
- public function bulkUpdateTranslation(){
793
- $api = $this->_getApi();
794
- $response = $api->getTranslation(array());
795
- return $response->job ? $response->job : false;
796
- }
797
-
798
- public function updateJob($job){
799
- $updateFlag = false;
800
- $jobStatusId = $this->_getStatusId($job->status);
801
-
802
- if ($jobStatusId && $job->status <> $this->getStatusName()) {
803
- $this->setStatusId($jobStatusId)->save();
804
- $updateFlag = true;
805
- }
806
-
807
- if ($job->tj_number && $job->tj_number <> $this->getTjNumber()) {
808
- $this->setTjNumber($job->tj_number)->save();
809
- $updateFlag = true;
810
- }
811
-
812
- if ($job->workflow && $job->workflow <> $this->getWorkFlow()) {
813
- $this->setWorkFlow($job->workflow)->save();
814
- $updateFlag = true;
815
- }
816
-
817
- if ($job->quotation && $job->quotation <> $this->getQuote()) {
818
- $this->setQuote($job->quotation)->save();
819
- $updateFlag = true;
820
- }
821
- foreach ($job->translated_file as $file) {
822
- if ($file->download_url && !$this->getDownloadUrl()) {
823
- $this->setDownloadUrl($file->download_url)->save();
824
- $this->_importTranslation();
825
- }
826
- }
827
- return $updateFlag;
828
- }
829
-
830
- protected function _getApi(){
831
-
832
- return Mage::getModel('strakertranslations_easytranslationplatform/api',array('store'=>$this->getStoreId()));
833
- }
834
-
835
- protected function _getStatusId($statusName)
836
- {
837
-
838
- return Mage::getModel('strakertranslations_easytranslationplatform/job_status')->load($statusName, 'status_name')->getId();
839
- }
840
-
841
- protected function _importTranslation()
842
- {
843
-
844
- $xml = $this->_getApi()->getTranslatedFile($this->getDownloadUrl());
845
-
846
- file_put_contents(Mage::getBaseDir() . $this->_translateFilePath . 'translated_job' . $this->getId() . '.xml', $xml, LOCK_EX);
847
-
848
- $data = simplexml_load_string($xml);
849
-
850
- $_translationValueGroup = array();
851
-
852
- foreach ($data->children() as $_translation) {
853
-
854
- $_entityTranslationId = (string)$_translation->attributes()->content_id;
855
- if ($this->_getType() == 'attribute') {
856
- if ($_translation->attributes()->content_context == "product attribute title") {
857
- $_translationValueGroup[$_entityTranslationId]['title'] = (string)$_translation->value;
858
- }
859
-
860
- if ($_translation->attributes()->content_context == "product attribute option") {
861
- $_translationValueGroup[$_entityTranslationId]['option']['id_' . $_translation->attributes()->option_id] = (string)$_translation->value;
862
- }
863
-
864
- } else {
865
- $_translationValueGroup[$_entityTranslationId] = (string)$_translation->value;
866
- }
867
-
868
- }
869
-
870
- foreach ($_translationValueGroup as $content_id => $_translationValue) {
871
-
872
- $value = $_translationValue;
873
-
874
- if (is_array($_translationValue)) {
875
- $xml = new SimpleXMLElement('<attribute/>');
876
- $this->array_to_xml($_translationValue, $xml);
877
- $value = (string)$xml->asXML();
878
- }
879
-
880
-
881
- $_entityTranslation = Mage::getModel('strakertranslations_easytranslationplatform/' . $this->_getType() . '_translate')->load($content_id);
882
- $_entityTranslation->setTranslate($value);
883
- $_entityTranslation->save();
884
- $_entityTranslation->clearInstance();
885
- }
886
-
887
- return $this->setDownloadedVersion(1)->save();
888
-
889
- }
890
-
891
- protected function _getType()
892
- {
893
- return str_replace(' ', '_', strtolower($this->getTypeName()));
894
- }
895
-
896
- public function updatePayment()
897
- {
898
-
899
- if ($this->getJobKey()) {
900
- $request = array();
901
- $request['job_key'] = $this->getJobKey();
902
- $api = $this->_getApi();
903
- $response = $api->getPayment($request);
904
-
905
- if (!empty($response) && $response->status == "Paid") { ///////waiting for payment api
906
- $this->setPaymentStatus(1)->save();
907
- return true;
908
- }
909
- }
910
- return false;
911
- }
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) {
919
- $collection->addFieldToFilter($this->_getType() . '_id', array('in' => $entityIds));
920
- }
921
-
922
- $updatedIds = array();
923
- $writeConnection = $this->getWriteAdapter();
924
-
925
- if (in_array($this->_getType(), array('cms_block', 'cms_page'))) {
926
- $this->createNewCms($entityIds);
927
- }
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();
937
- if (in_array($this->_getType(), array('cms_block', 'cms_page'))) {
938
- $cmstableName = str_replace('_', '', $this->_getType());
939
- $cmsColumnName = str_replace('cms_', '', $this->_getType());
940
- $entityId = $translation->getData($this->_getType() . '_id');
941
- $writeConnection->update($prefix . 'straker_job_' . $cmstableName, array('version' => 1), $cmsColumnName . "_id = {$entityId} and job_id ={$this->getId()}");
942
- } else {
943
- $writeConnection->update($prefix . 'straker_job_' . $this->_getType(), array('version' => 1), $this->_getType() . "_id = {$entityId} and job_id ={$this->getId()}");
944
- }
945
- }
946
- }
947
-
948
- return true;
949
- }
950
-
951
- protected function createNewCms($entityIds)
952
- {
953
-
954
-
955
- $cmsType = str_replace('cms_', '', $this->_getType());
956
-
957
- $cmsModelName = str_replace('_', '/', $this->_getType());
958
-
959
-
960
- $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_' . $this->_getType())->getCollection();
961
-
962
- $collection->addFieldToFilter('job_id', $this->getId());
963
-
964
- if ($entityIds) {
965
- $collection->addFieldToFilter($cmsType . '_id', array('in' => $entityIds));
966
- }
967
-
968
- foreach ($collection as $jobCms) {
969
-
970
- if (!$jobCms->getNewEntityId()) {
971
-
972
- $cmsModel = Mage::getModel($cmsModelName);
973
-
974
- $cmsData = json_decode($jobCms->getOrigin());
975
-
976
- foreach ($cmsData as $k => $v) {
977
- $cmsModel->setData($k, $v);
978
- }
979
- //add target store id
980
- // $cmsModel->setStores(array())->save();
981
- $cmsModel->setStores([$this->getStoreId()])->save();
982
- $jobCms->setNewEntityId($cmsModel->getId())->save();
983
-
984
- }
985
-
986
- }
987
-
988
- }
989
-
990
- public function isPublished()
991
- {
992
- if ($this->getStatusId() == 5) {
993
- return true;
994
- } elseif ($this->getStatusId() == 4) {
995
- return $this->updatePublishedStatus()->getStatus() == 5;
996
- } else {
997
- return false;
998
- }
999
- }
1000
-
1001
- protected function updatePublishedStatus()
1002
- {
1003
- $collection = Mage::getModel('strakertranslations_easytranslationplatform/job_' . $this->_getType())->getCollection()->addFieldToFilter('job_id', $this->getId());
1004
- $collection->addFieldToFilter('version',
1005
- array(
1006
- array('neq' => '1'),
1007
- array('null' => true)
1008
- )
1009
- );
1010
- if (!$collection->getFirstItem()->getId()) {
1011
- $this->setStatusId(5)->save();
1012
- }
1013
- return $this;
1014
- }
1015
-
1016
- public function submitSupport(array $data)
1017
- {
1018
-
1019
- $res = $this->_getApi()->callSupport($data);
1020
-
1021
- return $res->success;
1022
-
1023
- }
1024
-
1025
- public function checkAndCreateFolder()
1026
- {
1027
-
1028
- $ioAdapter = new Varien_Io_File();
1029
- try {
1030
- $ioAdapter->checkAndCreateFolder(Mage::getBaseDir('var') . DS . 'straker');
1031
- } catch (Exception $e) {
1032
- Mage::throwException($e->getMessage());
1033
- }
1034
-
1035
- return $this;
1036
-
1037
- }
1038
-
1039
- protected function getWriteAdapter()
1040
- {
1041
- return Mage::getSingleton('core/resource')->getConnection('core_write');
1042
- }
1043
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Attribute.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:39 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Attribute extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_attribute');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Category.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:52 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Category extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_category');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Block.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:04 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Cms_Block extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cms_block');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Page.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:02 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Cms_Page extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cms_page');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Product.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:38 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Product extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_product');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Status.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:43 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Status extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_status');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Type.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Job_Type extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_type');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:43 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Product_Attributes extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Product/Translate.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:46 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Product_Translate extends Mage_Core_Model_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_translate');
14
- }
15
-
16
- public function importTranslation(){
17
-
18
- //if translated value is null, skip
19
- $translatedValue = $this->getTranslate();
20
- if (is_null($translatedValue)){
21
- return;
22
- }
23
-
24
- $product = Mage::getModel('catalog/product')->setStoreId($this->getStoreId())->load($this->getProductId());
25
-
26
- $productAttributeCode = $this->_getAttributeCode($this->getAttributeId());
27
-
28
- $this->setBackup($product->getData($productAttributeCode));
29
-
30
- $product->setData($productAttributeCode, $translatedValue)
31
- ->getResource()
32
- ->saveAttribute($product, $productAttributeCode);
33
- $this->setIsImported(1)->save();
34
-
35
- $product->clearInstance();
36
-
37
- }
38
-
39
- protected function _getAttributeCode($attributeId){
40
-
41
- if (!Mage::registry('attributeCodeCache_'.$attributeId)){
42
- $productAttributeCode = Mage::getModel('eav/entity_attribute')->load($attributeId)->getAttributeCode();
43
- Mage::register('attributeCodeCache_'.$attributeId,$productAttributeCode);
44
- }else{
45
- $productAttributeCode = Mage::registry('attributeCodeCache_'.$attributeId);
46
- }
47
- return $productAttributeCode;
48
-
49
- }
50
-
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Actionlog extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/actionlog', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Actionlog/Collection.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Actionlog_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/actionlog');
14
- }
15
-
16
-
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Attribute_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/straker_attribute_translate', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Attribute/Translate/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Attribute_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/attribute_translate');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:55 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_attributes', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Attributes/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:55 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:53 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_translate', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Category/Translate/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:53 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Category_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/category_translate');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:28 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Block_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_attributes', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:28 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Block_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:07 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Block_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_translate', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:07 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Block_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_block_translate');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:28 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Page_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_attributes', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 19/05/16
6
- * Time: 3:29 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Page_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Page_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_translate', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:06 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Cms_Page_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/cms_page_translate');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Created by PhpStorm.
5
- * User: WlliamZhao
6
- * Date: 30/09/15
7
- * Time: 4:37 PM
8
- */
9
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job extends Mage_Core_Model_Resource_Db_Abstract {
10
-
11
- protected function _construct() {
12
- $this->_init('strakertranslations_easytranslationplatform/job', 'id');
13
- }
14
-
15
- protected function _getLoadSelect($field, $value, $object) {
16
- // $prefix = Mage::getConfig()->getTablePrefix()->__toString();
17
- $strakerJobTableName = $this->getTable('strakertranslations_easytranslationplatform/job');
18
- $select = parent::_getLoadSelect($field, $value, $object)
19
- ->join(array('t' => $this->getTable('strakertranslations_easytranslationplatform/job_type')),
20
- $strakerJobTableName.'.type_id=t.type_id',
21
- array('type_name')
22
- )
23
- ->join(array('s' => $this->getTable('strakertranslations_easytranslationplatform/job_status')),
24
- $strakerJobTableName.'.status_id=s.status_id',
25
- array('status_name')
26
- );
27
-
28
- return $select;
29
- }
30
-
31
- /**
32
- * Prepare data for save
33
- *
34
- * @param Mage_Core_Model_Abstract $object
35
- * @return array
36
- */
37
- protected function _prepareDataForSave(Mage_Core_Model_Abstract $object) {
38
- $currentTime = Varien_Date::now();
39
- if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) {
40
- $object->setCreatedAt($currentTime);
41
- }
42
- $object->setUpdatedAt($currentTime);
43
- $data = parent::_prepareDataForSave($object);
44
- return $data;
45
- }
46
-
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:39 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Attribute extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_attribute', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Attribute/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 18/01/16
6
- * Time: 7:39 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Attribute_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_attribute');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:52 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Category extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_category', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Category/Collection.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/11/15
6
- * Time: 8:52 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Category_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_category');
14
- }
15
-
16
- public function getAllIds()
17
- {
18
- $idsSelect = clone $this->getSelect();
19
- $idsSelect->reset(Zend_Db_Select::ORDER);
20
- $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT);
21
- $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
22
- $idsSelect->reset(Zend_Db_Select::COLUMNS);
23
-
24
- $idsSelect->columns('category_id', 'main_table');
25
- return $this->getConnection()->fetchCol($idsSelect);
26
- }
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:04 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Cms_Block extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cmsblock', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:04 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Cms_Block_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cms_block');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:02 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Cms_Page extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cmspage', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 12/05/16
6
- * Time: 12:02 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Cms_Page_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_cms_page');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:37 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:38 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_product', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Product/Collection.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 4:38 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Product_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_product');
14
- }
15
-
16
- public function getAllIds()
17
- {
18
- $idsSelect = clone $this->getSelect();
19
- $idsSelect->reset(Zend_Db_Select::ORDER);
20
- $idsSelect->reset(Zend_Db_Select::LIMIT_COUNT);
21
- $idsSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
22
- $idsSelect->reset(Zend_Db_Select::COLUMNS);
23
-
24
- $idsSelect->columns('product_id', 'main_table');
25
- return $this->getConnection()->fetchCol($idsSelect);
26
- }
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:43 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Status extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_status', 'status_id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Status/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:43 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Status_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_status');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Type extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_type', 'type_id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Type/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:41 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Type_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/job_type');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:44 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Attributes extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_attributes', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Attributes/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:44 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Attributes_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_attributes');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:46 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Translate extends Mage_Core_Model_Resource_Db_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_translate', 'id');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Product/Translate/Collection.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: WlliamZhao
5
- * Date: 30/09/15
6
- * Time: 8:46 PM
7
- */
8
- class StrakerTranslations_EasyTranslationPlatform_Model_Resource_Product_Translate_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
9
- {
10
-
11
- protected function _construct()
12
- {
13
- $this->_init('strakertranslations_easytranslationplatform/product_translate');
14
- }
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/System/Config/Source/SiteMode.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magento.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magento.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Used in creating options for Yes|No config value selection
29
- *
30
- */
31
- class StrakerTranslations_EasyTranslationPlatform_Model_System_Config_Source_SiteMode{
32
-
33
- /**
34
- * Options getter
35
- *
36
- * @return array
37
- */
38
- public function toOptionArray()
39
- {
40
- return array(
41
- array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Sandbox')),
42
- array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Live')),
43
- );
44
- }
45
-
46
- /**
47
- * Get options in "key-value" format
48
- *
49
- * @return array
50
- */
51
- public function toArray()
52
- {
53
- return array(
54
- 0 => Mage::helper('adminhtml')->__('Sandbox'),
55
- 1 => Mage::helper('adminhtml')->__('Live'),
56
- );
57
- }
58
-
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/AttributeController.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_AttributeController extends Mage_Adminhtml_Controller_Action{
3
- protected function _isAllowed()
4
- {
5
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
- }
7
-
8
- protected function _initAction()
9
- {
10
- $this->checkSiteMode();
11
-
12
- $this
13
- ->loadLayout()
14
- ->_setActiveMenu('straker/job')
15
- ;
16
-
17
- return $this;
18
- }
19
-
20
- protected function _initNewAction()
21
- {
22
- $this->checkSiteMode();
23
-
24
- $this
25
- ->loadLayout()
26
- ->_setActiveMenu('straker/new')
27
- ;
28
-
29
- return $this;
30
- }
31
-
32
-
33
- public function indexAction(){
34
-
35
- if (!$this->getRequest()->getParam('job_id')){
36
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
37
- $this->_redirect('*/straker_job/');
38
- return;
39
- }
40
-
41
- $this->_title($this->__('Straker Translations'))
42
- ->_title($this->__('Manage Jobs'));
43
-
44
- $this->loadLayout()->_setActiveMenu('straker/job');
45
- $this->renderLayout();
46
-
47
- }
48
-
49
- public function newAction(){
50
- $params = $this->getRequest()->getParams();
51
- if (empty($params['store'])) {
52
- $this->_redirect('*/straker_new');
53
- return;
54
- }
55
- else{
56
- return $this->_initNewAction()
57
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute','strakertranslations_easytranslationplatform_new_attribute',array('setup_store_id' => $params['store'])))
58
- ->renderLayout();
59
- }
60
- }
61
-
62
- public function addtoconfirmAction(){
63
- $data = $this->getRequest()->getParams();
64
- if(empty($data['attribute']) && empty($data['option'])){
65
- $data['attribute'] = Mage::getSingleton('adminhtml/session')->getData('straker_new_attribute');
66
- $data['option'] = Mage::getSingleton('adminhtml/session')->getData('straker_new_option');
67
- }
68
- $data['store'] = !empty($data['store']) ? $data['store'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_store');
69
-
70
- if( $data['store'] && ($data['attribute'] || $data['option']) ){
71
- Mage::getSingleton('adminhtml/session')
72
- ->setData('straker_new_attribute', $data['attribute'])
73
- ->setData('straker_new_option', $data['option'])
74
- ->setData('straker_new_store', $data['store'])
75
- ;
76
- return $this->_initAction()
77
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_attribute_confirm', 'strakertranslations_easytranslationplatform_new_attribute_confirm', array('store' => $data['store'], 'attribute' => $data['attribute']?$data['attribute']:array(), 'option' => $data['option']?$data['option']:array())))
78
- ->renderLayout();
79
- }
80
- else {
81
- $this->_redirect('*/straker_new/', $data);
82
- }
83
- }
84
-
85
- public function submitjobAction(){
86
- $data = $this->getRequest()->getParams();
87
- if( $data['store'] && isset($data['attribute']) && isset($data['option']) ){
88
- $attribute = !empty($data['attribute'])?explode(',', $data['attribute']):array();
89
- $option = !empty($data['option'])?explode(',', $data['option']):array();
90
- //prepare attribute array in nested
91
- foreach( array_unique( array_merge(
92
- $attribute,
93
- $option
94
- ) ) as $attributeId) {
95
-
96
- $attributeData[$attributeId]['label'] = in_array($attributeId, $attribute, true) ? 1 : 0;
97
- $attributeData[$attributeId]['option'] = in_array($attributeId, $option, true) ? 1 : 0;
98
-
99
- }
100
-
101
-
102
-
103
-
104
-
105
- //todo: insert model submit job from here
106
- // var_dump($attributeData); die();
107
-
108
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
109
- try {
110
- $jobModel->checkAndCreateFolder();
111
- }
112
- catch (Mage_Core_Exception $e){
113
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
114
- $this->_redirect('*/*/', array(
115
- 'store' => $data['store'],
116
- 'attr' => $data['attr']
117
- ));
118
- return;
119
- }
120
- foreach(explode(',', $data['attr']) as $attributeCode){
121
- $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
122
- ->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode)->getAttributeId();
123
- }
124
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
125
- $storeSetup = $helper->getStoreSetup($data['store']);
126
- $jobModel->setStoreId($data['store']);
127
- $jobModel->setSl($storeSetup['from']);
128
- $jobModel->setTl($storeSetup['to']);
129
- $jobModel->setToken('Token');
130
- $jobModel->submitAttributes($attributeData);
131
- if ($jobModel->getLastStatus()) {
132
- Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
133
- $this->_redirect('*/straker_job/');
134
- }
135
- else{
136
- Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
137
- $this->_redirect('*/*/new');
138
- }
139
- }
140
- else {
141
- $this->_redirect('*/*/new', $data);
142
- }
143
- }
144
-
145
- public function copyAllAction(){
146
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
147
-
148
- if (!$job->getId()){
149
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
150
- $this->_redirect('*/straker_job/');
151
- return;
152
- }
153
-
154
- if($job->applyTranslation()) {
155
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
156
- $this->_redirect('*/straker_job/');
157
- return;
158
- } else {
159
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
160
- $this->_redirect('*/straker_job/');
161
- return;
162
- }
163
-
164
- }
165
-
166
- public function applyTranslationAction(){
167
- $jobId = $this->getRequest()->getParam('job_id');
168
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
169
-
170
- if (!$job->getId()){
171
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
172
- $this->_redirect('*/straker_job/');
173
- return;
174
- }
175
- $attributeIds = $this->getRequest()->getParam('attribute');
176
- if(!empty($attributeIds)) {
177
- if ($job->applyTranslation($attributeIds)) {
178
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
179
- $this->_redirect('*/straker_attribute/',array('job_id' => $jobId));
180
- return;
181
- } else {
182
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
183
- $this->_redirect('*/straker_attribute/',array('job_id' => $jobId));
184
- return;
185
- }
186
- }
187
- else{
188
- Mage::getSingleton('adminhtml/session')->addError('Please select attributes to apply the translation.');
189
- $this->_redirect('*/straker_attribute/',array('job_id' => $jobId));
190
- return;
191
- }
192
-
193
- }
194
-
195
- private function checkSiteMode(){
196
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
197
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
198
- $helper->checkSiteMode();
199
- }
200
-
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/CategoryController.php DELETED
@@ -1,219 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_CategoryController extends Mage_Adminhtml_Controller_Action{
3
-
4
- protected function _isAllowed()
5
- {
6
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
7
- }
8
-
9
- protected function _initAction()
10
- {
11
- $this->checkSiteMode();
12
-
13
- $this
14
- ->loadLayout()
15
- ->_setActiveMenu('straker/job')
16
- ;
17
-
18
- return $this;
19
- }
20
-
21
- protected function _initNewAction()
22
- {
23
- $this->checkSiteMode();
24
-
25
- $this
26
- ->loadLayout()
27
- ->_setActiveMenu('straker/new')
28
- ;
29
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
30
- $this->_title($this->__('Create New Job'));
31
- return $this;
32
- }
33
-
34
- public function newAction(){
35
- $params = $this->getRequest()->getParams();
36
- if (empty($params['store'])) {
37
- $this->_redirect('*/straker_new');
38
- return;
39
- }
40
- elseif (empty($params['attr'])) {
41
- return $this->_initNewAction()
42
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_attribute', 'strakertranslations_easytranslationplatform_new_categories_attribute', array('setup_store_id' => $params['store'])))
43
- ->renderLayout();
44
- }
45
- else{
46
- return $this->_initNewAction()
47
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_tree', 'strakertranslations_easytranslationplatform_l_new_category_tree', array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
48
- ->renderLayout();
49
- }
50
- }
51
-
52
- public function attributeAction(){
53
- $data = $this->getRequest()->getParams();
54
- if($data['attr'] && $data['store']){
55
- $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
56
- }
57
- else {
58
- $this->_redirect('*/straker_new/');
59
- }
60
- }
61
-
62
- public function confirmCategoryAction(){
63
- $data = $this->getRequest()->getParams();
64
- $data['attr'] = !empty($data['attr']) ? $data['attr'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_attr');
65
- $data['store'] = !empty($data['store']) ? $data['store'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_store');
66
- $data['category'] = !empty($data['category']) ? $data['category'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_category');
67
- //format category
68
- $categoryIds = array_filter(array_unique(explode(',', $data['category'])));
69
- if(!empty($data['attr']) && !empty($data['store']) && !empty($categoryIds)){
70
- Mage::getSingleton('adminhtml/session')
71
- ->setData('straker_new_attr', $data['attr'])
72
- ->setData('straker_new_store', $data['store'])
73
- ->setData('straker_new_category', $data['category'])
74
- ;
75
- return $this->_initNewAction()
76
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_confirm', 'strakertranslations_easytranslationplatform__new_category_confirm', array('store' => $data['store'], 'attr' => $data['attr'], 'category' => $categoryIds)))
77
- ->renderLayout();
78
- }
79
- else{
80
- $this->_redirect('*/*/new', array('attr'=>$data['attr'],'store'=>$data['store']));
81
- }
82
- }
83
-
84
- public function submitjobAction()
85
- {
86
- $data = $this->getRequest()->getParams();
87
- if($data['attr'] && $data['store'] && $data['category']){
88
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
89
- try {
90
- $jobModel->checkAndCreateFolder();
91
- }
92
- catch (Mage_Core_Exception $e){
93
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
94
- $this->_redirect('*/*/', array(
95
- 'store' => $data['store'],
96
- 'attr' => $data['attr']
97
- ));
98
- return;
99
- }
100
- foreach(explode(',', $data['attr']) as $attributeCode){
101
- $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
102
- ->getAttribute(Mage_Catalog_Model_Category::ENTITY, $attributeCode)->getAttributeId();
103
- }
104
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
105
- $storeSetup = $helper->getStoreSetup($data['store']);
106
- $jobModel->setStoreId($data['store']);
107
- $jobModel->setSl($storeSetup['from']);
108
- $jobModel->setTl($storeSetup['to']);
109
- $jobModel->setToken('Token');
110
- $jobModel->submitCategories($attr_ids, explode(',',$data['category']));
111
- if ($jobModel->getLastStatus()) {
112
- Mage::getSingleton('adminhtml/session')
113
- ->setData('straker_new_attr', '')
114
- ->setData('straker_new_store', '')
115
- ->setData('straker_new_category', '')
116
- ;
117
- Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
118
- $this->_redirect('*/straker_job/');
119
- }
120
- else{
121
- Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
122
- $this->_redirect('*/*/new');
123
- }
124
- }
125
- else {
126
- $this->_redirect('*/*/new', $data);
127
- }
128
-
129
- }
130
-
131
- public function categoriesJsonAction()
132
- {
133
- $this->getResponse()->setBody(
134
- $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_category_tree')
135
- ->getCategoryChildrenJson($this->getRequest()->getParam('category'))
136
- );
137
- }
138
-
139
- public function indexAction(){
140
-
141
- if (!$this->getRequest()->getParam('job_id')){
142
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
143
- $this->_redirect('*/straker_job/');
144
- return;
145
- }
146
-
147
- $this->_title($this->__('Straker Translations'))
148
- ->_title($this->__('Manage Jobs'));
149
-
150
- $this->loadLayout()->_setActiveMenu('straker/job');
151
- $this->renderLayout();
152
-
153
- // try {
154
- // $this->_title($this->__('Manage Jobs'));
155
- // return $this->_initAction()
156
- // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid'))
157
- // ->renderLayout();
158
- // } catch (Exception $e) {
159
- // Mage::getSingleton('core/session')->addError($this->__('Error occurred. Please contact service administrator.'));
160
- // $this->_redirect('adminhtml/dashboard');
161
- // }
162
- }
163
-
164
- public function copyAllAction(){
165
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
166
-
167
- if (!$job->getId()){
168
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
169
- $this->_redirect('*/straker_job/');
170
- return;
171
- }
172
-
173
- if($job->applyTranslation()) {
174
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
175
- $this->_redirect('*/straker_job/');
176
- return;
177
- } else {
178
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
179
- $this->_redirect('*/straker_job/');
180
- return;
181
- }
182
-
183
- }
184
-
185
- public function applyTranslationAction(){
186
- $jobId = $this->getRequest()->getParam('job_id');
187
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
188
-
189
- if (!$job->getId()){
190
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
191
- $this->_redirect('*/straker_job/');
192
- return;
193
- }
194
- $categoryIds = $this->getRequest()->getParam('category');
195
- if(!empty($categoryIds)) {
196
- if ($job->applyTranslation($categoryIds)) {
197
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
198
- $this->_redirect('*/straker_category/',array('job_id' => $jobId));
199
- return;
200
- } else {
201
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
202
- $this->_redirect('*/straker_category/',array('job_id' => $jobId));
203
- return;
204
- }
205
- }
206
- else{
207
- Mage::getSingleton('adminhtml/session')->addError('Please select categorys to apply the translation.');
208
- $this->_redirect('*/straker_category/',array('job_id' => $jobId));
209
- return;
210
- }
211
-
212
- }
213
-
214
- private function checkSiteMode(){
215
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
216
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
217
- $helper->checkSiteMode();
218
- }
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/BlockController.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_Cms_BlockController extends Mage_Adminhtml_Controller_Action{
3
- protected function _isAllowed()
4
- {
5
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
- }
7
-
8
- protected function _initAction()
9
- {
10
- $this
11
- ->loadLayout()
12
- ->_setActiveMenu('straker/job')
13
- ;
14
-
15
- return $this;
16
- }
17
-
18
- protected function _initNewAction()
19
- {
20
- $this
21
- ->loadLayout()
22
- ->_setActiveMenu('straker/new')
23
- ;
24
-
25
- return $this;
26
- }
27
-
28
-
29
- public function indexAction(){
30
-
31
- if (!$this->getRequest()->getParam('job_id')){
32
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
33
- $this->_redirect('*/straker_job/');
34
- return;
35
- }
36
-
37
- $this->_title($this->__('Straker Translations'))
38
- ->_title($this->__('Manage Jobs'));
39
-
40
- $this->loadLayout()->_setActiveMenu('straker/job');
41
- $this->renderLayout();
42
-
43
- }
44
-
45
- public function newAction(){
46
- $params = $this->getRequest()->getParams();
47
- if (empty($params['store'])) {
48
- $this->_redirect('*/straker_new');
49
- return;
50
- }
51
- elseif (empty($params['attr'])) {
52
- return $this->_initNewAction()
53
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block_attribute','strakertranslations_easytranslationplatform_new_cms_block_attribute',array('setup_store_id' => $params['store'])))
54
- ->renderLayout();
55
- }
56
- elseif (empty($params['cms_block'])) {
57
- return $this->_initNewAction()
58
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block','strakertranslations_easytranslationplatform_new_cms_block',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
59
- ->renderLayout();
60
- }
61
- else{
62
- return $this->_initNewAction()
63
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block_confirm','strakertranslations_easytranslationplatform_new_cms_block_confirm',array('store' => $params['store'], 'cms_block' => $params['cms_block'], 'attr' => $params['attr'])))
64
- ->renderLayout();
65
- }
66
- }
67
-
68
- public function attributeAction(){
69
- $data = $this->getRequest()->getParams();
70
- if($data['attr'] && $data['store']){
71
- $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
72
- }
73
- else {
74
- $this->_redirect('*/straker_new/');
75
- }
76
- }
77
-
78
- public function addtoconfirmAction(){
79
- $data = $this->getRequest()->getParams();
80
- $data['store'] = !empty($data['store']) ? $data['store'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_store');
81
- $data['attr'] = !empty($data['attr']) ? $data['attr'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_attr');
82
- $data['cms_block'] = !empty($data['cms_block']) ? $data['cms_block'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_cms_block');
83
- if(!empty($data['attr']) && !empty($data['store']) && !empty($data['cms_block'])){
84
- Mage::getSingleton('adminhtml/session')
85
- ->setData('straker_new_attr', $data['attr'])
86
- ->setData('straker_new_store', $data['store'])
87
- ->setData('straker_new_cms_block', $data['cms_block'])
88
- ;
89
- return $this->_initAction()
90
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_block_confirm', 'strakertranslations_easytranslationplatform_new_cms_block_confirm', array('store' => $data['store'], 'cms_block' => $data['cms_block'], 'attr' => $data['attr'])))
91
- ->renderLayout();
92
- }
93
- else {
94
- $this->_redirect('*/straker_new/', $data);
95
- }
96
- }
97
-
98
- public function submitjobAction(){
99
- $data = $this->getRequest()->getParams();
100
- if($data['attr'] && $data['store'] && $data['cms_block']){
101
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
102
- try {
103
- $jobModel->checkAndCreateFolder();
104
- }
105
- catch (Mage_Core_Exception $e){
106
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
107
- $this->_redirect('*/*/', array(
108
- 'store' => $data['store']
109
- ));
110
- return;
111
- }
112
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
113
- $storeSetup = $helper->getStoreSetup($data['store']);
114
- $jobModel->setStoreId($data['store']);
115
- $jobModel->setSl($storeSetup['from']);
116
- $jobModel->setTl($storeSetup['to']);
117
- $jobModel->setToken('Token');
118
- $jobModel->submitCmsBlock(explode(',',$data['cms_block']),explode(',', $data['attr']));
119
- if ($jobModel->getLastStatus()) {
120
- Mage::getSingleton('adminhtml/session')
121
- ->setData('straker_new_store', '')
122
- ->setData('straker_new_cms_block', '')
123
- ;
124
- Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
125
- $this->_redirect('*/straker_job/');
126
- }
127
- else{
128
- Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
129
- $this->_redirect('*/*/new');
130
- }
131
- }
132
- else {
133
- $this->_redirect('*/*/new', $data);
134
- }
135
- }
136
-
137
- public function copyAllAction(){
138
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
139
-
140
- if (!$job->getId()){
141
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
142
- $this->_redirect('*/straker_job/');
143
- return;
144
- }
145
-
146
- if($job->applyTranslation()) {
147
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
148
- $this->_redirect('*/straker_job/');
149
- return;
150
- } else {
151
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
152
- $this->_redirect('*/straker_job/');
153
- return;
154
- }
155
-
156
- }
157
-
158
- public function applyTranslationAction(){
159
- $jobId = $this->getRequest()->getParam('job_id');
160
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
161
-
162
- if (!$job->getId()){
163
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
164
- $this->_redirect('*/straker_job/');
165
- return;
166
- }
167
- $blockIds = $this->getRequest()->getParam('block_id');
168
- if(!empty($blockIds)) {
169
- if ($job->applyTranslation($blockIds)) {
170
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
171
- $this->_redirect('*/straker_cms_block/',array('job_id' => $jobId));
172
- return;
173
- } else {
174
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
175
- $this->_redirect('*/straker_cms_block/',array('job_id' => $jobId));
176
- return;
177
- }
178
- }
179
- else{
180
- Mage::getSingleton('adminhtml/session')->addError('Please select products to apply the translation.');
181
- $this->_redirect('*/straker_cms_block/',array('job_id' => $jobId));
182
- return;
183
- }
184
-
185
- }
186
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/PageController.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_Cms_PageController extends Mage_Adminhtml_Controller_Action{
3
- protected function _isAllowed()
4
- {
5
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
- }
7
-
8
- protected function _initAction()
9
- {
10
- $this
11
- ->loadLayout()
12
- ->_setActiveMenu('straker/job')
13
- ;
14
-
15
- return $this;
16
- }
17
-
18
- protected function _initNewAction()
19
- {
20
- $this
21
- ->loadLayout()
22
- ->_setActiveMenu('straker/new')
23
- ;
24
-
25
- return $this;
26
- }
27
-
28
-
29
- public function indexAction(){
30
-
31
- if (!$this->getRequest()->getParam('job_id')){
32
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
33
- $this->_redirect('*/straker_job/');
34
- return;
35
- }
36
-
37
- $this->_title($this->__('Straker Translations'))
38
- ->_title($this->__('Manage Jobs'));
39
-
40
- $this->loadLayout()->_setActiveMenu('straker/job');
41
- $this->renderLayout();
42
-
43
- }
44
-
45
- public function newAction(){
46
- $params = $this->getRequest()->getParams();
47
- if (empty($params['store'])) {
48
- $this->_redirect('*/straker_new');
49
- return;
50
- }
51
- elseif (empty($params['attr'])) {
52
- return $this->_initNewAction()
53
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page_attribute','strakertranslations_easytranslationplatform_new_cms_page_attribute',array('setup_store_id' => $params['store'])))
54
- ->renderLayout();
55
- }
56
- elseif (empty($params['cms_page'])) {
57
- return $this->_initNewAction()
58
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page','strakertranslations_easytranslationplatform_new_cms_page',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
59
- ->renderLayout();
60
- }
61
- else{
62
- return $this->_initNewAction()
63
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page_confirm','strakertranslations_easytranslationplatform_new_cms_page_confirm',array('store' => $params['store'], 'cms_page' => $params['cms_page'], 'attr' => $params['attr'])))
64
- ->renderLayout();
65
- }
66
- }
67
-
68
- public function attributeAction(){
69
- $data = $this->getRequest()->getParams();
70
- if($data['attr'] && $data['store']){
71
- $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
72
- }
73
- else {
74
- $this->_redirect('*/straker_new/');
75
- }
76
- }
77
-
78
- public function addtoconfirmAction(){
79
- $data = $this->getRequest()->getParams();
80
- $data['store'] = !empty($data['store']) ? $data['store'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_store');
81
- $data['attr'] = !empty($data['attr']) ? $data['attr'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_attr');
82
- $data['cms_page'] = !empty($data['cms_page']) ? $data['cms_page'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_cms_page');
83
- if(!empty($data['attr']) && !empty($data['store']) && !empty($data['cms_page'])){
84
- Mage::getSingleton('adminhtml/session')
85
- ->setData('straker_new_attr', $data['attr'])
86
- ->setData('straker_new_store', $data['store'])
87
- ->setData('straker_new_cms_page', $data['cms_page'])
88
- ;
89
- return $this->_initAction()
90
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_cms_page_confirm', 'strakertranslations_easytranslationplatform_new_cms_page_confirm', array('store' => $data['store'], 'cms_page' => $data['cms_page'], 'attr' => $data['attr'])))
91
- ->renderLayout();
92
- }
93
- else {
94
- $this->_redirect('*/straker_new/', $data);
95
- }
96
- }
97
-
98
- public function submitjobAction(){
99
- $data = $this->getRequest()->getParams();
100
- if($data['attr'] && $data['store'] && $data['cms_page']){
101
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
102
- try {
103
- $jobModel->checkAndCreateFolder();
104
- }
105
- catch (Mage_Core_Exception $e){
106
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
107
- $this->_redirect('*/*/', array(
108
- 'store' => $data['store']
109
- ));
110
- return;
111
- }
112
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
113
- $storeSetup = $helper->getStoreSetup($data['store']);
114
- $jobModel->setStoreId($data['store']);
115
- $jobModel->setSl($storeSetup['from']);
116
- $jobModel->setTl($storeSetup['to']);
117
- $jobModel->setToken('Token');
118
- $jobModel->submitCmsPage(explode(',',$data['cms_page']),explode(',', $data['attr']));
119
- if ($jobModel->getLastStatus()) {
120
- Mage::getSingleton('adminhtml/session')
121
- ->setData('straker_new_store', '')
122
- ->setData('straker_new_cms_page', '')
123
- ;
124
- Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
125
- $this->_redirect('*/straker_job/');
126
- }
127
- else{
128
- Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
129
- $this->_redirect('*/*/new');
130
- }
131
- }
132
- else {
133
- $this->_redirect('*/*/new', $data);
134
- }
135
- }
136
-
137
- public function copyAllAction(){
138
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
139
-
140
- if (!$job->getId()){
141
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
142
- $this->_redirect('*/straker_job/');
143
- return;
144
- }
145
-
146
- if($job->applyTranslation()) {
147
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
148
- $this->_redirect('*/straker_job/');
149
- return;
150
- } else {
151
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
152
- $this->_redirect('*/straker_job/');
153
- return;
154
- }
155
-
156
- }
157
-
158
- public function applyTranslationAction(){
159
- $jobId = $this->getRequest()->getParam('job_id');
160
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
161
-
162
- if (!$job->getId()){
163
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
164
- $this->_redirect('*/straker_job/');
165
- return;
166
- }
167
- $cmsPageIds = $this->getRequest()->getParam('page_id');
168
- if(!empty($cmsPageIds)) {
169
- if ($job->applyTranslation($cmsPageIds)) {
170
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
171
- $this->_redirect('*/straker_cms_page/',array('job_id' => $jobId));
172
- return;
173
- } else {
174
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
175
- $this->_redirect('*/straker_cms_page/',array('job_id' => $jobId));
176
- return;
177
- }
178
- }
179
- else{
180
- Mage::getSingleton('adminhtml/session')->addError('Please select products to apply the translation.');
181
- $this->_redirect('*/straker_cms_page/',array('job_id' => $jobId));
182
- return;
183
- }
184
-
185
- }
186
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/JobController.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_JobController extends Mage_Adminhtml_Controller_Action{
3
- protected function _isAllowed()
4
- {
5
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
- }
7
-
8
- protected function _initAction()
9
- {
10
- $this
11
- ->loadLayout()
12
- ->_setActiveMenu('straker/job')
13
- ;
14
-
15
- return $this;
16
- }
17
-
18
- public function indexAction(){
19
-
20
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
21
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
22
- $helper->checkSiteMode();
23
-
24
- //todo refresh all jobs that is waiting on a quote. This should be refactored into different process.
25
- /** @var $collection StrakerTranslations_EasyTranslationPlatform_Model_Resource_Job_Collection */
26
- $collection = Mage::getModel('strakertranslations_easytranslationplatform/job')
27
- ->getCollection()
28
- ->addFieldToFilter('status_id', array('lt' => 4));
29
-
30
- // foreach($collection as $job){
31
- // $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($job->getId());
32
- // if ( $job->updateTranslation() ){
33
- // Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
34
- // }
35
- // }
36
- if ($collection->count() > 1){
37
- /** @var StrakerTranslations_EasyTranslationPlatform_Model_Job $job */
38
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job');
39
- $response = $job->bulkUpdateTranslation();
40
- if ( $response ) {
41
- foreach($collection as $jobModel){
42
- foreach ($response as $jobResponse) {
43
- if ($jobResponse->token == $jobModel->getId()) {
44
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobModel->getId());
45
- $jobModel->updateJob($jobResponse);
46
- }
47
- }
48
- if ( $job->updateTranslation() ){
49
-
50
- Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
51
- }
52
- }
53
- }
54
- }
55
-
56
- $this->_title($this->__('Straker Translations'))
57
- ->_title($this->__('Manage Jobs'));
58
-
59
- $this->loadLayout();
60
- $this->renderLayout();
61
- }
62
-
63
- public function updateJobAction() {
64
-
65
- $data = $this->getRequest()->getParams();
66
- if($data['job_id']){
67
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
68
-
69
- if(!$job->getJobKey()){
70
- return false;
71
- }
72
-
73
- if( $job->updateTranslation() ){
74
- Mage::getSingleton('core/session')->addSuccess($this->__('Job %s has been updated.', $job->getId()));
75
- }
76
- $this->_redirect('*/*/');
77
- return;
78
-
79
- }
80
-
81
- return false;
82
-
83
- }
84
-
85
-
86
- public function disputeAction() {
87
- $data = $this->getRequest()->getParams();
88
- if($data['job_id'] && $data['message']){
89
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['job_id']);
90
-
91
-
92
- $response = $job->submitSupport(array(
93
- 'title' => 'Dispute for '.$job->getTjNumber(),
94
- 'message' => $data['message']
95
- ));
96
-
97
- //Send out email
98
-
99
- $mail = new Zend_Mail(); //class for mail
100
- $mail->setBodyHtml($data['message']); //for sending message containing html code
101
- $mail->setFrom(Mage::getStoreConfig('trans_email/ident_general/email'), Mage::getStoreConfig('trans_email/ident_general/name'));
102
- $mail->addTo('processing@strakertranslations.com', 'Straker Support');
103
- $mail->setSubject('Dispute for '.$job->getTjNumber());
104
- $msg ='';
105
- Mage::log(print_r($mail,true), null , 'debugging.log' , true);
106
- try {
107
- if($mail->send())
108
- {
109
- $msg = true;
110
- }
111
- }
112
- catch(Exception $ex) {
113
- $msg = false;
114
- }
115
- if($msg){
116
- Mage::getSingleton('adminhtml/session')->addSuccess('Feedback has been submitted.');
117
- }
118
- else{
119
- Mage::getSingleton('adminhtml/session')->addError('Unkown error when sending email to processing@strakertranslations.com.');
120
- }
121
- }
122
- else{
123
- Mage::getSingleton('adminhtml/session')->addError('Required parameters missing when submitting a feedback.');
124
- }
125
- $this->_redirect('adminhtml/straker_product/index', array(
126
- 'job_id' => $data['job_id']
127
- ));
128
- return;
129
- }
130
-
131
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php DELETED
@@ -1,240 +0,0 @@
1
- <?php
2
-
3
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_NewController extends Mage_Adminhtml_Controller_Action
4
- {
5
- protected function _isAllowed()
6
- {
7
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/new');
8
- }
9
-
10
- protected function _initAction()
11
- {
12
- $this
13
- ->loadLayout()
14
- ->_setActiveMenu('straker/new');
15
- $this->_title($this->__('Create New Job'));
16
- return $this;
17
- }
18
-
19
- public function accountAction()
20
- {
21
- $this->_redirectUrl("https://myaccount.strakertranslations.com/");
22
- }
23
-
24
- public function termsAction()
25
- {
26
- $this->_redirectUrl("https://www.strakertranslations.com/about-us/terms-and-conditions-of-service.cfm");
27
- }
28
-
29
- public function indexAction()
30
- {
31
- $params = $this->getRequest()->getParams();
32
- if (Mage::helper('strakertranslations_easytranslationplatform')->getAppKey() === false || Mage::helper('strakertranslations_easytranslationplatform')->getAccessToken() === false) {
33
- return $this->_initAction()
34
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_register'))
35
- ->renderLayout();
36
- } elseif (empty($params['store'])) {
37
- $this->checkSiteMode();
38
- return $this->_initAction()
39
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_selectstore'))
40
- ->renderLayout();
41
- } elseif (Mage::helper('strakertranslations_easytranslationplatform')->getStoreSetup($params['store']) === false ) {
42
- $this->checkSiteMode();
43
- return $this->_initAction()
44
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_setupstore',
45
- 'strakertranslations_easytranslationplatform_new_setupstore', array('setup_store_id' => $params['store'])))
46
- ->renderLayout();
47
- } else {
48
- $this->checkSiteMode();
49
- return $this->_initAction()
50
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_type', 'strakertranslations_easytranslationplatform_new_type',
51
- array('setup_store_id' => $params['store'])))
52
- ->renderLayout();
53
- }
54
- }
55
-
56
- public function registerAction()
57
- {
58
-
59
- $data = $this->getRequest()->getPost();
60
- if (array_key_exists('form_key', $data)) {
61
- unset($data['form_key']);
62
- }
63
- if ($data['first_name'] && $data['last_name'] && $data['email'] && $data['terms']) {
64
- if ($data['company'] == '') {
65
- $data['company'] = $data['first_name'] . ' ' . $data['last_name'];
66
- }
67
- $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
68
- $response = $apiModel->callRegister($data);
69
- if ($response->access_token && $response->application_key) {
70
- $apiModel->saveAccessToken($response->access_token);
71
- $apiModel->saveAppKey($response->application_key);
72
- Mage::app()->getCacheInstance()->cleanType('config');
73
- Mage::getSingleton('adminhtml/session')->addSuccess('Registration success.');
74
- } elseif ($response->magentoMessage) {
75
- Mage::getSingleton('adminhtml/session')->addError($response->magentoMessage);
76
- } else {
77
- Mage::getSingleton('adminhtml/session')->addError('Registration unsuccessful.');
78
- }
79
- }
80
- $this->_redirect('*/*/');
81
- }
82
-
83
- public function selectstoreAction()
84
- {
85
- $store = $this->getRequest()->getParam('store');
86
- if ($store) {
87
- $this->_redirect('*/*/', array('store' => $store));
88
- } else {
89
- $this->_redirect('*/*/');
90
- }
91
- }
92
-
93
- public function setupstoreAction()
94
- {
95
- $data = $this->getRequest()->getParams();
96
- if ($data['store'] && $data['source'] && $data['from'] && $data['to']) {
97
- /** @var $session Mage_Admin_Model_Session */
98
- $session = Mage::getSingleton('adminhtml/session');
99
- try {
100
- //save the source, language from and to in stystem config
101
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
102
-
103
- if ($helper->saveStoreSetup($data['store'], $data['source'], $data['from'], $data['to']) !== false) {
104
- Mage::app()->getCacheInstance()->cleanType('config');
105
- $this->_redirect('*/*/', array('store' => $data['store']));
106
- return;
107
- } else {
108
- Mage::throwException(Mage::helper('strakertranslations_easytranslationplatform')->__('Unable to save store configurations.'));
109
- }
110
- } catch (Exception $e) {
111
- $session->addError($e->getMessage());
112
- $this->_redirect('*/*/');
113
- return;
114
- }
115
- }
116
- $this->_redirect('*/*/');
117
- }
118
-
119
- public function clearSettingsAction()
120
- {
121
- $session = Mage::getSingleton('adminhtml/session');
122
-
123
- try {
124
- $apiModel = Mage::getModel('strakertranslations_easytranslationplatform/api');
125
-
126
- $apiModel->saveAccessToken('');
127
- $apiModel->saveAppKey('');
128
- /** @var StrakerTranslations_EasyTranslationPlatform_Helper_Data $helper */
129
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
130
- foreach (Mage::app()->getStores() as $store) {
131
- $helper->saveStoreSetup($store->getId(), '', '', '');
132
- }
133
- $helper->clearSiteMode();
134
- Mage::app()->getCacheInstance()->cleanType('config');
135
- $session->addSuccess('Straker Settings has been cleared.');
136
-
137
- } catch (Exception $e) {
138
- $session->addError($e->getMessage());
139
- }
140
- $this->_redirect('adminhtml/system_config/edit/section/straker');
141
- return;
142
- }
143
-
144
- public function copyProdcutTableAction()
145
- {
146
- $session = Mage::getSingleton('adminhtml/session');
147
-
148
- try {
149
-
150
- $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
151
-
152
- $sql = 'CREATE TABLE catalog_product_entity_varchar_back AS SELECT * FROM catalog_product_entity_varchar;';
153
-
154
- $writeConnection->query($sql);
155
-
156
- $sql = 'CREATE TABLE catalog_product_entity_text_back AS SELECT * FROM catalog_product_entity_text;';
157
-
158
- $writeConnection->query($sql);
159
-
160
- $sql = 'CREATE TABLE catalog_category_entity_varchar_back AS SELECT * FROM catalog_category_entity_varchar;';
161
-
162
- $writeConnection->query($sql);
163
-
164
- $sql = 'CREATE TABLE catalog_category_entity_text_back AS SELECT * FROM catalog_category_entity_text;';
165
-
166
- $writeConnection->query($sql);
167
-
168
- $session->addSuccess('product and category entity tables has been duplicated ');
169
-
170
- } catch (Exception $e) {
171
- $session->addError($e->getMessage());
172
- }
173
- $this->_redirect('adminhtml/system_config/edit/section/straker');
174
- return;
175
- }
176
-
177
- public function restoreProdcutTableAction()
178
- {
179
- $session = Mage::getSingleton('adminhtml/session');
180
-
181
- try {
182
-
183
- $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
184
-
185
- if ($writeConnection->query("SELECT 1 FROM catalog_product_entity_varchar_back LIMIT 1")) {
186
-
187
- $sql = 'DELETE FROM straker_job';
188
- $writeConnection->query($sql);
189
-
190
- $sql = 'TRUNCATE catalog_product_entity_varchar; INSERT INTO catalog_product_entity_varchar SELECT * FROM catalog_product_entity_varchar_back;';
191
-
192
- $writeConnection->query($sql);
193
-
194
- $sql = 'TRUNCATE catalog_product_entity_text; INSERT INTO catalog_product_entity_text SELECT * FROM catalog_product_entity_text_back;';
195
-
196
- $writeConnection->query($sql);
197
-
198
- $sql = 'TRUNCATE catalog_category_entity_varchar; INSERT INTO catalog_category_entity_varchar SELECT * FROM catalog_category_entity_varchar_back;';
199
-
200
- $writeConnection->query($sql);
201
-
202
- $sql = 'TRUNCATE catalog_category_entity_text; INSERT INTO catalog_category_entity_text SELECT * FROM catalog_category_entity_text_back;';
203
-
204
- $writeConnection->query($sql);
205
-
206
- $session->addSuccess('product and category entity tables has been restored ');
207
- }
208
-
209
- } catch (Exception $e) {
210
- $session->addError($e->getMessage());
211
- }
212
- $this->_redirect('adminhtml/system_config/edit/section/straker');
213
- return;
214
- }
215
-
216
-
217
- public function resetStoreSettingsAction()
218
- {
219
- $storeId = $this->getRequest()->getParam('store');
220
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
221
- $session = Mage::getSingleton('adminhtml/session');
222
-
223
- if ($helper->getStoreSetup($storeId)) {
224
- $helper->saveStoreSetup($storeId, '', '', '');
225
- $session->addSuccess($this->__('Language settings has been reset.'));
226
- Mage::app()->getCacheInstance()->cleanType('config');
227
- } else {
228
- $session->addError($this->__('Store code is not valid.'));
229
- }
230
- $this->_redirect('adminhtml/system_config/edit/section/straker');
231
- return;
232
- }
233
-
234
- private function checkSiteMode(){
235
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
236
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
237
- $helper->checkSiteMode();
238
- }
239
-
240
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/ProductController.php DELETED
@@ -1,207 +0,0 @@
1
- <?php
2
- Class StrakerTranslations_EasyTranslationPlatform_Adminhtml_Straker_ProductController extends Mage_Adminhtml_Controller_Action{
3
- protected function _isAllowed()
4
- {
5
- return Mage::getSingleton('admin/session')->isAllowed('admin/straker/job');
6
- }
7
-
8
- protected function _initAction()
9
- {
10
- $this->checkSiteMode();
11
-
12
- $this
13
- ->loadLayout()
14
- ->_setActiveMenu('straker/job')
15
- ;
16
-
17
- return $this;
18
- }
19
-
20
- protected function _initNewAction()
21
- {
22
- $this->checkSiteMode();
23
-
24
- $this
25
- ->loadLayout()
26
- ->_setActiveMenu('straker/new')
27
- ;
28
-
29
- return $this;
30
- }
31
-
32
-
33
- public function indexAction(){
34
-
35
- if (!$this->getRequest()->getParam('job_id')){
36
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
37
- $this->_redirect('*/straker_job/');
38
- return;
39
- }
40
-
41
- $this->_title($this->__('Straker Translations'))
42
- ->_title($this->__('Manage Jobs'));
43
-
44
- $this->loadLayout()->_setActiveMenu('straker/job');
45
- $this->renderLayout();
46
-
47
- // try {
48
- // $this->_title($this->__('Manage Jobs'));
49
- // return $this->_initAction()
50
- // ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_grid'))
51
- // ->renderLayout();
52
- // } catch (Exception $e) {
53
- // Mage::getSingleton('core/session')->addError($this->__('Error occurred. Please contact service administrator.'));
54
- // $this->_redirect('adminhtml/dashboard');
55
- // }
56
- }
57
-
58
- public function newAction(){
59
- $params = $this->getRequest()->getParams();
60
- if (empty($params['store'])) {
61
- $this->_redirect('*/straker_new');
62
- return;
63
- }
64
- elseif (empty($params['attr'])) {
65
- return $this->_initNewAction()
66
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_attribute','strakertranslations_easytranslationplatform_new_products_attribute',array('setup_store_id' => $params['store'])))
67
- ->renderLayout();
68
- }
69
- else{
70
- return $this->_initNewAction()
71
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products','strakertranslations_easytranslationplatform_new_products',array('setup_store_id' => $params['store'], 'attr' => $params['attr'])))
72
- ->renderLayout();
73
- }
74
- }
75
-
76
-
77
- public function attributeAction(){
78
- $data = $this->getRequest()->getParams();
79
- if($data['attr'] && $data['store']){
80
- $this->_redirect('*/*/new', array('store' => $data['store'], 'attr' => implode(",",array_keys($data['attr']))));
81
- }
82
- else {
83
- $this->_redirect('*/straker_new/');
84
- }
85
- }
86
-
87
- public function addtoconfirmAction(){
88
- $data = $this->getRequest()->getParams();
89
- $data['attr'] = !empty($data['attr']) ? $data['attr'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_attr');
90
- $data['store'] = !empty($data['store']) ? $data['store'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_store');
91
- $data['product'] = !empty($data['product']) ? $data['product'] : Mage::getSingleton('adminhtml/session')->getData('straker_new_product');
92
- if(!empty($data['attr']) && !empty($data['store']) && !empty($data['product'])){
93
- Mage::getSingleton('adminhtml/session')
94
- ->setData('straker_new_attr', $data['attr'])
95
- ->setData('straker_new_store', $data['store'])
96
- ->setData('straker_new_product', $data['product'])
97
- ;
98
- return $this->_initAction()
99
- ->_addContent(Mage::getSingleton('core/layout')->createBlock('strakertranslations_easytranslationplatform/adminhtml_new_products_confirm', 'strakertranslations_easytranslationplatform_new_products_confirm', array('store' => $data['store'], 'attr' => $data['attr'], 'product' => $data['product'])))
100
- ->renderLayout();
101
- }
102
- else {
103
- $this->_redirect('*/straker_new/', $data);
104
- }
105
- }
106
-
107
- public function submitjobAction(){
108
- $data = $this->getRequest()->getParams();
109
- if($data['attr'] && $data['store'] && $data['product']){
110
- $jobModel = Mage::getModel('strakertranslations_easytranslationplatform/job');
111
- try {
112
- $jobModel->checkAndCreateFolder();
113
- }
114
- catch (Mage_Core_Exception $e){
115
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
116
- $this->_redirect('*/*/', array(
117
- 'store' => $data['store'],
118
- 'attr' => $data['attr']
119
- ));
120
- return;
121
- }
122
- foreach(explode(',', $data['attr']) as $attributeCode){
123
- $attr_ids[] = $attribute = Mage::getSingleton('eav/config')
124
- ->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode)->getAttributeId();
125
- }
126
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
127
- $storeSetup = $helper->getStoreSetup($data['store']);
128
- $jobModel->setStoreId($data['store']);
129
- $jobModel->setSl($storeSetup['from']);
130
- $jobModel->setTl($storeSetup['to']);
131
- $jobModel->setToken('Token');
132
- $jobModel->submitProducts($attr_ids, explode(',',$data['product']));
133
- if ($jobModel->getLastStatus()) {
134
- Mage::getSingleton('adminhtml/session')
135
- ->setData('straker_new_attr', '')
136
- ->setData('straker_new_store', '')
137
- ->setData('straker_new_product', '')
138
- ;
139
- Mage::getSingleton('adminhtml/session')->addSuccess('New job created');
140
- $this->_redirect('*/straker_job/');
141
- }
142
- else{
143
- Mage::getSingleton('adminhtml/session')->addError($jobModel->getLastMessage());
144
- $this->_redirect('*/*/new');
145
- }
146
- }
147
- else {
148
- $this->_redirect('*/*/new', $data);
149
- }
150
- }
151
-
152
- public function copyAllAction(){
153
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
154
-
155
- if (!$job->getId()){
156
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
157
- $this->_redirect('*/straker_job/');
158
- return;
159
- }
160
-
161
- if($job->applyTranslation()) {
162
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
163
- $this->_redirect('*/straker_job/');
164
- return;
165
- } else {
166
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
167
- $this->_redirect('*/straker_job/');
168
- return;
169
- }
170
-
171
- }
172
-
173
- public function applyTranslationAction(){
174
- $jobId = $this->getRequest()->getParam('job_id');
175
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
176
-
177
- if (!$job->getId()){
178
- Mage::getSingleton('adminhtml/session')->addError('Job ID missing');
179
- $this->_redirect('*/straker_job/');
180
- return;
181
- }
182
- $productIds = $this->getRequest()->getParam('product');
183
- if(!empty($productIds)) {
184
- if ($job->applyTranslation($productIds)) {
185
- Mage::getSingleton('adminhtml/session')->addSuccess('Translation has been applied.');
186
- $this->_redirect('*/straker_product/',array('job_id' => $jobId));
187
- return;
188
- } else {
189
- Mage::getSingleton('adminhtml/session')->addError('Error when applying translation.');
190
- $this->_redirect('*/straker_product/',array('job_id' => $jobId));
191
- return;
192
- }
193
- }
194
- else{
195
- Mage::getSingleton('adminhtml/session')->addError('Please select products to apply the translation.');
196
- $this->_redirect('*/straker_product/',array('job_id' => $jobId));
197
- return;
198
- }
199
-
200
- }
201
-
202
- private function checkSiteMode(){
203
- /** @var $helper StrakerTranslations_EasyTranslationPlatform_Helper_Data */
204
- $helper = Mage::helper('strakertranslations_easytranslationplatform');
205
- $helper->checkSiteMode();
206
- }
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/CallbackController.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- class StrakerTranslations_EasyTranslationPlatform_CallbackController extends Mage_Core_Controller_Front_Action{
3
- function indexAction(){
4
- $data = $this->getRequest()->getPost();
5
- Mage::log(print_r($data,true), null , 'straker_callback.log' , true);
6
-
7
- $this->getResponse()->setHeader('Content-type', 'application/json');
8
-
9
- if ($data['token'] && $data['event'] ){
10
-
11
- $job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load((int) $data['token']);
12
-
13
- switch ($data['event']){
14
-
15
- case 'quote_ready' :
16
-
17
- if ($job->getJobKey() && $job->updateQuote()){
18
- $this->getResponse()->setBody('{status: success}');
19
- }
20
-
21
- break;
22
-
23
- case 'translation_ready' :
24
-
25
- if ($job->getJobKey() && $job->updateTranslation()){
26
- $this->getResponse()->setBody('{status: success}');
27
- }
28
-
29
- break;
30
-
31
- }
32
-
33
- } else{
34
- $this->getResponse()->setHeader('HTTP/1.0', '400', true);
35
- $this->getResponse()->setBody('{status: error, message: parameter missing, token: '.$data['token'].', event: '.$data['event'].'}');
36
- }
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-install-1.2.0.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- /* @var $installer Mage_Core_Model_Resource_Setup */
3
- $installer = $this;
4
-
5
- $data = [
6
- [ 'status_id' => 1, 'status_name' => 'INIT' ],
7
- [ 'status_id' => 2, 'status_name' => 'QUEUED' ],
8
- [ 'status_id' => 3, 'status_name' => 'IN_PROGRESS'],
9
- [ 'status_id' => 4, 'status_name' => 'COMPLETED' ],
10
- [ 'status_id' => 5, 'status_name' => 'PUBLISHED' ],
11
- ];
12
-
13
- $installer->getConnection()->insertMultiple($installer->getTable('straker_job_status'), $data);
14
-
15
- $data = [
16
- [ 'type_id' => 1, 'type_name' => 'Product' ],
17
- [ 'type_id' => 3, 'type_name' => 'Category' ],
18
- [ 'type_id' => 4, 'type_name' => 'Attribute' ]
19
- ];
20
-
21
- $installer->getConnection()->insertMultiple($installer->getTable('straker_job_type'), $data);
22
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/data/strakertranslations_easytranslationplatform_setup/data-upgrade-1.2.0-1.3.0.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /* @var $installer Mage_Core_Model_Resource_Setup */
3
- $installer = $this;
4
-
5
- $data = [
6
- [ 'type_id' => 5, 'type_name' => 'CMS Page' ],
7
- [ 'type_id' => 6, 'type_name' => 'CMS Block' ]
8
- ];
9
-
10
- $installer->getConnection()->insertMultiple($installer->getTable('straker_job_type'), $data);
11
-
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/adminhtml.xml DELETED
@@ -1,76 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <menu>
4
- <straker>
5
- <title>Straker Translations</title>
6
- <label><![CDATA[<div style="position: absolute;"><img id="straker_logo" src="" alt="" border="0" /></div>&nbsp;<script>
7
- var n = SKIN_URL.indexOf("adminhtml");
8
- $('straker_logo').src = SKIN_URL.substring(0, n) + "adminhtml/default/straker/images/straker/straker-translations-logo.png";
9
- </script>]]></label>
10
- <sort_order>71</sort_order>
11
- <children>
12
- <new translate="title">
13
- <title>Create New Job</title>
14
- <sort_order>0</sort_order>
15
- <action>adminhtml/straker_new/index</action>
16
- </new>
17
- <job translate="title">
18
- <title>Manage Jobs</title>
19
- <sort_order>10</sort_order>
20
- <action>adminhtml/straker_job/index</action>
21
- </job>
22
- <settings translate="title">
23
- <title>Settings</title>
24
- <action>adminhtml/system_config/edit/section/straker</action>
25
- <sort_order>20</sort_order>
26
- </settings>
27
- <account translate="title">
28
- <title>Account</title>
29
- <action>adminhtml/straker_new/account</action>
30
- <sort_order>30</sort_order>
31
- </account>
32
- <terms translate="title">
33
- <title><![CDATA[Terms & Conditions]]></title>
34
- <action>adminhtml/straker_new/terms</action>
35
- <sort_order>40</sort_order>
36
- </terms>
37
- </children>
38
- </straker>
39
- </menu>
40
- <acl>
41
- <resources>
42
- <all>
43
- <title>Allow Everything</title>
44
- </all>
45
- <admin>
46
- <children>
47
- <straker>
48
- <title>Easy Translation Platform</title>
49
- <sort_order>70</sort_order>
50
- <children>
51
- <new>
52
- <title>Create a Translation Job</title>
53
- <sort_order>0</sort_order>
54
- </new>
55
- <job>
56
- <title>Manage Jobs</title>
57
- <sort_order>1</sort_order>
58
- </job>
59
- </children>
60
- </straker>
61
- <system>
62
- <children>
63
- <config>
64
- <children>
65
- <straker>
66
- <title>Easy Translation Platform</title>
67
- </straker>
68
- </children>
69
- </config>
70
- </children>
71
- </system>
72
- </children>
73
- </admin>
74
- </resources>
75
- </acl>
76
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml DELETED
@@ -1,156 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <StrakerTranslations_EasyTranslationPlatform>
5
- <version>1.3.4</version>
6
- </StrakerTranslations_EasyTranslationPlatform>
7
- </modules>
8
- <global>
9
- <models>
10
- <strakertranslations_easytranslationplatform>
11
- <class>StrakerTranslations_EasyTranslationPlatform_Model</class>
12
- <resourceModel>strakertranslations_easytranslationplatform_resource</resourceModel>
13
- </strakertranslations_easytranslationplatform>
14
- <strakertranslations_easytranslationplatform_resource>
15
- <class>StrakerTranslations_EasyTranslationPlatform_Model_Resource</class>
16
- <entities>
17
- <actionlog>
18
- <table>straker_actionlog</table>
19
- </actionlog>
20
- <job>
21
- <table>straker_job</table>
22
- </job>
23
- <job_product>
24
- <table>straker_job_product</table>
25
- </job_product>
26
- <job_type>
27
- <table>straker_job_type</table>
28
- </job_type>
29
- <job_status>
30
- <table>straker_job_status</table>
31
- </job_status>
32
- <product_attributes>
33
- <table>straker_product_attributes</table>
34
- </product_attributes>
35
- <product_translate>
36
- <table>straker_product_translate</table>
37
- </product_translate>
38
- <job_category>
39
- <table>straker_job_category</table>
40
- </job_category>
41
- <category_translate>
42
- <table>straker_category_translate</table>
43
- </category_translate>
44
- <category_attributes>
45
- <table>straker_category_attributes</table>
46
- </category_attributes>
47
- <job_attribute>
48
- <table>straker_job_attribute</table>
49
- </job_attribute>
50
- <straker_attribute_translate>
51
- <table>straker_attribute_translate</table>
52
- </straker_attribute_translate>
53
- <job_cmspage>
54
- <table>straker_job_cmspage</table>
55
- </job_cmspage>
56
- <job_cmsblock>
57
- <table>straker_job_cmsblock</table>
58
- </job_cmsblock>
59
- <cms_page_translate>
60
- <table>straker_cms_page_translate</table>
61
- </cms_page_translate>
62
- <cms_block_translate>
63
- <table>straker_cms_block_translate</table>
64
- </cms_block_translate>
65
- <cms_block_attributes>
66
- <table>straker_cms_block_attributes</table>
67
- </cms_block_attributes>
68
- <cms_page_attributes>
69
- <table>straker_cms_page_attributes</table>
70
- </cms_page_attributes>
71
- </entities>
72
- </strakertranslations_easytranslationplatform_resource>
73
- </models>
74
- <blocks>
75
- <strakertranslations_easytranslationplatform>
76
- <class>StrakerTranslations_EasyTranslationPlatform_Block</class>
77
- </strakertranslations_easytranslationplatform>
78
- <adminhtml>
79
- <rewrite>
80
- <cms_page_grid>StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Page_Grid</cms_page_grid>
81
- <cms_block_grid>StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Block_Grid</cms_block_grid>
82
- </rewrite>
83
- </adminhtml>
84
- </blocks>
85
- <helpers>
86
- <strakertranslations_easytranslationplatform>
87
- <class>StrakerTranslations_EasyTranslationPlatform_Helper</class>
88
- </strakertranslations_easytranslationplatform>
89
- </helpers>
90
- <resources>
91
- <strakertranslations_easytranslationplatform_setup>
92
- <setup>
93
- <module>StrakerTranslations_EasyTranslationPlatform</module>
94
- </setup>
95
- </strakertranslations_easytranslationplatform_setup>
96
- </resources>
97
- </global>
98
- <admin>
99
- <routers>
100
- <adminhtml>
101
- <args>
102
- <modules>
103
- <StrakerTranslations before="Mage_Adminhtml">StrakerTranslations_EasyTranslationPlatform_Adminhtml</StrakerTranslations>
104
- </modules>
105
- </args>
106
- </adminhtml>
107
- </routers>
108
- </admin>
109
- <frontend>
110
- <routers>
111
- <StrakerTranslations>
112
- <use>standard</use>
113
- <args>
114
- <module>StrakerTranslations_EasyTranslationPlatform</module>
115
- <frontName>straker</frontName>
116
- </args>
117
- </StrakerTranslations>
118
- </routers>
119
- </frontend>
120
- <stores>
121
- <admin>
122
- <design>
123
- <package>
124
- <name>default</name>
125
- </package>
126
- <theme>
127
- <default>straker</default>
128
- </theme>
129
- </design>
130
- </admin>
131
- </stores>
132
- <adminhtml>
133
- <layout>
134
- <updates>
135
- <StrakerTranslations_EasyTranslationPlatform>
136
- <file>straker.xml</file>
137
- </StrakerTranslations_EasyTranslationPlatform>
138
- </updates>
139
- </layout>
140
- </adminhtml>
141
- <default>
142
- <straker>
143
- <api_url>
144
- <register>https://app.strakertranslations.com/v1/ta1ma/register</register>
145
- <languages>https://app.strakertranslations.com/v1/languages</languages>
146
- <translate>https://app.strakertranslations.com/v1/ta1ma/translate</translate>
147
- <translate_sandbox>https://app-sandbox.strakertranslations.com/v1/ta1ma/translate</translate_sandbox>
148
- <quote>https://app.strakertranslations.com/v1/quote</quote>
149
- <countries>https://app.strakertranslations.com/v1/countries</countries>
150
- <payment>https://app.strakertranslations.com/v1/payment</payment>
151
- <payment_page>https://myaccount.strakertranslations.com/o/?action=api.quote</payment_page>
152
- <support>https://app.strakertranslations.com/v1/ta1ma/support</support>
153
- </api_url>
154
- </straker>
155
- </default>
156
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/system.xml DELETED
@@ -1,167 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <straker translate="label">
5
- <label>Straker Translations</label>
6
- <sort_order>10</sort_order>
7
- </straker>
8
- </tabs>
9
- <sections>
10
- <straker>
11
- <label>Straker Translation Extension</label>
12
- <tab>straker</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>20</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <general translate="label">
20
- <label>Account</label>
21
- <frontend_type>text</frontend_type>
22
- <sort_order>100</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <fields>
27
- <!--<site_mode translate="label comment" >-->
28
- <!--<label>Site Mode</label>-->
29
- <!--<frontend_type>select</frontend_type>-->
30
- <!--<sort_order>0</sort_order>-->
31
- <!--<source_model>strakertranslations_easytranslationplatform/system_config_source_siteMode</source_model>-->
32
- <!--<show_in_default>1</show_in_default>-->
33
- <!--<show_in_website>1</show_in_website>-->
34
- <!--<show_in_store>1</show_in_store>-->
35
- <!--</site_mode>-->
36
- <!-- <access_token translate="label comment" > -->
37
- <!-- <label>Access Token</label> -->
38
- <!-- <frontend_type>text</frontend_type> -->
39
- <!-- <sort_order>10</sort_order> -->
40
- <!-- <show_in_default>1</show_in_default> -->
41
- <!-- <show_in_website>1</show_in_website> -->
42
- <!-- <show_in_store>1</show_in_store> -->
43
- <!-- </access_token> -->
44
- <!-- <application_key translate="label comment" > -->
45
- <!-- <label>Application Key</label> -->
46
- <!-- <frontend_type>text</frontend_type> -->
47
- <!-- <sort_order>20</sort_order> -->
48
- <!-- <show_in_default>1</show_in_default> -->
49
- <!-- <show_in_website>1</show_in_website> -->
50
- <!-- <show_in_store>1</show_in_store> -->
51
- <!-- </application_key> -->
52
- <clear translate="label">
53
- <label>Clear All Language Settings</label>
54
- <frontend_type>button</frontend_type>
55
- <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_button</frontend_model>
56
- <sort_order>30</sort_order>
57
- <show_in_default>1</show_in_default>
58
- <show_in_website>1</show_in_website>
59
- <show_in_store>1</show_in_store>
60
- </clear>
61
- <store translate="label">
62
- <label>Reset Language Settings for a Store</label>
63
- <frontend_type>button</frontend_type>
64
- <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_store</frontend_model>
65
- <sort_order>40</sort_order>
66
- <show_in_default>1</show_in_default>
67
- <show_in_website>1</show_in_website>
68
- <show_in_store>1</show_in_store>
69
- </store>
70
- <!-- <backup translate="label"> -->
71
- <!-- <label>Backup Product Data</label> -->
72
- <!-- <frontend_type>button</frontend_type> -->
73
- <!-- <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_backupbutton</frontend_model> -->
74
- <!-- <sort_order>50</sort_order> -->
75
- <!-- <show_in_default>1</show_in_default> -->
76
- <!-- <show_in_website>1</show_in_website> -->
77
- <!-- <show_in_store>1</show_in_store> -->
78
- <!-- </backup> -->
79
- <!-- <restore translate="label"> -->
80
- <!-- <label>Backup Product Data</label> -->
81
- <!-- <frontend_type>button</frontend_type> -->
82
- <!-- <frontend_model>strakertranslations_easytranslationplatform/adminhtml_system_config_form_restorebutton</frontend_model> -->
83
- <!-- <sort_order>60</sort_order> -->
84
- <!-- <show_in_default>1</show_in_default> -->
85
- <!-- <show_in_website>1</show_in_website> -->
86
- <!-- <show_in_store>1</show_in_store> -->
87
- <!-- </restore> -->
88
- </fields>
89
- </general>
90
- <!-- <api_url translate="label"> -->
91
- <!-- <label>Api Url</label> -->
92
- <!-- <frontend_type>text</frontend_type> -->
93
- <!-- <sort_order>100</sort_order> -->
94
- <!-- <show_in_default>1</show_in_default> -->
95
- <!-- <show_in_website>1</show_in_website> -->
96
- <!-- <show_in_store>1</show_in_store> -->
97
- <!-- <fields> -->
98
- <!-- <register translate="label comment" > -->
99
- <!-- <label>Register</label> -->
100
- <!-- <frontend_type>text</frontend_type> -->
101
- <!-- <sort_order>10</sort_order> -->
102
- <!-- <show_in_default>1</show_in_default> -->
103
- <!-- <show_in_website>1</show_in_website> -->
104
- <!-- <show_in_store>1</show_in_store> -->
105
- <!-- </register> -->
106
- <!-- <quote translate="label comment" > -->
107
- <!-- <label>Quote</label> -->
108
- <!-- <frontend_type>text</frontend_type> -->
109
- <!-- <sort_order>20</sort_order> -->
110
- <!-- <show_in_default>1</show_in_default> -->
111
- <!-- <show_in_website>1</show_in_website> -->
112
- <!-- <show_in_store>1</show_in_store> -->
113
- <!-- </quote> -->
114
- <!-- <countries translate="label comment" > -->
115
- <!-- <label>Countries</label> -->
116
- <!-- <frontend_type>text</frontend_type> -->
117
- <!-- <sort_order>30</sort_order> -->
118
- <!-- <show_in_default>1</show_in_default> -->
119
- <!-- <show_in_website>1</show_in_website> -->
120
- <!-- <show_in_store>1</show_in_store> -->
121
- <!-- </countries> -->
122
- <!-- <languages translate="label comment" > -->
123
- <!-- <label>Languages</label> -->
124
- <!-- <frontend_type>text</frontend_type> -->
125
- <!-- <sort_order>40</sort_order> -->
126
- <!-- <show_in_default>1</show_in_default> -->
127
- <!-- <show_in_website>1</show_in_website> -->
128
- <!-- <show_in_store>1</show_in_store> -->
129
- <!-- </languages> -->
130
- <!-- <translate translate="label comment" > -->
131
- <!-- <label>Translate</label> -->
132
- <!-- <frontend_type>text</frontend_type> -->
133
- <!-- <sort_order>50</sort_order> -->
134
- <!-- <show_in_default>1</show_in_default> -->
135
- <!-- <show_in_website>1</show_in_website> -->
136
- <!-- <show_in_store>1</show_in_store> -->
137
- <!-- </translate> -->
138
- <!-- <translate_sandbox translate="label comment" > -->
139
- <!-- <label>Translate (Sandbox)</label> -->
140
- <!-- <frontend_type>text</frontend_type> -->
141
- <!-- <sort_order>50</sort_order> -->
142
- <!-- <show_in_default>0</show_in_default> -->
143
- <!-- <show_in_website>0</show_in_website> -->
144
- <!-- <show_in_store>0</show_in_store> -->
145
- <!-- </translate_sandbox> -->
146
- <!-- <payment_page translate="label comment" > -->
147
- <!-- <label>Payment Page</label> -->
148
- <!-- <frontend_type>text</frontend_type> -->
149
- <!-- <sort_order>70</sort_order> -->
150
- <!-- <show_in_default>1</show_in_default> -->
151
- <!-- <show_in_website>1</show_in_website> -->
152
- <!-- <show_in_store>1</show_in_store> -->
153
- <!-- </payment_page> -->
154
- <!-- <payment translate="label comment" > -->
155
- <!-- <label>Payment</label> -->
156
- <!-- <frontend_type>text</frontend_type> -->
157
- <!-- <sort_order>80</sort_order> -->
158
- <!-- <show_in_default>1</show_in_default> -->
159
- <!-- <show_in_website>1</show_in_website> -->
160
- <!-- <show_in_store>1</show_in_store> -->
161
- <!-- </payment> -->
162
- <!-- </fields> -->
163
- <!-- </api_url> -->
164
- </groups>
165
- </straker>
166
- </sections>
167
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/install-1.2.0.php DELETED
@@ -1,752 +0,0 @@
1
- <?php
2
-
3
- /* @var $installer Mage_Core_Model_Resource_Setup */
4
- $installer = $this;
5
- $installer->startSetup();
6
- $connection = $installer->getConnection();
7
-
8
- $rawTableName = 'straker_actionlog';
9
- $tableName = $installer->getTable($rawTableName);
10
- if ($connection->isTableExists($tableName) != true) {
11
- $table = $connection
12
- ->newTable($tableName)
13
- ->addColumn(
14
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
15
- [
16
- 'identity' => true,
17
- 'unsigned' => true,
18
- 'nullable' => false,
19
- 'primary' => true
20
- ],
21
- 'ID'
22
- )->addColumn(
23
- 'user_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
24
- [
25
- 'nullable' => false,
26
- 'unsigned' => true,
27
- ],
28
- 'User ID'
29
- )->addColumn(
30
- 'action', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
31
- [
32
- 'default' => null
33
- ],
34
- 'Action'
35
- )->addColumn(
36
- 'message', Varien_Db_Ddl_Table::TYPE_TEXT, null,
37
- [],
38
- 'Message'
39
- )->addColumn(
40
- 'extra', Varien_Db_Ddl_Table::TYPE_TEXT, null,
41
- [],
42
- 'Extra'
43
- )->addColumn(
44
- 'log_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null,
45
- [
46
- 'default' => null
47
- ],
48
- 'Log Time'
49
- )->addIndex(
50
- $installer->getIdxName($rawTableName, 'user_id'),
51
- 'user_id'
52
- )->addForeignKey(
53
- $installer->getFkName($rawTableName, 'user_id', 'admin_user', 'user_id'),
54
- 'user_id',
55
- $installer->getTable('admin_user'),
56
- 'user_id',
57
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
58
- )->setComment('Straker Action Log Table');;
59
- $connection->createTable($table);
60
- }
61
-
62
- $rawTableName = 'straker_apilog';
63
- $tableName = $installer->getTable($rawTableName);
64
- if ($connection->isTableExists($tableName) != true) {
65
- $table = $connection
66
- ->newTable($tableName)
67
- ->addColumn(
68
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
69
- [
70
- 'identity' => true,
71
- 'unsigned' => true,
72
- 'nullable' => false,
73
- 'primary' => true
74
- ],
75
- 'ID'
76
- )->addColumn(
77
- 'method', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
78
- [
79
- 'nullable' => false,
80
- 'default' => ''
81
- ],
82
- 'Method'
83
- )->addColumn(
84
- 'request', Varien_Db_Ddl_Table::TYPE_TEXT, null,
85
- [],
86
- 'Request'
87
- )->addColumn(
88
- 'response', Varien_Db_Ddl_Table::TYPE_TEXT, null,
89
- [],
90
- 'Response'
91
- )->addColumn(
92
- 'timestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null,
93
- [
94
- 'default' => null
95
- ],
96
- 'Timestamp'
97
- )->setComment('Straker Api Log Table');;
98
- $connection->createTable($table);
99
- }
100
-
101
- $rawTableName = 'straker_job';
102
- $tableName = $installer->getTable($rawTableName);
103
- if ($connection->isTableExists($tableName) != true) {
104
- $table = $connection
105
- ->newTable($tableName)
106
- ->addColumn(
107
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
108
- [
109
- 'identity' => true,
110
- 'unsigned' => true,
111
- 'nullable' => false,
112
- 'primary' => true
113
- ],
114
- 'ID'
115
- )->addColumn(
116
- 'type_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
117
- [
118
- 'unsigned' => true,
119
- 'nullable' => false
120
- ],
121
- 'Type Id'
122
- )->addColumn(
123
- 'source_store', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
124
- [
125
- 'unsigned' => true,
126
- 'nullable' => false
127
- ],
128
- 'Source Store'
129
- )->addColumn(
130
- 'store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
131
- [
132
- 'unsigned' => true,
133
- 'nullable' => false
134
- ],
135
- 'Store Id'
136
- )->addColumn(
137
- 'title', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
138
- [
139
- 'default' => null
140
- ],
141
- 'Title'
142
- )->addColumn(
143
- 'tj_number', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
144
- [
145
- 'default' => null
146
- ],
147
- 'Job Number'
148
- )->addColumn(
149
- 'sl', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
150
- [
151
- 'default' => null
152
- ],
153
- 'Source Language'
154
- )->addColumn(
155
- 'tl', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
156
- [
157
- 'default' => null
158
- ],
159
- 'Target Language'
160
- )->addColumn(
161
- 'job_key', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
162
- [
163
- 'default' => null
164
- ],
165
- 'Job Key'
166
- )->addColumn(
167
- 'quote', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
168
- [
169
- 'default' => null
170
- ],
171
- 'Quote'
172
- )->addColumn(
173
- 'status_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
174
- [
175
- 'unsigned' => true,
176
- 'nullable' => false,
177
- 'default' => 1
178
- ],
179
- 'Status Id'
180
- )->addColumn(
181
- 'work_flow', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
182
- [
183
- 'default' => null
184
- ],
185
- 'Work Flow'
186
- )->addColumn(
187
- 'payment_status', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
188
- [
189
- 'default' => null
190
- ],
191
- 'Payment Status'
192
- )->addColumn(
193
- 'source_file', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
194
- [
195
- 'default' => null
196
- ],
197
- 'Source File'
198
- )->addColumn(
199
- 'download_url', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
200
- [
201
- 'default' => null
202
- ],
203
- 'Download Url'
204
- )->addColumn(
205
- 'remote_version', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
206
- [
207
- 'default' => null
208
- ],
209
- 'Remote Version'
210
- )->addColumn(
211
- 'downloaded_version', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
212
- [
213
- 'default' => null
214
- ],
215
- 'Downloaded Version'
216
- )->addColumn(
217
- 'created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null,
218
- [
219
- 'default' => null
220
- ],
221
- 'Created Time'
222
- )->addColumn(
223
- 'updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null,
224
- [
225
- 'default' => null
226
- ],
227
- 'Updated Time'
228
- )->addIndex($installer->getIdxName($rawTableName, 'job_key'),
229
- 'job_key',
230
- [
231
- 'type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
232
- ]
233
- )->addIndex($installer->getIdxName($rawTableName, 'store_id'),
234
- 'store_id'
235
- )->addIndex($installer->getIdxName($rawTableName, 'type_id'),
236
- 'type_id'
237
- )->addIndex($installer->getIdxName($rawTableName, 'status_id'),
238
- 'status_id'
239
- )->addForeignKey($installer->getFkName($rawTableName, 'store_id', 'core_store', 'store_id'),
240
- 'store_id', $installer->getTable('core_store'), 'store_id',
241
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
242
- )->addForeignKey($installer->getFkName($rawTableName, 'type_id', 'straker_job_type', 'type_id'),
243
- 'type_id', $installer->getTable('straker_job_type'), 'type_id',
244
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
245
- )->addForeignKey($installer->getFkName($rawTableName, 'status_id', 'straker_job_status', 'status_id'),
246
- 'status_id', $installer->getTable('straker_job_status'), 'status_id',
247
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
248
- )->setComment('Straker Job Table');
249
- $connection->createTable($table);
250
- }
251
-
252
- $rawTableName = 'straker_job_product';
253
- $tableName = $installer->getTable($rawTableName);
254
- if ($connection->isTableExists($tableName) != true) {
255
- $table = $connection
256
- ->newTable($tableName)
257
- ->addColumn(
258
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
259
- [
260
- 'identity' => true,
261
- 'unsigned' => true,
262
- 'nullable' => false,
263
- 'primary' => true
264
- ],
265
- 'ID'
266
- )->addColumn(
267
- 'product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
268
- [
269
- 'unsigned' => true,
270
- 'nullable' => false
271
- ],
272
- 'Product Id'
273
- )->addColumn(
274
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
275
- [
276
- 'unsigned' => true,
277
- 'nullable' => false
278
- ],
279
- 'Job Id'
280
- )->addColumn(
281
- 'version', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
282
- [
283
- 'default' => null
284
- ],
285
- 'Version'
286
- )->addIndex($installer->getIdxName($rawTableName, 'product_id'),
287
- 'product_id'
288
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
289
- 'job_id'
290
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
291
- 'job_id', $installer->getTable('straker_job'), 'id',
292
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
293
- )->setComment('Straker Product Job Table');
294
- $connection->createTable($table);
295
- }
296
-
297
- $rawTableName = 'straker_job_status';
298
- $tableName = $installer->getTable($rawTableName);
299
- if ($connection->isTableExists($tableName) != true) {
300
- $table = $connection
301
- ->newTable($tableName)
302
- ->addColumn(
303
- 'status_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
304
- [
305
- 'identity' => true,
306
- 'unsigned' => true,
307
- 'nullable' => false,
308
- 'primary' => true
309
- ],
310
- 'Status Id'
311
- )->addColumn(
312
- 'status_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
313
- [
314
- 'nullable' => false,
315
- 'default' => ''
316
- ],
317
- 'Status Name'
318
- )->setComment('Straker Job Status Table');
319
- $connection->createTable($table);
320
- }
321
-
322
- $rawTableName = 'straker_job_type';
323
- $tableName = $installer->getTable($rawTableName);
324
- if ($connection->isTableExists($tableName) != true) {
325
- $table = $connection
326
- ->newTable($tableName)
327
- ->addColumn(
328
- 'type_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
329
- [
330
- 'identity' => true,
331
- 'unsigned' => true,
332
- 'nullable' => false,
333
- 'primary' => true
334
- ],
335
- 'Type Id'
336
- )->addColumn(
337
- 'type_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
338
- [
339
- 'nullable' => false,
340
- 'default' => ''
341
- ],
342
- 'Type Name'
343
- )->setComment('Straker Job Type Table');
344
- $connection->createTable($table);
345
- }
346
-
347
- $rawTableName = 'straker_product_attributes';
348
- $tableName = $installer->getTable($rawTableName);
349
- if ($connection->isTableExists($tableName) != true) {
350
- $table = $connection
351
- ->newTable($tableName)
352
- ->addColumn(
353
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
354
- [
355
- 'identity' => true,
356
- 'unsigned' => true,
357
- 'nullable' => false,
358
- 'primary' => true
359
- ],
360
- 'ID'
361
- )->addColumn(
362
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
363
- [
364
- 'unsigned' => true,
365
- 'nullable' => false
366
- ],
367
- 'Job Id'
368
- )->addColumn(
369
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
370
- [
371
- 'unsigned' => true,
372
- 'nullable' => false
373
- ],
374
- 'Attribute Id'
375
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
376
- 'job_id'
377
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
378
- 'attribute_id'
379
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
380
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
381
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
382
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
383
- 'job_id', $installer->getTable('straker_job'), 'id',
384
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
385
- )->setComment('Straker Product Attribute Table');
386
- $connection->createTable($table);
387
- }
388
-
389
- $rawTableName = 'straker_product_translate';
390
- $tableName = $installer->getTable($rawTableName);
391
- if ($connection->isTableExists($tableName) != true) {
392
- $table = $connection
393
- ->newTable($tableName)
394
- ->addColumn(
395
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
396
- [
397
- 'identity' => true,
398
- 'unsigned' => true,
399
- 'nullable' => false,
400
- 'primary' => true
401
- ],
402
- 'ID'
403
- )->addColumn(
404
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
405
- [
406
- 'unsigned' => true,
407
- 'nullable' => false
408
- ],
409
- 'Job Id'
410
- )->addColumn(
411
- 'product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
412
- [
413
- 'unsigned' => true,
414
- 'nullable' => false
415
- ],
416
- 'Product Id'
417
- )->addColumn(
418
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
419
- [
420
- 'unsigned' => true,
421
- 'nullable' => false
422
- ],
423
- 'Attribute Id'
424
- )->addColumn(
425
- 'original', Varien_Db_Ddl_Table::TYPE_TEXT, null,
426
- [],
427
- 'Original'
428
- )->addColumn(
429
- 'translate', Varien_Db_Ddl_Table::TYPE_TEXT, null,
430
- [],
431
- 'Translate'
432
- )->addColumn(
433
- 'backup', Varien_Db_Ddl_Table::TYPE_TEXT, null,
434
- [],
435
- 'Backup'
436
- )->addColumn(
437
- 'is_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
438
- [
439
- 'unsigned' => true,
440
- 'nullable' => false,
441
- 'default' => 0
442
- ],
443
- 'Is Imported'
444
- )->addIndex($installer->getIdxName($rawTableName, 'product_id'),
445
- 'product_id'
446
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
447
- 'job_id'
448
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
449
- 'attribute_id'
450
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
451
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
452
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
453
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
454
- 'job_id', $installer->getTable('straker_job'), 'id',
455
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
456
- )->setComment('Straker Product Translation Table');
457
- $connection->createTable($table);
458
- }
459
-
460
- $rawTableName = 'straker_job_category';
461
- $tableName = $installer->getTable($rawTableName);
462
- if ($connection->isTableExists($tableName) != true) {
463
- $table = $connection
464
- ->newTable($tableName)
465
- ->addColumn(
466
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
467
- [
468
- 'identity' => true,
469
- 'unsigned' => true,
470
- 'nullable' => false,
471
- 'primary' => true
472
- ],
473
- 'ID'
474
- )->addColumn(
475
- 'category_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
476
- [
477
- 'unsigned' => true,
478
- 'nullable' => false
479
- ],
480
- 'Category Id'
481
- )->addColumn(
482
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
483
- [
484
- 'unsigned' => true,
485
- 'nullable' => false
486
- ],
487
- 'Job Id'
488
- )->addColumn(
489
- 'version', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
490
- [
491
- 'default' => null
492
- ],
493
- 'Version'
494
- )->addIndex($installer->getIdxName($rawTableName, 'category_id'),
495
- 'category_id'
496
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
497
- 'job_id'
498
- )->addForeignKey($installer->getFkName($rawTableName, 'category_id', 'catalog_category_entity', 'entity_id'),
499
- 'category_id', $installer->getTable('catalog_category_entity'), 'entity_id',
500
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
501
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
502
- 'job_id', $installer->getTable('straker_job'), 'id',
503
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
504
- )->setComment('Straker Category Job Table');
505
-
506
- $connection->createTable($table);
507
- }
508
-
509
- $rawTableName = 'straker_category_attributes';
510
- $tableName = $installer->getTable($rawTableName);
511
- if ($connection->isTableExists($tableName) != true) {
512
- $table = $connection
513
- ->newTable($tableName)
514
- ->addColumn(
515
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
516
- [
517
- 'identity' => true,
518
- 'unsigned' => true,
519
- 'nullable' => false,
520
- 'primary' => true
521
- ],
522
- 'ID'
523
- )->addColumn(
524
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
525
- [
526
- 'unsigned' => true,
527
- 'nullable' => false
528
- ],
529
- 'Job Id'
530
- )->addColumn(
531
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
532
- [
533
- 'unsigned' => true,
534
- 'nullable' => false
535
- ],
536
- 'Attribute Id'
537
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
538
- 'attribute_id'
539
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
540
- 'job_id'
541
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
542
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
543
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
544
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
545
- 'job_id', $installer->getTable('straker_job'), 'id',
546
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
547
- )->setComment('Straker Category Attribute Table');
548
-
549
- $connection->createTable($table);
550
- }
551
-
552
- $rawTableName = 'straker_category_translate';
553
- $tableName = $installer->getTable($rawTableName);
554
- if ($connection->isTableExists($tableName) != true) {
555
- $table = $connection
556
- ->newTable($tableName)
557
- ->addColumn(
558
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
559
- [
560
- 'identity' => true,
561
- 'unsigned' => true,
562
- 'nullable' => false,
563
- 'primary' => true
564
- ],
565
- 'ID'
566
- )->addColumn(
567
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
568
- [
569
- 'unsigned' => true,
570
- 'nullable' => false
571
- ],
572
- 'Job Id'
573
- )->addColumn(
574
- 'category_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
575
- [
576
- 'unsigned' => true,
577
- 'nullable' => false
578
- ],
579
- 'Category Id'
580
- )->addColumn(
581
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
582
- [
583
- 'unsigned' => true,
584
- 'nullable' => false
585
- ],
586
- 'Attribute Id'
587
- )->addColumn(
588
- 'original', Varien_Db_Ddl_Table::TYPE_TEXT, null,
589
- [],
590
- 'Original'
591
- )->addColumn(
592
- 'translate', Varien_Db_Ddl_Table::TYPE_TEXT, null,
593
- [],
594
- 'Translate'
595
- )->addColumn(
596
- 'backup', Varien_Db_Ddl_Table::TYPE_TEXT, null,
597
- [],
598
- 'Backup'
599
- )->addColumn(
600
- 'is_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
601
- [
602
- 'unsigned' => true,
603
- 'nullable' => false,
604
- 'default' => 0
605
- ],
606
- 'Is Imported'
607
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
608
- 'job_id'
609
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
610
- 'attribute_id'
611
- )->addIndex($installer->getIdxName($rawTableName, 'category_id'),
612
- 'category_id'
613
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
614
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
615
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
616
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
617
- 'job_id', $installer->getTable('straker_job'), 'id',
618
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
619
- )->setComment('Straker Category Translation Table');
620
-
621
- $connection->createTable($table);
622
- }
623
-
624
- $rawTableName = 'straker_job_attribute';
625
- $tableName = $installer->getTable($rawTableName);
626
- if ($connection->isTableExists($tableName) != true) {
627
- $table = $connection
628
- ->newTable($tableName)
629
- ->addColumn(
630
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
631
- [
632
- 'identity' => true,
633
- 'unsigned' => true,
634
- 'nullable' => false,
635
- 'primary' => true
636
- ],
637
- 'ID'
638
- )->addColumn(
639
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
640
- [
641
- 'unsigned' => true,
642
- 'nullable' => false
643
- ],
644
- 'Attribute Id'
645
- )->addColumn(
646
- 'translate_label', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
647
- [
648
- 'unsigned' => true,
649
- 'nullable' => false,
650
- 'default' => 0
651
- ],
652
- 'Translate Label'
653
- )->addColumn(
654
- 'translate_option', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
655
- [
656
- 'unsigned' => true,
657
- 'nullable' => false,
658
- 'default' => 0
659
- ],
660
- 'Translate Option'
661
- )->addColumn(
662
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
663
- [
664
- 'unsigned' => true,
665
- 'nullable' => false
666
- ],
667
- 'Job Id'
668
- )->addColumn(
669
- 'version', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
670
- [
671
- 'default' => null
672
- ],
673
- 'Version'
674
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
675
- 'attribute_id'
676
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
677
- 'job_id'
678
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
679
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
680
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
681
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
682
- 'job_id', $installer->getTable('straker_job'), 'id',
683
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
684
- )->setComment('Straker Attribute Job Table');
685
-
686
- $connection->createTable($table);
687
- }
688
-
689
- $rawTableName = 'straker_attribute_translate';
690
- $tableName = $installer->getTable($rawTableName);
691
- if ($connection->isTableExists($tableName) != true) {
692
- $table = $connection
693
- ->newTable($tableName)
694
- ->addColumn(
695
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
696
- [
697
- 'identity' => true,
698
- 'unsigned' => true,
699
- 'nullable' => false,
700
- 'primary' => true
701
- ],
702
- 'ID'
703
- )->addColumn(
704
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
705
- [
706
- 'unsigned' => true,
707
- 'nullable' => false
708
- ],
709
- 'Job Id'
710
- )->addColumn(
711
- 'attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
712
- [
713
- 'unsigned' => true,
714
- 'nullable' => false
715
- ],
716
- 'Attribute Id'
717
- )->addColumn(
718
- 'original', Varien_Db_Ddl_Table::TYPE_TEXT, null,
719
- [],
720
- 'Original'
721
- )->addColumn(
722
- 'translate', Varien_Db_Ddl_Table::TYPE_TEXT, null,
723
- [],
724
- 'Translate'
725
- )->addColumn(
726
- 'backup', Varien_Db_Ddl_Table::TYPE_TEXT, null,
727
- [],
728
- 'Backup'
729
- )->addColumn(
730
- 'is_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
731
- [
732
- 'unsigned' => true,
733
- 'nullable' => false,
734
- 'default' => 0
735
- ],
736
- 'Is Imported'
737
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
738
- 'job_id'
739
- )->addIndex($installer->getIdxName($rawTableName, 'attribute_id'),
740
- 'attribute_id'
741
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
742
- 'job_id', $installer->getTable('straker_job'), 'id',
743
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
744
- )->addForeignKey($installer->getFkName($rawTableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
745
- 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id',
746
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
747
- )->setComment('Straker Attribute Translation Table');
748
-
749
- $connection->createTable($table);
750
- }
751
-
752
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.2.0-1.3.0.php DELETED
@@ -1,358 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: stevenyang
5
- * Date: 18/09/15
6
- * Time: 9:46 AM
7
- */
8
- /* @var $installer Mage_Core_Model_Resource_Setup */
9
- $installer = $this;
10
- $installer->startSetup();
11
- $connection = $installer->getConnection();
12
-
13
- $rawTableName = 'straker_cms_block_attributes';
14
- $tableName = $installer->getTable($rawTableName);
15
- if ($connection->isTableExists($tableName) != true) {
16
- $table = $connection
17
- ->newTable($tableName)
18
- ->addColumn(
19
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
20
- [
21
- 'identity' => true,
22
- 'unsigned' => true,
23
- 'nullable' => false,
24
- 'primary' => true
25
- ],
26
- 'ID'
27
- )->addColumn(
28
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
29
- [
30
- 'nullable' => false,
31
- 'unsigned' => true,
32
- ],
33
- 'User ID'
34
- )->addColumn(
35
- 'column_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
36
- [
37
- 'default' => null
38
- ],
39
- 'Column Name'
40
- )->addIndex(
41
- $installer->getIdxName($rawTableName, 'job_id'),
42
- 'job_id'
43
- )->addForeignKey(
44
- $installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
45
- 'job_id',
46
- $installer->getTable('straker_job'),
47
- 'id',
48
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
49
- )->setComment('Straker Cms Block Attribute Table');;
50
- $connection->createTable($table);
51
- }
52
-
53
-
54
- $rawTableName = 'straker_cms_block_translate';
55
- $tableName = $installer->getTable($rawTableName);
56
- if ($connection->isTableExists($tableName) != true) {
57
- $table = $connection
58
- ->newTable($tableName)
59
- ->addColumn(
60
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
61
- [
62
- 'identity' => true,
63
- 'unsigned' => true,
64
- 'nullable' => false,
65
- 'primary' => true
66
- ],
67
- 'ID'
68
- )->addColumn(
69
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
70
- [
71
- 'nullable' => false,
72
- 'unsigned' => true,
73
- ],
74
- 'User ID'
75
- )->addColumn(
76
- 'cms_block_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
77
- [
78
- 'default' => null
79
- ],
80
- 'Cms Block ID'
81
- )->addColumn(
82
- 'column_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
83
- [
84
- 'nullable' => false,
85
- 'default' => ''
86
- ],
87
- 'Column Name'
88
- )->addColumn(
89
- 'original', Varien_Db_Ddl_Table::TYPE_TEXT, null,
90
- [],
91
- 'Original'
92
- )->addColumn(
93
- 'translate', Varien_Db_Ddl_Table::TYPE_TEXT, null,
94
- [],
95
- 'Translate'
96
- )->addColumn(
97
- 'backup', Varien_Db_Ddl_Table::TYPE_TEXT, null,
98
- [],
99
- 'Backup'
100
- )->addColumn(
101
- 'is_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
102
- [
103
- 'unsigned' => true,
104
- 'nullable' => false,
105
- 'default' => 0
106
- ],
107
- 'Is Imported'
108
- )->addColumn(
109
- 'job_cms_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
110
- [
111
- 'default' => null
112
- ],
113
- 'Job Cms ID'
114
- )->addIndex(
115
- $installer->getIdxName($rawTableName, 'job_id'),
116
- 'job_id'
117
- )->addForeignKey(
118
- $installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
119
- 'job_id',
120
- $installer->getTable('straker_job'),
121
- 'id',
122
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
123
- )->setComment('Straker Cms Block Translate Table');;
124
- $connection->createTable($table);
125
- }
126
-
127
- $rawTableName = 'straker_cms_page_attributes';
128
- $tableName = $installer->getTable($rawTableName);
129
- if ($connection->isTableExists($tableName) != true) {
130
- $table = $connection
131
- ->newTable($tableName)
132
- ->addColumn(
133
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
134
- [
135
- 'identity' => true,
136
- 'unsigned' => true,
137
- 'nullable' => false,
138
- 'primary' => true
139
- ],
140
- 'ID'
141
- )->addColumn(
142
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
143
- [
144
- 'nullable' => false,
145
- 'unsigned' => true,
146
- ],
147
- 'User ID'
148
- )->addColumn(
149
- 'column_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
150
- [
151
- 'default' => null
152
- ],
153
- 'Column Name'
154
- )->addIndex(
155
- $installer->getIdxName($rawTableName, 'job_id'),
156
- 'job_id'
157
- )->addForeignKey(
158
- $installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
159
- 'job_id',
160
- $installer->getTable('straker_job'),
161
- 'id',
162
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
163
- )->setComment('Straker Cms Block Translate Table');;
164
- $connection->createTable($table);
165
- }
166
-
167
- $rawTableName = 'straker_cms_page_translate';
168
- $tableName = $installer->getTable($rawTableName);
169
- if ($connection->isTableExists($tableName) != true) {
170
- $table = $connection
171
- ->newTable($tableName)
172
- ->addColumn(
173
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
174
- [
175
- 'identity' => true,
176
- 'unsigned' => true,
177
- 'nullable' => false,
178
- 'primary' => true
179
- ],
180
- 'ID'
181
- )->addColumn(
182
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
183
- [
184
- 'nullable' => false,
185
- 'unsigned' => true,
186
- ],
187
- 'User ID'
188
- )->addColumn(
189
- 'cms_page_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
190
- [
191
- 'default' => null
192
- ],
193
- 'Cms Page ID'
194
- )->addColumn(
195
- 'column_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255,
196
- [
197
- 'nullable' => false,
198
- 'default' => ''
199
- ],
200
- 'Column Name'
201
- )->addColumn(
202
- 'original', Varien_Db_Ddl_Table::TYPE_TEXT, null,
203
- [],
204
- 'Original'
205
- )->addColumn(
206
- 'translate', Varien_Db_Ddl_Table::TYPE_TEXT, null,
207
- [],
208
- 'Translate'
209
- )->addColumn(
210
- 'backup', Varien_Db_Ddl_Table::TYPE_TEXT, null,
211
- [],
212
- 'Backup'
213
- )->addColumn(
214
- 'is_imported', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5,
215
- [
216
- 'unsigned' => true,
217
- 'nullable' => false,
218
- 'default' => 0
219
- ],
220
- 'Is Imported'
221
- )->addColumn(
222
- 'job_cms_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
223
- [
224
- 'default' => null
225
- ],
226
- 'Job Cms ID'
227
- )->addIndex(
228
- $installer->getIdxName($rawTableName, 'job_id'),
229
- 'job_id'
230
- )->addForeignKey(
231
- $installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
232
- 'job_id',
233
- $installer->getTable('straker_job'),
234
- 'id',
235
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
236
- )->setComment('Straker Cms Block Translate Table');;
237
- $connection->createTable($table);
238
- }
239
-
240
-
241
- $rawTableName = 'straker_job_cmsblock';
242
- $tableName = $installer->getTable($rawTableName);
243
- if ($connection->isTableExists($tableName) != true) {
244
- $table = $connection
245
- ->newTable($tableName)
246
- ->addColumn(
247
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
248
- [
249
- 'identity' => true,
250
- 'unsigned' => true,
251
- 'nullable' => false,
252
- 'primary' => true
253
- ],
254
- 'ID'
255
- )->addColumn(
256
- 'block_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
257
- [
258
- 'nullable' => false
259
- ],
260
- 'Block Id'
261
- )->addColumn(
262
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
263
- [
264
- 'unsigned' => true,
265
- 'nullable' => false
266
- ],
267
- 'Job Id'
268
- )->addColumn(
269
- 'version', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
270
- [
271
- 'default' => null
272
- ],
273
- 'Version'
274
- )->addColumn(
275
- 'origin', Varien_Db_Ddl_Table::TYPE_TEXT, null,
276
- [],
277
- 'Origin'
278
- )->addColumn(
279
- 'new_entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
280
- [
281
- 'default' => null
282
- ],
283
- 'New Entity ID'
284
- )->addIndex($installer->getIdxName($rawTableName, 'block_id'),
285
- 'block_id'
286
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
287
- 'job_id'
288
- )->addForeignKey($installer->getFkName($rawTableName, 'block_id', 'cms_block', 'block_id'),
289
- 'block_id', $installer->getTable('cms_block'), 'block_id',
290
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
291
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
292
- 'job_id', $installer->getTable('straker_job'), 'id',
293
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
294
- )->setComment('Straker Cms Block Job Table');
295
-
296
- $connection->createTable($table);
297
- }
298
-
299
-
300
- $rawTableName = 'straker_job_cmspage';
301
- $tableName = $installer->getTable($rawTableName);
302
- if ($connection->isTableExists($tableName) != true) {
303
- $table = $connection
304
- ->newTable($tableName)
305
- ->addColumn(
306
- 'id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
307
- [
308
- 'identity' => true,
309
- 'unsigned' => true,
310
- 'nullable' => false,
311
- 'primary' => true
312
- ],
313
- 'ID'
314
- )->addColumn(
315
- 'page_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
316
- [
317
- 'nullable' => false
318
- ],
319
- 'Page Id'
320
- )->addColumn(
321
- 'job_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
322
- [
323
- 'unsigned' => true,
324
- 'nullable' => false
325
- ],
326
- 'Job Id'
327
- )->addColumn(
328
- 'version', Varien_Db_Ddl_Table::TYPE_SMALLINT, 6,
329
- [
330
- 'default' => null
331
- ],
332
- 'Version'
333
- )->addColumn(
334
- 'origin', Varien_Db_Ddl_Table::TYPE_TEXT, null,
335
- [],
336
- 'Origin'
337
- )->addColumn(
338
- 'new_entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10,
339
- [
340
- 'default' => null
341
- ],
342
- 'New Entity ID'
343
- )->addIndex($installer->getIdxName($rawTableName, 'page_id'),
344
- 'page_id'
345
- )->addIndex($installer->getIdxName($rawTableName, 'job_id'),
346
- 'job_id'
347
- )->addForeignKey($installer->getFkName($rawTableName, 'page_id', 'cms_page', 'page_id'),
348
- 'page_id', $installer->getTable('cms_page'), 'page_id',
349
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
350
- )->addForeignKey($installer->getFkName($rawTableName, 'job_id', 'straker_job', 'id'),
351
- 'job_id', $installer->getTable('straker_job'), 'id',
352
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
353
- )->setComment('Straker Cms Page Job Table');
354
-
355
- $connection->createTable($table);
356
- }
357
-
358
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.0-1.3.1.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: stevenyang
5
- * Date: 18/09/15
6
- * Time: 9:46 AM
7
- */
8
- /* @var $installer Mage_Core_Model_Resource_Setup */
9
- $installer = $this;
10
- $connection = $installer->getConnection();
11
-
12
- $rawTableName = 'straker_job_cmspage';
13
- $tableName = $installer->getTable($rawTableName);
14
- if ($connection->isTableExists($tableName) == true) {
15
- $table = $connection
16
- ->addIndex(
17
- $tableName,
18
- $installer->getIdxName($rawTableName, 'new_entity_id'),
19
- 'new_entity_id'
20
- );
21
- }
22
-
23
- $rawTableName = 'straker_job_cmsblock';
24
- $tableName = $installer->getTable($rawTableName);
25
- if ($connection->isTableExists($tableName) == true) {
26
- $table = $connection
27
- ->addIndex(
28
- $tableName,
29
- $installer->getIdxName($rawTableName, 'new_entity_id'),
30
- 'new_entity_id'
31
- );
32
- }
33
-
34
- // $tables = [
35
- // 'straker_actionlog',
36
- // 'straker_cms_block_attributes',
37
- // 'straker_cms_block_translate',
38
- // 'straker_cms_page_attributes',
39
- // 'straker_cms_page_translate',
40
- // 'straker_job_cmsblock',
41
- // 'straker_job_cmspage'
42
- // ];
43
- //
44
- // $prefix = Mage::getConfig()->getTablePrefix();
45
- //
46
- //
47
- // //format of returned foreign key
48
- // //[
49
- // // 'FK_NAME',
50
- // // 'SCHEMA_NAME',
51
- // // 'TABLE_NAME',
52
- // // 'COLUMN_NAME',
53
- // // 'REF_SHEMA_NAME',
54
- // // 'REF_TABLE_NAME',
55
- // // 'REF_COLUMN_NAME',
56
- // // 'ON_DELETE',
57
- // // 'ON_UPDATE'
58
- // //];
59
- //
60
- // foreach ($tables as $table){
61
- // $tableName = $installer->getTable($table);
62
- // $fks = $connection->getForeignKeys($tableName);
63
- // if(strcasecmp($table, 'straker_actionlog') === 0){
64
- // $fk = reset($fks);
65
- // $connection->dropForeignKey($tableName, $fk['FK_NAME']);
66
- // $connection->addForeignKey(
67
- // $installer->getFkName($table, 'user_id', 'admin_user', 'user_id'),
68
- // $tableName,
69
- // 'user_id',
70
- // $installer->getTable('admin_user'),
71
- // 'user_id',
72
- // Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
73
- // );
74
- // }else{
75
- // foreach ($fks as $fk){
76
- //
77
- // if(strcasecmp(substr($fk['REF_TABLE_NAME'], 0, strlen($prefix)), $prefix) !== 0){
78
- // $connection->dropForeignKey($tableName, $fk['FK_NAME']);
79
- // $connection->addForeignKey(
80
- // $installer->getFkName($table, $fk['COLUMN_NAME'], $fk['REF_TABLE_NAME'], $fk['REF_COLUMN_NAME']),
81
- // $tableName,
82
- // $fk['COLUMN_NAME'],
83
- // $installer->getTable($fk['REF_TABLE_NAME']),
84
- // $fk['REF_COLUMN_NAME'],
85
- // Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
86
- // );
87
- // }
88
- // }
89
- // }
90
- //
91
- // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/upgrade-1.3.3-1.3.4.php DELETED
@@ -1,80 +0,0 @@
1
- <?php
2
-
3
- /** @var $installer Mage_Eav_Model_Entity_Setup */
4
- $installer = $this;
5
- $connection = $installer->getConnection();
6
-
7
- $tables = [
8
- 'straker_actionlog',
9
- 'straker_cms_block_attributes',
10
- 'straker_cms_block_translate',
11
- 'straker_cms_page_attributes',
12
- 'straker_cms_page_translate',
13
- 'straker_job_cmsblock',
14
- 'straker_job_cmspage'
15
- ];
16
-
17
- $prefix = Mage::getConfig()->getTablePrefix();
18
-
19
-
20
- //format of returned foreign key
21
- //[
22
- // 'FK_NAME',
23
- // 'SCHEMA_NAME',
24
- // 'TABLE_NAME',
25
- // 'COLUMN_NAME',
26
- // 'REF_SHEMA_NAME',
27
- // 'REF_TABLE_NAME',
28
- // 'REF_COLUMN_NAME',
29
- // 'ON_DELETE',
30
- // 'ON_UPDATE'
31
- //];
32
-
33
- if(strcasecmp($prefix, '') !== 0){
34
- foreach ($tables as $table){
35
- $tableName = $installer->getTable($table);
36
- $fks = $connection->getForeignKeys($tableName);
37
- if(strcasecmp($table, 'straker_actionlog') === 0){
38
- $fk = reset($fks);
39
- $connection->dropForeignKey($tableName, $fk['FK_NAME']);
40
- $connection->addForeignKey(
41
- $installer->getFkName($table, 'user_id', 'admin_user', 'user_id'),
42
- $tableName,
43
- 'user_id',
44
- $installer->getTable('admin_user'),
45
- 'user_id',
46
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
47
- );
48
- }else{
49
- foreach ($fks as $fk){
50
-
51
- if(strcasecmp(substr($fk['REF_TABLE_NAME'], 0, strlen($prefix)), $prefix) !== 0){
52
- $connection->dropForeignKey($tableName, $fk['FK_NAME']);
53
- $connection->addForeignKey(
54
- $installer->getFkName($table, $fk['COLUMN_NAME'], $fk['REF_TABLE_NAME'], $fk['REF_COLUMN_NAME']),
55
- $tableName,
56
- $fk['COLUMN_NAME'],
57
- $installer->getTable($fk['REF_TABLE_NAME']),
58
- $fk['REF_COLUMN_NAME'],
59
- Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE
60
- );
61
- }
62
- }
63
- }
64
- }
65
- }
66
- /**
67
- * Add new field to 'cataloginventory/stock_item'
68
- */
69
- $installer->getConnection()
70
- ->addColumn(
71
- $installer->getTable('straker_job'),
72
- 'is_test_job',
73
- [
74
- 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
75
- 'length' => 1,
76
- 'comment' => 'Is Test Job',
77
- 'nullable' => false,
78
- 'default' => 0
79
- ]
80
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>straker-translations-easy-translation-platform</name>
4
- <version>1.3.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Multilingual eCommerce extensions from the award-winning global translation company.</summary>
10
  <description>Total automation of the translation process, simple installation and setup, quality human translation at cost-effective rates, scalable to more than 80 languages and 1000s of projects and powerful dashboard reporting.</description>
11
- <notes>Bug fix release</notes>
12
  <authors><author><name>Chris</name><user>Straker_support</user><email>extensions@strakertranslations.com</email></author></authors>
13
- <date>2016-12-11</date>
14
- <time>23:46:36</time>
15
- <contents><target name="magecommunity"><dir name="StrakerTranslations"><dir name="EasyTranslationPlatform"><dir name="Block"><dir name="Adminhtml"><dir name="Cms"><dir name="Block"><file name="Grid.php" hash="f3f619834386cc32c7b0d938d85b1b94"/></dir><dir name="Page"><file name="Grid.php" hash="b24310c42254a22bc94fa926f93735fd"/></dir></dir><dir name="Job"><dir name="Attribute"><file name="Grid.php" hash="4eae0bb7355b35a7e7b695f6add78fae"/></dir><file name="Attribute.php" hash="c355f64a030766afcf646b411035f85f"/><dir name="Category"><file name="Grid.php" hash="1052d1e5494533c80a89a5e74041f72d"/></dir><file name="Category.php" hash="f2c9c52e51b2112f32065beee4c3cafe"/><dir name="Cms"><dir name="Block"><file name="Grid.php" hash="64170c9e8cf55c3cfd5a8c9717fe665a"/></dir><file name="Block.php" hash="e5ab4001b92c2bccc442ae4cfb59f047"/><dir name="Page"><file name="Grid.php" hash="6a8406b8bf46d1e4a802b182cef19603"/></dir><file name="Page.php" hash="b7c14cf9b9892977d4c945d7d4b5e4bd"/></dir><file name="Grid.php" hash="c52dbc25e0c5c0f07f111e8dcc0f301b"/><dir name="Product"><file name="Grid.php" hash="5fd9795e42b12b97cb217fbad0e529f8"/></dir><file name="Product.php" hash="85f95b9ffd2a3f80fb62ad37b3cf11b5"/></dir><file name="Job.php" hash="bf5ad4cd596a3a93a54447ee112c0a23"/><dir name="New"><dir name="Attribute"><dir name="Confirm"><file name="Grid.php" hash="5ab113bb0a3e42ceef939b1b52c36876"/></dir><file name="Confirm.php" hash="d7ed18d35d0df6b899b402beb0800caa"/><file name="Grid.php" hash="7fd33f4b1c1b9854dd2592e2171db618"/></dir><file name="Attribute.php" hash="31f61557f7c69d8b90521e60bbb79898"/><dir name="Category"><file name="Attribute.php" hash="b6698a36ee449853edff1815fca6a56f"/><dir name="Confirm"><file name="Grid.php" hash="64fd873d16622c13581ae398eb07bbbb"/></dir><file name="Confirm.php" hash="b710371dceb26866857a62f9d19425e7"/><file name="Tree.php" hash="b405b4bf4969812e13d63d752cd89c23"/></dir><dir name="Cms"><dir name="Block"><file name="Attribute.php" hash="698021304ad1346b6f8476fd629c8eed"/><dir name="Confirm"><file name="Grid.php" hash="dcf6c9a7a3a844963076b5140370507c"/></dir><file name="Confirm.php" hash="d38a9be9238e8eff3c322529e066b2ae"/><file name="Grid.php" hash="25cd4beda99cf997a108db78d6af2b32"/></dir><file name="Block.php" hash="771df45fe8fa9d24b7a920f485cc67a4"/><dir name="Page"><file name="Attribute.php" hash="3643f4821171d2efb08f478db03b2eaa"/><dir name="Confirm"><file name="Grid.php" hash="5c77ef51a041fc61422efe3467e5be75"/></dir><file name="Confirm.php" hash="ca21f36fe293b10f5a7f0be7d4acd437"/><file name="Grid.php" hash="0916a315b664c02c94cebfa79af4a0a0"/></dir><file name="Page.php" hash="d4f32301e714f1e6692ace8ed40ec5c4"/></dir><dir name="Confirm"><file name="Grid.php" hash="49a048fe7340150dc387a30355951385"/></dir><file name="Confirm.php" hash="a903a2f53c3b44fb8c72dc70716ff0d3"/><dir name="Products"><file name="Attribute.php" hash="f9b11618404c31e7ac91622a0188479d"/><dir name="Confirm"><file name="Grid.php" hash="e35a967bf2e3d9882889a67d7de26e09"/></dir><file name="Confirm.php" hash="d4dddb499ff29d646fcd48246666126a"/><file name="Grid.php" hash="5c716c61d8b23d253b37f4755d4ea231"/></dir><file name="Products.php" hash="cd0c2de765d91c4c7a82cc74bb1797c9"/><file name="Register.php" hash="7f43aee445980708a6cb8510eec21e78"/><file name="Selectstore.php" hash="42553d67a4e14ca8f754ea096ddf9cf6"/><file name="Setupstore.php" hash="bc1ca941654f47f763d0e7605fc7b050"/><file name="Type.php" hash="6786a8663d019a616dfcd229f609b0cf"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Backupbutton.php" hash="8bfae419ddceed0553db1f5dc5322356"/><file name="Button.php" hash="eb5d2544ba93cbcd09e534dc5b81bbc1"/><file name="Restorebutton.php" hash="e98058e6769f5308fa9f48fa19a22704"/><file name="Store.php" hash="5b98d4711b04acbb60d1b7c17405a4a6"/></dir></dir></dir><dir name="Template"><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="47a1988c0136fa892856d7390af1d6bd"/><file name="AttributeOriginalLabel.php" hash="895fdf18d8993d3268d95541cca1a7a3"/><file name="AttributeOriginalOption.php" hash="3cbe41544c9a32a5742950392973a533"/><file name="AttributeTranslateLabel.php" hash="eef210480eea84f5fd69ded360697acf"/><file name="AttributeTranslateOption.php" hash="2393ee81a57d67de08d38c5e81ea9403"/><file name="Backend.php" hash="6ca085c9a5c50e635f8f4aa41d3314e1"/><file name="CmsOriginTitle.php" hash="e66578d499b77b65226ec3be9e727c56"/><file name="CmsVersion.php" hash="d396904cc2b8637e87c3332eff877436"/><file name="ConfirmTranslateLabel.php" hash="09fdb0146ab6f9fad36bff50042d2587"/><file name="ConfirmTranslateOptions.php" hash="90ba018bb7eef8d6ac3006b058d66197"/><file name="Dispute.php" hash="3bae4a4bbf43890a53a8c2698315430e"/><file name="Frontend.php" hash="f1a0c9a0b98e3e16ec28a46c11f3b71f"/><file name="Path.php" hash="5d9e268bde77a5e1d6d435a48d9f60b7"/><file name="Quote.php" hash="728f3e53af9619760a3921993a823ca6"/><file name="Refresh.php" hash="28db5556c4dad64f4d3aa808758673dd"/><file name="Selected.php" hash="88f58ed6edb419d1701a6f6a4955d881"/><file name="Status.php" hash="fd88108278d137995b6bbd2b9747a179"/><file name="StrakerTranslated.php" hash="8f6d3a963627f02fcd092c4103843c61"/><file name="TranslateOptions.php" hash="00f1c42c2205f76db4322fa0dbd686f6"/><file name="Translated.php" hash="cda1f5c402ed086974b76ee427c2a23a"/><file name="Update.php" hash="43a114983b2c00af3432e664512b1704"/><file name="Version.php" hash="908c1697bd48848a2ebf00cd38aa8dc1"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8015cf21db04507b48387b9821dcd30f"/></dir><dir name="Model"><file name="Actionlog.php" hash="bd8a61e14712e32937e0622376b07ae7"/><file name="Api.php" hash="6b38c84f487d57023a243194e6ccfe18"/><dir name="Attribute"><file name="Translate.php" hash="f16a1150f44c70e92e1f5e75da3cfc0d"/></dir><dir name="Category"><file name="Attributes.php" hash="31639770ebe8f2aa4b320d686786f716"/><file name="Translate.php" hash="63888c2d229d1cc860b2d3555470f597"/></dir><dir name="Cms"><dir name="Block"><file name="Attributes.php" hash="1df167ceeea902db512b297d601336b8"/><file name="Translate.php" hash="239afe3bb57efe43687f7fd4abaabe11"/></dir><dir name="Page"><file name="Attributes.php" hash="f9aa8f988a06b442d44c5e1e3c044b0c"/><file name="Translate.php" hash="ada614e5395bea4a02694e38a9b4d761"/></dir></dir><dir name="Job"><file name="Attribute.php" hash="6bc9221934346093ec6054704625808e"/><file name="Category.php" hash="37079e7131a4d10a9577afb499c6d7b6"/><dir name="Cms"><file name="Block.php" hash="2263b8165de77cda0c368a6b127e5edb"/><file name="Page.php" hash="54cf2ffb4943b3bcffe28a5fc60a0d00"/></dir><file name="Product.php" hash="9f02ce34f909df6dd26c3414356ad565"/><file name="Status.php" hash="64c766deaf33bd0460c739f04544f8db"/><file name="Type.php" hash="c5010524e83e0c3c56595bcd72bba97d"/></dir><file name="Job.php" hash="279f6b7a8d105380389c58425467a855"/><dir name="Product"><file name="Attributes.php" hash="f8539bb8a73a59017b811bea7d99835b"/><file name="Translate.php" hash="ebe6df5219d4ca3ee71290bf3e1de0da"/></dir><dir name="Resource"><dir name="Actionlog"><file name="Collection.php" hash="a60fb59aa09d55b5e5d4f41d58e20e6f"/></dir><file name="Actionlog.php" hash="5742408ecac5dce23b3492d118d6ca41"/><dir name="Attribute"><dir name="Translate"><file name="Collection.php" hash="dc15902d152cdc907123bbd847bc124a"/></dir><file name="Translate.php" hash="f619af9fb3bb71e346d89a314c1d0a2c"/></dir><dir name="Category"><dir name="Attributes"><file name="Collection.php" hash="d0d1bdb74c8b6d3ebcd00e986bbda5ac"/></dir><file name="Attributes.php" hash="438aefd7fd4768a18dea3835e592d020"/><dir name="Translate"><file name="Collection.php" hash="6f9b263579ba9c988dbf476a9a8d5254"/></dir><file name="Translate.php" hash="3493c3a5f4dff5278e61cf758b58f09e"/></dir><dir name="Cms"><dir name="Block"><dir name="Attributes"><file name="Collection.php" hash="877832a90560893e916e43b967e6dc34"/></dir><file name="Attributes.php" hash="09ff0c55a851e01cb84ea36d04f25991"/><dir name="Translate"><file name="Collection.php" hash="de7c22817b8216ba532469e22530fc9e"/></dir><file name="Translate.php" hash="a42c5543d64b231251c50623c06267e3"/></dir><dir name="Page"><dir name="Attributes"><file name="Collection.php" hash="e1316d1cd3595bbfb7733b2ac237796e"/></dir><file name="Attributes.php" hash="17aad05de17f6e1457ee41022acdce17"/><dir name="Translate"><file name="Collection.php" hash="6d3a9c65e8cab69179ac62d3cf4a86eb"/></dir><file name="Translate.php" hash="875bb57fe743508ff7fb46d7cb5031f9"/></dir></dir><dir name="Job"><dir name="Attribute"><file name="Collection.php" hash="e336ec26c414bdb050ae87d70487349a"/></dir><file name="Attribute.php" hash="6c096169a8867d54b37997312753a94e"/><dir name="Category"><file name="Collection.php" hash="6e29696c703503c821fb4fbeb04f7169"/></dir><file name="Category.php" hash="5cb332770a4600be8d82d5440a42a2a6"/><dir name="Cms"><dir name="Block"><file name="Collection.php" hash="6524c7d53db9e32d2802e571cc54a8ca"/></dir><file name="Block.php" hash="9de78cd2dad032b94b7a0fe32ca6b785"/><dir name="Page"><file name="Collection.php" hash="b36385630e4cd6fd25a233305bd8d359"/></dir><file name="Page.php" hash="0d449938e643605e500efc3f4c4f13ea"/></dir><file name="Collection.php" hash="26b821d388a969c048418254c702767d"/><dir name="Product"><file name="Collection.php" hash="0b333a2caf8977dbc9a8e71e58c54de6"/></dir><file name="Product.php" hash="8b0dfa9ce28bc4292021055f9253ea5d"/><dir name="Status"><file name="Collection.php" hash="84dd6c9d32fda84ea11102692b5359a9"/></dir><file name="Status.php" hash="5e29fbf619c9b1278273266fb2ce2afa"/><dir name="Type"><file name="Collection.php" hash="625b61447aee152376c19f36a347d5d8"/></dir><file name="Type.php" hash="36b8ec250e3bc2377c1fb755459fad95"/></dir><file name="Job.php" hash="22b19e144ede17aa8c57f817f3c84046"/><dir name="Product"><dir name="Attributes"><file name="Collection.php" hash="3f479577ce23ba9f264125439c1d1099"/></dir><file name="Attributes.php" hash="93c962dc76384771d9139574796c16b5"/><dir name="Translate"><file name="Collection.php" hash="4dc7e3a0a44edd6acea4b8cf45b40d05"/></dir><file name="Translate.php" hash="f88f7ea6f6e1dfdc55ef648ddea2ca38"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="SiteMode.php" hash="89a8260d88855f2caea230e3466c8f9a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Straker"><file name="AttributeController.php" hash="699a547cfbddab454f057136df40c93a"/><file name="CategoryController.php" hash="0950833563bef549cc2426f63030f6db"/><dir name="Cms"><file name="BlockController.php" hash="2627bff77c3b5fafc0ad1102ce716445"/><file name="PageController.php" hash="e43d66294440afb15294217135334e80"/></dir><file name="JobController.php" hash="34c064012ad52f06ff65b4e61df2a7f2"/><file name="NewController.php" hash="c7288367fd7f7b2488d2e1746c5edfa5"/><file name="ProductController.php" hash="ae3b984d64ce4730b0f37084f8b1add6"/></dir></dir><file name="CallbackController.php" hash="c9abd6304f6f071940735a47ab658633"/></dir><dir name="data"><dir name="strakertranslations_easytranslationplatform_setup"><file name="data-install-1.2.0.php" hash="8f64e0b9eea4fe7b0d880cd354f59412"/><file name="data-upgrade-1.2.0-1.3.0.php" hash="5e01aabbd2c80e6c6d1c3e12126a4e6e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="802ab54b889201efd9318ec11f220f18"/><file name="config.xml" hash="19d848792a0bafdc9aa74b3f7cbbbf3a"/><file name="system.xml" hash="577f61032f35ff143513513ae5bdac95"/></dir><dir name="sql"><dir name="strakertranslations_easytranslationplatform_setup"><file name="install-1.2.0.php" hash="a93fd3369feb8cf12e1c69a8ae3bbe8b"/><file name="upgrade-1.2.0-1.3.0.php" hash="55e4e676d70e9ca6371b7b7ccd7a48e4"/><file name="upgrade-1.3.0-1.3.1.php" hash="37441781e0348f3761e677457e6b73b0"/><file name="upgrade-1.3.3-1.3.4.php" hash="5a7c214c97e3a8935feb0d7a1947c7eb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="layout"><file name="straker.xml" hash="52ec2d65c1ac817a5f1603e916037d15"/></dir><dir name="template"><dir name="cms"><dir name="form"><file name="container.phtml" hash="9069e9f2e13f3f0c1f175920c295ee65"/></dir></dir><dir name="straker"><dir name="job"><dir name="attribute"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="attribute.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="category"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="category.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="cms"><dir name="block"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="block.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="page"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="page.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/></dir><dir name="product"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="product.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/></dir><file name="job.phtml" hash="63c7a5b66b969635ee9996638878d63c"/><dir name="new"><dir name="attribute"><file name="confirm.phtml" hash="609ab700b5386b7d9549fb74f7e9025f"/><file name="massaction.phtml" hash="9dcf11014c7a598128a64c048e0108cf"/></dir><file name="attribute.phtml" hash="9f327fe0551b9d39e455b361d662ce08"/><file name="attributes.phtml" hash="a2b5136923f2afad369185077a3c4c53"/><dir name="category"><file name="attributes.phtml" hash="c92f98e8397ae9143c17c87e2e468758"/><dir name="confirm"><file name="grid.phtml" hash="8336aad4f7275992704b1b7ddaccac3e"/></dir><file name="confirm.phtml" hash="8e10afdfc326dc5e16f8d40125bfeaf8"/><file name="tree.phtml" hash="4599d5840d9bdf21cf5c057c6112dfcc"/></dir><dir name="cms"><dir name="block"><file name="attributes.phtml" hash="b2767598f08b2159c952c446f306e717"/><file name="confirm.phtml" hash="a7369555063de98c418c6cdf64485b6c"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="block.phtml" hash="6ad391571d617ca4f262d3bc15a41d7c"/><dir name="page"><file name="attributes.phtml" hash="288ef5992432d95493f919372af419bb"/><file name="confirm.phtml" hash="329c1f0943eda97164bda08e712a929c"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="page.phtml" hash="9e5e384888f81b5933ea2deb8dd9e0e8"/></dir><file name="confirm.phtml" hash="72552d8f56335eb644a4c0ffe314f12b"/><dir name="products"><file name="attributes.phtml" hash="fdfeb163ffb82ae983b4872fe59d2b77"/><file name="confirm.phtml" hash="f00acbdd4f83694b390c29346f6f0f79"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="products.phtml" hash="2930c175307b3178a7b8a6205981cdf2"/><file name="register.phtml" hash="13da4e89dafcdf0508343905121a6ed3"/><file name="selectstore.phtml" hash="59b46141938afec500ce3acf36da5427"/><file name="setupstore.phtml" hash="c3dab5a53f6007ac9608721bd75761bf"/><file name="type.phtml" hash="ab8bd7f6b5945af2e1dd0a9b19f0bfee"/></dir><dir name="system"><dir name="config"><file name="button.phtml" hash="9725dd1eea9e0a5c6ff9a34a31d5e433"/><file name="store.phtml" hash="accefd80ff19bf7c917c923b2aed961c"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="css"><file name="straker.css" hash="7de7c21b46326f421fcbb6363ab9e955"/><file name="straker.less" hash="5455064a2c31680a823d39bdc24997b0"/></dir><dir name="images"><dir name="default"><file name="bottom_left.gif" hash="fb99ffa815a8648f95f42698fe5dfaa1"/><file name="bottom_mid.gif" hash="49b9ca7025562ea7f070a9111282364b"/><file name="bottom_right.gif" hash="e46768f632765cd86c5fe5d0166dcf2c"/><file name="bottom_right_resize.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="center_left.gif" hash="bd567580b4ee16a7a2734057cfbbe219"/><file name="center_right.gif" hash="eef184d5d89d1710313581a2ccf408e8"/><file name="clear.gif" hash="7af1206eeb0e7834a75e69d70676060d"/><file name="close.gif" hash="8a08f243c37a8e25a88d4ac135b2f07d"/><file name="inspect.gif" hash="aa2a0961067aad5c54b8634919af863b"/><file name="maximize.gif" hash="e73cd71c4979ebeadeb9e27d40a9e8fb"/><file name="minimize.gif" hash="2d2f4b1bd0506f342425f80ab76c49a3"/><file name="overlay.png" hash="536d40e87cda0c7ae7b11f1721aa52d0"/><file name="resize.gif" hash="320f534b5d444b39701e0b679529e779"/><file name="sizer.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="top_left.gif" hash="9c5e5920bfc189a45cc618099af93aa8"/><file name="top_mid.gif" hash="a12ff2b944025ad2d127d033dae5e9e1"/><file name="top_right.gif" hash="0cf1ec5b93f8ac8fcce0e2f72cf7f45e"/></dir><file name="magento-banner.jpg" hash="b3105fd2dd00004ab903db4fbb81b61e"/><file name="refresh_32.png" hash="96e793bcbcc2dc48768b8e124beea378"/><file name="straker-translations-logo.png" hash="7cb5e29f562420142f918147d95ed232"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="StrakerTranslations_EasyTranslationPlatform.xml" hash="eb61fdaac7559a75e39bc01206165d0c"/></dir></target><target name="mage"><dir name="js"><dir name="straker"><file name="translations.js" hash="0168be67b66e071d1e8f833a959d95b7"/></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>straker-translations-easy-translation-platform</name>
4
+ <version>1.3.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Multilingual eCommerce extensions from the award-winning global translation company.</summary>
10
  <description>Total automation of the translation process, simple installation and setup, quality human translation at cost-effective rates, scalable to more than 80 languages and 1000s of projects and powerful dashboard reporting.</description>
11
+ <notes>Fix bug when applying attribute translation.</notes>
12
  <authors><author><name>Chris</name><user>Straker_support</user><email>extensions@strakertranslations.com</email></author></authors>
13
+ <date>2017-02-26</date>
14
+ <time>21:29:31</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="layout"><file name="straker.xml" hash="52ec2d65c1ac817a5f1603e916037d15"/></dir><dir name="template"><dir name="cms"><dir name="form"><file name="container.phtml" hash="9069e9f2e13f3f0c1f175920c295ee65"/></dir></dir><dir name="straker"><dir name="job"><dir name="attribute"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="attribute.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="category"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="category.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="cms"><dir name="block"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="block.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/><dir name="page"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="page.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/></dir><dir name="product"><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="product.phtml" hash="e908bcbf0ad1435a35d6009f599c4f77"/></dir><file name="job.phtml" hash="63c7a5b66b969635ee9996638878d63c"/><dir name="new"><dir name="attribute"><file name="confirm.phtml" hash="609ab700b5386b7d9549fb74f7e9025f"/><file name="massaction.phtml" hash="9dcf11014c7a598128a64c048e0108cf"/></dir><file name="attribute.phtml" hash="9f327fe0551b9d39e455b361d662ce08"/><file name="attributes.phtml" hash="a2b5136923f2afad369185077a3c4c53"/><dir name="category"><file name="attributes.phtml" hash="c92f98e8397ae9143c17c87e2e468758"/><dir name="confirm"><file name="grid.phtml" hash="8336aad4f7275992704b1b7ddaccac3e"/></dir><file name="confirm.phtml" hash="8e10afdfc326dc5e16f8d40125bfeaf8"/><file name="tree.phtml" hash="4599d5840d9bdf21cf5c057c6112dfcc"/></dir><dir name="cms"><dir name="block"><file name="attributes.phtml" hash="b2767598f08b2159c952c446f306e717"/><file name="confirm.phtml" hash="a7369555063de98c418c6cdf64485b6c"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="block.phtml" hash="6ad391571d617ca4f262d3bc15a41d7c"/><dir name="page"><file name="attributes.phtml" hash="288ef5992432d95493f919372af419bb"/><file name="confirm.phtml" hash="329c1f0943eda97164bda08e712a929c"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="page.phtml" hash="9e5e384888f81b5933ea2deb8dd9e0e8"/></dir><file name="confirm.phtml" hash="72552d8f56335eb644a4c0ffe314f12b"/><dir name="products"><file name="attributes.phtml" hash="fdfeb163ffb82ae983b4872fe59d2b77"/><file name="confirm.phtml" hash="f00acbdd4f83694b390c29346f6f0f79"/><file name="massaction.phtml" hash="1c3b4ce443f6e4086bcc362d43f75354"/></dir><file name="products.phtml" hash="2930c175307b3178a7b8a6205981cdf2"/><file name="register.phtml" hash="13da4e89dafcdf0508343905121a6ed3"/><file name="selectstore.phtml" hash="59b46141938afec500ce3acf36da5427"/><file name="setupstore.phtml" hash="c3dab5a53f6007ac9608721bd75761bf"/><file name="type.phtml" hash="ab8bd7f6b5945af2e1dd0a9b19f0bfee"/></dir><dir name="system"><dir name="config"><file name="button.phtml" hash="9725dd1eea9e0a5c6ff9a34a31d5e433"/><file name="store.phtml" hash="accefd80ff19bf7c917c923b2aed961c"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="straker"><dir name="css"><file name="straker.css" hash="7de7c21b46326f421fcbb6363ab9e955"/><file name="straker.less" hash="5455064a2c31680a823d39bdc24997b0"/></dir><dir name="images"><dir name="default"><file name="bottom_left.gif" hash="fb99ffa815a8648f95f42698fe5dfaa1"/><file name="bottom_mid.gif" hash="49b9ca7025562ea7f070a9111282364b"/><file name="bottom_right.gif" hash="e46768f632765cd86c5fe5d0166dcf2c"/><file name="bottom_right_resize.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="center_left.gif" hash="bd567580b4ee16a7a2734057cfbbe219"/><file name="center_right.gif" hash="eef184d5d89d1710313581a2ccf408e8"/><file name="clear.gif" hash="7af1206eeb0e7834a75e69d70676060d"/><file name="close.gif" hash="8a08f243c37a8e25a88d4ac135b2f07d"/><file name="inspect.gif" hash="aa2a0961067aad5c54b8634919af863b"/><file name="maximize.gif" hash="e73cd71c4979ebeadeb9e27d40a9e8fb"/><file name="minimize.gif" hash="2d2f4b1bd0506f342425f80ab76c49a3"/><file name="overlay.png" hash="536d40e87cda0c7ae7b11f1721aa52d0"/><file name="resize.gif" hash="320f534b5d444b39701e0b679529e779"/><file name="sizer.gif" hash="1b35a4ec3b734dfe37e31ba87bcc7d99"/><file name="top_left.gif" hash="9c5e5920bfc189a45cc618099af93aa8"/><file name="top_mid.gif" hash="a12ff2b944025ad2d127d033dae5e9e1"/><file name="top_right.gif" hash="0cf1ec5b93f8ac8fcce0e2f72cf7f45e"/></dir><file name="magento-banner.jpg" hash="b3105fd2dd00004ab903db4fbb81b61e"/><file name="refresh_32.png" hash="96e793bcbcc2dc48768b8e124beea378"/><file name="straker-translations-logo.png" hash="7cb5e29f562420142f918147d95ed232"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="StrakerTranslations_EasyTranslationPlatform.xml" hash="eb61fdaac7559a75e39bc01206165d0c"/></dir></target><target name="mage"><dir name="js"><dir name="straker"><file name="translations.js" hash="0168be67b66e071d1e8f833a959d95b7"/></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>7.1.0</max></php></required></dependencies>
18
  </package>