예제 #1
0
파일: poi.php 프로젝트: stefda/pocketsail
 function add()
 {
     $this->load->library('geo/*');
     $this->load->model('POIModel');
     $this->load->model('POITypeModel');
     $lat = filter_input(INPUT_GET, 'lat', FILTER_VALIDATE_FLOAT);
     $lng = filter_input(INPUT_GET, 'lng', FILTER_VALIDATE_FLOAT);
     $sub = filter_input(INPUT_GET, 'sub', FILTER_SANITIZE_STRING);
     $latLng = new LatLng($lat, $lng);
     $catObject = POITypeModel::catFromSub($sub);
     // Create dummy poi object
     $poi = new stdClass();
     $poi->name = '';
     $poi->label = '';
     $poi->cat = $catObject->id;
     $poi->sub = $sub;
     $poi->nearId = null;
     $poi->countryId = null;
     $poi->latLng = $latLng;
     $poi->border = null;
     $cats = POITypeModel::loadCats();
     $subs = POITypeModel::loadSubs($catObject->id);
     $nears = POIModel::loadNears($latLng);
     $countries = POIModel::loadCountries($latLng);
     $this->assign('poi', $poi);
     $this->assign('nears', $nears);
     $this->assign('countries', $countries);
     $this->assign('cats', $cats);
     $this->assign('subs', $subs);
     $this->assign('attrs', new stdClass());
     $this->load->view('templates/add');
 }
예제 #2
0
파일: tpl.php 프로젝트: stefda/pocketsail
function tpl_edit($sub)
{
    $load = CL_Loader::get_instance();
    $editViewsPath = 'tpl/edit/';
    $subViewPath = $editViewsPath . $sub;
    if (view_exists($subViewPath)) {
        return view_get_html($subViewPath);
    } else {
        $load->model('POITypeModel');
        $type = POITypeModel::catFromSub($sub);
        $catViewPath = $editViewsPath . $type->id;
        if (file_exists($catViewPath)) {
            return view_get_html($catViewPath);
        }
    }
    return view_get_html($editViewsPath . 'default');
}