public static function getRecentUserCheckins($uid) { return PublicApp::getDB()->getRecords('SELECT checkins.timestamp, checkins.checkin_id, pubs.pub_id, pubs.name AS pubname, users.user_id, users.username, users.fb_uid FROM checkins INNER JOIN users ON checkins.user_id = users.user_id INNER JOIN pubs ON checkins.pub_id = pubs.pub_id where users.user_id = ' . $uid); }
/** * Gets the number of drinks. * * @return Checkin The latest checkin of a user. */ public function getNumberTabs() { return PublicApp::getDB()->getRecord('SELECT count(drink_id) as count FROM tabs WHERE checkin_id = ' . $this->checkin_id); }
/** * Gets the pubs within your range. * * @return array All the drinks. */ public static function getPubsByLocation($lat, $long) { return PublicApp::getDB()->getRecords('SELECT * , (latitude - ' . $lat . ') AS dif_lat, (longitude - ' . $long . ') AS dif_long FROM pubs WHERE (latitude - ' . $lat . ') < 0.02 AND(longitude - ' . $long . ') < 0.02 GROUP BY (latitude - ' . $lat . ') DESC'); }
/** * Gets the top drinkers of this drink. * * @return array All the drinks. */ function getTop() { return PublicApp::getDB()->getRecords('SELECT users.user_id, users.username, count(users.user_id) as count FROM tabs INNER JOIN checkins on tabs.checkin_id = checkins.checkin_id INNER JOIN users on checkins.user_id = users.user_id WHERE tabs.drink_id = ' . $this->drink_id . ' group by users.user_id asc LIMIT 5'); }