Beispiel #1
0
 function render()
 {
     if ($this->latitude === false || $this->longitude === false) {
         throw new \Exception('initial center coords required but not set!');
     }
     $header = XhtmlHeader::getInstance();
     $header->includeJs('http://maps.google.com/maps/api/js' . '?sensor=' . sbool($this->sensor) . ($this->lang ? '&language=' . $this->lang : '') . ($this->region ? '&region=' . $this->region : ''));
     $div_id = 'gmap_' . mt_rand();
     $res = 'var myOptions={' . 'center:new google.maps.LatLng(' . $this->latitude . ',' . $this->longitude . '),' . 'zoom:' . $this->zoom . ',' . 'mapTypeId:google.maps.MapTypeId.ROADMAP' . '};' . 'var myMap=new google.maps.Map(document.getElementById("' . $div_id . '"),myOptions);';
     foreach ($this->markers as $idx => $m) {
         $res .= 'var mk' . $idx . '=new google.maps.Marker({' . 'position:new google.maps.LatLng(' . $m->latitude . ',' . $m->longitude . '),' . ($m->icon ? 'icon:"' . $m->icon . '",' : '') . ($m->tooltip ? 'title:"' . $m->tooltip . '",' : '') . ($m->zIndex ? 'zIndex:' . $m->zIndex . ',' : '') . ($m->flat ? 'flat:true,' : '') . 'map:myMap' . '});';
     }
     $header->embedJsOnload($res);
     return '<div id="' . $div_id . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;"></div>';
 }
Beispiel #2
0
 public function testSBool1()
 {
     $this->assertEquals(sbool(true), 'true');
     $this->assertEquals(sbool(false), 'false');
 }