You are here

class smart_ip_views_bridge_openlayers_proximity_handler_filter_circle in Smart IP 6

Same name and namespace in other branches
  1. 6.2 modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc \smart_ip_views_bridge_openlayers_proximity_handler_filter_circle
  2. 7.2 modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc \smart_ip_views_bridge_openlayers_proximity_handler_filter_circle

Hierarchy

Expanded class hierarchy of smart_ip_views_bridge_openlayers_proximity_handler_filter_circle

3 string references to 'smart_ip_views_bridge_openlayers_proximity_handler_filter_circle'
smart_ip_views_bridge_openlayers_proximity_handler_field::options_form in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_field.inc
Basic options for all sort criteria
smart_ip_views_bridge_openlayers_proximity_handler_sort::options_form in modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_sort.inc
Basic options for all sort criteria
smart_ip_views_bridge_views_data in modules/smart_ip_views_bridge/views/smart_ip_views_bridge.views.inc
Implements hook_views_data().

File

modules/smart_ip_views_bridge/views/smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc, line 3

View source
class smart_ip_views_bridge_openlayers_proximity_handler_filter_circle extends openlayers_proximity_handler_filter_circle {

  /**
   * Process operator.
   */
  function op_process($op = 'simple', $field) {
    if (isset($this->view->exposed_input) && !empty($this->view->exposed_input)) {
      $exposed_input = $this->view->exposed_input['circle']['location'];
      $this->options['value']['location'] = $exposed_input;
      foreach ($this->value as $key => $value) {
        if (is_numeric($key)) {
          $this->value[$key]['location'] = $exposed_input;
        }
        elseif ($key == 'location') {
          $this->value['location'] = $exposed_input;
        }
      }
    }
    else {
      $token = $this->options['value']['location'];
      smart_ip_views_bridge_substitute_token_value($this->options['value']['location'], $token);
      foreach ($this->value as $key => $value) {
        if (is_numeric($key)) {
          smart_ip_views_bridge_substitute_token_value($this->value[$key]['location'], $token);
        }
        elseif ($key == 'location') {
          smart_ip_views_bridge_substitute_token_value($this->value['location'], $token);
        }
      }
    }
    $this->table_alias = 'openlayers_proximity';
    parent::op_process($op, $field);
  }

  /**
   * Provide a simple textfield for equality
   */
  function value_form(&$form, &$form_state) {
    parent::value_form($form, $form_state);

    // Add description showing Smart IP tokens
    $form['value']['location']['#description'] .= smart_ip_views_bridge_form_fields_description();
  }

  /**
   * Render our chunk of the exposed filter form when selecting
   */
  function exposed_form(&$form, &$form_state) {
    parent::exposed_form($form, $form_state);
    if (isset($this->view->exposed_input) && empty($this->view->exposed_input)) {

      // Replace field value with the query input
      $token = $form['circle']['location']['#default_value'];
      smart_ip_views_bridge_substitute_token_value($form['circle']['location']['#default_value'], $token);
      smart_ip_views_bridge_substitute_token_value($form['circle']['location']['#value'], $token);
    }
  }

}

Members