Préparation modification affichage carte
This commit is contained in:
parent
60fe74b931
commit
d34b17bd16
@ -424,6 +424,22 @@ class IdentiteController extends Zend_Controller_Action
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
$userAccessEdition = $user->checkModeEdition();
|
||||
$this->view->userAccessEdition = $userAccessEdition;
|
||||
|
||||
// --- Gestion source
|
||||
$mapSource = 'google';
|
||||
if ($mapSource == 'google') {
|
||||
$this->view->headScript()->appendFile('http://maps.google.com/maps/api/js?sensor=false', 'text/javascript');
|
||||
}
|
||||
if ($mapSource == 'openstreetmap') {
|
||||
$this->view->headLink()->appendStylesheet('/libs/openstreetmap/ol.css', 'all');
|
||||
$this->view->headScript()->appendFile('/libs/openstreetmap/ol.js', 'text/javascript');
|
||||
}
|
||||
$this->view->source = $mapSource;
|
||||
|
||||
// --- Marker
|
||||
$siren = substr($this->siret,0,9);
|
||||
$actif = $request->getParam('actif', -1);
|
||||
|
||||
@ -445,8 +461,7 @@ class IdentiteController extends Zend_Controller_Action
|
||||
$marqueurs = array();
|
||||
|
||||
if ( count($etabs)>0 ) {
|
||||
foreach ($etabs as $i => $etab)
|
||||
{
|
||||
foreach ($etabs as $i => $etab) {
|
||||
if ($etab->Siege == 1) {
|
||||
$type = 'Siège ';
|
||||
} else {
|
||||
@ -506,7 +521,6 @@ class IdentiteController extends Zend_Controller_Action
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($marks);
|
||||
}
|
||||
$this->view->source = 'google';
|
||||
$this->view->assign('marks', json_encode($marks));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
<div id="carte" style="width:100%;height:500px">Préparation de la carte ...</div>
|
||||
<div id="map" class="map">Préparation de la carte ...</div>
|
||||
|
||||
<?php if ($this->source == 'google') {?>
|
||||
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
||||
<script type="text/javascript">
|
||||
<?php echo 'var marks = '.$this->marks.';'?>
|
||||
var timer;
|
||||
@ -50,7 +49,7 @@ function loadGoogleMap() {
|
||||
zoom: 8,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
};
|
||||
map = new google.maps.Map(document.getElementById('carte'), mapOptions);
|
||||
map = new google.maps.Map(document.getElementById('map'), mapOptions);
|
||||
zoneMarker = new google.maps.LatLngBounds();
|
||||
$.each(marks, function (i, item){
|
||||
if (item.location) {
|
||||
@ -74,6 +73,7 @@ $(document).ready(function(){
|
||||
marks[i].location = new google.maps.LatLng(item.gps.lat, item.gps.lon);
|
||||
markDone++;
|
||||
} else {
|
||||
<?php if ($this->userAccessEdition) {?>
|
||||
geocoder.geocode({ address:item.address, region:'FR' }, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
if (results[0]) {
|
||||
@ -124,7 +124,84 @@ $(document).ready(function(){
|
||||
//console.log("GeoCode: " + status + ' - index: ' + i);
|
||||
});
|
||||
}
|
||||
<?php }?>
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php }?>
|
||||
|
||||
<?php if ($this->source == 'openstreetmap') {?>
|
||||
<script type="text/javascript">
|
||||
<?php echo 'var marks = '.$this->marks.';'?>
|
||||
var zoneMarker;
|
||||
var zoom = 6;
|
||||
var FCenterLng = 1.87528;
|
||||
var FCenterLat = 46.60611;
|
||||
|
||||
//--- Wait the document is ready
|
||||
$(document).ready(function(){
|
||||
|
||||
// --- Load Map
|
||||
var map = new ol.Map({
|
||||
target: 'map',
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
view: new ol.View({
|
||||
center: ol.proj.transform([FCenterLng, FCenterLat], 'EPSG:4326', 'EPSG:3857'),
|
||||
zoom: zoom
|
||||
})
|
||||
});
|
||||
|
||||
// --- Zone des markers
|
||||
|
||||
// --- Create Markers
|
||||
$.each(marks, function (i, item){
|
||||
if (item.gps.lat && item.gps.lon) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function createMarker(m){
|
||||
// --- Marker options
|
||||
var marker = new ol.Overlay({
|
||||
position: ol.proj.transform([2, 46], 'EPSG:4326', 'EPSG:3857'),
|
||||
element: $('<img src="http://extranet.scores-decisions.com/themes/default/images/maps/siege1.png">')
|
||||
});
|
||||
map.addOverlay(marker);
|
||||
// --- Info Window
|
||||
// --- Create event marker
|
||||
// --- Extend map by adding marker
|
||||
|
||||
}
|
||||
|
||||
//--- Create Marker
|
||||
function createMarker(m) {
|
||||
// --- Marker options
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
position: m.location,
|
||||
title: m.title,
|
||||
icon: m.icon,
|
||||
});
|
||||
// --- Info Window
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
content: m.text
|
||||
});
|
||||
// --- Create event marker
|
||||
google.maps.event.addListener(marker, 'click', function() {
|
||||
infowindow.open(map, marker);
|
||||
});
|
||||
// --- Extend map by adding marker
|
||||
zoneMarker.extend(marker.getPosition());
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php }?>
|
@ -543,6 +543,7 @@ div.domiciliation { float:left; margin:5px 0 0 5px; line-height:16px; }
|
||||
div.domiciliation img { vertical-align:middle; }
|
||||
div.domiciliation span{ display:none; }
|
||||
a.AncienSiege { background-color: #4D90FE; border: 1px solid #3079ED; color: #FFFFFF; font-weight: bold; padding: 2px 5px; }
|
||||
.map { width:100%; height:500px; }
|
||||
|
||||
/* Finance
|
||||
----------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user