class chado_views_handler_sort

  1. 3.x tripal_chado/views_handlers/chado_views_handler_sort.inc chado_views_handler_sort
  2. 1.x tripal_views/views/handlers/chado_views_handler_sort.inc chado_views_handler_sort

@file A chado wrapper for the views_handler_sort.

Handles fields which may be aggregated during the chado join process. Sorting of aggregated fields required PostgreSQL 9.0 due to postgresql limitations. Sorting of non-aggregated fields works for all PostgreSQL versions.

Hierarchy

Expanded class hierarchy of chado_views_handler_sort

3 string references to 'chado_views_handler_sort'
tripal_views_get_integration_array_for_chado_table in tripal_views/api/tripal_views.api.inc
Returns the array needed to integrate a given chado table with views
tripal_views_integration_form in tripal_views/includes/tripal_views_integration.inc
Purpose: defines the web form used for specifing the base table, joins and handlers when integrating a table with views. This form is used for both creating a new record and editing an existing record.
tripal_views_views_handlers in tripal_views/tripal_views.views.inc
Implements hook_views_handlers()

File

tripal_views/views/handlers/chado_views_handler_sort.inc, line 11
A chado wrapper for the views_handler_sort.

View source
class chado_views_handler_sort extends views_handler_sort {

  /**
   * Defines the options form (form available to admin when they add a field to a view)
   */
  function options_form(&$form, &$form_state) {

    $form['msg'] = array(
      '#type' => 'item',
      '#value' => '<b>Sorting of aggregated fields only works for PostgreSQL 9.0+. This is due to lack of support at the database level. With lower postgreSQL versions, no sorting is applied.</b>'
    );

    parent::options_form($form, $form_state);
  }

  /**
   * Adds the sort to the query only if the field isn't aggregated
   * If the field is aggregated then the sort has to be applied at the join handler level
   */
  function query() {

    // Determine if the current field is part of an aggregated table
    $table = $this->query->get_table_info($this->table);
    if (preg_match('/aggregator/', $table['join']->definition['handler'])) {
      $this->aggregated = TRUE;
    }
    else {
      $this->aggregated = FALSE;
    }

    // One day when the aggregated sort will work (ie: Postgresql 9.0+)
    // it will need to be applied in join handler
    // thus tell join handler about the sort
    $table['join']->sort[] = array(
      'table' => $table['alias'],
      'field' => $this->options['field'],
      'order' => $this->options['order']
    );


    // if not then add the sort
    if (!$this->aggregated) {
      parent::query();
    }

  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
chado_views_handler_sort::options_form function Defines the options form (form available to admin when they add a field to a view) Overrides views_handler_sort::options_form
chado_views_handler_sort::query function Adds the sort to the query only if the field isn't aggregated If the field is aggregated then the sort has to be applied at the join handler level Overrides views_handler_sort::query
views_handler::accept_exposed_input function Take input from exposed filters and assign to this handler, if necessary.
views_handler::access function Check whether current user has access to this handler.
views_handler::broken function Determine if the handler is considered 'broken', meaning it's a a placeholder used when a handler can't be found.
views_handler::can_expose function Determine if a handler can be exposed.
views_handler::ensure_my_table function Ensure the main table for this handler is in the query. This is used a lot.
views_handler::exposed_form function Render our chunk of the exposed filter form when selecting
views_handler::exposed_info function Get information about the exposed form for the form renderer.
views_handler::exposed_submit function Submit the exposed filter form
views_handler::exposed_validate function Validate the exposed filter form
views_handler::expose_options function Set new exposed option defaults when exposed setting is flipped on.
views_handler::extra_options function Provide defaults for the handler.
views_handler::extra_options_form function Provide a form for setting options.
views_handler::extra_options_submit function Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
views_handler::extra_options_validate function Validate the options form.
views_handler::get_join function Get the join object that should be used for this handler.
views_handler::has_extra_options function If a handler has 'extra options' it will get a little settings widget and another form called extra_options.
views_handler::init function init the handler with necessary data.
views_handler::is_exposed function Determine if this item is 'exposed', meaning it provides form elements to let users modify the view.
views_handler::needs_style_plugin function Determine if the argument needs a style plugin.
views_handler::options_submit function Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
views_handler::options_validate function Validate the options form.
views_handler::pre_query function Run before the view is built.
views_handler::set_relationship function Called just prior to query(), this lets a handler set up any relationship it needs.
views_handler::store_exposed_input function If set to remember exposed input in the session, store it there.
views_handler::ui_name function Return a string representing this handler's name in the UI.
views_handler::validate function Validates the handler against the complete View.
views_handler_sort::admin_summary function Display whether or not the sort order is ascending or descending Overrides views_handler::admin_summary
views_handler_sort::option_definition function Information about options for all kinds of purposes will be held here. Overrides views_object::option_definition
views_object::construct function Views handlers use a special construct function so that we can more easily construct them with variable arguments.
views_object::destroy function
views_object::options function Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility.
views_object::set_default_options function Set default options. For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point.
views_object::set_definition function Let the handler know what its full definition is.
views_object::unpack_options function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::_set_option_defaults function