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_XmlConnect_Block_Adminhtml_Mobile_Edit_Tab_Flurryanalytics
35: extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36: implements Mage_Adminhtml_Block_Widget_Tab_Interface
37: {
38: protected $_pages;
39:
40: 41: 42: 43:
44: public function __construct()
45: {
46: parent::__construct();
47: $this->setShowGlobalIcon(true);
48: }
49:
50: 51: 52: 53: 54: 55:
56: protected function _prepareForm()
57: {
58: $form = new Varien_Data_Form();
59:
60: $this->setForm($form);
61:
62: $data = Mage::helper('xmlconnect')->getApplication()->getFormData();
63: $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
64:
65: $fieldset = $form->addFieldset('flurryAnalytics', array('legend' => $this->__('Flurry Analytics')));
66:
67: if (isset($data['conf[native][merchantFlurryTracking][isActive]'])) {
68: $isActiveValue = $data['conf[native][merchantFlurryTracking][isActive]'];
69: } else {
70: $isActiveValue = '0';
71: }
72:
73: $enabled = $fieldset->addField('conf/native/merchantFlurryTracking/isActive', 'select', array(
74: 'label' => $this->__('Enable Flurry Analytics'),
75: 'name' => 'conf[native][merchantFlurryTracking][isActive]',
76: 'values' => $yesNoValues,
77: 'note' => $this->__('Enable Flurry Analytics for the merchant.'),
78: 'value' => $isActiveValue
79: ));
80:
81: $flurryAnalyticsUrl = $this->escapeHtml(
82: Mage::getStoreConfig('xmlconnect/flurry_analytics/statistics_url')
83: );
84:
85: $fieldset->addField('flurry_analytics_link', 'link', array(
86: 'title' => $this->__('Flurry Analytics Site'),
87: 'label' => $this->__('Flurry Analytics Site'),
88: 'value' => $flurryAnalyticsUrl,
89: 'href' => $flurryAnalyticsUrl,
90: 'target' => '__blank',
91: 'note' => $this->__('You can watch statistics here.'),
92: ));
93:
94: if (isset($data['conf[native][merchantFlurryTracking][accountId]'])) {
95: $accountIdValue = $data['conf[native][merchantFlurryTracking][accountId]'];
96: } else {
97: $accountIdValue = '';
98: }
99:
100: $flurryApiCode = $fieldset->addField('conf/native/merchantFlurryTracking/accountId', 'text', array(
101: 'label' => $this->__('Flurry API Code'),
102: 'name' => 'conf[native][merchantFlurryTracking][accountId]',
103: 'enabled' => true,
104: 'required' => true,
105: 'value' => $accountIdValue
106: ));
107:
108:
109: $this->setChild('form_after', $this->getLayout()
110: ->createBlock('adminhtml/widget_form_element_dependence')
111: ->addFieldMap($flurryApiCode->getHtmlId(), $flurryApiCode->getName())
112: ->addFieldMap($enabled->getHtmlId(), $enabled->getName())
113: ->addFieldDependence(
114: $flurryApiCode->getName(),
115: $enabled->getName(),
116: 1
117: ));
118: return parent::_prepareForm();
119: }
120:
121: 122: 123: 124: 125:
126: public function getTabLabel()
127: {
128: return $this->__('Analytics');
129: }
130:
131: 132: 133: 134: 135:
136: public function getTabTitle()
137: {
138: return $this->__('Flurry Analytics');
139: }
140:
141: 142: 143: 144: 145:
146: public function canShowTab()
147: {
148: return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication()
149: && Mage::helper('xmlconnect')->getDeviceType() == Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE;
150: }
151:
152: 153: 154: 155: 156:
157: public function isHidden()
158: {
159: return false;
160: }
161: }
162: