summaryrefslogtreecommitdiffstats
path: root/library/Poolctrl/Validator/TitleUnique.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/TitleUnique.php
parentMinor (diff)
downloadpoolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.tar.gz
poolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.tar.xz
poolctrl-015cc65efb99d98b5cebc021db50b15ece92e41c.zip
weitere korrektur
Diffstat (limited to 'library/Poolctrl/Validator/TitleUnique.php')
-rwxr-xr-xlibrary/Poolctrl/Validator/TitleUnique.php57
1 files changed, 0 insertions, 57 deletions
diff --git a/library/Poolctrl/Validator/TitleUnique.php b/library/Poolctrl/Validator/TitleUnique.php
deleted file mode 100755
index f051438..0000000
--- a/library/Poolctrl/Validator/TitleUnique.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-require_once 'Zend/Validate/Abstract.php';
-
-class Poolctrl_Validate_TitleUnique extends Zend_Validate_Abstract
-{
- const NOT_UNIQUE = 'notUnique';
-
- protected $_messageTemplates = array(
- self::NOT_UNIQUE => "Title is already assigned",
- );
-
- public function __construct($option)
- {
- if ($option instanceof Zend_Config) {
- $option = $option->toArray();
- }
-
- if (is_array($option)) {
- if (array_key_exists('title', $option)) {
- $this->oldTitle = $option['title'];
- }
- }
- }
-
- protected $oldTitle;
-
- public function isValid($value)
- {
- $this->_setValue($value);
- if(empty($this->oldTitle)) {
- $eventMapper = new Application_Model_EventMapper();
- $sameEvent = $eventMapper->findBy(array("title" => $value));
-
- if (count($sameEvent) > 0) {
- $this->_error(self::NOT_UNIQUE);
- return false;
- } else {
- return true;
- }
- } else {
- if($this->oldTitle == $value) {
- return true;
- } else {
- $eventMapper = new Application_Model_EventMapper();
- $sameEvent = $eventMapper->findBy(array("title" => $value));
-
- if (count($sameEvent) > 0) {
- $this->_error(self::NOT_UNIQUE);
- return false;
- } else {
- return true;
- }
-
- }
- }
- }
-} \ No newline at end of file