| 1 |
|
<?php |
| 2 |
|
// $Id: views_handler_field.inc,v 1.14.2.20 2009/11/02 23:31:14 merlinofchaos Exp $ |
| 3 |
|
|
| 4 |
|
/** |
| 5 |
|
* Handler for GROUP BY on simple numeric fields. |
| 6 |
|
*/ |
| 7 |
|
class views_handler_field_group_by_numeric extends views_handler_field { |
| 8 |
|
function init(&$view, $options) { |
| 9 |
|
parent::init($view, $options); |
| 10 |
|
|
| 11 |
|
// Initialize the original handler. |
| 12 |
|
$this->handler = views_get_handler($options['table'], $options['field'], 'field'); |
| 13 |
|
$this->handler->init($view, $options); |
| 14 |
|
} |
| 15 |
|
|
| 16 |
|
/** |
| 17 |
|
* Called to add the field to a query. |
| 18 |
|
*/ |
| 19 |
|
function query() { |
| 20 |
|
$this->ensure_my_table(); |
| 21 |
|
// Add the field, taking care of any aggregation that may affect it. |
| 22 |
|
$params = array( |
| 23 |
|
'function' => $this->options['group_type'], |
| 24 |
|
); |
| 25 |
|
|
| 26 |
|
$this->field_alias = $this->query->add_field($this->table_alias, $this->real_field, NULL, $params); |
| 27 |
|
$this->add_additional_fields(); |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
/** |
| 31 |
|
* Called to determine what to tell the clicksorter. |
| 32 |
|
*/ |
| 33 |
|
function click_sort($order) { |
| 34 |
|
$params = array( |
| 35 |
|
'function' => $this->options['group_type'], |
| 36 |
|
); |
| 37 |
|
|
| 38 |
|
$this->query->add_orderby($this->table, $this->field, $order, $this->field_alias, $params); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
function ui_name() { |
| 42 |
|
return $this->get_field(parent::ui_name()); |
| 43 |
|
} |
| 44 |
|
} |