Projet

Général

Profil

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

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

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
  function construct() {
15
    parent::construct();
16
    $this->value_value = t('Is the logged in user');
17
  }
18

    
19
  function query() {
20
    $this->ensure_my_table();
21

    
22
    $field = $this->table_alias . '.' . $this->real_field . ' ';
23
    $or = db_or();
24

    
25
    if (empty($this->value)) {
26
      $or->condition($field, '***CURRENT_USER***', '<>');
27
      if ($this->accept_null) {
28
        $or->isNull($field);
29
      }
30
    }
31
    else {
32
      $or->condition($field, '***CURRENT_USER***', '=');
33
    }
34
    $this->query->add_where($this->options['group'], $or);
35
  }
36
}