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 AUT_TABLE_CATEG : $objects[]= array( 'type' => $this->type, 'layer' => "authority", 'ids' => array($this->id) ); break; } $this->model = new map_model($map_hold, $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(); $coords = $map_hold->get_coords(); if(!count($coords))return ""; $lats = $longs = array(); for($i=0 ; $iget_decimal_lat(); $longs[] = $coords[$i]->get_decimal_long(); } $lats = array_unique($lats); $longs = array_unique($longs); sort($lats); sort($longs); return "initialFit: [ ".$longs[0]." , ".$lats[0]." , ".$longs[1]." , ".$lats[1]."], 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(); } public function get_map() { global $dbh; global $opac_map_base_layer_type; global $oapc_map_base_layer_params; global $opac_map_size_notice_edition; $layer_params = json_decode($opac_map_base_layer_params,true); $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType.".$oapc_map_base_layer_type; if(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; switch($this->type){ case TYPE_RECORD : $objects[]= array( 'layer' => "record", 'ids' => $ids ); break; case AUT_TABLE_CATEG : $objects[]= array( 'type' => $this->type, 'layer' => "authority", 'ids' => $ids ); break; } $map_hold = null; $size=explode("*",$opac_map_size_notice_edition); if(count($size)!=2)$map_size="width:800px; height:480px;"; $map_size= "width:".$size[0]."px; height:".$size[1]."px;"; $map = "
"; return $map; } public function get_form() { global $dbh,$msg; $form_map=""; switch($this->type){ case TYPE_RECORD : $form_map="
".$this->get_map()."
"; break; case AUT_TABLE_CATEG : $form_map="
".$this->get_map()."
"; break; } return $form_map; } public function save_form() { global $dbh; global $map_wkt; $this->delete(); // save des emprises: if(count($map_wkt)){ for($i=0 ; $i