コード例 #1
0
 public function setIncludeDownloadJavascript($inclusion)
 {
     self::$include_download_javascript = $inclusion;
 }
コード例 #2
0
<?php

require_once dirname(__FILE__) . '/../../lib/WebService.class.php';
require_once dirname(__FILE__) . '/../../lib/MapAPI.class.php';
class testWebService extends WebService
{
    public static function fetch()
    {
        return file_get_contents(dirname(__FILE__) . '/fixtures/data/fake_web_service.xml');
    }
}
$myMap = new MapAPI();
$t = new lime_test(1, new lime_output_color());
$t->is($myMap->getMapSize(testWebService::fetch(), 100));
コード例 #3
0
 /**
  * Get a new GoogleMapAPI object and load it with the default settings
  *
  * @return GoogleMapAPI
  */
 public static function instance()
 {
     self::$instances++;
     if (self::$allow_full_screen == null) {
         self::$allow_full_screen = Config::inst()->get('Mappable', 'allow_full_screen');
     }
     // for JS
     if (self::$allow_full_screen === false) {
         self:
         $allow_full_screen = 'asdfsda';
     }
     $url = Director::absoluteBaseURL();
     // remove http and https
     $url = str_replace('http://', '', $url);
     $url = str_replace('https://', '', $url);
     $parts = explode('/', $url);
     $host = $parts[0];
     $key = self::$api_key;
     // if an array, get the key by an array keyed by host
     if (is_array($key)) {
         $key = $key[$host];
     }
     $gmap = new MapAPI($key);
     $gmap->setDivId(self::$div_id . "_" . self::$instances);
     $gmap->setEnableAutomaticCenterZoom(self::$automatic_center);
     $gmap->setDisplayDirectionFields(self::$direction_fields);
     $gmap->setSize(self::$map_width, self::$map_height);
     $gmap->setDefaultHideMarker(self::$hide_marker);
     $gmap->setMapType(self::$map_type);
     $gmap->setInfoWindowWidth(self::$info_window_width);
     $gmap->setCenter(self::$center);
     $gmap->setIconSize(self::$iconWidth, self::$iconHeight);
     $gmap->setIncludeDownloadJavascript(self::$map_already_rendered);
     $gmap->setAllowFullScreen(self::$allow_full_screen);
     return $gmap;
 }