home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (views_handler_filter_float.inc)

This example Drupal source code file (views_handler_filter_float.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

between, class, else, extends, field, function, if, op_between, op_simple, or, php, views_handler_filter_float, views_handler_filter_numeric

The views_handler_filter_float.inc Drupal example source code

<?php
// $Id: views_handler_filter_float.inc,v 1.1 2009/03/25 17:29:33 merlinofchaos Exp $

/**
 * Simple filter to handle greater than/less than filters.
 * It based on views_handler_filter_numeric but deals with
 * float numbers.
 */
class views_handler_filter_float extends views_handler_filter_numeric {
  function op_between($field) {
    if ($this->operator == 'between') {
      $this->query->add_where($this->options['group'], "$field >= %f", $this->value['min']);
      $this->query->add_where($this->options['group'], "$field <= %f", $this->value['max']);
    }
    else {
      $this->query->add_where($this->options['group'], "$field <= %f OR $field >= %f", $this->value['min'], $this->value['max']);
    }
  }

  function op_simple($field) {
    $this->query->add_where($this->options['group'], "$field $this->operator %f", $this->value['value']);
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal views_handler_filter_float.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.