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:
35: class Mage_Adminhtml_Block_Sitemap_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37:
38: 39: 40:
41: public function __construct()
42: {
43: parent::__construct();
44: $this->setId('sitemap_form');
45: $this->setTitle(Mage::helper('adminhtml')->__('Sitemap Information'));
46: }
47:
48:
49: protected function _prepareForm()
50: {
51: $model = Mage::registry('sitemap_sitemap');
52:
53: $form = new Varien_Data_Form(array(
54: 'id' => 'edit_form',
55: 'action' => $this->getData('action'),
56: 'method' => 'post'
57: ));
58:
59: $fieldset = $form->addFieldset('add_sitemap_form', array('legend' => Mage::helper('sitemap')->__('Sitemap')));
60:
61: if ($model->getId()) {
62: $fieldset->addField('sitemap_id', 'hidden', array(
63: 'name' => 'sitemap_id',
64: ));
65: }
66:
67: $fieldset->addField('sitemap_filename', 'text', array(
68: 'label' => Mage::helper('sitemap')->__('Filename'),
69: 'name' => 'sitemap_filename',
70: 'required' => true,
71: 'note' => Mage::helper('adminhtml')->__('example: sitemap.xml'),
72: 'value' => $model->getSitemapFilename()
73: ));
74:
75: $fieldset->addField('sitemap_path', 'text', array(
76: 'label' => Mage::helper('sitemap')->__('Path'),
77: 'name' => 'sitemap_path',
78: 'required' => true,
79: 'note' => Mage::helper('adminhtml')->__('example: "sitemap/" or "/" for base path (path must be writeable)'),
80: 'value' => $model->getSitemapPath()
81: ));
82:
83: if (!Mage::app()->isSingleStoreMode()) {
84: $field = $fieldset->addField('store_id', 'select', array(
85: 'label' => Mage::helper('sitemap')->__('Store View'),
86: 'title' => Mage::helper('sitemap')->__('Store View'),
87: 'name' => 'store_id',
88: 'required' => true,
89: 'value' => $model->getStoreId(),
90: 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
91: ));
92: $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
93: $field->setRenderer($renderer);
94: }
95: else {
96: $fieldset->addField('store_id', 'hidden', array(
97: 'name' => 'store_id',
98: 'value' => Mage::app()->getStore(true)->getId()
99: ));
100: $model->setStoreId(Mage::app()->getStore(true)->getId());
101: }
102:
103: $fieldset->addField('generate', 'hidden', array(
104: 'name' => 'generate',
105: 'value' => ''
106: ));
107:
108: $form->setValues($model->getData());
109:
110: $form->setUseContainer(true);
111:
112: $this->setForm($form);
113:
114: return parent::_prepareForm();
115: }
116:
117: }
118: