protected function _postDelete() { $tblUserDetail = new Kutu_Core_Orm_Table_UserDetail(); $rowsetUserDetail = $tblUserDetail->fetchAll("uid='{$this->guid}'"); foreach ($rowsetUserDetail as $row) { // delete $row->delete(); } //delete from table KutuUserInvoice $tblInvoice = new Kutu_Core_Orm_Table_Invoice(); $tblInvoice->delete("uid='{$this->guid}'"); //delete from table KutuUserAccessLog $tblUserLog = new Kutu_Core_Orm_Table_UserLog(); $tblUserLog->delete("user_id='{$this->guid}'"); //delete from ACL $aclMan = Kutu_Acl::manager(); $aclMan->deleteUser($this->username); // delete physical user folder define by guid $sDir = KUTU_ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $this->guid; try { $this->removeRessource($sDir); } catch (Exception $e) { throw new Exception($e); } }
public function lastLogin($userId = NULL) { if ($userId) { $id = $userId; } else { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { return; } $id = $auth->getIdentity()->kopel; } /* list($ret, $body) = Pandamp_Lib_Remote::serverCmd('lastLogin',array('kopel'=>$id)); switch ($ret) { case 200: return $body; break; default : return NULL; } */ //$conn = Zend_Registry::get('db2'); $tblUserAccessLog = new Kutu_Core_Orm_Table_UserLog(); $rowUserAccessLog = $tblUserAccessLog->fetchRow("user_id='" . $id . "' AND NOT (lastlogin='******' or isnull(lastlogin))", 'user_access_log_id DESC'); if (isset($rowUserAccessLog)) { $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); $hari = $array_hari[date("N", strtotime($rowUserAccessLog->lastlogin))]; $dLog = $hari . ', ' . date('j F Y \\j\\a\\m H:i', strtotime($rowUserAccessLog->lastlogin)) . ' <br>dari ' . $rowUserAccessLog->user_ip; } else { $dLog = '-'; } return $dLog; /* $tblUserAccessLog = new App_Model_Db_Table_Log(); $rowUserAccessLog = $tblUserAccessLog->fetchRow("user_id='".$id."' AND NOT (lastlogin='******' or isnull(lastlogin))",'user_access_log_id DESC'); if (isset($rowUserAccessLog)) echo date('l F jS, Y \a\t g:ia',strtotime($rowUserAccessLog->lastlogin)). ' from '.$rowUserAccessLog->user_ip; * */ }
function getLastLogin() { $tblUserAccessLog = new Kutu_Core_Orm_Table_UserLog(); if (Zend_Auth::getInstance()->hasIdentity()) { $rowUserAccessLog = $tblUserAccessLog->fetchRow("user_id='" . Zend_Auth::getInstance()->getIdentity()->guid . "' AND NOT (lastlogin='******' or isnull(lastlogin))", 'user_access_log_id DESC'); } if (isset($rowUserAccessLog)) { return strftime('%d-%m-%Y %H:%M:%S', strtotime($rowUserAccessLog->lastlogin)); } }
static function writeLog() { $userId = Zend_Auth::getInstance()->getIdentity()->kopel; $model = new Kutu_Core_Orm_Table_UserLog(); $model->addUserLog(array('user_id' => $userId, 'user_ip' => self::getRealIpAddr(), 'login' => new Zend_Db_Expr('NOW()'))); }