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_Design_Accordion_Images
35: extends Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
36: {
37: 38: 39: 40: 41:
42: public function getTitle()
43: {
44: return $this->__('Images');
45: }
46:
47: 48: 49: 50: 51:
52: public function getIsOpen()
53: {
54: return true;
55: }
56:
57: 58: 59: 60: 61: 62:
63: protected function _prepareForm()
64: {
65: $form = new Varien_Data_Form();
66:
67: $fieldset = $form->addFieldset('field_logo', array());
68: $this->_addElementTypes($fieldset);
69: $this->addImage($fieldset,
70: 'conf[native][navigationBar][icon]',
71: $this->__('Logo in Header'),
72: $this->__('Recommended size 35px x 35px.'),
73: $this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'),
74: true
75: );
76:
77: $deviceType = Mage::helper('xmlconnect')->getDeviceType();
78: switch ($deviceType) {
79: case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
80: $this->addImage($fieldset,
81: 'conf[native][body][bannerImage]',
82: $this->__('Banner on Home Screen'),
83: $this->__('Recommended size 320px x 230px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
84: $this->_getDesignPreviewImageUrl('conf/native/body/bannerImage'),
85: true
86: );
87: $this->addImage($fieldset,
88: 'conf[native][body][backgroundImage]',
89: $this->__('App Background'),
90: $this->__('Recommended size 320px x 367px. Note: Image size affects the performance of your app. Keep your image size below 75 KB for optimal performance.'),
91: $this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'),
92: true
93: );
94: break;
95: case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
96: $this->addImage($fieldset,
97: 'conf[native][body][bannerIpadLandscapeImage]',
98: $this->__('Banner on Home Screen <br />(landscape mode)'),
99: $this->__('Recommended size 1024px x 344px. Note: Image size affects the performance of your app.'),
100: $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadLandscapeImage'),
101: true
102: );
103: $this->addImage($fieldset,
104: 'conf[native][body][bannerIpadImage]',
105: $this->__('Banner on Home Screen <br />(portrait mode)'),
106: $this->__('Recommended size 768px x 294px. Note: Image size affects the performance of your app.'),
107: $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadImage'),
108: true
109: );
110: $this->addImage($fieldset,
111: 'conf[native][body][backgroundIpadLandscapeImage]',
112: $this->__('App Background <br />(landscape mode)'),
113: $this->__('Recommended size 1024px x 704px. Note: Image size affects the performance of your app.'),
114: $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadLandscapeImage'),
115: true
116: );
117: $this->addImage($fieldset,
118: 'conf[native][body][backgroundIpadPortraitImage]',
119: $this->__('App Background <br />(portrait mode)'),
120: $this->__('Recommended size 768px x 960px. Note: Image size affects the performance of your app.'),
121: $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'),
122: true
123: );
124: break;
125: case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
126: $this->addImage($fieldset,
127: 'conf[native][body][bannerAndroidImage]',
128: $this->__('Banner on Home Screen'),
129: $this->__('Recommended size 320px x 258px. Note: Image size affects the performance of your app. Keep your image size below 50 KB for optimal performance.'),
130: $this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'),
131: true
132: );
133: break;
134: default:
135: Mage::throwException(
136: $this->__('Device doesn\'t recognized: "%s". Unable to load a helper.', $deviceType)
137: );
138: break;
139: }
140:
141: $form->setValues(Mage::helper('xmlconnect')->getApplication()->getFormData());
142: $this->setForm($form);
143: return parent::_prepareForm();
144: }
145:
146: 147: 148: 149: 150: 151:
152: protected function _getDesignPreviewImageUrl($name)
153: {
154: $name = Mage::helper('xmlconnect/image')->getInterfaceImagesPaths($name);
155: return Mage::helper('xmlconnect/image')->getDefaultDesignUrl($name);
156: }
157: }
158: