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');
             }
         }
     }
 }
예제 #3
0
 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 editUserAction()
 {
     $user_id = $this->getRequest()->getParam('id');
     if (!$user_id) {
         $user_id = 0;
     }
     $form = new RsvAcl_Form_FrmUser();
     $db = new RsvAcl_Model_DbTable_DbUser();
     $rs = $db->getUserInfo('SELECT * FROM rsv_acl_user where user_id=' . $user_id);
     Application_Model_Decorator::setForm($form, $rs);
     $this->view->form = $form;
     $this->view->user_id = $user_id;
     $rsloc = $db->getUserInfo('SELECT * FROM rsv_acl_ubranch where user_id=' . $user_id . " GROUP BY location_id ");
     $this->view->branchname = $rsloc;
     $items = new Application_Model_GlobalClass();
     $locationRows = $items->getLocationAssign();
     $this->view->locations = $locationRows;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $db->updateUser($post, $user_id);
         // 			$tr = Application_Form_FrmLanguages::getCurrentlanguage();
         // 			Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED'));
         // 			Application_Form_FrmMessage::redirector('/rsvAcl/user/index');
         $this->_redirect('/rsvAcl/user/index');
     }
     Application_Model_Decorator::removeAllDecorator($form);
 }
예제 #5
0
 public function editUserAction()
 {
     $user_id = $this->getRequest()->getParam('id');
     if (!$user_id) {
         $user_id = 0;
     }
     $form = new RsvAcl_Form_FrmUser();
     $db = new RsvAcl_Model_DbTable_DbUser();
     //$rs = $db->getUserInfo('SELECT * FROM rsv_acl_user where user_id='.$user_id);
     $rs = $db->getUserInfo('SELECT au.*, ui.name, ui.title, ui.cso_id FROM rsv_acl_user AS au, fi_users_info AS ui WHERE au.user_id=' . $user_id . ' AND ui.id=' . $user_id);
     Application_Model_Decorator::setForm($form, $rs);
     $this->view->form = $form;
     $this->view->user_id = $user_id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($rs[0]['username'] == $post['username']) {
             $db->updateUser($post, $rs[0]['user_id']);
             //write log file
             $userLog = new Application_Model_Log();
             $userLog->writeUserLog($user_id);
             //End write log file
             //Application_Form_FrmMessage::message('One row affected!');
             Application_Form_FrmMessage::redirector('/rsvAcl/user/index');
         } else {
             if (!$db->isUserExist($post['username'])) {
                 $db->updateUser($post, $rs[0]['user_id']);
                 //write log file
                 $userLog = new Application_Model_Log();
                 $userLog->writeUserLog($user_id);
                 //End write log file
                 //Application_Form_FrmMessage::message('One row affected!');
                 Application_Form_FrmMessage::redirector('/rsvAcl/user/index');
             } else {
                 Application_Form_FrmMessage::message('User had existed already');
             }
         }
     }
     Application_Model_Decorator::removeAllDecorator($form);
 }