예제 #1
0
     $place = new Place();
     $place->post($_POST);
     $return = $apl->savePlace($place);
     echo json_encode(array('feedback' => $return));
 } else {
     if (preg_match('/^(update-place){1}$/', $_POST['method'])) {
         $apl = new AplMap();
         $place = new Place($_POST['id-place']);
         $place->post($_POST);
         $return = $apl->updatePlace($place);
         echo json_encode(array('feedback' => $return));
     } else {
         if (preg_match('/^(get-place-data){1}$/', $_POST['method'])) {
             $apl = new AplMap();
             $place = new Place($_POST['id-place']);
             $place->post($_POST);
             $place = $apl->getPlace($place);
             echo json_encode(array('place' => $place->getDataJSON()));
         } else {
             if (preg_match('/^(get-places-closest){1}$/', $_POST['method'])) {
                 $apl = new AplMap();
                 $place = new Place();
                 $place->setLatitude($_POST['latitude']);
                 $place->setLongitude($_POST['longitude']);
                 $place->setDistance($_POST['distance']);
                 $arrayPlaces = $apl->getPlacesClosest($place);
                 // SEND TO CLIENT
                 $tam = count($arrayPlaces);
                 $arrayJson = array();
                 for ($i = 0; $i < $tam; $i++) {
                     $arrayJson[] = $arrayPlaces[$i]->getDataJSON();