Projet

Général

Profil

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

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

1
<?php
2

    
3
/**
4
 * @file
5
 * Contains .
6
 */
7

    
8
/**
9
 * Argument handler to accept a user id.
10
 *
11
 * @ingroup views_argument_handlers
12
 */
13
class views_handler_argument_user_uid extends views_handler_argument_numeric {
14

    
15
  /**
16
   * Override the behavior of title(). Get the name of the user.
17
   *
18
   * @return array
19
   *    A list of usernames.
20
   */
21
  public function title_query() {
22
    if (!$this->argument) {
23
      return array(variable_get('anonymous', t('Anonymous')));
24
    }
25

    
26
    $titles = array();
27

    
28
    $result = db_query("SELECT u.name FROM {users} u WHERE u.uid IN (:uids)", array(':uids' => $this->value));
29
    foreach ($result as $term) {
30
      $titles[] = check_plain($term->name);
31
    }
32
    return $titles;
33
  }
34

    
35
}