Пример #1
0
 public static function log($message, $origin, $destination = '')
 {
     $log_mapper = new Application_Model_LogMapper();
     $log = new Application_Model_Log();
     $log->setOrigin($origin)->setDestination($destination)->setMessage(serialize($message))->setTstamp(date('Y-m-d H:i:s'));
     $log_mapper->save($log);
 }
Пример #2
0
 public function fetchAll()
 {
     $resultSet = $this->getDbTable()->fetchAll();
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Application_Model_Log();
         $entry->setId($row->id)->setOrigin($row->origin)->setDestination($row->destination)->setTstamp($row->tstamp)->setMessage($row->message);
         $entries[] = $entry;
     }
     return $entries;
 }
Пример #3
0
 public function init()
 {
     $this->setName('frmDbConfig');
     $model = new Application_Model_Log();
     $configArray = $model->getLogs();
     $this->addElement('select', 'configId', array('label' => 'Config File Id:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Select Config Id')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $configArray));
     $this->addElement('text', 'dbServerName', array('label' => 'Database Server Name :', 'autocomplete' => "off", 'required' => true, 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter database server name'))))));
     // Add an first name element
     $this->addElement('text', 'dbServerPort', array('label' => 'Database Server Port:', 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter databse server port')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'dbName', array('label' => 'Database Name:', 'class' => 'text-input medium-input', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter databse name name')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'dbUser', array('label' => 'Database User:'******'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter database user')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'dbPassword', array('label' => 'Database password:'******'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter databse password')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('select', 'dbTransType', array('label' => 'Databse Transection Type:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('0' => "select", '1' => "Insert", '2' => "Update", '3' => "Delete"), 'value' => "select"));
     $this->addElement('select', 'status', array('label' => 'Status:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'MultiOptions' => array('0' => "Inactive", '1' => "Active")));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
Пример #4
0
 public function init()
 {
     $this->setName('frmConfiguration');
     $model = new Application_Model_Log();
     $arrlogs1 = array(0 => 'Select Parent Config id');
     $arrLogs = $model->getLogs();
     $result = array_merge($arrlogs1, $arrLogs);
     $this->addElement('select', 'parentConfigId', array('label' => 'Parent Config Id:', 'id' => 'parentConfigId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user group.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $result));
     $this->addElement('text', 'configName', array('label' => 'Config Name:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Configuration Name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'configDesc', array('rowss' => '10', 'label' => 'Config Desc:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please Enter Config Description.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param1', array('label' => 'Param1:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param2', array('label' => 'Param2:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param3', array('label' => 'Param3:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param4', array('label' => 'Param4:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'param5', array('label' => 'Param5:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
Пример #5
0
 public function deleteLogAction()
 {
     $id = $this->_getParam('id');
     $usersNs = new Zend_Session_Namespace("members");
     $this->view->config_id = $id;
     $model1 = new Application_Model_Log();
     $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'));
     }
     if ($model->delete("config_id={$id}")) {
         $this->_flashMessenger->addMessage(array('success' => 'Data Deleted succesfully'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log/'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to Delete the data '));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/log'));
     }
 }
Пример #6
0
 public function editAction()
 {
     $acl_id = $this->getRequest()->getParam('id');
     if (!$acl_id) {
         $acl_id = 0;
     }
     $form = new RsvAcl_Form_FrmAcl();
     $db = new RsvAcl_Model_DbTable_DbAcl();
     $rs = $db->getUserInfo('SELECT * FROM rms_acl_acl where acl_id=' . $acl_id);
     $this->view->acl_data = $rs[0];
     $this->view->acl_id = $acl_id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($rs[0]['action'] == $post['action']) {
             $db->updateAcl($post, $rs[0]['acl_id']);
             //write log file
             $userLog = new Application_Model_Log();
             $userLog->writeUserLog($acl_id);
             //End write log file
             //Application_Form_FrmMessage::message('One row affected!');
             Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
         } else {
             if (!$db->isActionExist($post['action'])) {
                 $db->updateAcl($post, $rs[0]['acl_id']);
                 //write log file
                 $userLog = new Application_Model_Log();
                 $userLog->writeUserLog($acl_id);
                 //End write log file
                 //Application_Form_FrmMessage::message('One row affected!');
                 Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
             } else {
                 Application_Form_FrmMessage::message('Action had existed already');
             }
         }
     }
 }
Пример #7
0
 public function editUserTypeAction()
 {
     if ($this->getRequest()->getParam('id')) {
         $db = new RsvAcl_Model_DbTable_DbUserType();
         $user_type_id = $this->getRequest()->getParam('id');
         $rs = $db->getUserType($user_type_id);
         $this->view->usertype = $rs;
         $db1 = new Application_Model_DbTable_DbGlobal();
         $allusertype = $db1->getGlobalDb('SELECT user_type_id,user_type FROM rsv_acl_user_type WHERE status=1 AND user_type_id <> ' . $user_type_id);
         $options = array('' => 'Please select');
         foreach ($allusertype as $read) {
             $options[$read['user_type_id']] = $read['user_type'];
         }
         $this->view->usertype_list = $options;
     } else {
         Application_Form_FrmMessage::message('User type had not existed');
     }
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //print_r($rs); exit;
         if ($rs['user_type'] == $post['user_type']) {
             $db->updateUserType($post, $rs['user_type_id']);
             //write log file
             $userLog = new Application_Model_Log();
             $userLog->writeUserLog($user_type_id);
             //End write log file
             //Application_Form_FrmMessage::message('One row affected!');
             Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index');
         } else {
             if (!$db->isUserTypeExist($post['user_type'])) {
                 $db->updateUserType($post, $rs['user_type_id']);
                 //write log file
                 $userLog = new Application_Model_Log();
                 $userLog->writeUserLog($user_type_id);
                 //End write log file
                 //Application_Form_FrmMessage::message('One row affected!');
                 Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index');
             } else {
                 Application_Form_FrmMessage::message('User had existed already');
             }
         }
     }
 }
Пример #8
0
 public function updateStatusAction()
 {
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $db = new RsvAcl_Model_DbTable_DbUserAccess();
         $user_type_id = $post['user_type_id'];
         $acl_id = $post['acl_id'];
         $status = $post['status'];
         $data = array('acl_id' => $acl_id, 'user_type_id' => $user_type_id);
         if ($status === "yes") {
             $where = "user_type_id='" . $user_type_id . "' AND acl_id='" . $acl_id . "'";
             $db->delete($where);
             echo "no";
         } elseif ($status === "no") {
             $db->insert($data);
             echo "yes";
         }
         //write log file
         $userLog = new Application_Model_Log();
         $userLog->writeUserLog($acl_id);
     }
     exit;
 }
Пример #9
0
 public function changePasswordAction()
 {
     $session_user = new Zend_Session_Namespace('auth');
     if ($session_user->user_id == $this->getRequest()->getParam('id') or $session_user->level == 1) {
         $form = new RsvAcl_Form_FrmChgpwd();
         //echo $form->getElement('current_password'); exit;
         $this->view->form = $form;
         //echo "Work"; exit;
         if ($this->getRequest()->isPost()) {
             $db = new RsvAcl_Model_DbTable_DbUser();
             $user_id = $this->getRequest()->getParam('id');
             if (!$user_id) {
                 $user_id = 0;
             }
             $current_password = $this->getRequest()->getParam('current_password');
             $password = $this->getRequest()->getParam('password');
             if ($db->isValidCurrentPassword($user_id, $current_password)) {
                 $db->changePassword($user_id, md5($password));
                 //write log file
                 $userLog = new Application_Model_Log();
                 $userLog->writeUserLog($user_id);
                 //End write log file
                 Application_Form_FrmMessage::message('Password has been changed');
                 Application_Form_FrmMessage::redirector('/rsvAcl/user/view-user/id/' . $user_id);
             } else {
                 Application_Form_FrmMessage::message('Invalid current password');
             }
         }
     } else {
         Application_Form_FrmMessage::message('Access Denied!');
         Application_Form_FrmMessage::redirector('/rsvAcl');
     }
 }
 public function configInfoAction()
 {
     $this->view->layout()->disableLayout();
     $configId = $this->_getParam("config_id");
     $model = new Application_Model_Log();
     $config = $model->find($configId);
     if (false === $config) {
         exit("Records not found for config id : {$configId}!");
     }
     $this->view->config = $config;
 }
Пример #11
0
 public function getLogs()
 {
     $obj = new Application_Model_Log();
     $entries = $obj->fetchAll();
     $arrLogs = array();
     foreach ($entries as $entry) {
         $arrlogs[$entry->getConfigId()] = ucfirst($entry->getConfigName());
     }
     return $arrlogs;
 }