| 1 |
<?php
|
| 2 |
// $Id: country_code_handler_filter_node_country_current.inc,v 1.4 2008/10/23 09:14:56 snpower Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Implementation of a views current country filter for the country code module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Filter by country.
|
| 11 |
*/
|
| 12 |
class country_code_handler_filter_node_country_current extends views_handler_filter {
|
| 13 |
|
| 14 |
function query() {
|
| 15 |
$this->ensure_my_table();
|
| 16 |
|
| 17 |
$definition = array(
|
| 18 |
'table' => 'node',
|
| 19 |
'field' => 'tnid',
|
| 20 |
'left_table' => 'node',
|
| 21 |
'left_field' => 'tnid',
|
| 22 |
'extra' => array(
|
| 23 |
array(
|
| 24 |
'field' => 'language',
|
| 25 |
'value' => '***CURRENT_LANGUAGE***',
|
| 26 |
),
|
| 27 |
),
|
| 28 |
);
|
| 29 |
|
| 30 |
$join = new views_join();
|
| 31 |
$join->definition = $definition;
|
| 32 |
$join->construct();
|
| 33 |
|
| 34 |
$alias = $this->query->add_table('node', NULL, $join);
|
| 35 |
$this->query->add_where($this->options['group'], "$this->table_alias.language =
|
| 36 |
'%s' OR ($this->table_alias.language =
|
| 37 |
'%s' AND $alias.nid IS NULL)", array('***CURRENT_LANGUAGE***', '***COUNTRY_CODE_LANGUAGE***'));
|
| 38 |
}
|
| 39 |
|
| 40 |
}
|