예제 #1
0
 public function run()
 {
     parent::run();
     echo CHtml::activeHiddenField($this->model, $this->attributeLat, $this->htmlOptions);
     echo CHtml::activeHiddenField($this->model, $this->attributeLon, $this->htmlOptions);
     echo CHtml::activeHiddenField($this->model, $this->attributeZoom, $this->htmlOptions);
     //        echo CHtml::activeTextField($this->model, $this->attributeLat, $this->htmlOptions);
     //        echo CHtml::activeTextField($this->model, $this->attributeLon, $this->htmlOptions);
     //        echo CHtml::activeTextField($this->model, $this->attributeZoom, $this->htmlOptions);
 }
<?php

//
// Initialisation
//
define('GMAP_LIB_PATH', dirname(__FILE__) . '/../../lib/');
require_once GMAP_LIB_PATH . 'GMap.class.php';
//
// Controller
//
$gMap = new GMap();
$gMap->setZoom(4);
$gMap->setCenter(-25.363882, 131.044922);
$gMap->setHeight('500');
$gMap->setWidth('100%');
$marker = new GMapMarker(-25.363882, 131.044922, array('title' => '"Hello World!"'));
$marker->addEvent(new GMapEvent('click', 'map.set_zoom(8);'));
$gMap->addMarker($marker);
$gMap->addEvent(new GMapEvent('zoom_changed', 'setTimeout(moveToDarwin, 1500);'));
//
// View
//
?>

<?php 
require_once GMAP_LIB_PATH . 'helper/GMapHelper.php';
?>

<html>
  <head>
    <?php 
예제 #3
0
<?php

/**
 * Teste la sauvegarde d'équipes dans le backend
 * @author fabriceb
 * @since Feb 16, 2009 fabriceb
 */
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(10, new lime_output_color());
$t->diag('GMap Tests');
/** @var $gMap GMap */
$gMap = new GMap();
$gMap->addMarker(new GMapMarker(51.245475, 6.821373));
$gMap->addMarker(new GMapMarker(46.262248, 6.115969));
$gMap->addMarker(new GMapMarker(48.848959, 2.341577));
$gMap->addMarker(new GMapMarker(48.718952, 2.21918));
$gMap->addMarker(new GMapMarker(47.37642, 8.547995));
$t->diag('->getWidth test');
$t->is($gMap->getWidth(), 512, 'Correct width');
$t->is($gMap->getHeight(), 512, 'Correct height');
$gMap->setWidth(256);
$gMap->setHeight(128);
$t->is($gMap->getWidth(), 256, 'Correct width');
$t->is($gMap->getHeight(), 128, 'Correct height');
$gMap->setWidth(512);
$gMap->setHeight(512);
$t->diag('->getMarkersCenterCoord test');
$t->is($gMap->getMarkersCenterCoord()->__toString(), '48.7538615, 5.3835875', 'The center of our markers is ok');
$gMap->centerOnMarkers();
$t->is($gMap->getCenterCoord()->__toString(), '48.7538615, 5.3835875', 'The center of the map is ok');
$t->diag('->getMarkersFittingZoom test');
<?php

/**
 *
 * @author fabriceb
 * @since Feb 16, 2009 fabriceb
 */
include dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(3, new lime_output_color());
$t->diag('GMap Tests');
/** @var $gMap GMap */
$gMap = new GMap();
$tab = '  ';
$new_line = "\n";
$separator = $new_line . $tab . $tab;
$gMap->setCenter(47, 52);
$t->is($gMap->optionsToJs(), '{' . $separator . $tab . 'center: new google.maps.LatLng(47, 52),' . $separator . $tab . 'mapTypeId: google.maps.MapTypeId.ROADMAP' . $separator . '}', 'correct output with center set');
$gMap->setZoom(8);
$t->is($gMap->optionsToJs(), '{' . $separator . $tab . 'center: new google.maps.LatLng(47, 52),' . $separator . $tab . 'zoom: 8,' . $separator . $tab . 'mapTypeId: google.maps.MapTypeId.ROADMAP' . $separator . '}', 'correct output with zoom set');
$t->is($gMap->getJavascript(), $new_line . $tab . 'var map = null;' . $new_line . $tab . '//  Call this function when the page has been loaded' . $new_line . $tab . 'function initialize()' . $new_line . $tab . '{' . $new_line . $tab . $tab . 'var mapOptions = {' . $new_line . $tab . $tab . $tab . 'center: new google.maps.LatLng(47, 52),' . $new_line . $tab . $tab . $tab . 'zoom: 8,' . $new_line . $tab . $tab . $tab . 'mapTypeId: google.maps.MapTypeId.ROADMAP' . $new_line . $tab . $tab . '};' . $new_line . $tab . $tab . 'map = new google.maps.Map(document.getElementById("map"), mapOptions);' . $new_line . $tab . '}' . $new_line . 'window.onload = function(){initialize()};' . $new_line, 'correct output with zoom set');
예제 #5
0
<?php

