~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to modules/og/modules/og_views/includes/og_views_handler_filter_og_type.inc

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// TODOL: query() does not work.
 
3
class og_views_handler_filter_og_type extends views_handler_filter_node_type {
 
4
  function get_value_options() {
 
5
    if (!isset($this->value_options)) {
 
6
      $this->value_title = t('Group node type');
 
7
      $group_types = og_get_types('group');
 
8
      $types = node_get_types();
 
9
      foreach ($group_types as $group_type) {
 
10
        $options[$group_type] = $types[$group_type]->name;
 
11
      }
 
12
      $this->value_options = $options;
 
13
    }
 
14
  }
 
15
  
 
16
  // This is a copy of views_handler_filter_in_operator::query
 
17
  // We force the table to be 'node' instead of 'og'. There might be cleaner ways to do this.
 
18
  function query() {
 
19
    if (empty($this->value)) {
 
20
      return;
 
21
    }
 
22
    $table = $this->query->ensure_table('node');
 
23
    $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'";
 
24
 
 
25
    $replace = array_fill(0, sizeof($this->value), $placeholder);
 
26
    $in = ' (' . implode(", ", $replace) . ')';
 
27
    $this->query->add_where($this->options['group'], "$table.$this->real_field " . $this->operator . $in, $this->value);
 
28
  } 
 
29
}
 
 
b'\\ No newline at end of file'