Projet

Général

Profil

Paste
Télécharger (876 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / user / views_handler_filter_user_current.inc @ 4003efde

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_filter_user_current.
6
 */
7

    
8
/**
9
 * Filter handler for the current user.
10
 *
11
 * @ingroup views_filter_handlers
12
 */
13
class views_handler_filter_user_current extends views_handler_filter_boolean_operator {
14

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function construct() {
19
    parent::construct();
20
    $this->value_value = t('Is the logged in user');
21
  }
22

    
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function query() {
27
    $this->ensure_my_table();
28

    
29
    $field = $this->table_alias . '.' . $this->real_field . ' ';
30
    $or = db_or();
31

    
32
    if (empty($this->value)) {
33
      $or->condition($field, '***CURRENT_USER***', '<>');
34
      if ($this->accept_null) {
35
        $or->isNull($field);
36
      }
37
    }
38
    else {
39
      $or->condition($field, '***CURRENT_USER***', '=');
40
    }
41
    $this->query->add_where($this->options['group'], $or);
42
  }
43

    
44
}