Added option to get calendar data
- Changed ?data GET parameter to ?location - Added ?calendar GET parameter - Will fetch calendar data from internal.jnf.me
This commit is contained in:
parent
2fee359ec0
commit
5d9c995762
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
if (isset($_GET["data"])):
|
if (isset($_GET["location"])):
|
||||||
$options = array(
|
$options = array(
|
||||||
'http' => array(
|
'http' => array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
@ -18,6 +18,18 @@
|
|||||||
echo json_encode($output['device_tracker.jasonsphone_jason']);
|
echo json_encode($output['device_tracker.jasonsphone_jason']);
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
|
elseif (isset($_GET["calendar"])):
|
||||||
|
$options = array(
|
||||||
|
'http' => array(
|
||||||
|
'header' => 'Host: internal.jnf.me'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$context = stream_context_create($options);
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo file_get_contents("http://192.168.0.25/public/pages/display/calendar.php?location", false, $context);
|
||||||
|
|
||||||
else:
|
else:
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -60,7 +72,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updateLocation() {
|
function updateLocation() {
|
||||||
$.getJSON('?data', function(data) {
|
$.getJSON('?location', function(data) {
|
||||||
$('h1').html((data.state == 'not_home') ? 'Nobody Knows' : 'At ' + data.state.replace(/^\w/, c => c.toUpperCase()));
|
$('h1').html((data.state == 'not_home') ? 'Nobody Knows' : 'At ' + data.state.replace(/^\w/, c => c.toUpperCase()));
|
||||||
var locLive = new google.maps.LatLng(data.attributes.latitude, data.attributes.longitude);
|
var locLive = new google.maps.LatLng(data.attributes.latitude, data.attributes.longitude);
|
||||||
map.setCenter(locLive);
|
map.setCenter(locLive);
|
||||||
|
Loading…
Reference in New Issue
Block a user