You are here

class views_contextual_filters_or_query in Views Contextual Filters OR 7

Object used to create a SELECT query.

Hierarchy

Expanded class hierarchy of views_contextual_filters_or_query

2 string references to 'views_contextual_filters_or_query'
views_contextual_filters_or_views_plugins_alter in ./views_contextual_filters_or.views.inc
Implements hook_views_plugins_alter().
views_contextual_filters_or_views_preview_info_alter in ./views_contextual_filters_or.module
Implements hook_views_preview_info_alter().

File

plugins/views_contextual_filters_or_query.inc, line 11
Defines the alter query object.

View source
class views_contextual_filters_or_query extends views_plugin_query_default {
  function option_definition() {
    $options = parent::option_definition();
    $options['contextual_filters_or'] = array(
      'default' => FALSE,
      'translatable' => FALSE,
      'bool' => TRUE,
    );
    return $options;
  }

  /**
   * Add settings for the ui.
   */
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['contextual_filters_or'] = array(
      '#title' => t('Contextual filters OR'),
      '#description' => t('Contextual filters applied to OR logic.'),
      '#type' => 'checkbox',
      '#default_value' => !empty($this->options['contextual_filters_or']),
    );
  }

  /**
   * Add a simple WHERE clause to the query. The caller is responsible for
   * ensuring that all fields are fully qualified (TABLE.FIELD) and that
   * the table already exists in the query.
   */
  function add_where($group, $field, $value = NULL, $operator = NULL) {
    parent::add_where($group, $field, $value, $operator);

    // Check for a group.
    if ($group === 0 && isset($this->where[$group])) {
      $op = $this->options['contextual_filters_or'] ? 'OR' : 'AND';
      $this
        ->set_where_group($op, $group);
    }
  }

  /**
   * Add a complex WHERE clause to the query.
   */
  function add_where_expression($group, $snippet, $args = array()) {
    parent::add_where_expression($group, $snippet, $args);

    // Check for a group.
    if ($group === 0 && isset($this->where[$group])) {
      $op = $this->options['contextual_filters_or'] ? 'OR' : 'AND';
      $this
        ->set_where_group($op, $group);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_contextual_filters_or_query::add_where function Add a simple WHERE clause to the query. The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table already exists in the query. Overrides views_plugin_query_default::add_where
views_contextual_filters_or_query::add_where_expression function Add a complex WHERE clause to the query. Overrides views_plugin_query_default::add_where_expression
views_contextual_filters_or_query::options_form function Add settings for the ui. Overrides views_plugin_query_default::options_form
views_contextual_filters_or_query::option_definition function Information about options for all kinds of purposes will be held here. Overrides views_plugin_query_default::option_definition
views_object::$definition public property Handler's definition.
views_object::$options public property Except for displays, options for the object will be held here. 1
views_object::altered_option_definition function Collect this handler's option definition and alter them, ready for use.
views_object::construct public function Views handlers use a special construct function. 4
views_object::destroy public function Destructor. 2
views_object::export_option public function 1
views_object::export_options public function
views_object::export_option_always public function Always exports the option, regardless of the default value.
views_object::options Deprecated public function Set default options on this object. 1
views_object::set_default_options public function Set default options.
views_object::set_definition public function Let the handler know what its full definition is.
views_object::unpack_options public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable public function Unpack a single option definition.
views_object::unpack_translatables public function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults public function
views_plugin::$display public property The current used views display.
views_plugin::$plugin_name public property The plugin name of this plugin, for example table or full.
views_plugin::$plugin_type public property The plugin type of this plugin, for example style or query.
views_plugin::$view public property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions public function Provide a list of additional theme functions for the theme info page.
views_plugin::plugin_title public function Return the human readable name of the display.
views_plugin::theme_functions public function Provide a full list of possible theme templates used by this style.
views_plugin::validate public function Validate that the plugin is correct and can be saved. 3
views_plugin_query::options_validate public function Validate the options form. Overrides views_plugin::options_validate
views_plugin_query::render_pager public function Render the pager, if necessary.
views_plugin_query::set_group_operator public function Control how all WHERE and HAVING groups are put together.
views_plugin_query::set_limit public function Set a LIMIT on the query, specifying a maximum number of results.
views_plugin_query::set_offset public function Set an OFFSET on the query, specifying a number of results to skip
views_plugin_query::set_where_group public function Create a new grouping for the WHERE or HAVING clause.
views_plugin_query::summary_title public function Returns the summary of the settings in the display. Overrides views_plugin::summary_title
views_plugin_query_default::$distinct public property A flag as to whether or not to make the primary field distinct.
views_plugin_query_default::$fields public property An array of fields.
views_plugin_query_default::$field_aliases public property An array mapping table aliases and field names to field aliases.
views_plugin_query_default::$get_count_optimized public property Should this query be optimized for counts, for example no sorts.
views_plugin_query_default::$groupby public property A simple array of group by clauses.
views_plugin_query_default::$group_operator public property The default operator to use when connecting the WHERE groups. May be AND or OR.
views_plugin_query_default::$has_aggregate public property
views_plugin_query_default::$having public property An array of sections of the HAVING query. Each section is in itself an array of pieces and a flag as to whether or not it should be AND or OR.
views_plugin_query_default::$header public property The table header to use for tablesort. This matters because tablesort needs to modify the query and needs the header.
views_plugin_query_default::$no_distinct public property Is the view marked as not distinct.
views_plugin_query_default::$orderby public property A simple array of order by clauses.
views_plugin_query_default::$pager public property The current used pager plugin. Overrides views_plugin_query::$pager
views_plugin_query_default::$pure_distinct public property Defines the distinct type.
views_plugin_query_default::$relationships public property Holds an array of relationships, which are aliases of the primary table that represent different ways to join the same table in.
views_plugin_query_default::$tables public property Holds an array of tables and counts added so that we can create aliases.
views_plugin_query_default::$table_queue public property A list of tables in the order they should be added, keyed by alias.
views_plugin_query_default::$tags public property Query tags which will be passed over to the dbtng query object.
views_plugin_query_default::$where public property An array of sections of the WHERE query. Each section is in itself an array of pieces and a flag as to whether or not it should be AND or OR.
views_plugin_query_default::add_field public function Add a field to the query table, possibly with an alias. This will automatically call ensure_table to make sure the required table exists, *unless* $table is unset.
views_plugin_query_default::add_groupby public function Add a simple GROUP BY clause to the query.
views_plugin_query_default::add_having public function Add a simple HAVING clause to the query.
views_plugin_query_default::add_having_expression public function Add a complex HAVING clause to the query.
views_plugin_query_default::add_orderby public function Add an ORDER BY clause to the query.
views_plugin_query_default::add_relationship public function A relationship is an alternative endpoint to a series of table joins.
views_plugin_query_default::add_signature public function Add a signature to the query, if such a thing is feasible. Overrides views_plugin_query::add_signature
views_plugin_query_default::add_table public function Add a table to the query, ensuring the path exists.
views_plugin_query_default::add_tag public function Adds a query tag to the sql object.
views_plugin_query_default::adjust_join public function Fix a join to adhere to the proper relationship.
views_plugin_query_default::alter public function Let modules modify the query just prior to finalizing it. Overrides views_plugin_query::alter
views_plugin_query_default::build public function Builds the necessary info to execute the query. Overrides views_plugin_query::build
views_plugin_query_default::build_condition public function Construct the "WHERE" or "HAVING" part of the query.
views_plugin_query_default::clear_fields public function Remove all fields that may've been added.
views_plugin_query_default::compile_fields public function Build fields array.
views_plugin_query_default::ensure_path public function Make sure that the specified table can be properly linked to the primary table in the JOINs. This function uses recursion. If the tables needed to complete the path back to the primary table are not in the query they will be added, but additional…
views_plugin_query_default::ensure_table public function Ensure a table exists in the queue; if it already exists it won't do anything, but if it doesn't it will add the table queue. It will ensure a path leads back to the relationship table.
views_plugin_query_default::execute public function Executes the query and fills the associated view object with according values. Overrides views_plugin_query::execute
views_plugin_query_default::get_aggregation_info public function Get aggregation info for group by queries. Overrides views_plugin_query::get_aggregation_info
views_plugin_query_default::get_field_alias public function Returns the alias for the given field added to $table.
views_plugin_query_default::get_join_data public function Retrieve join data from the larger join data cache.
views_plugin_query_default::get_result_entities public function Returns the according entity objects for the given query results. Overrides views_plugin_query::get_result_entities
views_plugin_query_default::get_table_info public function Get the information associated with a table.
views_plugin_query_default::get_where_args public function Get the arguments attached to the WHERE and HAVING clauses of this query.
views_plugin_query_default::init public function Constructor; Create the basic query object and fill with default values. Overrides views_plugin_query::init
views_plugin_query_default::mark_table public function
views_plugin_query_default::options_submit public function Special submit handling. Overrides views_plugin_query::options_submit
views_plugin_query_default::placeholder public function Generates a unique placeholder used in the db query.
views_plugin_query_default::query public function Generate a query and a countquery from all of the information supplied to the object. Overrides views_plugin_query::query
views_plugin_query_default::queue_table public function Add a table to the query without ensuring the path.
views_plugin_query_default::set_count_field public function Set what field the query will count() on for paging.
views_plugin_query_default::set_distinct public function Set the view to be distinct.
views_plugin_query_default::set_header public function Set the table header.