Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • AdvancedSearchForm
  • ContentControllerSearchExtension
  • EndsWithFilter
  • ExactMatchFilter
  • ExactMatchMultiFilter
  • FulltextFilter
  • FulltextSearchable
  • GreaterThanFilter
  • LessThanFilter
  • NegationFilter
  • PartialMatchFilter
  • SearchContext
  • SearchFilter
  • SearchForm
  • StartsWithFilter
  • StartsWithMultiFilter
  • SubstringFilter
  • WithinRangeFilter
 1 <?php
 2 /**
 3  * @package sapphire
 4  * @subpackage search
 5  */
 6 
 7 /**
 8  * Incomplete.
 9  * 
10  * @todo add to tests
11  * 
12  * @package sapphire
13  * @subpackage search
14  */
15 class WithinRangeFilter extends SearchFilter {
16     
17     private $min;
18     private $max;
19     
20     function setMin($min) {
21         $this->min = $min;
22     }
23     
24     function setMax($max) {
25         $this->max = $max;
26     }
27     
28     function setValue($val) {
29         if(is_string($val) && strpos($val, ',') !== false) {
30             list($min, $max) = explode(',', $val);
31             $this->setMin($min);
32             $this->setMax($max);
33         }
34         elseif(is_array($val) && array_key_exists('min', $val) && array_key_exists('max', $val)) {
35             $this->setMin($val['min']);
36             $this->setMax($val['max']);
37         } else {
38             $this->setMin($val);
39             $this->setMax($val);
40         }
41         
42     }
43     
44     function apply(SQLQuery $query) {
45         if ($this->min) {
46             $query->where(sprintf(
47                 "%s >= '%s'",
48                 $this->getDbName(),
49                 Convert::raw2sql($this->min)
50             ));
51         }
52         if ($this->max) {
53             $query->where(sprintf(
54                 "%s <= '%s'",
55                 $this->getDbName(),
56                 Convert::raw2sql($this->max)
57             ));
58         }
59     }
60     
61 }
62 
63 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0