Changeset 466

Show
Ignore:
Timestamp:
11/25/08 15:26:26 (1 month ago)
Author:
nicolas
Message:

Map : ajout google street

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/apps/intranet/modules/maps/templates/showSuccess.php

    r465 r466  
    11<h3><?php echo ucfirst(__('map')) ?></h3> 
    22<?php include_partial('sales/thumb', array('sales' => $sales)) ?> 
     3<div id="pano_main" style="display: none;width: 679px; height: 470px;"> 
     4  <h3>Google street view</h3> 
     5  <div name="pano" id="pano" style="width: 679px; height: 400px;"></div> 
     6  <hr /> 
     7</div> 
    38<?php 
    49  $map = new PhoogleMap(); 
    510  $map->setWidth(679); 
    611  $map->setHeight(400); 
    7   $map->zoomLevel = 3;  
     12  $map->zoomLevel = 2;  
    813  $map->setAPIKey(GOOGLE_MAP_KEY); 
    914  slot('gmapheader'); 
     
    1520  $address .= $sales->getEstate()->getPostalcode().' '; 
    1621  $address .= $sales->getEstate()->getCityValue().', FRANCE'; 
    17   $map->addAddress($address, '<strong>'.ucfirst(__('sale')).'</strong><br />'.addslashes(ereg_replace(',', '<br />', $address))); 
    18    
    19   $address  = $sales->getContactRelatedBySellerId()->getAddress1().', '; 
    20   if($sales->getContactRelatedBySellerId()->getAddress2()) 
    21   $address .= $sales->getContactRelatedBySellerId()->getAddress2().', '; 
    22   $address .= $sales->getContactRelatedBySellerId()->getPostalcode().' '; 
    23   $address .= $sales->getContactRelatedBySellerId()->getCityValue().', '.$sales->getContactRelatedBySellerId()->getCountry(); 
    24   $map->addAddress($address, '<strong>'.ucfirst(__('seller')).'</strong><br />'.$sales->getContactRelatedBySellerId().'<br />'.addslashes(ereg_replace(',', '<br />', $address))); 
    25   $map->showMap(); 
     22  $points = $map->getPoints($address); 
     23  $map->addGeoPoint($points['lat'], $points['lon'], '<strong>'.ucfirst(__('sale')).'</strong><br />'.addslashes(ereg_replace(',', '<br />', $address))); 
     24  $map->showMap(true); 
    2625?> 
  • trunk/lib/phoogle.php

    r3 r466  
    268268* @description  Displays the Google Map on the page 
    269269*/ 
    270         function showMap(){ 
     270        function showMap($streetview = false){ 
    271271                echo "\n<div id=\"map\" style=\"width: ".$this->mapWidth."px; height: ".$this->mapHeight."px\">\n</div>\n"; 
    272272                echo "    <script type=\"text/javascript\">\n 
     
    312312              echo "});\n"; 
    313313        } 
     314 
     315        if($streetview): 
     316          echo" 
     317          var myPano = new GStreetviewPanorama(document.getElementById('pano')); 
     318          svOverlay = new GStreetviewOverlay(); 
     319          map.addOverlay(svOverlay); 
     320          GEvent.addListener(map,'click', function(overlay,latlng) { 
     321            myPano.setLocationAndPOV(latlng); 
     322            Element.show('pano_main'); 
     323          }); 
     324          "; 
     325                endif; 
     326 
    314327                echo "          //]]>\n 
    315328                } 
     
    337350     } 
    338351    function characterData($parser,$data){ 
    339        $key=end($this->keys); 
    340        $this->arrays[$this->depth][$key]=$data; 
    341        $this->node_flag=0;  
    342      } 
     352      if(!trim($data)) return; 
     353      $key=end($this->keys); 
     354      $this->arrays[$this->depth][$key]=$data; 
     355      $this->node_flag=0;  
     356    } 
    343357    function endElement($parser, $name) 
    344358     {