public function getLocationLink() { $checkIn = CheckIn::getMostRecent($this); if ($checkIn) { $lat = $checkIn->getLat(); $long = $checkIn->getLong(); $time = $checkIn->getTime(); $url = "http://maps.google.com/maps?q={$lat},+{$long}"; return "<br /><a href=\"{$url}\">Most Recent Check-In: {$lat}, {$long} (at {$time})</a>"; } else { return ''; } }
public function qualifies(Team $team, $time, $city, $direction, $distance, $defaultIfNull) { if ($time != null) { if (current_mysql_time() >= $time) { return true; } } if ($direction != null && $distance != null && $city != null) { $checkIn = CheckIn::getMostRecent($team); if ($checkIn != null && Direction::inRange($checkIn, $city, $direction, $distance)) { return true; } } if ($time == null && ($direction == null || $distance == null || $city == null)) { return $defaultIfNull; } return false; }