Exemple #1
0
 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 deleteMessageCategoryAction()
 {
     $id = $this->_getParam('id');
     $usersNs = new Zend_Session_Namespace("members");
     $this->view->config_id = $id;
     $model1 = new Application_Model_MessageCategory();
     $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-category'));
     }
     if ($model->delete("message_category_id={$id}")) {
         $this->_flashMessenger->addMessage(array('success' => 'Data Deleted succesfully'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/message-category'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to Delete the data '));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/message-category'));
     }
 }
 public function getMessageCategories()
 {
     $obj = new Application_Model_MessageCategory();
     $entries = $obj->fetchAll();
     $arrMessageCategory = array();
     foreach ($entries as $entry) {
         $arrMessageCategory[$entry->getMessageCategoryId()] = $entry->getMessageCategoryName();
     }
     return $arrMessageCategory;
 }