editable = true; $this->type = $object_type; $this->id = $object_id; $objects = array(); switch ($this->type) { case TYPE_RECORD : $objects[] = array( 'layer' => "record", 'ids' => array($this->id) ); break; case TYPE_LOCATION : $objects[] = array( 'layer' => "location", 'ids' => array($this->id) ); break; case TYPE_SUR_LOCATION : $objects[] = array( 'layer' => "sur_location", 'ids' => array($this->id) ); break; case AUT_TABLE_CATEG : $objects[] = array( 'type' => $this->type, 'layer' => "authority", 'ids' => array($this->id) ); break; case AUT_TABLE_CONCEPT : $objects[] = array( 'type' => $this->type, 'layer' => "authority_concept", 'ids' => array($this->id) ); break; } $this->model = new map_model('', $objects, 0); $this->model->set_mode("edition"); } // end of member function __construct public function get_json_informations() { global $pmb_url_base; global $dbh; $map_hold = $this->get_bounding_box(); if (!$map_hold) { return ""; } $coords = $map_hold->get_coords(); if (!count($coords)) { return ""; } return "initialFit: [ " . map_objects_controler::get_coord_initialFit($coords) . "], layers : " . json_encode($this->model->get_json_informations(false, $pmb_url_base, $this->editable)); } public function get_bounding_box() { return $this->model->get_bounding_box(1); } public function get_map() { global $dbh; global $pmb_map_base_layer_type; global $pmb_map_base_layer_params; global $pmb_map_size_notice_edition; global $pmb_map_size_location_edition; $layer_params = json_decode($pmb_map_base_layer_params, true); $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType." . $pmb_map_base_layer_type; if (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']); } $ids[] = $this->id; $size = explode("*", $pmb_map_size_notice_edition); switch ($this->type) { case TYPE_RECORD : $objects[] = array( 'layer' => "record", 'ids' => $ids ); break; case TYPE_LOCATION : $objects[] = array( 'layer' => "location", 'ids' => $ids ); $size = explode("*", $pmb_map_size_location_edition); break; case TYPE_SUR_LOCATION : $objects[] = array( 'layer' => "sur_location", 'ids' => $ids ); $size = explode("*", $pmb_map_size_location_edition); break; case AUT_TABLE_CATEG : $objects[] = array( 'type' => $this->type, 'layer' => "authority", 'ids' => $ids ); break; case AUT_TABLE_CONCEPT : $objects[] = array( 'type' => $this->type, 'layer' => "authority_concept", 'ids' => $ids ); break; } $map_hold = null; if(count($size)!=2) { $map_size="width:100%; height:400px;"; } else { if (is_numeric($size[0])) { $size[0] = $size[0] . "px"; } if (is_numeric($size[1])) { $size[1] = $size[1] . "px"; } $map_size= "width:".$size[0]."; height:".$size[1].";"; } $map = "