Changeset 3151 for trunk/modules
- Timestamp:
- 07/18/2008 12:13:09 PM (5 months ago)
- Location:
- trunk/modules/gmaps
- Files:
-
- 1 added
- 6 modified
-
controllers/gmaps_demo.php (modified) (1 diff)
-
i18n/en_US/gmaps.php (modified) (1 diff)
-
i18n/es_ES/gmaps.php (modified) (1 diff)
-
libraries/Gmap.php (modified) (1 diff)
-
views/gmaps/javascript.php (modified) (1 diff)
-
views/gmaps/jquery_javascript.php (modified) (1 diff)
-
views/gmaps/static_demo.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/gmaps/controllers/gmaps_demo.php
r3145 r3151 31 31 32 32 View::factory('gmaps/api_demo')->set(array('api_url' => $map->api_uri(), 'map' => $map->render()))->render(TRUE); 33 } 34 35 public function image_map() 36 { 37 $points = array('-37.814251' => '144.963169', '-33.867139' => '151.207114', '-27.467580' => '153.027892'); 38 39 View::factory('gmaps/static_demo')->set(array('simple' => Gmap::static_map(44.9801, -93.2519),'multi' => Gmap::static_map($points)))->render(TRUE); 33 40 } 34 41 -
trunk/modules/gmaps/i18n/en_US/gmaps.php
r3145 r3151 3 3 $lang = array 4 4 ( 5 'invalid_marker' => 'Los parametros del marcador son incorrectos', 5 'invalid_marker' => 'Invalid marker params (latitude: %s, longitude: %s)', 6 'invalid_dimensions' => 'Invalid map dimensions (width: %s, height: %s)', 6 7 ); -
trunk/modules/gmaps/i18n/es_ES/gmaps.php
r3145 r3151 3 3 $lang = array 4 4 ( 5 'invalid_marker' => 'Los parametros del marcador son incorrectos', 5 'invalid_marker' => 'Los parametros del marcador son incorrectos (latitud: %s, longitud: %s)', 6 'invalid_dimensions' => 'Las dimensones del mapa son incorrectas (ancho: %s, alto: %s)', 6 7 ); -
trunk/modules/gmaps/libraries/Gmap.php
r3146 r3151 93 93 return $xml; 94 94 } 95 96 /** 97 * Returns an image map 98 * 99 * @param mixed $lat latitude or an array of marker points 100 * @param float $lon longitude 101 * @param integer $zoom zoom level (1-16) 102 * @param string $type map type (roadmap or mobile) 103 * @param integer $width map width 104 * @param integer $height map height 105 * @return string 106 */ 107 public static function static_map($lat = 0, $lon = 0, $zoom = 6, $type = 'roadmap', $width = 300, $height = 300) 108 { 109 $api_url = 'http://maps.google.com/staticmap?key='.Config::item('gmaps.api_key'); 110 111 $types = array('roadmap', 'mobile'); 112 113 $width = min(640, (int) $width); 114 $height = min(640, (int) $height); 115 116 if ($width <= 0 OR $height <= 0) 117 throw new Kohana_Exception('gmaps.invalid_dimensions', $width, $height); 118 119 $api_url = $api_url.'&size='.$width.'x'.$height; 120 121 if (in_array($type, $types)) 122 $api_url = $api_url.'&maptype='.$type; 123 124 if (is_array($lat)) 125 { 126 foreach ($lat as $key => $value) 127 $markers[] = $key.','.$value; 128 129 $api_url = $api_url.'&markers='.implode('|', $markers); 130 } 131 else 132 { 133 $api_url = $api_url.'&center='.$lat.','.$lon.'&zoom='.$zoom; 134 } 135 136 return $api_url; 137 } 95 138 96 139 // Map settings -
trunk/modules/gmaps/views/gmaps/javascript.php
r3145 r3151 1 google.load("maps", "2.x", {"language" : "<?php echo substr(Config::item('locale.language '), 0, 2);?>"});1 google.load("maps", "2.x", {"language" : "<?php echo substr(Config::item('locale.language.0'), 0, 2);?>"}); 2 2 function initialize() { 3 3 if (GBrowserIsCompatible()) { -
trunk/modules/gmaps/views/gmaps/jquery_javascript.php
r3145 r3151 1 google.load("maps", "2.x", {"language" : "<?php echo substr(Config::item('locale.language '), 0, 2);?>"});1 google.load("maps", "2.x", {"language" : "<?php echo substr(Config::item('locale.language.0'), 0, 2);?>"}); 2 2 3 3 $(function()
