1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Contains the flagged content filter handler.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Handler to filter for content that has not been flagged.
|
10 |
|
|
*
|
11 |
|
|
* @ingroup views
|
12 |
|
|
*/
|
13 |
|
|
class flag_handler_filter_flagged extends views_handler_filter_boolean_operator {
|
14 |
|
|
function option_definition() {
|
15 |
|
|
$options = parent::option_definition();
|
16 |
|
|
$options['value'] = array('default' => 1);
|
17 |
|
|
return $options;
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
function options_form(&$form, &$form_state) {
|
21 |
|
|
parent::options_form($form, $form_state);
|
22 |
|
|
$form['value']['#type'] = 'radios';
|
23 |
|
|
$form['value']['#title'] = t('Status');
|
24 |
76e2e7c3
|
Assos Assos
|
$form['value']['#options'] = array(
|
25 |
|
|
1 => t('Flagged'),
|
26 |
|
|
0 => t('Not flagged'),
|
27 |
|
|
'All' => t('All'),
|
28 |
|
|
);
|
29 |
85ad3d82
|
Assos Assos
|
$form['value']['#default_value'] = empty($this->options['value']) ? '0' : $this->options['value'];
|
30 |
|
|
$form['value']['#description'] = '<p>' . t('This filter is only needed if the relationship used has the "Include only flagged content" option <strong>unchecked</strong>. Otherwise, this filter is useless, because all records are already limited to flagged content.') . '</p><p>' . t('By choosing <em>Not flagged</em>, it is possible to create a list of content <a href="@unflagged-url">that is specifically not flagged</a>.', array('@unflagged-url' => 'http://drupal.org/node/299335')) . '</p>';
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
function query() {
|
34 |
|
|
$operator = $this->value ? 'IS NOT' : 'IS';
|
35 |
|
|
$this->query->add_where($this->options['group'], $this->relationship . '.uid', NULL, $operator . ' NULL');
|
36 |
|
|
}
|
37 |
|
|
} |