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) { } }
/** * deleteLogUser * @return JSON */ function deleteLogUserAction() { $uid = $this->_getParam('uid') ? $this->_getParam('uid') : ''; $tblUserLog = new Pandamp_Modules_Identity_Log_Model_Log(); $rowUser = $tblUserLog->find($uid)->current(); $result = $rowUser->delete(); if ($result) { $this->view->success = true; $this->view->message = "Delete successfully"; } else { $this->view->success = false; $this->view->message = "Delete failed"; } }
static function writeLog() { $userId = Zend_Auth::getInstance()->getIdentity()->guid; $model = new Pandamp_Modules_Identity_Log_Model_Log(); $model->addUserLog(array('user_id' => $userId, 'user_ip' => self::getRealIpAddr(), 'login' => new Zend_Db_Expr('NOW()'))); }
function userlogAction() { $sortDir = $this->_getParam('dir') ? $this->_getParam('dir') : 'DESC'; $sortBy = $this->_getParam('sort') ? $this->_getParam('sort') : 'user_access_log_id'; $start = $this->_getParam('start') ? $this->_getParam('start') : 0; $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10; $uid = $this->_getParam('uid') ? $this->_getParam('uid') : ''; $tblAccessLog = new Pandamp_Modules_Identity_Log_Model_Log(); $rowLog = $tblAccessLog->fetchAll("user_id='" . $uid . "'", "{$sortBy} {$sortDir}", $end, $start); $rowset = $tblAccessLog->fetchAll("user_id='" . $uid . "'", "user_access_log_id DESC"); $a = array(); $a['totalCount'] = count($rowset); $i = 0; if ($a['totalCount'] != 0) { foreach ($rowLog as $row) { $a['log'][$i]['user_access_log_id'] = $row->user_access_log_id; $a['log'][$i]['login'] = strftime('%d-%m-%Y %H:%M:%S', strtotime($row->login)); $a['log'][$i]['lastlogin'] = $row->lastlogin ? strftime('%d-%m-%Y %H:%M:%S', strtotime($row->lastlogin)) : '-'; $a['log'][$i]['user_ip'] = $row->user_ip; $i++; } } if ($a['totalCount'] == 0) { $a['log'][0]['user_access_log_id'] = ''; $a['log'][0]['login'] = ""; $a['log'][0]['lastlogin'] = ''; $a['log'][0]['user_ip'] = ''; } echo Zend_Json::encode($a); }