protected function _prepareForm() { $form = new Varien_Data_Form(); $fieldset = $form->addFieldset('general', array('legend' => $this->__('General information'))); $fieldset->addField('category_name', 'text', array('name' => 'category_name', 'label' => $this->__('Title'), 'class' => 'required-entry', 'required' => true)); if (Mage::app()->isSingleStoreMode()) { $fieldset->addField('category_store_ids', 'hidden', array('name' => 'category_store_ids[]', 'value' => Mage::app()->getStore()->getId())); } else { $fieldset->addField('category_store_ids', 'multiselect', array('name' => 'category_store_ids[]', 'label' => $this->__('Store View'), 'title' => $this->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))); } $fieldset->addField('category_url_key', 'text', array('name' => 'category_url_key', 'label' => $this->__('URL key'), 'note' => $this->__('Used to address the category from URL. If left empty, will be converted from category title during saving. URL key must be unique within selected store views.'))); $fieldset->addField('category_status', 'select', array('name' => 'category_status', 'label' => $this->__('Status'), 'values' => AW_Kbase_Model_Source_Status::toOptionArray())); $fieldset->addField('category_order', 'text', array('name' => 'category_order', 'label' => $this->__('Order'))); $data = Mage::registry('kbase_category'); if (!is_array($data)) { $data = array(); } if (isset($data['category_store_ids'])) { if (Mage::app()->isSingleStoreMode()) { if (is_array($data['category_store_ids'])) { $data['category_store_ids'] = isset($data['category_store_ids'][0]) ? $data['category_store_ids'][0] : ''; } } } $form->setValues($data); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareForm() { $form = new Varien_Data_Form(); $data = Mage::registry('kbase_article'); if (!is_array($data)) { $data = array(); } $fieldset = $form->addFieldset('general', array('legend' => $this->__('General information'), 'class' => 'fieldset-wide')); $fieldset->addField('article_date_created', 'hidden', array('name' => 'article_date_created')); $fieldset->addField('article_title', 'text', array('name' => 'article_title', 'label' => $this->__('Title'), 'required' => true)); if (AW_Kbase_Helper_Data::mageVersionIsAbove13()) { $config = Mage::getSingleton('cms/wysiwyg_config')->getConfig(); $config->setData(AW_Kbase_Helper_Data::recursiveReplace('/kbase_admin/', '/' . (string) Mage::app()->getConfig()->getNode('admin/routers/adminhtml/args/frontName') . '/', $config->getData())); } else { $config = false; } $fieldset->addField('article_text', 'editor', array('name' => 'article_text', 'label' => $this->__('Article'), 'style' => 'height:25em', 'required' => true, 'config' => $config)); $fieldset->addField('article_attachment', 'file', array('name' => 'article_attachment', 'label' => $this->__('Attachment'), 'class' => 'kbase')); $form->getElement('article_attachment')->setRenderer($this->getLayout()->createBlock('kbase/adminhtml_edit_uploader')); $fieldset->addField('article_tags', 'text', array('name' => 'article_tags', 'label' => $this->__('Tags'), 'note' => $this->__('Separate tags with commas'))); $fieldset->addField('article_url_key', 'text', array('name' => 'article_url_key', 'label' => $this->__('URL key'), 'note' => $this->__('URL key must be unique within store views'))); $fieldset->addField('article_status', 'select', array('name' => 'article_status', 'label' => $this->__('Status'), 'values' => AW_Kbase_Model_Source_Status::toOptionArray())); $fieldset->addField('article_author_id', 'select', array('name' => 'article_author_id', 'label' => $this->__('Author'), 'values' => AW_Kbase_Model_Source_User::toShortOptionArray())); $form->setValues($data); $this->setForm($form); return parent::_prepareForm(); }
protected function _prepareMassaction() { $this->setMassactionIdField('main_table.article_id'); $this->getMassactionBlock()->setFormFieldName('article_ids'); $this->getMassactionBlock()->addItem('delete', array('label' => $this->__('Delete'), 'url' => $this->getUrl('*/*/massDelete'), 'confirm' => $this->__('Are you sure?'))); $statuses = AW_Kbase_Model_Source_Status::toOptionArray(); array_unshift($statuses, array('label' => '', 'value' => '')); $this->getMassactionBlock()->addItem('status', array('label' => $this->__('Change status'), 'url' => $this->getUrl('*/*/massStatus', array('_current' => true)), 'additional' => array('visibility' => array('name' => 'status', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Status'), 'values' => $statuses)))); return $this; }