/** * Push an event batch to the Connect API. * @param array $batch the batch to push * @return Response */ private function pushEventBatch($batch) { $eventBatch = []; foreach ($batch as $collection => $events) { $eventBatch[$collection] = array_map(function ($eventDetails) { $event = new Event($eventDetails); return $event->getDetails(); }, $events); } return $this->client->pushEventBatch($eventBatch); }
<?php require 'core/init.php'; if (!isset($_POST['type'])) { redirect("index.php"); } //create an Event object $event = new Event(); $type = $_POST['type']; if ($type == 'fetch') { echo $event->fetch(); } if ($type == 'getDetails') { $data = array(); $data['id'] = $_POST['eventid']; echo $event->getDetails($data); }