/** * @AjaxCallable=TRUE * @AjaxMethod=POST * @AjaxAsync=TRUE */ function get_edit_poi_dialog() { $this->load->library('geo/LatLng'); $this->load->model('POIModel'); $this->load->model('POITypeModel'); $id = filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT); $poi = POIModel::load($id); $countries = POIModel::find_countries($poi->get_latlng()); $nearbys = POIModel::find_nearby($poi->get_latlng()); $this->assign('id', $id); $this->assign('latLng', $poi->get_latlng()); $this->assign('boundary', $poi->get_boundary()); $this->assign('cat', $poi->get_cat()); $this->assign('sub', $poi->get_sub()); $this->assign('countryId', $poi->get_country_id()); $this->assign('nearbyId', $poi->get_near_id()); $this->assign('name', $poi->get_name()); $this->assign('label', $poi->get_label()); $this->assign('ft', $poi->get_features()); $this->assign('cats', POITypeModel::loadCats()); $this->assign('subs', POITypeModel::loadSubs($poi->get_cat())); $this->assign('countries', $countries); $this->assign('nearbys', $nearbys); return $this->load->view('/admin/add_poi_dialog', false); }
function edit() { $this->load->library('geo/*'); $this->load->model('POIModel'); $this->load->model('POITypeModel'); $poiId = filter_input(INPUT_GET, 'poiId', FILTER_VALIDATE_INT); $poiObject = new stdClass(); $attrsObject = new stdClass(); if ($poiId !== NULL) { $poi = POIModel::load($poiId); $poiObject = $poi->toObject(); $attrsObject = $poi->attrs(); } $cats = POITypeModel::loadCats(); $subs = POITypeModel::loadSubs($poi->cat()); $nears = POIModel::loadNears($poi->latLng()); $countries = POIModel::loadCountries($poi->latLng()); $this->assign('poi', $poi->toObject()); $this->assign('nears', $nears); $this->assign('countries', $countries); $this->assign('cats', $cats); $this->assign('subs', $subs); $this->assign('attrs', $poi->attrs()); $this->load->view('templates/edit'); }