Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Validate/GreaterThan.php
Go to the documentation of this file.
00001 <?php
00025 require_once 'Zend/Validate/Abstract.php';
00026 
00033 class Zend_Validate_GreaterThan extends Zend_Validate_Abstract
00034 {
00035 
00036     const NOT_GREATER = 'notGreaterThan';
00037 
00041     protected $_messageTemplates = array(
00042         self::NOT_GREATER => "'%value%' is not greater than '%min%'",
00043     );
00044 
00048     protected $_messageVariables = array(
00049         'min' => '_min'
00050     );
00051 
00057     protected $_min;
00058 
00065     public function __construct($min)
00066     {
00067         if ($min instanceof Zend_Config) {
00068             $min = $min->toArray();
00069         }
00070 
00071         if (is_array($min)) {
00072             if (array_key_exists('min', $min)) {
00073                 $min = $min['min'];
00074             } else {
00075                 require_once 'Zend/Validate/Exception.php';
00076                 throw new Zend_Validate_Exception("Missing option 'min'");
00077             }
00078         }
00079 
00080         $this->setMin($min);
00081     }
00082 
00088     public function getMin()
00089     {
00090         return $this->_min;
00091     }
00092 
00099     public function setMin($min)
00100     {
00101         $this->_min = $min;
00102         return $this;
00103     }
00104 
00113     public function isValid($value)
00114     {
00115         $this->_setValue($value);
00116 
00117         if ($this->_min >= $value) {
00118             $this->_error(self::NOT_GREATER);
00119             return false;
00120         }
00121         return true;
00122     }
00123 
00124 }
 All Data Structures Namespaces Files Functions Variables Enumerations