Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/comment/views_handler_sort_ncs_last_comment_name.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Sort handler to sort by last comment name which might be in 2 different |
|
10 |
* fields. |
|
9 |
* Sort by last comment name, which might be in two different fields. |
|
11 | 10 |
* |
12 | 11 |
* @ingroup views_sort_handlers |
13 | 12 |
*/ |
14 | 13 |
class views_handler_sort_ncs_last_comment_name extends views_handler_sort { |
15 |
function query() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function query() { |
|
16 | 19 |
$this->ensure_my_table(); |
17 | 20 |
$join = new views_join(); |
18 | 21 |
$join->construct('users', $this->table_alias, 'last_comment_uid', 'uid'); |
19 | 22 |
|
20 |
// @todo this might be safer if we had an ensure_relationship rather than guessing |
|
21 |
// the table alias. Though if we did that we'd be guessing the relationship name |
|
22 |
// so that doesn't matter that much. |
|
23 |
// $this->user_table = $this->query->add_relationship(NULL, $join, 'users', $this->relationship); |
|
23 |
// @todo This might be safer if we had an ensure_relationship rather than |
|
24 |
// guessing the table alias. Though if we did that we'd be guessing the |
|
25 |
// relationship name so that doesn't matter that much. |
|
26 |
// $this->user_table = $this->query |
|
27 |
// ->add_relationship(NULL, $join, 'users', $this->relationship); |
|
24 | 28 |
$this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join); |
25 | 29 |
$this->user_field = $this->query->add_field($this->user_table, 'name'); |
26 | 30 |
|
27 | 31 |
// Add the field. |
28 | 32 |
$this->query->add_orderby(NULL, "LOWER(COALESCE($this->user_table.name, $this->table_alias.$this->field))", $this->options['order'], $this->table_alias . '_' . $this->field); |
29 | 33 |
} |
34 |
|
|
30 | 35 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules