/[drupal]/contributions/modules/geo/modules/geo_field/includes/views/views_handler_field_geo_field.inc
ViewVC logotype

Diff of /contributions/modules/geo/modules/geo_field/includes/views/views_handler_field_geo_field.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4, Thu Aug 6 04:58:33 2009 UTC revision 1.5, Thu Aug 6 05:28:25 2009 UTC
# Line 1  Line 1 
1  <?php //$Id: views_handler_field_geo_field.inc,v 1.3 2009/08/06 04:09:32 vauxia Exp $  <?php //$Id: views_handler_field_geo_field.inc,v 1.4 2009/08/06 04:58:33 vauxia Exp $
2    
3  class views_handler_field_geo_field extends content_handler_field_multiple {  class views_handler_field_geo_field extends content_handler_field_multiple {
4    function query() {    function query() {
# Line 13  class views_handler_field_geo_field exte Line 13  class views_handler_field_geo_field exte
13      $this->query->add_field(NULL, geo('field_select', $this->geo_field), NULL, array('aggregate' => TRUE));      $this->query->add_field(NULL, geo('field_select', $this->geo_field), NULL, array('aggregate' => TRUE));
14    }    }
15    
16    function render($values) {    function pre_render(&$values) {
17        foreach ($values as $i => $row) {
18          // Re-assemble the components of the selected item.
19          $item = array();
20          $base = substr($this->field_alias, 0, -4);
21          foreach (array('wkb', 'bbox', 'srid') as $key) {
22            $column = $base .'_'. $key;
23            $item[$key] = db_decode_blob($row->$column);
24          }
25          $values[$i]->{$this->field_alias} = $item;
26        }
27      }
28    
29      function render(&$values) {
30      $values->build_mode = 'views';      $values->build_mode = 'views';
31    
32      // Get the formatter's theme name.  This will be used by geo_set_value().      // Get the formatter's theme name.  This will be used by geo_set_value().
# Line 21  class views_handler_field_geo_field exte Line 34  class views_handler_field_geo_field exte
34      $formatter = _content_get_formatter($name, $this->content_field['type']);      $formatter = _content_get_formatter($name, $this->content_field['type']);
35      $theme = $formatter['module'] .'_formatter_'. $name;      $theme = $formatter['module'] .'_formatter_'. $name;
36    
     // Re-assemble the components of the selected item.  
     $item = array();  
     $base = substr($this->field_alias, 0, -4);  
     foreach (array('wkb', 'bbox', 'srid') as $key) {  
       $column = $base .'_'. $key;  
       $item[$key] = db_decode_blob($values->$column);  
     }  
   
37      // Convert the resulting output to a format recognized by the theme function      // Convert the resulting output to a format recognized by the theme function
38      $item = geo_set_value($item, $theme);      $item = geo_set_value($values->{$this->field_alias}, $theme);
39    
40      // Do what the field module was going to do.      // Do what the field module was going to do.
41      $item['#delta'] = !empty($values->{$this->table_alias . '_delta'}) ? $values->{$this->table_alias . '_delta'} : 0;      $item['#delta'] = !empty($values->{$this->table_alias . '_delta'}) ? $values->{$this->table_alias . '_delta'} : 0;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2