//
// Initialisation
//
define('GMAP_LIB_PATH', dirname(__FILE__) . '/../../lib/');
require_once GMAP_LIB_PATH . 'GMap.class.php';
//
// Controller
//
$gMap = new GMap();
$gMap->setZoom(8);
$gMap->setCenter(-34.397, 150.644);
$gMap->setHeight('500');
$gMap->setWidth('100%');
//
// View
//
?>

<?php 
require_once GMAP_LIB_PATH . 'helper/GMapHelper.php';
?>

<html>
  <head>
    <?php 
include_google_map_javascript_file($gMap);
?>
  </head>
  <body>
예제 #6
0
 /**
  * Multiple GMapInfoWindow sample
  *
  * @author Vincent Guillon <*****@*****.**>
  * @since 2010-03-04
  */
 public function executeSample10()
 {
     // Initialize the google map
     $gMap = new GMap();
     $markers = array(new GMapMarker(51.245475, 6.821373), new GMapMarker(46.262248, 6.115969), new GMapMarker(48.848959, 2.341577), new GMapMarker(48.718952, 2.21918), new GMapMarker(47.37642, 8.547995));
     foreach ($markers as $marker) {
         // Reverse geocoding of the center of the map
         $geocoded_addr = new GMapGeocodedAddress(null);
         $geocoded_addr->setLat($marker->getLat());
         $geocoded_addr->setLng($marker->getLng());
         $geocoded_addr->reverseGeocode($gMap->getGMapClient());
         $info_window = new GMapInfoWindow('<div>' . $geocoded_addr->getRawAddress() . '</div>');
         $marker->addHtmlInfoWindow($info_window);
         $gMap->addMarker($marker);
     }
     // Center the map on marker width 0.3 margin
     $gMap->centerAndZoomOnMarkers(0.3);
     $this->gMap = $gMap;
     $this->setTemplate('sample1');
     // END OF ACTION
     $this->message = 'Multiple info window : click marker to open info window';
     $this->action_source = $this->functionToString('executeSample10');
 }
예제 #7
0
  /**
   * GMapInfoWindow sample
   *
   * @author Vincent Guillon <*****@*****.**>
   * @since 2009-10-02 17:16:44
   */
  public function executeSample3()
  {
    // Initialize the google map
    $gMap = new GMap();
    $gMap->setZoom(13);
    $gMap->setCenter(-12.461334, 130.841904);

    // Create GMapInfoWindow
    $info_window = new GMapInfoWindow('<div>Your HTML content here !</div>');

    // Create marker
    $marker = new GMapMarker(-12.461334, 130.841904, array('title' => '"Darwin"'));
    $marker->addHtmlInfoWindow($info_window);
    $gMap->addMarker($marker);

    $this->gMap = $gMap;

    $this->setTemplate('sample1');

    // END OF ACTION
    $this->message = 'Simple GMapInfoWindow : click marker to open info window';
    $this->action_source = $this->functionToString('executeSample3');
    $this->generated_js = str_replace(' ', '&nbsp;', preg_replace('/^\n(.*)/', '$1', $this->gMap->getJavascript()));
  }
예제 #8
0
<?php
/**
 * Teste la sauvegarde d'équipes dans le backend
 * @author fabriceb
 * @since Feb 16, 2009 fabriceb
 */
include(dirname(__FILE__).'/../bootstrap/unit.php');

$t = new lime_test(10, new lime_output_color());

$t->diag('GMap Tests');

/** @var $gMap GMap */
$gMap = new GMap();
$tab = '  ';
$separator = "\n".$tab.$tab;

$gMap->setCenter(47, 52);
$t->is($gMap->optionsToJs(), '{'.$separator.$tab.'center: new google.maps.LatLng(47, 52)'.$separator.'}', 'correct output with center set');
$gMap->setZoom(8);
$t->is($gMap->optionsToJs(), '{'.$separator.$tab.'center: new google.maps.LatLng(47, 52),'.$separator.$tab.'zoom: 8'.$separator.'}', 'correct output with zoom set');

$t->is($gMap->getJavascript(), '', 'correct output with zoom set');