Version Notes
Initial Stable release
Download this release
Release Info
Developer | Chris |
Extension | straker-translations-easy-translation-platform |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.3.2
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php +48 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Page/Grid.php +49 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block.php +41 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php +141 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page.php +41 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php +141 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block.php +47 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Attribute.php +17 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm.php +48 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Confirm/Grid.php +102 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block/Grid.php +124 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page.php +47 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Attribute.php +20 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm.php +48 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Confirm/Grid.php +109 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Page/Grid.php +134 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php +1 -1
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php +1 -1
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsOriginTitle.php +10 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsVersion.php +20 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Status.php +2 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/StrakerTranslated.php +14 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Helper/Data.php +27 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Attributes.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Translate.php +43 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Attributes.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Translate.php +43 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php +177 -3
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Block.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Page.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Attributes/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Block/Translate/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Attributes/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Cms/Page/Translate/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Block/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Resource/Job/Cms/Page/Collection.php +16 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/BlockController.php +186 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/Cms/PageController.php +186 -0
- app/code/community/StrakerTranslations/EasyTranslationPlatform/controllers/Adminhtml/Straker/NewController.php +0 -10
- app/code/community/StrakerTranslations/EasyTranslationPlatform/etc/config.xml +25 -1
- app/code/community/StrakerTranslations/EasyTranslationPlatform/sql/strakertranslations_easytranslationplatform_setup/mysql4-upgrade-1.3.0-1.3.1.php +127 -0
- app/design/adminhtml/default/straker/layout/straker.xml +32 -0
- app/design/adminhtml/default/straker/template/cms/form/container.phtml +47 -0
- app/design/adminhtml/default/straker/template/straker/job/cms/block.phtml +39 -0
- app/design/adminhtml/default/straker/template/straker/job/cms/block/massaction.phtml +87 -0
- app/design/adminhtml/default/straker/template/straker/job/cms/page.phtml +39 -0
- app/design/adminhtml/default/straker/template/straker/job/cms/page/massaction.phtml +87 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/block.phtml +31 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/block/attributes.phtml +28 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/block/confirm.phtml +38 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/block/massaction.phtml +87 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/page.phtml +31 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/page/attributes.phtml +28 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/page/confirm.phtml +38 -0
- app/design/adminhtml/default/straker/template/straker/new/cms/page/massaction.phtml +87 -0
- package.xml +4 -4
- skin/adminhtml/default/straker/css/straker.css +18 -0
- skin/adminhtml/default/straker/css/straker.less +19 -0
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Block/Grid.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Block_Grid extends Mage_Adminhtml_Block_Cms_Block_Grid {
|
3 |
+
protected function _prepareCollection()
|
4 |
+
{
|
5 |
+
$collection = Mage::getModel('cms/block')->getCollection();
|
6 |
+
/* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
|
7 |
+
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
8 |
+
$collection->getSelect()->joinLeft(
|
9 |
+
array('straker' => $prefix.'straker_job_cmsblock'),
|
10 |
+
'straker.new_entity_id = main_table.block_id',
|
11 |
+
array('straker_translated' => 'straker.version')
|
12 |
+
);
|
13 |
+
$this->setCollection($collection);
|
14 |
+
|
15 |
+
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
|
16 |
+
}
|
17 |
+
|
18 |
+
protected function _prepareColumns()
|
19 |
+
{
|
20 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
21 |
+
$this->addColumnAfter('straker_translated', array(
|
22 |
+
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Created by Straker'),
|
23 |
+
'type' => 'options',
|
24 |
+
'options' => array('0' => 'No', '1' => 'Yes'),
|
25 |
+
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_StrakerTranslated',
|
26 |
+
'index' => 'straker_translated',
|
27 |
+
'filter_index' => 'straker.version',
|
28 |
+
'filter_condition_callback' => array($this, '_filterStrakerVersion')
|
29 |
+
), 'update_time');
|
30 |
+
}
|
31 |
+
return parent::_prepareColumns();
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _filterStrakerVersion($collection, $column)
|
35 |
+
{
|
36 |
+
$value = $column->getFilter()->getValue();
|
37 |
+
if ($value == 0) {
|
38 |
+
$this->getCollection()->getSelect()->where(
|
39 |
+
"straker.version IS NULL");
|
40 |
+
}
|
41 |
+
else {
|
42 |
+
$this->getCollection()->getSelect()->where(
|
43 |
+
"straker.version = ".$value);
|
44 |
+
}
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Cms/Page/Grid.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Cms_Page_Grid extends Mage_Adminhtml_Block_Cms_Page_Grid {
|
3 |
+
protected function _prepareCollection()
|
4 |
+
{
|
5 |
+
$collection = Mage::getModel('cms/page')->getCollection();
|
6 |
+
/* @var $collection Mage_Cms_Model_Mysql4_Page_Collection */
|
7 |
+
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
8 |
+
$collection->getSelect()->joinLeft(
|
9 |
+
array('straker' => $prefix.'straker_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/Cms/Block.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block extends Mage_Adminhtml_Block_Widget_Container{
|
3 |
+
|
4 |
+
protected $_job;
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setTemplate('straker/job/cms/block.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _prepareLayout()
|
13 |
+
{
|
14 |
+
$jobId = $this->getRequest()->getParam('job_id');
|
15 |
+
$jobStatus = $this->getJob()->getStatusId();
|
16 |
+
if ( $jobStatus == '4'){
|
17 |
+
$this->_addButton('publish', array(
|
18 |
+
'label' => Mage::helper('catalog')->__('Publish All Translations'),
|
19 |
+
'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
|
20 |
+
'class' => 'task'
|
21 |
+
));
|
22 |
+
}
|
23 |
+
|
24 |
+
$this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_cms_block_grid', 'job_cms_block.grid'));
|
25 |
+
$this->getChild('grid')->setStatusId($jobStatus);
|
26 |
+
return parent::_prepareLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getGridHtml()
|
30 |
+
{
|
31 |
+
return $this->getChildHtml('grid');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getJob(){
|
35 |
+
if(!$this->_job) {
|
36 |
+
$jobId = $this->getRequest()->getParam('job_id');
|
37 |
+
$this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
|
38 |
+
}
|
39 |
+
return $this->_job;
|
40 |
+
}
|
41 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Block/Grid.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Block_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
protected $_attributes;
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('strakerJobCmsBlockGrid');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareLayout()
|
14 |
+
{
|
15 |
+
$this->setChild('dispute_button',
|
16 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
17 |
+
->setData(array(
|
18 |
+
'label' => Mage::helper('catalog')->__('Feedback'),
|
19 |
+
'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
|
20 |
+
'class' => 'feedback'
|
21 |
+
))
|
22 |
+
);
|
23 |
+
|
24 |
+
return parent::_prepareLayout();
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _prepareCollection() {
|
28 |
+
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
29 |
+
$job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
|
30 |
+
|
31 |
+
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_block')->getCollection()
|
32 |
+
->addFieldToFilter('main_table.job_id', $job->getId());
|
33 |
+
|
34 |
+
//echo $collection->getSelect(); die();
|
35 |
+
$this->setCollection($collection);
|
36 |
+
return parent::_prepareCollection();
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _prepareColumns() {
|
40 |
+
$this->addColumn('title', array(
|
41 |
+
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
|
42 |
+
'align' => 'center',
|
43 |
+
'index' => 'origin',
|
44 |
+
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsOriginTitle',
|
45 |
+
'sortable' => false,
|
46 |
+
'filter' => false,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
|
50 |
+
$this->addColumn('version', array(
|
51 |
+
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
|
52 |
+
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
|
53 |
+
'align' => 'center',
|
54 |
+
'index' => false,
|
55 |
+
'filter' => false,
|
56 |
+
));
|
57 |
+
}
|
58 |
+
|
59 |
+
return parent::_prepareColumns();
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getRowUrl($row) {
|
63 |
+
// return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
64 |
+
return '';
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _prepareMassaction()
|
68 |
+
{
|
69 |
+
if ($this->getStatusId() == '4') {
|
70 |
+
|
71 |
+
$this->setMassactionIdField('block_id');
|
72 |
+
$this->getMassactionBlock()->setFormFieldName('block_id');
|
73 |
+
|
74 |
+
$this->getMassactionBlock()->addItem('add', array(
|
75 |
+
'label' => Mage::helper('catalog')->__('Publish Translation'),
|
76 |
+
'url' => $this->getUrl('*/*/applyTranslation'),
|
77 |
+
'selected' => 1
|
78 |
+
));
|
79 |
+
|
80 |
+
$this->getMassactionBlock()->setTemplate('straker/job/cms/page/massaction.phtml');
|
81 |
+
|
82 |
+
$hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
|
83 |
+
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
|
84 |
+
|
85 |
+
|
86 |
+
// Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function _prepareMassactionColumn()
|
92 |
+
{
|
93 |
+
if ($this->getStatusId() == '4') {
|
94 |
+
$columnId = 'massaction';
|
95 |
+
$massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
|
96 |
+
->setData(array(
|
97 |
+
'index' => $this->getMassactionIdField(),
|
98 |
+
'use_index' => $this->getMassactionIdField(),
|
99 |
+
'filter_index' => $this->getMassactionIdFilter(),
|
100 |
+
'type' => 'massaction',
|
101 |
+
'name' => $this->getMassactionBlock()->getFormFieldName(),
|
102 |
+
'align' => 'center',
|
103 |
+
'is_system' => true
|
104 |
+
));
|
105 |
+
|
106 |
+
if ($this->getNoFilterMassactionColumn()) {
|
107 |
+
$massactionColumn->setData('filter', false);
|
108 |
+
}
|
109 |
+
|
110 |
+
$massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
|
111 |
+
->setGrid($this)
|
112 |
+
->setId($columnId);
|
113 |
+
|
114 |
+
$oldColumns = $this->_columns;
|
115 |
+
$this->_columns = array();
|
116 |
+
$this->_columns[$columnId] = $massactionColumn;
|
117 |
+
$this->_columns = array_merge($this->_columns, $oldColumns);
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getMainButtonsHtml()
|
123 |
+
{
|
124 |
+
$html = '';
|
125 |
+
if ($this->getStatusId() == '4') {
|
126 |
+
$html .= $this->getChildHtml('dispute_button');
|
127 |
+
}
|
128 |
+
if($this->getFilterVisibility()){
|
129 |
+
$html.= $this->getResetFilterButtonHtml();
|
130 |
+
$html.= $this->getSearchButtonHtml();
|
131 |
+
}
|
132 |
+
return $html;
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function getAttributes(){
|
136 |
+
if(!$this->_attributes){
|
137 |
+
$this->_attributes = Mage::getModel('strakertranslations_easytranslationplatform/cms_block_attributes')->getCollection()->addFieldToFilter('job_id',$this->getRequest()->getParam('job_id'));
|
138 |
+
}
|
139 |
+
return $this->_attributes;
|
140 |
+
}
|
141 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page extends Mage_Adminhtml_Block_Widget_Container{
|
3 |
+
|
4 |
+
protected $_job;
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setTemplate('straker/job/cms/page.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _prepareLayout()
|
13 |
+
{
|
14 |
+
$jobId = $this->getRequest()->getParam('job_id');
|
15 |
+
$jobStatus = $this->getJob()->getStatusId();
|
16 |
+
if ( $jobStatus == '4'){
|
17 |
+
$this->_addButton('publish', array(
|
18 |
+
'label' => Mage::helper('catalog')->__('Publish All Translations'),
|
19 |
+
'onclick' => "setLocation('{$this->getUrl('*/*/copyAll',array('job_id'=>$jobId))}');",
|
20 |
+
'class' => 'task'
|
21 |
+
));
|
22 |
+
}
|
23 |
+
|
24 |
+
$this->setChild('grid', $this->getLayout()->createBlock('strakertranslations_easytranslationplatform/adminhtml_job_cms_page_grid', 'job_cms_page.grid'));
|
25 |
+
$this->getChild('grid')->setStatusId($jobStatus);
|
26 |
+
return parent::_prepareLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getGridHtml()
|
30 |
+
{
|
31 |
+
return $this->getChildHtml('grid');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getJob(){
|
35 |
+
if(!$this->_job) {
|
36 |
+
$jobId = $this->getRequest()->getParam('job_id');
|
37 |
+
$this->_job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($jobId);
|
38 |
+
}
|
39 |
+
return $this->_job;
|
40 |
+
}
|
41 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Job/Cms/Page/Grid.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Job_Cms_Page_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
protected $_attributes;
|
6 |
+
|
7 |
+
public function __construct() {
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('strakerJobCmsPageGrid');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareLayout()
|
14 |
+
{
|
15 |
+
$this->setChild('dispute_button',
|
16 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
17 |
+
->setData(array(
|
18 |
+
'label' => Mage::helper('catalog')->__('Feedback'),
|
19 |
+
'onclick' => 'disputeForm.show(\''.$this->getRequest()->getParam('job_id').'\')',
|
20 |
+
'class' => 'feedback'
|
21 |
+
))
|
22 |
+
);
|
23 |
+
|
24 |
+
return parent::_prepareLayout();
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _prepareCollection() {
|
28 |
+
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
29 |
+
$job = Mage::getModel('strakertranslations_easytranslationplatform/job')->load($this->getRequest()->getParam('job_id'));
|
30 |
+
|
31 |
+
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job_cms_page')->getCollection()
|
32 |
+
->addFieldToFilter('main_table.job_id', $job->getId());
|
33 |
+
|
34 |
+
$this->setCollection($collection);
|
35 |
+
return parent::_prepareCollection();
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _prepareColumns() {
|
39 |
+
|
40 |
+
$this->addColumn('title', array(
|
41 |
+
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Title'),
|
42 |
+
'align' => 'center',
|
43 |
+
'index' => 'origin',
|
44 |
+
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsOriginTitle',
|
45 |
+
'sortable' => false,
|
46 |
+
'filter' => false,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ($this->getStatusId() == '4' || $this->getStatusId() == '5'){
|
50 |
+
$this->addColumn('version', array(
|
51 |
+
'header' => Mage::helper('strakertranslations_easytranslationplatform')->__('Published'),
|
52 |
+
'renderer' => 'StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_Renderer_CmsVersion',
|
53 |
+
'align' => 'center',
|
54 |
+
'index' => false,
|
55 |
+
'filter' => false,
|
56 |
+
));
|
57 |
+
}
|
58 |
+
|
59 |
+
return parent::_prepareColumns();
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getRowUrl($row) {
|
63 |
+
// return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
64 |
+
return '';
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _prepareMassaction()
|
68 |
+
{
|
69 |
+
if ($this->getStatusId() == '4') {
|
70 |
+
|
71 |
+
$this->setMassactionIdField('page_id');
|
72 |
+
$this->getMassactionBlock()->setFormFieldName('page_id');
|
73 |
+
|
74 |
+
$this->getMassactionBlock()->addItem('add', array(
|
75 |
+
'label' => Mage::helper('catalog')->__('Publish Translation'),
|
76 |
+
'url' => $this->getUrl('*/*/applyTranslation'),
|
77 |
+
'selected' => 1
|
78 |
+
));
|
79 |
+
|
80 |
+
$this->getMassactionBlock()->setTemplate('straker/job/cms/page/massaction.phtml');
|
81 |
+
|
82 |
+
$hiddenParams = '<input type="hidden" name="job_id" value="' . $this->getRequest()->getParam('job_id') . '" />';
|
83 |
+
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
|
84 |
+
|
85 |
+
|
86 |
+
// Mage::dispatchEvent('adminhtml_strakertranslation_job_product_grid_prepare_massaction', array('block' => $this));
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function _prepareMassactionColumn()
|
92 |
+
{
|
93 |
+
if ($this->getStatusId() == '4') {
|
94 |
+
$columnId = 'massaction';
|
95 |
+
$massactionColumn = $this->getLayout()->createBlock('adminhtml/widget_grid_column')
|
96 |
+
->setData(array(
|
97 |
+
'index' => $this->getMassactionIdField(),
|
98 |
+
'use_index' => $this->getMassactionIdField(),
|
99 |
+
'filter_index' => $this->getMassactionIdFilter(),
|
100 |
+
'type' => 'massaction',
|
101 |
+
'name' => $this->getMassactionBlock()->getFormFieldName(),
|
102 |
+
'align' => 'center',
|
103 |
+
'is_system' => true
|
104 |
+
));
|
105 |
+
|
106 |
+
if ($this->getNoFilterMassactionColumn()) {
|
107 |
+
$massactionColumn->setData('filter', false);
|
108 |
+
}
|
109 |
+
|
110 |
+
$massactionColumn->setSelected($this->getMassactionBlock()->getSelected())
|
111 |
+
->setGrid($this)
|
112 |
+
->setId($columnId);
|
113 |
+
|
114 |
+
$oldColumns = $this->_columns;
|
115 |
+
$this->_columns = array();
|
116 |
+
$this->_columns[$columnId] = $massactionColumn;
|
117 |
+
$this->_columns = array_merge($this->_columns, $oldColumns);
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
public function getMainButtonsHtml()
|
123 |
+
{
|
124 |
+
$html = '';
|
125 |
+
if ($this->getStatusId() == '4') {
|
126 |
+
$html .= $this->getChildHtml('dispute_button');
|
127 |
+
}
|
128 |
+
if($this->getFilterVisibility()){
|
129 |
+
$html.= $this->getResetFilterButtonHtml();
|
130 |
+
$html.= $this->getSearchButtonHtml();
|
131 |
+
}
|
132 |
+
return $html;
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function getAttributes(){
|
136 |
+
if(!$this->_attributes){
|
137 |
+
$this->_attributes = Mage::getModel('strakertranslations_easytranslationplatform/cms_page_attributes')->getCollection()->addFieldToFilter('job_id',$this->getRequest()->getParam('job_id'));
|
138 |
+
}
|
139 |
+
return $this->_attributes;
|
140 |
+
}
|
141 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Cms/Block.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$collection = Mage::getModel('cms/page')->getCollection();
|
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 |
+
'filter_condition_callback'
|
53 |
+
=> array($this, '_filterStoreCondition'),
|
54 |
+
));
|
55 |
+
}
|
56 |
+
|
57 |
+
$this->addColumn('is_active', array(
|
58 |
+
'header' => Mage::helper('cms')->__('Status'),
|
59 |
+
'index' => 'is_active',
|
60 |
+
'type' => 'options',
|
61 |
+
'options' => Mage::getSingleton('cms/page')->getAvailableStatuses()
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->addColumn('creation_time', array(
|
65 |
+
'header' => Mage::helper('cms')->__('Date Created'),
|
66 |
+
'index' => 'creation_time',
|
67 |
+
'type' => 'datetime',
|
68 |
+
));
|
69 |
+
|
70 |
+
$this->addColumn('update_time', array(
|
71 |
+
'header' => Mage::helper('cms')->__('Last Modified'),
|
72 |
+
'index' => 'update_time',
|
73 |
+
'type' => 'datetime',
|
74 |
+
));
|
75 |
+
|
76 |
+
$this->addColumn('page_actions', array(
|
77 |
+
'header' => Mage::helper('cms')->__('Action'),
|
78 |
+
'width' => 10,
|
79 |
+
'sortable' => false,
|
80 |
+
'filter' => false,
|
81 |
+
'renderer' => 'adminhtml/cms_page_grid_renderer_action',
|
82 |
+
));
|
83 |
+
|
84 |
+
return parent::_prepareColumns();
|
85 |
+
}
|
86 |
+
|
87 |
+
protected function _afterLoadCollection()
|
88 |
+
{
|
89 |
+
$this->getCollection()->walk('afterLoad');
|
90 |
+
parent::_afterLoadCollection();
|
91 |
+
}
|
92 |
+
|
93 |
+
protected function _filterStoreCondition($collection, $column)
|
94 |
+
{
|
95 |
+
if (!$value = $column->getFilter()->getValue()) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->getCollection()->addStoreFilter($value);
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function _prepareMassaction()
|
103 |
+
{
|
104 |
+
$this->setMassactionIdField('entity_id');
|
105 |
+
$this->getMassactionBlock()->setFormFieldName('cms_page');
|
106 |
+
|
107 |
+
$this->getMassactionBlock()->addItem('add', array(
|
108 |
+
'label'=> Mage::helper('catalog')->__('Add to Confirm Page'),
|
109 |
+
'url' => $this->getUrl('*/*/addtoconfirm'),
|
110 |
+
'selected' => 1
|
111 |
+
));
|
112 |
+
$this->getMassactionBlock()->setTemplate('straker/new/cms/page/massaction.phtml');
|
113 |
+
|
114 |
+
//todo: refine this
|
115 |
+
$hiddenParams = '<input type="hidden" name="store" value="'.$this->_getStore()->getId().'" />';
|
116 |
+
$hiddenParams .= '<input type="hidden" name="attr" value="'.$this->getAttr().'" />';
|
117 |
+
$this->getMassactionBlock()->setHiddenParams($hiddenParams);
|
118 |
+
|
119 |
+
|
120 |
+
Mage::dispatchEvent('adminhtml_strakertranslation_new_products_grid_prepare_massaction', array('block' => $this));
|
121 |
+
return $this;
|
122 |
+
}
|
123 |
+
|
124 |
+
public function getRowUrl($row)
|
125 |
+
{
|
126 |
+
return '';
|
127 |
+
}
|
128 |
+
|
129 |
+
protected function _getStore()
|
130 |
+
{
|
131 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
132 |
+
return Mage::app()->getStore($storeId);
|
133 |
+
}
|
134 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/New/Type.php
CHANGED
@@ -12,7 +12,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_New_Type exten
|
|
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_".strtolower($type->getTypeName
|
16 |
|
17 |
}
|
18 |
return $html;
|
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;
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/Action.php
CHANGED
@@ -8,7 +8,7 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
|
|
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_".strtolower($row->getTypeName
|
12 |
return $out;
|
13 |
}
|
14 |
}
|
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 |
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/CmsOriginTitle.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/Status.php
CHANGED
@@ -4,6 +4,8 @@ class StrakerTranslations_EasyTranslationPlatform_Block_Adminhtml_Template_Grid_
|
|
4 |
{
|
5 |
public function render(Varien_Object $row){
|
6 |
if (get_class($row) == get_class(Mage::getModel('strakertranslations_easytranslationplatform/job') )) {
|
|
|
|
|
7 |
//if status is QUEUED
|
8 |
if ($row->getStatusName() == 'QUEUED') {
|
9 |
$quote = $row->getQuote();
|
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();
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Block/Adminhtml/Template/Grid/Renderer/StrakerTranslated.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/Helper/Data.php
CHANGED
@@ -31,4 +31,31 @@ class StrakerTranslations_EasyTranslationPlatform_Helper_Data extends Mage_Core_
|
|
31 |
|
32 |
return $sourceText . ' > ' . $destinationText;
|
33 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
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 |
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Block/Attributes.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
$this->setIsImported(1)->save();
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
private function _getConnection() {
|
40 |
+
return Mage::getSingleton('core/resource')->getConnection('core_write');
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Cms/Page/Attributes.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
}
|
38 |
+
|
39 |
+
private function _getConnection() {
|
40 |
+
return Mage::getSingleton('core/resource')->getConnection('core_write');
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job.php
CHANGED
@@ -108,6 +108,29 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
|
|
108 |
return $this;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
public function array_to_xml( $data, &$xml_data ) {
|
112 |
foreach( $data as $key => $value ) {
|
113 |
if( is_array($value) ) {
|
@@ -290,6 +313,92 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
|
|
290 |
return $this;
|
291 |
}
|
292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
protected function _createProductTranslateFile() {
|
294 |
|
295 |
$_xml = '<?xml version="1.0" encoding="utf-8"?><root>';
|
@@ -456,6 +565,22 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
|
|
456 |
return $this;
|
457 |
}
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
public function updateQuote(){
|
460 |
|
461 |
if ($this->getJobKey()){
|
@@ -596,7 +721,7 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
|
|
596 |
}
|
597 |
|
598 |
protected function _getType(){
|
599 |
-
return strtolower($this->getTypeName
|
600 |
}
|
601 |
|
602 |
public function updatePayment(){
|
@@ -626,21 +751,70 @@ class StrakerTranslations_EasyTranslationPlatform_Model_Job extends Mage_Core_Mo
|
|
626 |
$updatedIds = array();
|
627 |
$writeConnection = $this->getWriteAdapter();
|
628 |
|
|
|
|
|
|
|
|
|
629 |
foreach ($collection as $translation) {
|
630 |
$translation->setStoreId($this->getStoreId())->importTranslation();
|
631 |
|
632 |
-
$entityId= call_user_func(array($translation, '
|
633 |
|
634 |
if (empty($updatedIds[$entityId])){
|
635 |
$updatedIds[$entityId] = true;
|
636 |
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
637 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
}
|
639 |
}
|
640 |
|
641 |
return true;
|
642 |
}
|
643 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
public function isPublished()
|
645 |
{
|
646 |
if ($this->getStatusId() == 5) {
|
108 |
return $this;
|
109 |
}
|
110 |
|
111 |
+
protected function addCmsTranslateOriginal($Column, $cmsDataCollection, $type='page',$jobCmsIds) {
|
112 |
+
|
113 |
+
$writeConnection = $this->getWriteAdapter();
|
114 |
+
|
115 |
+
$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 ';
|
116 |
+
$queryVals = array();
|
117 |
+
foreach ($cmsDataCollection as $cmsData) {
|
118 |
+
|
119 |
+
foreach ($jobCmsIds as $k => $v){
|
120 |
+
if ($cmsData[$type.'_id'] == $v){
|
121 |
+
$jobCmsId = $k;
|
122 |
+
break;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
$queryVals[] = '(' . $this->getId() . ', ' . $cmsData[$type.'_id'] . ', \'' . addslashes($Column). '\', \'' . addslashes($cmsData[$Column]).'\', ' . $jobCmsId . ')';
|
127 |
+
}
|
128 |
+
|
129 |
+
$writeConnection->query( $query . implode(',', $queryVals));
|
130 |
+
|
131 |
+
return $this;
|
132 |
+
}
|
133 |
+
|
134 |
public function array_to_xml( $data, &$xml_data ) {
|
135 |
foreach( $data as $key => $value ) {
|
136 |
if( is_array($value) ) {
|
313 |
return $this;
|
314 |
}
|
315 |
|
316 |
+
|
317 |
+
public function addCmsEntities($ids, $Columns = array(), $type = 'page'){
|
318 |
+
|
319 |
+
if (!$this->getId()){
|
320 |
+
if (!$this->getStoreId()){
|
321 |
+
Mage::throwException('Error: Missing Store Id');
|
322 |
+
}
|
323 |
+
$this->setSourceStore(Mage::getStoreConfig('straker/general/source',$this->getStoreId()));
|
324 |
+
$this->save();
|
325 |
+
}
|
326 |
+
|
327 |
+
foreach ($Columns as $Column) {
|
328 |
+
$this->_attributes[] =
|
329 |
+
Mage::getModel('strakertranslations_easytranslationplatform/cms_'.$type.'_attributes')
|
330 |
+
->setJobId($this->getId())
|
331 |
+
->setColumnName($Column)
|
332 |
+
->save();
|
333 |
+
}
|
334 |
+
|
335 |
+
$writeConnection = $this->getWriteAdapter();
|
336 |
+
|
337 |
+
$searchQuery = 'SELECT * FROM ' .Mage::getSingleton('core/resource')->getTableName('cms/'.$type)
|
338 |
+
.' WHERE '.$type.'_id IN ('.implode(',',$ids).')';
|
339 |
+
|
340 |
+
$cmsDataCollection = $writeConnection->fetchAll($searchQuery);
|
341 |
+
|
342 |
+
$query = 'INSERT INTO `'
|
343 |
+
.Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_cms'.$type)
|
344 |
+
.'` (`'.$type.'_id`, `job_id` , `origin`) VALUES ';
|
345 |
+
|
346 |
+
$queryVals = array();
|
347 |
+
|
348 |
+
foreach ($cmsDataCollection as $cmsData) {
|
349 |
+
$id = $cmsData[$type.'_id'];
|
350 |
+
|
351 |
+
unset($cmsData[$type.'_id']);
|
352 |
+
|
353 |
+
|
354 |
+
$queryVals[] = "(" . (int) $id . ", ". $this->getId() . ", '". addslashes(json_encode($cmsData)) . "')";
|
355 |
+
}
|
356 |
+
|
357 |
+
$writeConnection->query( $query . implode(',', $queryVals));
|
358 |
+
|
359 |
+
$query = 'SELECT id, '.$type.'_id FROM '.Mage::getSingleton('core/resource')->getTableName('strakertranslations_easytranslationplatform/job_cms'.$type)
|
360 |
+
.' WHERE job_id = '. $this->getId();
|
361 |
+
|
362 |
+
$jobCmsIds = $writeConnection->fetchPairs($query);
|
363 |
+
|
364 |
+
foreach ($Columns as $Column) {
|
365 |
+
$this->addCmsTranslateOriginal($Column, $cmsDataCollection, $type,$jobCmsIds);
|
366 |
+
}
|
367 |
+
|
368 |
+
|
369 |
+
$this->_createCMSTranslateFile($type);
|
370 |
+
|
371 |
+
|
372 |
+
return $this;
|
373 |
+
|
374 |
+
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
protected function _createCMSTranslateFile($type) {
|
379 |
+
|
380 |
+
$_xml = '<?xml version="1.0" encoding="utf-8"?><root>';
|
381 |
+
|
382 |
+
$cmsTranslateCollection = Mage::getModel('strakertranslations_easytranslationplatform/cms_'.$type.'_translate')->getCollection($this->getWriteAdapter());
|
383 |
+
$cmsTranslateCollection->addFieldToFilter('job_id',$this->getId());
|
384 |
+
|
385 |
+
foreach ($cmsTranslateCollection as $cmsTranslate ){
|
386 |
+
|
387 |
+
$_xml .= '<data name="cms_' .$type. '_' .$cmsTranslate->getCmsId().'_'.$cmsTranslate->getColumnName().'_'.'" ' ;
|
388 |
+
$_xml .= 'content_context="'.$cmsTranslate->getColumnName().'" ';
|
389 |
+
$_xml .= 'content_id="'. $cmsTranslate->getId() .'">';
|
390 |
+
$_xml .= '<value><![CDATA['.$cmsTranslate->getOriginal().']]></value></data>';
|
391 |
+
}
|
392 |
+
$_xml .='</root>';
|
393 |
+
|
394 |
+
file_put_contents(MAGENTO_ROOT.$this->_translateFilePath.'job'.$this->getId().'.xml',$_xml);
|
395 |
+
$this->setSourceFile('job'.$this->getId().'.xml')->save() ;
|
396 |
+
|
397 |
+
return $this;
|
398 |
+
|
399 |
+
|
400 |
+
}
|
401 |
+
|
402 |
protected function _createProductTranslateFile() {
|
403 |
|
404 |
$_xml = '<?xml version="1.0" encoding="utf-8"?><root>';
|
565 |
return $this;
|
566 |
}
|
567 |
|
568 |
+
public function submitCmsPage($cmsIds,$columns = array('title','content')){
|
569 |
+
|
570 |
+
$this->setTypeId(5);
|
571 |
+
$this->addCmsEntities($cmsIds,$columns,'page')
|
572 |
+
->_summitJob();
|
573 |
+
return $this;
|
574 |
+
}
|
575 |
+
|
576 |
+
public function submitCmsblock($cmsIds,$columns = array('title','content')){
|
577 |
+
|
578 |
+
$this->setTypeId(6);
|
579 |
+
$this->addCmsEntities($cmsIds,$columns,'block')
|
580 |
+
->_summitJob();
|
581 |
+
return $this;
|
582 |
+
}
|
583 |
+
|
584 |
public function updateQuote(){
|
585 |
|
586 |
if ($this->getJobKey()){
|
721 |
}
|
722 |
|
723 |
protected function _getType(){
|
724 |
+
return str_replace(' ', '_', strtolower($this->getTypeName()));
|
725 |
}
|
726 |
|
727 |
public function updatePayment(){
|
751 |
$updatedIds = array();
|
752 |
$writeConnection = $this->getWriteAdapter();
|
753 |
|
754 |
+
if (in_array($this->_getType() , array('cms_block','cms_page'))){
|
755 |
+
$this->createNewCms($entityIds);
|
756 |
+
}
|
757 |
+
|
758 |
foreach ($collection as $translation) {
|
759 |
$translation->setStoreId($this->getStoreId())->importTranslation();
|
760 |
|
761 |
+
$entityId= call_user_func(array($translation, 'getData'),strtolower(str_replace(' ','_',$this->getTypeName().'_id')));
|
762 |
|
763 |
if (empty($updatedIds[$entityId])){
|
764 |
$updatedIds[$entityId] = true;
|
765 |
$prefix = Mage::getConfig()->getTablePrefix()->__toString();
|
766 |
+
if (in_array($this->_getType() , array('cms_block','cms_page'))){
|
767 |
+
$cmstableName = str_replace('_','',$this->_getType());
|
768 |
+
$cmsColumnName = str_replace('cms_', '', $this->_getType());
|
769 |
+
$entityId = $translation->getData($this->_getType().'_id');
|
770 |
+
$writeConnection->update($prefix.'straker_job_'.$cmstableName ,array('version' => 1), $cmsColumnName."_id = {$entityId} and job_id ={$this->getId()}" );
|
771 |
+
}else{
|
772 |
+
$writeConnection->update($prefix.'straker_job_'.$this->_getType() ,array('version' => 1), $this->_getType()."_id = {$entityId} and job_id ={$this->getId()}" );
|
773 |
+
}
|
774 |
}
|
775 |
}
|
776 |
|
777 |
return true;
|
778 |
}
|
779 |
|
780 |
+
protected function createNewCms($entityIds){
|
781 |
+
|
782 |
+
|
783 |
+
$cmsType = str_replace('cms_', '', $this->_getType());
|
784 |
+
|
785 |
+
$cmsModelName = str_replace('_', '/', $this->_getType());
|
786 |
+
|
787 |
+
|
788 |
+
$collection = Mage::getModel('strakertranslations_easytranslationplatform/job_'.$this->_getType())->getCollection();
|
789 |
+
|
790 |
+
$collection->addFieldToFilter('job_id',$this->getId());
|
791 |
+
|
792 |
+
if ($entityIds) {
|
793 |
+
$collection->addFieldToFilter($cmsType.'_id', array('in' => $entityIds));
|
794 |
+
}
|
795 |
+
|
796 |
+
foreach ($collection as $jobCms) {
|
797 |
+
|
798 |
+
if (!$jobCms->getNewEntityId()) {
|
799 |
+
|
800 |
+
$cmsModel = Mage::getModel($cmsModelName);
|
801 |
+
|
802 |
+
$cmsData = json_decode($jobCms->getOrigin());
|
803 |
+
|
804 |
+
foreach ($cmsData as $k => $v){
|
805 |
+
$cmsModel->setData($k,$v);
|
806 |
+
}
|
807 |
+
|
808 |
+
$cmsModel->setStores(array())->save();
|
809 |
+
|
810 |
+
$jobCms->setNewEntityId($cmsModel->getId()) ->save();
|
811 |
+
|
812 |
+
}
|
813 |
+
|
814 |
+
}
|
815 |
+
|
816 |
+
}
|
817 |
+
|
818 |
public function isPublished()
|
819 |
{
|
820 |
if ($this->getStatusId() == 5) {
|
app/code/community/StrakerTranslations/EasyTranslationPlatform/Model/Job/Cms/Block.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/Resource/Cms/Block/Attributes.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/Cms/Block.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: WlliamZhao
|