public function __construct($o) { $this->id = $o->id; $this->url = $o->url; $this->nearId = $o->nearId; $this->nearName = $o->nearName; $this->countryId = $o->countryId; $this->countryName = $o->countryName; $this->userId = $o->userId; $this->name = $o->name; $this->label = $o->label; $this->cat = $o->cat; $this->sub = $o->sub; $this->subName = $o->subName; $this->lat = $o->lat; $this->lng = $o->lng; $this->border = Polygon::fromWKT($o->borderWKT); $this->attrs = json_decode($o->attrs); $this->rank = $o->rank; $this->timestamp = $o->timestamp; }
/** * @AjaxCallable=TRUE * @AjaxMethod=POST * @AjaxAsync=TRUE */ public function updatePoi() { $this->load->library('geo/*'); $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); $url = filter_input(INPUT_POST, 'url', FILTER_SANITIZE_STRING); $nearId = filter_input(INPUT_POST, 'nearId', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $countryId = filter_input(INPUT_POST, 'countryId', FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE); $cat = filter_input(INPUT_POST, 'cat', FILTER_SANITIZE_STRING); $sub = filter_input(INPUT_POST, 'sub', FILTER_SANITIZE_STRING); $latLngWKT = filter_input(INPUT_POST, 'latLng', FILTER_SANITIZE_STRING); $borderWKT = filter_input(INPUT_POST, 'border', FILTER_SANITIZE_STRING); $attrs = filter_input(INPUT_POST, 'attrs', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY); $latLng = LatLng::fromWKT($latLngWKT); $border = Polygon::fromWKT($borderWKT); //POIModel::addNew(1, $nearId, $countryId, $name, $label, $cat, $sub, $latLng, $border, $attrs); POIModel::update($id, $url, $nearId, $countryId, 1, $name, $label, $cat, $sub, $latLng, $border, $attrs); return TRUE; }