public function init() { $this->setName('frmMessage'); $model = new Application_Model_MessageCategory(); $arrCategories = $model->getMessageCategories(); $this->addElement('select', 'categoryId', array('label' => 'Category Id:', 'id' => 'categoryId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Category.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrCategories)); $model = new Application_Model_MessageSevirity(); $arrSevirities = $model->getMessageSevirities(); $this->addElement('select', 'severityId', array('label' => 'Severity Id:', 'id' => 'severityId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Severity.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrSevirities)); $model = new Application_Model_MessageType(); $arrTypes = $model->getMessageTypes(); $this->addElement('select', 'typeId', array('label' => 'Type Id:', 'id' => 'typeId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select type.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrTypes)); $this->addElement('text', 'userMessage', array('label' => 'User Message:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter user message')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'sysMessage', array('label' => 'System Message:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter System')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function deleteMessageSevirityAction() { $id = $this->_getParam('id'); $usersNs = new Zend_Session_Namespace("members"); $this->view->config_id = $id; $model1 = new Application_Model_MessageSevirity(); $model = $model1->find($id); if (false === $model) { $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/message-sevirity')); } if ($model->delete("message_sevirity_id={$id}")) { $this->_flashMessenger->addMessage(array('success' => 'Data Deleted succesfully')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/message-sevirity')); } else { $this->_flashMessenger->addMessage(array('error' => 'Failed to Delete the data ')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/message-sevirity')); } }
public function getMessageSevirities() { $obj = new Application_Model_MessageSevirity(); $entries = $obj->fetchAll(); $arrMessageSevirity = array(); foreach ($entries as $entry) { $arrMessageSevirity[$entry->getMessageSevirityId()] = $entry->getMessageSevirityName(); } return $arrMessageSevirity; }