/** * Shows the list of logged in users */ public function indexAction() { $activeUser = new Ot_Model_DbTable_Activeuser(); $otAccount = new Ot_Model_DbTable_Account(); $otRole = new Ot_Model_DbTable_Role(); $allActiveUsers = $activeUser->fetchAll(null, 'dt DESC')->toArray(); foreach ($allActiveUsers as &$a) { $a['accountInfo'] = $otAccount->getByAccountId($a['accountId']); } $this->_helper->pageTitle('ot-activeusers-index:title'); $this->view->assign(array('activeUsers' => $allActiveUsers)); }
public function postDispatch(Zend_Controller_Request_Abstract $request) { if (Zend_Auth::getInstance()->hasIdentity()) { $identity = Zend_Auth::getInstance()->getIdentity(); $activeUser = new Ot_Model_DbTable_Activeuser(); $thisUser = $activeUser->find($identity->accountId); $data = array('accountId' => $identity->accountId, 'dt' => time()); try { if (is_null($thisUser)) { $activeUser->insert($data); } else { $activeUser->update($data, null); } $activeUser->purgeInactiveUsers(); } catch (Exception $e) { // we don't care if it fails. this shouldn't interrupt service at all return false; } } }