You are here

public function date_views_filter_handler_simple::init in Date 7.3

Same name and namespace in other branches
  1. 8 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::init()
  2. 7.2 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::init()

Provide some extra help to get the operator/value easier to use.

This likely has to be overridden by filters which are more complex than simple operator/value.

Overrides views_handler_filter::init

1 call to date_views_filter_handler_simple::init()
date_views_filter_handler::init in date_views/includes/date_views_filter_handler.inc
Provide some extra help to get the operator/value easier to use.
1 method overrides date_views_filter_handler_simple::init()
date_views_filter_handler::init in date_views/includes/date_views_filter_handler.inc
Provide some extra help to get the operator/value easier to use.

File

date_views/includes/date_views_filter_handler_simple.inc, line 26
A standard Views filter for a single date field.

Class

date_views_filter_handler_simple
A standard Views filter for a single date field.

Code

public function init(&$view, &$options) {
  parent::init($view, $options);
  module_load_include('inc', 'date_api', 'date_api_sql');
  $this->date_handler = new date_sql_handler(DATE_UNIX);
  if (!empty($this->definition['field_name'])) {
    $field = field_info_field($this->definition['field_name']);
    if (!empty($field) && !empty($field['type'])) {
      $this->date_handler->date_type = $field['type'];
    }
    $this->date_handler->db_timezone = date_get_timezone_db($field['settings']['tz_handling']);
    $this->date_handler->local_timezone = date_get_timezone($field['settings']['tz_handling']);
  }
  $this->form_submitted = FALSE;
  $this->date_handler->granularity = isset($options['granularity']) ? $options['granularity'] : 'day';
  $this->format = $this->date_handler
    ->views_formats($this->options['granularity'], 'sql');

  // Identify the base table for this field. It will be used to call for the
  // right query field options.
  $this->base_table = $this->table;
}