SpoonHTTP::redirect('index.php'); } $recent = CheckIn::getCheckinsByPubId($pub->pub_id); for ($i = 0; $i < sizeof($recent); $i++) { $recent[$i]['timestamp'] = SpoonDate::getTimeAgo(strtotime($recent[$i]['timestamp'])); //check if the user has a fb account authenticated if (!$recent[$i]['fb_uid']) { //else, use standard fb icon $recent[$i]['fb_uid'] = 1; } } if ($recent !== null) { $tpl->assign('oRecent', true); $tpl->assign('iRecent', $recent); } else { $tpl->assign('oNoRecent', true); } if (CheckIn::getTopCheckinsByPubId($pub->pub_id) !== null) { $tpl->assign('oTopCheckins', true); $tpl->assign('iTopCheckins', CheckIn::getTopCheckinsByPubId($pub->pub_id)); } else { $tpl->assign('oNoTopCheckins', true); } $tpl->assign('name', $pub->name); $tpl->assign('longitude', $pub->longitude); $tpl->assign('latitude', $pub->latitude); $tpl->assign('people', $pub->getNumberPeople()); $tpl->assign('checkins', $pub->getNumberCheckins()); // show the output $tpl->assign('content', $tpl->getContent('templates/pubDetail.tpl')); $tpl->display('templates/layout.tpl');
} //Content layout $tpl->assign('oNavPubs', true); $lat = SpoonFilter::getGetValue('lat', null, ''); $long = SpoonFilter::getGetValue('long', null, ''); $pubs = array(); if ($lat !== "" && $long !== "") { $tpl->assign('latitude', $lat); $tpl->assign('longitude', $long); $pubs = Pub::getPubsByLocation($lat, $long); $abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for ($i = 0; $i < sizeof($pubs); $i++) { $pub = new Pub($pubs[$i]["pub_id"]); $pubs[$i]["letter"] = substr($abc, $i, 1); $pubs[$i]["people"] = $pub->getNumberPeople(); $pubs[$i]["checkins"] = $pub->getNumberCheckins(); } } else { $tpl->assign('latitude', '""'); $tpl->assign('longitude', '""'); } if ($pubs !== null) { $tpl->assign('iPubs', $pubs); } else { $tpl->assign('iPubs', array()); } $tpl->assign('intoHead', '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script> $(document).ready(function() { var longitude = {$longitude}; var latitude = {$latitude};