public function editbasicAction() { $do = 'editbasic'; $message = ''; if ($this->getRequest()->getParam('do')) { $do = $this->getRequest()->getParam('do'); } $id = $this->_getParam('id', 0); $u = new Application_Model_DbTable_Mstuser(); $user = $u->getBasicInfo($id); $this->view->u = $user; $this->view->id = $id; $form = new Admin_Form_User_EditBasic(); $form->setName('edituserbasic'); $htmlStringBg = ''; if ($do == 'editbasic') { $form->getElement('id')->setValue($id); $form->getElement('userId')->setValue($user['login']); $form->getElement('role')->setValue($user['role_id']); $form->getElement('email')->setValue($user['email']); $form->getElement('country')->setValue($user['country_id']); $form->getElement('mobile')->setValue($user['mobile']); $form->getElement('active')->setValue($user['is_active']); $form->getElement('temporaryPwd')->setValue($user['is_temporary_pwd']); $form->getElement('blocked')->setValue($user['is_blocked']); $form->getElement('blockedReason')->setValue($user['blocked_reason']); $form->getElement('remarks')->setValue($user['remarks']); } else { if ($do == 'savebasic') { if ($form->isValid($this->getRequest()->getPost())) { /*Save the info*/ $data = array('login' => $this->getRequest()->getPost('userId'), 'role_id' => $this->getRequest()->getPost('role'), 'email' => $this->getRequest()->getPost('email'), 'mobile' => $this->getRequest()->getPost('mobile'), 'is_temporary_pwd' => $this->getRequest()->getPost('temporaryPwd'), 'country_id' => $this->getRequest()->getPost('country'), 'remarks' => $this->getRequest()->getPost('remarks'), 'is_active' => $this->getRequest()->getPost('active'), 'is_blocked' => $this->getRequest()->getPost('blocked'), 'blocked_reason' => $this->getRequest()->getPost('blockedReason')); $id = $this->getRequest()->getParam('id'); $userModel = new Admin_Model_User(); $message = $userModel->updateBasicInfo($id, $data); if ($message == '') { //Successfull $message = 'Successfully updated.'; $user = $u->getBasicInfo($id); //Refresh the background page $this->view->u = $user; $htmlStringBg = $this->view->render('user/viewbasic.ajax.phtml'); } } } } $this->view->form = $form; $htmlString = $this->view->render('user/editbasic.phtml'); $rs = new stdClass(); $rs->do = $do; $rs->debug = $this->getRequest()->getPost(); $rs->message = $message; $rs->htmlBody = $htmlString; $rs->htmlBodyBg = $htmlStringBg; $this->_helper->json($rs); }