protected function _prepareColumns() { $this->addColumn('id', array('header' => $this->__('ID'), 'width' => '100px', 'index' => 'id')); $this->addColumn('title', array('header' => $this->__('Name'), 'index' => 'title')); $this->addColumn('is_active', array('header' => $this->__('Status'), 'index' => 'is_active', 'type' => 'options', 'options' => AW_Helpdesk3_Model_Source_Status::toOptionHash(), 'width' => '100px')); $this->addColumn('types', array('header' => $this->__('Scope'), 'index' => 'types', 'type' => 'options', 'renderer' => 'aw_hdu3/adminhtml_rejecting_pattern_grid_renderer_types', 'filter_condition_callback' => array($this, '_filterTypes'), 'options' => AW_Helpdesk3_Model_Source_Gateway_Mail_RejectPattern::toOptionHash())); $this->addColumn('pattern', array('header' => $this->__('Pattern'), 'index' => 'pattern')); $this->addColumn('actions', array('header' => $this->__('Actions'), 'width' => '150px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => $this->__('Edit'), 'url' => array('base' => '*/*/edit'), 'field' => 'id'), array('caption' => $this->__('Delete'), 'url' => array('base' => '*/*/delete'), 'field' => 'id', 'confirm' => $this->__('Are you sure you want do this?'))), 'filter' => false, 'sortable' => false, 'is_system' => true)); return parent::_prepareColumns(); }
public function render(Varien_Object $row) { $row->setTypes(explode(',', $row->getTypes())); $out = ''; foreach (AW_Helpdesk3_Model_Source_Gateway_Mail_RejectPattern::toOptionArray() as $type) { if (in_array($type['value'], $row->getTypes())) { $out .= $type['label'] . '<br/>'; } } return $out; }
protected function _prepareForm() { $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post')); $form->setUseContainer(true); $this->setForm($form); $fieldset = $form->addFieldset('aw_hdu3_rejecting_pattern_form', array('legend' => $this->__('General Information'))); $fieldset->addField('title', 'text', array('name' => 'title', 'label' => $this->__('Title'), 'required' => true)); $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => $this->__('Status'), 'required' => true, 'values' => AW_Helpdesk3_Model_Source_Status::toOptionArray())); $fieldset->addField('types', 'multiselect', array('name' => 'types', 'label' => $this->__('Scope'), 'required' => true, 'values' => AW_Helpdesk3_Model_Source_Gateway_Mail_RejectPattern::toOptionArray())); $fieldset->addField('pattern', 'text', array('name' => 'pattern', 'label' => $this->__('Pattern'), 'required' => true)); $form->setValues(Mage::registry('current_pattern')->getData()); return parent::_prepareForm(); }