} } print_r($_SESSION); //users history $userevents = getevents($user); //sanitise data //yelp $places = sanitise($places, $userevents); // get user tags $usertags = gettags($user); // weight yelp for ($i = 0; $i < count($places); $i++) { $places[$i] = weight($places[$i], $usertags); } //sort yelp $places = sortevents($places); $places = array_values($places); $_SESSION['places'] = $places; $userlat = $_SESSION['userlat']; $userlong = $_SESSION['userlong']; //display top $suggestion = $places[0]; $postcode = $suggestion['postcode']; //enrich with foursquare //geocode to get lat long $latlong = geocodepost($postcode); $suggestion['latlong'] = $latlong; //get foursquare id $foursqid = getfoursqid($latlong[0], $latlong[1], $suggestion['name']); $suggestion['foursqid'] = $foursqid; //get foursquare data
$usertags = gettags($user); // weight yelp for ($i = 0; $i < count($yelp); $i++) { $yelp[$i] = weight($yelp[$i], $usertags); } //weight eventful if ($eventful) { for ($i = 0; $i < count($eventful); $i++) { $eventful[$i] = weight($eventful[$i], $usertags); } } //sort yelp $yelp = sortevents($yelp); //sort eventful if ($eventful) { $eventful = sortevents($eventful); } //pick top if ($eventful) { $suggestion = topevent($yelp[0], $eventful[0]); if ($suggestion['name'] == $_SESSION['suggestion']['name']) { $suggestion = $yelp[1]; } $_SESSION['suggestion'] = $suggestion; } else { $suggestion = $yelp[0]; if ($suggestion['name'] == $_SESSION['suggestion']['name']) { $suggestion = $yelp[1]; } $_SESSION['suggestion'] = $suggestion; }