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: class Mage_Adminhtml_Block_System_Design_Edit_Tab_General extends Mage_Adminhtml_Block_Widget_Form
27: {
28:
29: protected function _prepareForm()
30: {
31: $form = new Varien_Data_Form();
32:
33: $fieldset = $form->addFieldset('general', array('legend'=>Mage::helper('core')->__('General Settings')));
34:
35: if (!Mage::app()->isSingleStoreMode()) {
36: $field = $fieldset->addField('store_id', 'select', array(
37: 'label' => Mage::helper('core')->__('Store'),
38: 'title' => Mage::helper('core')->__('Store'),
39: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
40: 'name' => 'store_id',
41: 'required' => true,
42: ));
43: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
44: $field->setRenderer($renderer);
45: } else {
46: $fieldset->addField('store_id', 'hidden', array(
47: 'name' => 'store_id',
48: 'value' => Mage::app()->getStore(true)->getId(),
49: ));
50: }
51:
52: $fieldset->addField('design', 'select', array(
53: 'label' => Mage::helper('core')->__('Custom Design'),
54: 'title' => Mage::helper('core')->__('Custom Design'),
55: 'values' => Mage::getSingleton('core/design_source_design')->getAllOptions(),
56: 'name' => 'design',
57: 'required' => true,
58: ));
59:
60: $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
61: $fieldset->addField('date_from', 'date', array(
62: 'label' => Mage::helper('core')->__('Date From'),
63: 'title' => Mage::helper('core')->__('Date From'),
64: 'name' => 'date_from',
65: 'image' => $this->getSkinUrl('images/grid-cal.gif'),
66: 'format' => $dateFormatIso,
67:
68: ));
69: $fieldset->addField('date_to', 'date', array(
70: 'label' => Mage::helper('core')->__('Date To'),
71: 'title' => Mage::helper('core')->__('Date To'),
72: 'name' => 'date_to',
73: 'image' => $this->getSkinUrl('images/grid-cal.gif'),
74: 'format' => $dateFormatIso,
75:
76: ));
77:
78: $formData = Mage::getSingleton('adminhtml/session')->getDesignData(true);
79: if (!$formData){
80: $formData = Mage::registry('design')->getData();
81: } else {
82: $formData = $formData['design'];
83: }
84:
85: $form->addValues($formData);
86: $form->setFieldNameSuffix('design');
87: $this->setForm($form);
88: }
89:
90: }
91: