Example #1
0
 protected function _postDelete()
 {
     $tblUserDetail = new Pandamp_Modules_Identity_User_Model_UserDetail();
     $rowsetUserDetail = $tblUserDetail->fetchAll("uid='{$this->guid}'");
     foreach ($rowsetUserDetail as $row) {
         // delete
         $row->delete();
     }
     //delete from table KutuUserInvoice
     $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice();
     $tblInvoice->delete("uid='{$this->kopel}'");
     //delete from table KutuUserAccessLog
     $tblUserLog = new Pandamp_Modules_Identity_Log_Model_Log();
     $tblUserLog->delete("user_id='{$this->guid}'");
     //delete from ACL
     $aclMan = Pandamp_Acl::manager();
     $aclMan->deleteUser($this->username);
     // delete physical user folder define by guid
     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $this->guid;
     try {
         $this->removeRessource($sDir);
     } catch (Exception $e) {
         throw new Exception($e);
     }
     $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'photo';
     try {
         if (file_exists($sDir . "/" . $this->guid . ".gif")) {
             unlink($sDir . "/" . $this->guid . ".gif");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpg")) {
             unlink($sDir . "/" . $this->guid . ".jpg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".jpeg")) {
             unlink($sDir . "/" . $this->guid . ".jpeg");
         }
         if (file_exists($sDir . "/" . $this->guid . ".png")) {
             unlink($sDir . "/" . $this->guid . ".png");
         }
     } catch (Exception $e) {
     }
 }
 /**	
  * deleteUser
  * @return JSON 
  */
 function deleteUserDetailAction()
 {
     $uid = $this->_getParam('uid') ? $this->_getParam('uid') : '';
     $username = $this->_getParam('username') ? $this->_getParam('username') : '';
     $tblUserDetail = new Pandamp_Modules_Identity_User_Model_UserDetail();
     $rowUserDetail = $tblUserDetail->find($uid)->current();
     $result = $rowUserDetail->delete();
     if ($result) {
         $this->view->success = true;
         $this->view->message = "[username:{$username}] Delete successfully";
     } else {
         $this->view->success = false;
         $this->view->message = "[username:{$username}] Delete failed";
     }
 }