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