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_Themes extends Mage_Adminhtml_Block_Template
35: {
36: 37: 38:
39: public function __construct()
40: {
41: parent::__construct();
42:
43: $model = Mage::helper('xmlconnect')->getApplication();
44: $this->setTemplate('xmlconnect/form/element/themes.phtml');
45:
46: $data = $model->getFormData();
47: $this->setColorFieldset(array(
48: array('id' => 'field_colors', 'label' => $this->__('Colors'), 'fields' => array(
49: $this->_addColorBox(
50: 'conf[native][navigationBar][tintColor]',
51: $this->__('Header Background Color'),
52: $data
53: ),
54: $this->_addColorBox(
55: 'conf[native][body][primaryColor]',
56: $this->__('Primary Color'),
57: $data
58: ),
59: $this->_addColorBox(
60: 'conf[native][body][secondaryColor]',
61: $this->__('Secondary Color'),
62: $data
63: ),
64: $this->_addColorBox(
65: 'conf[native][categoryItem][backgroundColor]',
66: $this->__('Category Item Background Color'),
67: $data
68: ),
69: $this->_addColorBox(
70: 'conf[native][categoryItem][tintColor]',
71: $this->__('Category Button Color'),
72: $data
73: ),
74: )),
75: array('id' => 'field_fonts', 'label' => $this->__('Fonts'), 'fields' => array(
76: $this->_addColorBox(
77: 'conf[extra][fontColors][header]',
78: $this->__('Header Font Color'),
79: $data
80: ),
81: $this->_addColorBox(
82: 'conf[extra][fontColors][primary]',
83: $this->__('Primary Font Color'),
84: $data
85: ),
86: $this->_addColorBox(
87: 'conf[extra][fontColors][secondary]',
88: $this->__('Secondary Font Color'),
89: $data
90: ),
91: $this->_addColorBox(
92: 'conf[extra][fontColors][price]',
93: $this->__('Price Font Color'),
94: $data
95: ),
96: )),
97: array('id' => 'field_advanced', 'label' => $this->__('Advanced Settings'), 'fields' => array(
98: $this->_addColorBox(
99: 'conf[native][body][backgroundColor]',
100: $this->__('Background Color'),
101: $data
102: ),
103: $this->_addColorBox(
104: 'conf[native][body][scrollBackgroundColor]',
105: $this->__('Scroll Background Color'),
106: $data
107: ),
108: $this->_addColorBox(
109: 'conf[native][itemActions][relatedProductBackgroundColor]',
110: $this->__('Related Product Background Color'),
111: $data
112: ),
113: )),
114: ));
115: }
116:
117: 118: 119: 120: 121:
122: public function getAllThemes()
123: {
124: $result = array();
125:
126: foreach ($this->getThemes() as $theme) {
127: $result[$theme->getName()] = $theme->getFormData();
128: }
129: return $result;
130: }
131:
132: 133: 134: 135: 136: 137: 138: 139:
140: protected function _addColorBox($id, $label, $data)
141: {
142: return array(
143: 'id' => $id,
144: 'name' => $id,
145: 'label' => $label,
146: 'value' => isset($data[$id]) ? $data[$id] : ''
147: );
148: }
149:
150: 151: 152: 153: 154:
155: public function getDefaultThemeLoaded()
156: {
157: return Mage::helper('xmlconnect')->getApplication()->getDefaultThemeLoaded();
158: }
159:
160: 161: 162: 163: 164:
165: public function isNewApplication()
166: {
167: return Mage::helper('xmlconnect')->getApplication()->getId() ? false : true;
168: }
169:
170: 171: 172: 173: 174:
175: public function getSaveThemeActionUrl()
176: {
177: return $this->getUrl('*/*/saveTheme');
178: }
179:
180: 181: 182: 183: 184:
185: public function getDeleteThemeActionUrl()
186: {
187: return $this->getUrl('*/*/deleteTheme');
188: }
189:
190: 191: 192: 193: 194:
195: public function getResetThemeActionUrl()
196: {
197: return $this->getUrl('*/*/resetTheme');
198: }
199: }
200: