* { * events: [ * { * * }, * ... * ] * } * * If there is a problem the error code will be 400 with a json response of the form: * { * "error": { * "message": "Error message" * } * } */ if (isset($_GET['startdate']) && ($parseddate = strtotime($_GET['startdate']))) { $startdate = $parseddate; } else { $startdate = time(); } if (isset($_GET['enddate']) && ($parseddate = strtotime($_GET['enddate']))) { $enddate = $parseddate; } else { $enddate = time(); } $json = array('events' => array()); foreach (EventTime::getRangeVisible($startdate, $enddate) as $eventTime) { $json['events'][] = $eventTime->toEventSummaryArray(); } fJSON::output($json);
* ... * ] * } * * If there is a problem the error code will be 400 with a json response of the form: * { * "error": { * "message": "Error message" * } * } */ if (isset($_GET['startdate']) && ($parseddate = strtotime($_GET['startdate']))) { $startdate = $parseddate; } else { $startdate = time(); } if (isset($_GET['enddate']) && ($parseddate = strtotime($_GET['enddate']))) { $enddate = $parseddate; } else { $enddate = time(); } $json = array('events' => array()); if (isset($_GET['id'])) { $events = EventTime::getByID($_GET['id']); } else { $events = EventTime::getRangeVisible($startdate, $enddate); } foreach ($events as $eventTime) { $json['events'][] = $eventTime->toEventSummaryArray(); } fJSON::output($json);