summaryrefslogtreecommitdiffstats
path: root/library/Poolctrl/Validator/DateGreaterThan.php
diff options
context:
space:
mode:
authorBjörn Geiger2011-10-24 13:30:25 +0200
committerBjörn Geiger2011-10-24 13:30:25 +0200
commit015cc65efb99d98b5cebc021db50b15ece92e41c (patch)
treeebc5640c01843bac8bd250d19b0e529e3d032abc /library/Poolctrl/Validator/DateGreaterThan.php
parentMinor (diff)
downloadpoolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.tar.gz
poolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.tar.xz
poolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.zip
weitere korrektur
Diffstat (limited to 'library/Poolctrl/Validator/DateGreaterThan.php')
-rwxr-xr-xlibrary/Poolctrl/Validator/DateGreaterThan.php108
1 files changed, 0 insertions, 108 deletions
diff --git a/library/Poolctrl/Validator/DateGreaterThan.php b/library/Poolctrl/Validator/DateGreaterThan.php
deleted file mode 100755
index d7be22d..0000000
--- a/library/Poolctrl/Validator/DateGreaterThan.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-require_once 'Zend/Validate/Abstract.php';
-
-class Poolctrl_Validate_DateGreaterThan extends Zend_Validate_Abstract
-{
- const NOT_GREATER = 'notGreaterThan';
-
- protected $_messageTemplates = array(
- self::NOT_GREATER => "Value must be set to a date later than %compare% date",
- );
-
- protected $_messageVariables = array(
- 'element' => '_element',
- 'compare' => '_compare',
- );
-
- protected $_element;
- protected $_compare;
- protected $_min;
- protected $_minTimestamp;
-
- public function __construct($option)
- {
- if ($option instanceof Zend_Config) {
- $option = $option->toArray();
- }
-
- if (is_array($option)) {
- if (array_key_exists('min', $option)) {
- $min = $option['min'];
- $minTimestamp = strtotime($min);
- } else {
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception("Missing option 'min'");
- }
- if (array_key_exists('element', $option)) {
- $element = $option['element'];
- } else {
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception("Missing option 'element'");
- }
- if (array_key_exists('compare', $option)) {
- $compare = $option['compare'];
- } else {
- require_once 'Zend/Validate/Exception.php';
- throw new Zend_Validate_Exception("Missing option 'compare'");
- }
- }
-
- $this->setElement($element);
- $this->setCompare($compare);
- $this->setMin($min);
- $this->setMinTimestamp($minTimestamp);
- }
-
- public function getElement()
- {
- return $this->_element;
- }
-
- public function setElement($element)
- {
- $this->_element = $element;
- }
-
- public function getCompare()
- {
- return $this->_compare;
- }
-
- public function setCompare($compare)
- {
- $this->_compare = $compare;
- }
-
- public function getMin()
- {
- return $this->_min;
- }
-
- public function setMin($min)
- {
- $this->_min = $min;
- return $this;
- }
-
- public function getMinTimestamp()
- {
- return $this->_minTimestamp;
- }
-
- public function setMinTimestamp($minTimestamp)
- {
- $this->_minTimestamp = $minTimestamp;
- }
-
- public function isValid($value)
- {
- $this->_setValue($value);
- $valueTimestamp = strtotime($value);
-
- if ($this->getMinTimestamp() >= $valueTimestamp) {
- $this->_error(self::NOT_GREATER);
- return false;
- }
- return true;
- }
-} \ No newline at end of file