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_General
35: extends Mage_Adminhtml_Block_Widget_Form
36: implements Mage_Adminhtml_Block_Widget_Tab_Interface
37: {
38: 39: 40: 41: 42: 43:
44: protected function _prepareForm()
45: {
46: $model = Mage::helper('xmlconnect')->getApplication();
47:
48: $form = new Varien_Data_Form();
49: $form->setHtmlIdPrefix('app_');
50: $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('App Information')));
51:
52: if ($model->getId()) {
53: $fieldset->addField('application_id', 'hidden', array(
54: 'name' => 'application_id',
55: 'value' => $model->getId()
56: ));
57: }
58:
59: $fieldset->addField('name', 'text', array(
60: 'name' => 'name',
61: 'label' => $this->__('App Name'),
62: 'title' => $this->__('App Name'),
63: 'maxlength' => '250',
64: 'value' => $model->getName(),
65: 'required' => true,
66: ));
67:
68: if ($model->getId()) {
69: $fieldset->addField('code', 'label', array(
70: 'label' => $this->__('App Code'),
71: 'title' => $this->__('App Code'),
72: 'value' => $model->getCode(),
73: ));
74: }
75:
76: 77: 78:
79: if (!Mage::app()->isSingleStoreMode()) {
80: $storeElement = $fieldset->addField('store_id', 'select', array(
81: 'name' => 'store_id',
82: 'label' => $this->__('Store View'),
83: 'title' => $this->__('Store View'),
84: 'required' => true,
85: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false),
86: ));
87: } else {
88: $storeElement = $fieldset->addField('store_id', 'hidden', array(
89: 'name' => 'store_id',
90: 'value' => Mage::app()->getStore(true)->getId()
91: ));
92: $model->setStoreId(Mage::app()->getStore(true)->getId());
93: }
94:
95: if ($model->getId()) {
96: $storeElement->setValue($model->getStoreId());
97: $storeElement->setDisabled(true);
98: } else if ($model->getStoreId()) {
99: $storeElement->setValue($model->getStoreId());
100: }
101:
102: $fieldset->addField('showdev', 'select', array(
103: 'name' => 'showdev',
104: 'label' => $this->__('Device Type'),
105: 'title' => $this->__('Device Type'),
106: 'values' => array($model->getType() => $model->getDevtype()),
107: 'disabled' => true,
108: ));
109:
110: $fieldset->addField('devtype', 'hidden', array(
111: 'name' => 'devtype',
112: 'value' => $model->getType(),
113: ));
114:
115: $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
116:
117: $fieldset->addField('browsing_mode', 'select', array(
118: 'label' => $this->__('Catalog Only App?'),
119: 'name' => 'browsing_mode',
120: 'note' => $this->__('A Catalog Only App will not support functions such as add to cart, add to wishlist, or login.'),
121: 'value' => $model->getBrowsingMode(),
122: 'values' => $yesNoValues
123: ));
124:
125: $this->setForm($form);
126: return parent::_prepareForm();
127: }
128:
129: 130: 131: 132: 133:
134: public function getTabLabel()
135: {
136: return $this->__('General');
137: }
138:
139: 140: 141: 142: 143:
144: public function getTabTitle()
145: {
146: return $this->__('General');
147: }
148:
149: 150: 151: 152: 153:
154: public function canShowTab()
155: {
156: return (bool) !Mage::getSingleton('adminhtml/session')->getNewApplication();
157: }
158:
159: 160: 161: 162: 163:
164: public function isHidden()
165: {
166: return false;
167: }
168: }
169: