/[drupal]/contributions/modules/relatedviews/relatedviews.module
ViewVC logotype

Diff of /contributions/modules/relatedviews/relatedviews.module

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

revision 1.4, Wed Dec 19 23:14:11 2007 UTC revision 1.5, Thu Oct 30 01:59:26 2008 UTC
# Line 59  function relatedviews_handler_filter_tax Line 59  function relatedviews_handler_filter_tax
59      $nid = arg(1);      $nid = arg(1);
60    } // if there's an nid to get    } // if there's an nid to get
61    
62      $term = null;
63      $vid = $filter['value'][0];
64    if (!is_null($nid)) {    if (!is_null($nid)) {
     $vid = $filter['value'][0];  
65      $terms = array_keys(taxonomy_node_get_terms_by_vocabulary($nid, $vid));      $terms = array_keys(taxonomy_node_get_terms_by_vocabulary($nid, $vid));
66      $term = $terms[0];      $term = $terms[0];
67      }
68    
69      _views_add_taxonomy($filter['operator'], array($term), $filter['options'], $query);    if (is_null($term)) {
70        if (!empty($filter['options'])) {
71          $terms = taxonomy_get_term_by_name($filter['options']);
72          foreach ($terms as $myterm) {
73              if ($myterm->vid == $vid)
74                  $term = $myterm->tid;
75              break;
76          }
77        } else {
78          // No term and no default = no results.
79          $query->where[] = "0";
80        }
81      }
82    
83      $query->where[] = "node.nid != '%s'";    _views_add_taxonomy($filter['operator'], array($term), 0, $query);
84      $query->where_args[] = $nid;  
85    } // if we've got a node    $query->where[] = "node.nid != '%s'";
86      $query->where_args[] = $nid;
87    
   // if there is no node, the view shouldn't return anything.  
   if (is_null($nid)) {  
     $query->where[] = "0";  
   } // if there is no node  
88  } // function relatedviews_handler_filter_taxcurnode  } // function relatedviews_handler_filter_taxcurnode

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

  ViewVC Help
Powered by ViewVC 1.1.2