Beispiel #1
0
 /**
  * @AjaxCallable=TRUE
  * @AjaxMethod=POST
  * @AjaxAsync=TRUE
  */
 function save_poi()
 {
     $this->load->library('geo/LatLng');
     $this->load->library('geo/Point');
     $this->load->library('geo/Polygon');
     $this->load->model('POIModel');
     $id = filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT);
     $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
     $label = filter_input(INPUT_POST, 'label', FILTER_SANITIZE_STRING);
     $cat = filter_input(INPUT_POST, 'cat', FILTER_SANITIZE_STRING);
     $sub = filter_input(INPUT_POST, 'sub', FILTER_SANITIZE_STRING);
     $sLatLng = filter_input(INPUT_POST, 'latLng', FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY);
     $sBoundary = filter_input(INPUT_POST, 'boundary', FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY);
     $countryId = filter_input(INPUT_POST, 'countryId', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
     $nearbyId = filter_input(INPUT_POST, 'nearbyId', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
     $features = filter_input(INPUT_POST, 'feature', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
     $latLng = LatLng::deserialize($sLatLng);
     $boundary = Polygon::deserialize($sBoundary);
     if ($id !== false) {
         POIModel::update($id, $nearbyId, $countryId, $name, $label, $cat, $sub, $latLng, $boundary, $features);
         return $id;
     } else {
         return POIModel::add(1, $nearbyId, $countryId, $name, $label, $cat, $sub, $latLng, $boundary, $features);
     }
 }