views_handler_sort_group_by_numeric.inc 949 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. /**
  13. * {@inheritdoc}
  14. */
  15. public function init(&$view, &$options) {
  16. parent::init($view, $options);
  17. // Initialize the original handler.
  18. $this->handler = views_get_handler($options['table'], $options['field'], 'sort');
  19. $this->handler->init($view, $options);
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function query() {
  25. $this->ensure_my_table();
  26. $params = array(
  27. 'function' => $this->options['group_type'],
  28. );
  29. $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params);
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function ui_name($short = FALSE) {
  35. return $this->get_field(parent::ui_name($short));
  36. }
  37. }