views_handler_sort_group_by_numeric.inc

Definition of views_handler_sort_group_by_numeric.

File

handlers/views_handler_sort_group_by_numeric.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_sort_group_by_numeric.
  5. */
  6. /**
  7. * Handler for GROUP BY on simple numeric fields.
  8. *
  9. * @ingroup views_sort_handlers
  10. */
  11. class views_handler_sort_group_by_numeric extends views_handler_sort {
  12. function init(&$view, &$options) {
  13. parent::init($view, $options);
  14. // Initialize the original handler.
  15. $this->handler = views_get_handler($options['table'], $options['field'], 'sort');
  16. $this->handler->init($view, $options);
  17. }
  18. /**
  19. * Called to add the field to a query.
  20. */
  21. function query() {
  22. $this->ensure_my_table();
  23. $params = array(
  24. 'function' => $this->options['group_type'],
  25. );
  26. $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params);
  27. }
  28. function ui_name($short = FALSE) {
  29. return $this->get_field(parent::ui_name($short));
  30. }
  31. }