function addAction() { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); //print_r($data);exit(); $db = new Keeping_Model_DbTable_DbOutmoney(); try { if ($this->getRequest()->getPost("btn_save")) { $db = $db->insertWithdrawKeeping($data); Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', self::REDIRECT_URL_ADD); } if ($this->getRequest()->getPost("btn_save_close")) { //print_r($data);exit(); $db = $db->insertWithdrawKeeping($data); Application_Form_FrmMessage::message('ការបញ្ចូលជោគជ័យ'); Application_Form_FrmMessage::redirector(self::REDIRECT_URL_EXIT); } } catch (Exception $e) { $this->view->msg = 'ការបញ្ចូលមិនជោគជ័យ'; } } $pructis = new Keeping_Form_FrmOutMoney(); $frm = $pructis->dokMoney(); Application_Model_Decorator::removeAllDecorator($frm); $this->view->frm = $frm; }
public function indexAction() { // action body $this->_helper->layout()->disableLayout(); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($data["lange"] == 2) { $dbs = new Application_Model_DbTable_DbSiteLanguages(); $ids = 2; $lang = $dbs->getbyid($ids); $session_lang = new Zend_Session_Namespace('lang'); $session_lang->unlock(); $session_lang->lang_id = $lang['id']; $session_lang->lang = $lang['language']; } if ($data["lange"] == 1) { $dbs = new Application_Model_DbTable_DbSiteLanguages(); $ids = 1; $lang = $dbs->getbyid($ids); $session_lang = new Zend_Session_Namespace('lang'); $session_lang->unlock(); $session_lang->lang_id = $lang['id']; $session_lang->lang = $lang['language']; } $db_user = new Application_Model_DbTable_DbUsers(); $login = $data['login']; $password = $data['password']; if ($db_user->checkUsr($login)) { if ($db_user->userAuthenticate($login, $password)) { $user_id = $db_user->getUserID($login); $user_info = $db_user->getUserInfo($user_id); if ($user_info['user_type'] == 1) { $session_user = new Zend_Session_Namespace('auth'); $session_user->unlock(); $session_user->user_id = $user_id; $session_user->fullname = $user_info['name']; $session_user->user_name = $user_info['user_name']; $session_user->level = $user_info['user_type']; $session_user->email = $user_info['email']; Application_Form_FrmMessage::redirector('/index/pos'); } else { $session_user = new Zend_Session_Namespace('auth'); $session_user->unlock(); $session_user->user_id = $user_id; $session_user->fullname = $user_info['name']; $session_user->user_name = $user_info['user_name']; $session_user->level = $user_info['user_type']; $session_user->email = $user_info['email']; Application_Form_FrmMessage::redirector('/index/home'); } } elseif (!$db_user->checkStatusBy($login)) { $this->view->msg = ' Login Fall Comfirm ! '; } else { $this->view->msg = ' User Name or Password Incorect ! '; } } else { $this->view->msg = ' Login not Success ! '; } } }
public function editUserTypeAction() { $user_type_id = $this->getRequest()->getParam('id'); if (!$user_type_id) { $user_type_id = 0; } $form = new RsvAcl_Form_FrmUserType(); $db = new RsvAcl_Model_DbTable_DbUserType(); $rs = $db->getUserTypeInfo('SELECT * FROM rsv_acl_user_type where user_type_id=' . $user_type_id); Application_Model_Decorator::setForm($form, $rs); $this->view->form = $form; $this->view->user_id = $user_type_id; $tr = Application_Form_FrmLanguages::getCurrentlanguage(); if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if ($rs[0]['user_type'] == $post['user_type']) { Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); $db->updateUserType($post, $rs[0]['user_type_id']); Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index'); } else { if (!$db->isUserTypeExist($post['user_type'])) { $db->updateUserType($post, $rs[0]['user_type_id']); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index'); } else { Application_Form_FrmMessage::message('User had existed already'); } } } }
public function editAclAction() { $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 rsv_acl_acl where acl_id=' . $acl_id); Application_Model_Decorator::setForm($form, $rs); $this->view->form = $form; $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']); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/acl/index'); } else { if (!$db->isActionExist($post['action'])) { $db->updateAcl($post, $rs[0]['acl_id']); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED')); Application_Form_FrmMessage::redirector('/rsvAcl/acl/index'); } else { Application_Form_FrmMessage::message('Action had existed already'); } } } }
public function indexAction() { Application_Form_FrmMessage::redirector('/rsvAcl/user-type/index'); }
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 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 editUserAccessAction() { $id = $this->getRequest()->getParam('id'); if (!$id) { $id = 0; } $session = new Zend_Session_Namespace('auth'); $session->user_type_id = $id; $session->lock(); $form = new RsvAcl_Form_FrmUserAccess(); //echo "it works"; exit; $db = new RsvAcl_Model_DbTable_DbUserAccess(); $sql = "select user_type_id, user_type from rms_acl_user_type where user_type_id=" . $id; $rs = $db->getUserAccessInfo($sql); //print_r($rs); exit; //Sophen add here //to assign project list in view $db_acl = new Application_Model_DbTable_DbGlobal(); $sqlNotParentId = "SELECT user_type_id FROM `rms_acl_user_type` WHERE `parent_id` =" . $id; $notParentId = $db_acl->getGlobalDb($sqlNotParentId); $usernotparentid = $notParentId[0]['user_type_id']; //print $usernotparentid; exit; if ($id == 1) { $sql_acl = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access from rms_acl_acl as acl"; } if (!$usernotparentid) { $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.user_type_id)\n\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id; } else { $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id; } //print $sql_acl; exit; $acl_name = $db_acl->getGlobalDb($sql_acl); //print_r($acl_name); exit; if ($acl_name != '') { $form->setAcl($acl_name); } Application_Model_Decorator::setForm($form, $rs); $this->view->form = $form; $rows = array(); for ($i = 1; $i <= $form->getPlus(); $i++) { $rows[] = array($i, $form->getElement('acl_id_' . $i)->getLabel(), $form->getElement('acl_id_' . $i)); } $list = new Application_Form_Frmlist(); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $columns = array($tr->translate('URL'), $tr->translate('STATUS')); $this->view->form_layout = $list->getCheckList('radio', $columns, $rows); $this->view->id = $id; if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); //if($rs[0]['']==$post['username']){ $db_user = new RsvAcl_Model_DbTable_DbUserType(); print_r($post); exit; //print $rs[0]['user_type_id']; exit; $db_user->updateUserTypeAccess($post['user_type'], $rs[0]['user_type_id']); $db->assignAcl($post, $rs[0]['user_type_id'], $form->getPlus()); //write log file $userLog = new Application_Model_Log(); $userLog->writeUserLog($id); //End write log file //Application_Form_FrmMessage::message('One row affected!'); Application_Form_FrmMessage::redirector('/rmsAcl/user-access/index'); /*}else{ if(!$db->isUserExist($post['username'])){ $db->updateUser($post,$rs[0]['user_id']); //write log file //$userLog= new RsvLogging_Model_RsvLogging(); //$userLog->writeUserLog($user_id); //End write log file Application_Form_FrmMessage::message('One row affected!'); Application_Form_FrmMessage::redirector('/rmsAcl/user/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'); } }
public function insertUserAccess($arr, $id) { if (empty($arr["user_access"])) { Application_Form_FrmMessage::message("Please Select Type of Module & Controller "); Application_Form_FrmMessage::redirector("/userWu/user-access/edit/id/" . $id); exit; //break; } else { // $data=array( // "user_type_id" => $id, // "acl_id" => $arr["acl_ids"], // "status" => 1, // ); // $this->_name = "rsv_acl_user_access"; // $this->insert($data); $data = array(); } $data['user_type_id'] = $id; $data['acl_id'] = $arr['user_access']; $data['status'] = '1'; return $this->insert($data); //echo $id;exit(); }