Exemplo n.º 1
0
 /**
  * Render a map of this result
  *
  * NOTE: For map types simply send the constant string, any
  *  prefix will be appended automatically
  *
  * @param string $container_id - the id of the container object
  * @param array $options - the map options
  * @param string $type - the type of map to render
  */
 public function renderMap($container_id, $options = array(), $type = null)
 {
     if (!isset(self::$_map_containers[$container_id])) {
         // Get the type for this if it was not sent
         if ($type === null) {
             $type = $this->_driver->getDriverName();
         }
         // Lowercase the map type
         $type = strtolower($type);
         // Save the container id and the type
         self::$_map_containers[$container_id] = $type;
         // Render the view
         $map_script = $this->render("{$type}/map", array('query' => $this->query, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'container_id' => $container_id, 'options' => $options), true);
         // Register the javascript
         Yii::app()->getClientScript()->registerScript("{$type}_map_js" . self::$_map_count++, $map_script, CClientScript::POS_READY);
     }
     // Render the map point
     $this->renderPoint($this->latitude, $this->longitude, $container_id, $this->clean_query);
 }