|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* |
|
5
|
|
|
* |
|
6
|
|
|
* @category Mygento |
|
7
|
|
|
* @package Mygento_Geoip |
|
8
|
|
|
* @copyright 2014 NKS LLC. (https://www.mygento.ru) |
|
9
|
|
|
*/ |
|
10
|
|
|
class Mygento_Geoip_Block_System_Config_Synchronize extends Mage_Adminhtml_Block_System_Config_Form_Field |
|
11
|
|
|
{ |
|
12
|
|
|
|
|
13
|
|
|
protected function _construct() |
|
14
|
|
|
{ |
|
15
|
|
|
parent::_construct(); |
|
16
|
|
|
$this->setTemplate('mygento/geoip/system/config/synchronize.phtml'); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function render(Varien_Data_Form_Element_Abstract $element) |
|
20
|
|
|
{ |
|
21
|
|
|
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); |
|
22
|
|
|
return parent::render($element); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* |
|
27
|
|
|
* @param Varien_Data_Form_Element_Abstract $element |
|
28
|
|
|
* @return string |
|
29
|
|
|
* |
|
30
|
|
|
* @SuppressWarnings("unused") |
|
31
|
|
|
*/ |
|
32
|
|
|
|
|
33
|
|
|
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) |
|
34
|
|
|
{ |
|
35
|
|
|
return $this->_toHtml(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getAjaxSyncUrl() |
|
39
|
|
|
{ |
|
40
|
|
|
return Mage::getSingleton('adminhtml/url')->getUrl('geoip/adminhtml_geoip/synchronize'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getAjaxStatusUpdateUrl() |
|
44
|
|
|
{ |
|
45
|
|
|
return Mage::getSingleton('adminhtml/url')->getUrl('geoip/adminhtml_geoip/status'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getButtonHtml() |
|
49
|
|
|
{ |
|
50
|
|
|
/** @var $button Mage_Adminhtml_Block_Widget_Button */ |
|
51
|
|
|
$button = $this->getLayout()->createBlock('adminhtml/widget_button'); |
|
52
|
|
|
$button->setData(array( |
|
53
|
|
|
'id' => 'synchronize_button', |
|
54
|
|
|
'label' => $this->helper('adminhtml')->__('Synchronize'), |
|
55
|
|
|
'onclick' => 'javascript:synchronize(); return false;' |
|
56
|
|
|
)); |
|
57
|
|
|
|
|
58
|
|
|
return $button->toHtml(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getSyncStorageParams() |
|
62
|
|
|
{ |
|
63
|
|
|
$flag = Mage::getSingleton('core/file_storage')->getSyncFlag(); |
|
64
|
|
|
$flagData = $flag->getFlagData(); |
|
65
|
|
|
|
|
66
|
|
|
if ($flag->getState() == Mage_Core_Model_File_Storage_Flag::STATE_NOTIFIED && is_array($flagData) && isset($flagData['destination_storage_type']) && $flagData['destination_storage_type'] != '' && isset($flagData['destination_connection_name']) |
|
67
|
|
|
) { |
|
68
|
|
|
$storageType = $flagData['destination_storage_type']; |
|
69
|
|
|
$connectionName = $flagData['destination_connection_name']; |
|
70
|
|
|
} else { |
|
71
|
|
|
$storageType = Mage_Core_Model_File_Storage::STORAGE_MEDIA_FILE_SYSTEM; |
|
72
|
|
|
$connectionName = ''; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
return array( |
|
76
|
|
|
'storage_type' => $storageType, |
|
77
|
|
|
'connection_name' => $connectionName |
|
78
|
|
|
); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|