1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_filter_node_version_count.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Filter to handle dates stored as a timestamp.
|
10
|
*
|
11
|
* @ingroup views_filter_handlers
|
12
|
*/
|
13
|
class views_handler_filter_node_version_count extends views_handler_filter_numeric {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function op_between($field) {
|
19
|
if ($this->operator == 'between') {
|
20
|
$this->query->add_where_expression($this->options['group'], '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) BETWEEN :min AND :max', array(':min' => $this->value['min'], ':max' => $this->value['max']));
|
21
|
}
|
22
|
else {
|
23
|
$this->query->add_where_expression($this->options['group'], '((SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) <= :min OR (SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) >= :max)', array(':min' => $this->value['min'], ':max' => $this->value['max']));
|
24
|
}
|
25
|
}
|
26
|
|
27
|
/**
|
28
|
* {@inheritdoc}
|
29
|
*/
|
30
|
public function op_simple($field) {
|
31
|
$this->query->add_where_expression($this->options['group'], '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid)' . $this->operator . ' :value', array(':value' => $this->value['value']));
|
32
|
}
|
33
|
|
34
|
/**
|
35
|
* {@inheritdoc}
|
36
|
*/
|
37
|
public function op_empty($field) {
|
38
|
if ($this->operator == 'empty') {
|
39
|
$operator = "IS NULL";
|
40
|
}
|
41
|
else {
|
42
|
$operator = "IS NOT NULL";
|
43
|
}
|
44
|
|
45
|
$this->query->add_where_expression($this->options['group'], '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) ' . $this->operator);
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* {@inheritdoc}
|
50
|
*/
|
51
|
public function op_regex($field) {
|
52
|
$this->query->add_where_expression($this->options['group'], '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) RLIKE :value', array(':value' => $this->value['value']));
|
53
|
}
|
54
|
|
55
|
}
|