uc_order_handler_filter_order_status.inc 861 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @file
  4. * Views handler.
  5. */
  6. /**
  7. * Filters by order status.
  8. */
  9. class uc_order_handler_filter_order_status extends views_handler_filter_in_operator {
  10. /**
  11. * Overrides views_handler_filter_in_operator::get_value_options().
  12. */
  13. function get_value_options() {
  14. if (!isset($this->value_options)) {
  15. $options['_active'] = t('Active');
  16. foreach (uc_order_status_list() as $status => $name) {
  17. $options[$name['id']] = $name['title'];
  18. }
  19. $this->value_title = t('Order status');
  20. $this->value_options = $options;
  21. }
  22. }
  23. /**
  24. * Overrides views_handler_field::query().
  25. */
  26. function query() {
  27. if (is_array($this->value) && in_array('_active', $this->value)) {
  28. $this->value = array_merge($this->value, array_values(uc_order_status_list('general', TRUE)));
  29. }
  30. parent::query();
  31. }
  32. }