public function lastLogin($userId = NULL) { if ($userId) { $id = $userId; } else { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { return; } $id = $auth->getIdentity()->kopel; } $tblUserAccessLog = new App_Model_Db_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; }
static function updateUserLog() { $auth = Zend_Auth::getInstance(); $identity = $auth->getIdentity(); //$userId = Zend_Auth::getInstance()->getIdentity()->kopel; $userId = $identity->kopel; $model = new App_Model_Db_Table_UserLog(); $model->updateUserLog($userId, array('lastlogin' => new Zend_Db_Expr('NOW()'))); }
function deletelogAction() { if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) { $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted'); } $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $r = $this->getRequest(); $userId = explode(',', $r->getParam('id')); $modelUserLog = new App_Model_Db_Table_UserLog(); if (is_array($userId)) { foreach ($userId as $guid) { $rowUserLog = $modelUserLog->find($guid)->current(); if ($rowUserLog) { $rowUserLog->delete(); } } } else { $rowUserLog = $modelUserLog->find($userId)->current(); if ($rowUserLog) { $rowUserLog->delete(); } } }