editable = false; $this->ajax = false; $this->ids=$ids; $this->type=$type; $this->objects = array(); $this->id_dom = $type; switch($this->type){ case TYPE_RECORD : $items = array( 'layer' => "record", 'ids' => $this->ids ); break; case AUT_TABLE_AUTHORS : $items = array( 'layer' => "authority", 'ids' => $this->ids ); break; case TYPE_LOCATION : $items = array( 'layer' => "location", 'ids' => $this->ids ); break; case TYPE_SUR_LOCATION : $items = array( 'layer' => "sur_location", 'ids' => $this->ids ); break; case AUT_TABLE_CATEG : $items = array( 'layer' => "authority", 'type' => AUT_TABLE_CATEG, 'ids' => $this->ids ); break; case AUT_TABLE_CONCEPT : $items = array( 'layer' => "authority_concept", 'type' => AUT_TABLE_CONCEPT, 'ids' => $this->ids ); break; } $this->objects[] = $items; $this->fetch_datas(); $this->model = new map_model(null, $this->objects,$opac_map_max_holds); $this->model->set_mode("visualisation"); } // end of member function __construct public function get_data() { return $this->map; } public function fetch_datas() { global $dbh,$msg; switch($this->type){ case TYPE_RECORD : break; case AUT_TABLE_AUTHORS : break; } } public function get_json_informations(){ global $opac_url_base; global $dbh; $map_hold = $this->get_bounding_box(); if($map_hold){ $coords = $map_hold->get_coords(); if(!count($coords)) { return ""; } return "mode:\"visualization\", type:\"" . $this->type . "\", initialFit: [ ".self::get_coord_initialFit($coords)."], layers : ".json_encode($this->model->get_json_informations(false, $opac_url_base,$this->editable)); }else{ return ""; } } public function get_bounding_box(){ return $this->model->get_bounding_box(); } public function get_map($suffix='', $id_img_plus = "") { global $opac_map_base_layer_type; global $opac_map_base_layer_params; $json_informations = $this->get_json_informations(); $map = ""; if($json_informations){ $id = (!empty($this->ids[0]) ? $this->ids[0] : 0); $map_hold = null; $layer_params = json_decode($opac_map_base_layer_params,true); $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType.".$opac_map_base_layer_type; if(isset($layer_params) && is_array($layer_params) && count($layer_params)){ if($layer_params['name']) $baselayer.=",baseLayerName:\"".$layer_params['name']."\""; if($layer_params['url']) $baselayer.=",baseLayerUrl:\"".$layer_params['url']."\""; if($layer_params['options']) $baselayer.=",baseLayerOptions:".json_encode($layer_params['options']); } $map = "
"; } return $map; } public function get_map_controler_name(){ return "apps/map/map_controler"; } public function get_map_size() { global $opac_map_size_notice_view; global $opac_map_size_location_view; switch($this->type){ case TYPE_SUR_LOCATION : // no break case TYPE_LOCATION : $size=explode("*",$opac_map_size_location_view); break; case TYPE_RECORD : // no break case AUT_TABLE_AUTHORS : // no break case AUT_TABLE_CONCEPT : // no break default: $size=explode("*",$opac_map_size_notice_view); break; } return $this->format_size($size); } public static function get_coord_initialFit($tab_coords) { $lats_longs = $lats = $longs = array(); for($i=0 ; $i