1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
35: extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
36: {
37: 38: 39: 40: 41: 42:
43: protected function _getFrontendClass($element)
44: {
45: return parent::_getFrontendClass($element) . ' with-button '
46: . ($this->_isPaymentEnabled($element) ? ' enabled' : '');
47: }
48:
49: 50: 51: 52: 53: 54:
55: protected function _isPaymentEnabled($element)
56: {
57: $groupConfig = $this->getGroup($element)->asArray();
58: $activityPath = isset($groupConfig['activity_path']) ? $groupConfig['activity_path'] : '';
59:
60: if (empty($activityPath)) {
61: return false;
62: }
63:
64: $isPaymentEnabled = (string)Mage::getSingleton('adminhtml/config_data')->getConfigDataValue($activityPath);
65:
66: return (bool)$isPaymentEnabled;
67: }
68:
69: 70: 71: 72: 73: 74:
75: protected function ($element)
76: {
77: $html = '<div class="config-heading" ><div class="heading"><strong>' . $element->getLegend();
78:
79: $groupConfig = $this->getGroup($element)->asArray();
80: if (!empty($groupConfig['learn_more_link'])) {
81: $html .= '<a class="link-more" href="' . $groupConfig['learn_more_link'] . '" target="_blank">'
82: . $this->__('Learn More') . '</a>';
83: }
84: if (!empty($groupConfig['demo_link'])) {
85: $html .= '<a class="link-demo" href="' . $groupConfig['demo_link'] . '" target="_blank">'
86: . $this->__('View Demo') . '</a>';
87: }
88: $html .= '</strong>';
89:
90: if ($element->getComment()) {
91: $html .= '<span class="heading-intro">' . $element->getComment() . '</span>';
92: }
93: $html .= '</div>';
94:
95: $html .= '<div class="button-container"><button type="button"'
96: . ($this->_isPaymentEnabled($element) ? '' : ' disabled="disabled"') . ' class="button'
97: . (empty($groupConfig['paypal_ec_separate']) ? '' : ' paypal-ec-separate')
98: . ($this->_isPaymentEnabled($element) ? '' : ' disabled') . '" id="' . $element->getHtmlId()
99: . '-head" onclick="paypalToggleSolution.call(this, \'' . $element->getHtmlId() . '\', \''
100: . $this->getUrl('*/*/state') . '\'); return false;"><span class="state-closed">'
101: . $this->__('Configure') . '</span><span class="state-opened">'
102: . $this->__('Close') . '</span></button></div></div>';
103:
104: return $html;
105: }
106:
107: 108: 109: 110: 111: 112:
113: protected function ($element)
114: {
115: return '';
116: }
117:
118: 119: 120: 121: 122: 123:
124: protected function _getCollapseState($element)
125: {
126: return false;
127: }
128: }
129: