HosipLan

Untitled

Oct 18th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. class MapControl extends Nette\Object
  2. {
  3.  
  4.     /**
  5.      * @param string $centerAddress
  6.      * @param array $markers
  7.      * @param array $attrs
  8.      */
  9.     public function render($centerAddress, array $markers = array(), array $attrs = array())
  10.     {
  11.         $query = http_build_query($attrs + array(
  12.             'center' => $centerAddress,
  13.             'zoom' => 13,
  14.             'size' => '600x300',
  15.             'maptype' => 'roadmap',
  16.             'sensor' => 'false',
  17.         ));
  18.  
  19.         foreach ($markers as $marker) {
  20.             $query .= '&markers=' . urlencode($marker);
  21.         }
  22.  
  23.         echo Html::el()->src('http://maps.googleapis.com/maps/api/staticmap?' . $query);
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment