/** * Otestuje ci usersONline vracia spravy pocet riadkov */ function testUsersOnline() { $UsersOnline = new UsersOnline(); $auth_user = count($this->auth->usersOnline()); $online_cnt = $UsersOnline->findCount(); $this->assertEqual($online_cnt, $auth_user, 'Niektori uzivatel je asi prihlaseny 2 x - to moze byt ok, pri resetovnie session!!'); }
/** * @see UsersOnline::getUsersOnline() */ public function getUsersOnline() { $this->enableUserAgentIcons = WCF::getUser()->getPermission('admin.general.canViewIpAddress'); parent::getUsersOnline(); $location = new UsersOnlineLocation(); // cache location data $location->cacheLocations($this->users); if (USERS_ONLINE_SHOW_GUESTS) { $location->cacheLocations($this->guests); } if (USERS_ONLINE_SHOW_ROBOTS) { $location->cacheLocations($this->spiders); } // get location data $location->getLocations($this->users); if (USERS_ONLINE_SHOW_GUESTS) { $location->getLocations($this->guests); } if (USERS_ONLINE_SHOW_ROBOTS) { $location->getLocations($this->spiders); } }
<?php /** * Get all the users from UserOnline class and pass them to * javascript with json */ $users = new UsersOnline(); echo json_encode($users->Get());
/** * Zisti ci je pouzivatel momentalne prihlaseny v systeme * * @param string $username * @return boolean true/false */ public function isOnline($user_id) { $UsersOnline = new UsersOnline(); // unbind all models $UsersOnline->recursive = -1; // zisti ci taky pouzivatel existuje v tabulke $result = $UsersOnline->hasAny(array('user_id' => $user_id)); return $result ? true : false; }