public function viewUserTypeAction() { /* Initialize action controller here */ 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->rs = $rs; } }
public function editAction() { 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 rms_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/usertype/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/usertype/index'); } else { Application_Form_FrmMessage::message('User had existed already'); } } } }