Example #1
0
 public function init()
 {
     $this->setName('frmMessage');
     $model = new Security_Model_SysMessage();
     $arrCategories = $model->getCategoryArray();
     $this->addElement('select', 'categoryId', array('label' => 'Category Id:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Category.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrCategories));
     $arrSevirities = $model->getSeverityArray();
     $this->addElement('select', 'severityId', array('label' => 'Severity Id:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Severity.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrSevirities));
     $arrTypes = $model->getTypeArray();
     $this->addElement('select', 'typeId', array('label' => 'Type Id:', '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", '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", '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, 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
 public function deleteMessageAction()
 {
     $id = $this->_getParam('id');
     $guid = $this->_getParam('guid');
     $model1 = new Security_Model_SysMessage();
     $model = $model1->fetchRow("message_id='{$id}' and row_guid='{$guid}'");
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-message/messages'));
     }
     if ($model->delete("message_id={$id}")) {
         $this->_flashMessenger->addMessage(array('success' => 'Data Deleted succesfully'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-message/messages'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to Delete the data '));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/sys-message/messages'));
     }
 }
Example #3
0
 private function setModel($row)
 {
     $model = new Security_Model_SysMessage();
     $model->setMessageId($row->message_id)->setCategoryId($row->category_id)->setSeverityId($row->severity_id)->setTypeId($row->type_id)->setUserMessage($row->user_message)->setSysMessage($row->sys_message)->setRowGuid($row->row_guid)->setCreatedBy($row->created_by)->setUpdatedBy($row->updated_by)->setRowVersion($row->row_version)->setRowMaxId($row->row_max_id);
     return $model;
 }