public function indexAction()
 {
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý tài khoản - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'canhan/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $userModel = new Front_Model_Users();
     $success_message = '';
     $error_message = array();
     if ($this->_request->isPost()) {
         $mat_khau_cu = trim($this->_arrParam['mat_khau_cu']);
         $mat_khau_moi = trim($this->_arrParam['mat_khau_moi_1']);
         $xac_nhan_mat_khau = trim($this->_arrParam['mat_khau_moi_2']);
         $validator_length = new Zend_Validate_StringLength(array('min' => 6, 'max' => 25));
         //kiem tra dữ liệu
         if (!$validator_length->isValid($mat_khau_moi)) {
             $error_message[] = 'Mật khẩu mới phải lớn hơn 5 ký tự và nhỏ hơn 26 ký tự';
         }
         if ($mat_khau_moi != $xac_nhan_mat_khau) {
             $error_message[] = 'Mật khẩu mới và xác nhận mật khẩu không khớp nhau.';
         }
         if (!sizeof($error_message)) {
             $check_pass = $userModel->fetchRow('user_id =' . $identity->user_id . ' and password="******"');
             if ($check_pass) {
                 $userModel->update(array('password' => md5($mat_khau_moi)), 'user_id =' . $identity->user_id);
                 $success_message = 'Thay đổi mật khẩu thành công.';
             } else {
                 $error_message[] = 'Mật khẩu cũ không chính xác.';
             }
         }
     }
     $this->view->success_message = $success_message;
     $this->view->error_message = $error_message;
 }
 public function deleteAction()
 {
     $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED;
     $option = array('layout' => 'hethong/layout', 'layoutPath' => $layoutPath);
     Zend_Layout::startMvc($option);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->view->title = 'Quản lý tài khoản - ' . $translate->_('TEXT_DEFAULT_TITLE');
     $this->view->headTitle($this->view->title);
     $id = $this->_getParam('id', 0);
     $userModel = new Front_Model_Users();
     $error_message = array();
     $success_message = '';
     $user_info = $userModel->fetchRow('user_id=' . $id);
     if (!$user_info) {
         $error_message[] = 'Không tìm thấy thông tin của tài khoản.';
     }
     if ($this->_request->isPost()) {
         $del = $this->getRequest()->getPost('del');
         if ($del == 'Yes') {
             $id = $this->getRequest()->getPost('id');
             $userModel->delete('user_id=' . $id);
         }
         $this->_redirect('hethong/users/index/page/' . $this->_page);
     }
     $this->view->user_info = $user_info;
     $this->view->error_message = $error_message;
 }