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'); } } } }
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; }
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'); } } } }
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'); } }