$json = $news->getJSON(); print $json; } else { exit; } } else { if (isset($_REQUEST["ajaxGetTVGuide"])) { $channel = $_REQUEST["ajaxGetTVGuide"]; $API = new TVApi(); $API->getChannel(0)->getPrograms($API->getChannel($API->getChannelID($channel))->getSigla() . "&startDate=" . $today . "&endDate=" . $tomorrow); print $API->getChannel(0)->getJSON(); } else { if (isset($_REQUEST["ajaxGetWeather"])) { $city = $_REQUEST["ajaxGetWeather"]; $w = new Weather($city); $w->getWeather(); $w->getWeatherForecast(); $json_forecast = $w->getForecastJSON(); $curWeather = $w->getCurrent(); $curTempInterval = $w->getTempInterval(); $curTemp = $w->getTemp(); $cur = array(); array_push($cur, $curWeather, $curTemp, $curTempInterval); $rtn = array(); array_push($rtn, $cur, $json_forecast); print json_encode($rtn); } else { exit; } } }
$pack = array(); $row['type'] = 'schedule'; $row['content'] = $schedule; $pack[] = $row; foreach ($slides as $slide) { $row['type'] = 'image'; $row['content'] = $slide['content_src']; $pack[] = $row; } //Weather junk! //TODO: associate lat/lon values with signs somehow. Really need a good model for this stuff to be more modular //OK SO the plan is to staple this on to the `players` table for now like the astra_guid to get it implemented by the end of the month, but implement content types and region targeting later $coords = json_decode($player['weather_coords'], true); //$lat = 42.3798; //$lon = -71.1284; //TODO: pass $dbh into Weather class? $w = new Weather($coords['lat'], $coords['lon']); $forecast = $w->getForecastJSON(); $forecast = json_decode($forecast, true); //Just to be extra counterintuitive $secondary = array(); $secondary[] = array('type' => 'forecast', 'content' => $forecast); //Wait up that's just one region $output['primary'] = $pack; $output['sidebar'] = $secondary; $pack = $output; header('content-type:text/plain'); //$json = json_encode($pack, JSON_PRETTY_PRINT); $json = json_encode($pack); //Can't do that in old timey php without that weird upcompatibility version shim :0 echo $json;