| 1 |
<?php
|
| 2 |
// $Id: views_handler_filter_boolean_operator_string.inc,v 1.1 2008/12/16 19:12:27 merlinofchaos Exp $
|
| 3 |
/**
|
| 4 |
* Simple filter to handle matching of boolean values.
|
| 5 |
*
|
| 6 |
* This handler checks to see if a string field is empty (equal to '') or not.
|
| 7 |
* It is otherwise identical to the parent operator.
|
| 8 |
*
|
| 9 |
* Definition items:
|
| 10 |
* - label: (REQUIRED) The label for the checkbox.
|
| 11 |
*/
|
| 12 |
class views_handler_filter_boolean_operator_string extends views_handler_filter_boolean_operator {
|
| 13 |
function query() {
|
| 14 |
$this->ensure_my_table();
|
| 15 |
$where = "$this->table_alias.$this->real_field ";
|
| 16 |
|
| 17 |
if (empty($this->value)) {
|
| 18 |
$where .= "= ''";
|
| 19 |
if ($this->accept_null) {
|
| 20 |
$where = '(' . $where . " OR $this->table_alias.$this->real_field IS NULL)";
|
| 21 |
}
|
| 22 |
}
|
| 23 |
else {
|
| 24 |
$where .= "<> ''";
|
| 25 |
}
|
| 26 |
$this->query->add_where($this->options['group'], $where);
|
| 27 |
}
|
| 28 |
}
|