예제 #1
0
파일: ErrorsTest.php 프로젝트: lortnus/zf1
 public function setupElement()
 {
     $element = new Zend_Form_Element('foo');
     $element->addValidator('Alnum')->addValidator('Alpha')->setView($this->getView());
     $element->isValid('abc-123');
     $this->element = $element;
     $this->decorator->setElement($element);
 }
예제 #2
0
파일: Element.php 프로젝트: highhair20/glo
 public function isValid($value, $context = null)
 {
     if ($this->isRequired()) {
         if (!array_key_exists($this->getName(), $context)) {
             throw new Glo_Exception_MissingParameter($this->getName() . " is a required parameter");
         } elseif (!$value) {
             throw new Glo_Exception_BadData($this->getName() . " cannot be null");
         }
     }
     return parent::isValid($value, $context);
 }
예제 #3
0
 public function isValid($value, $context = null)
 {
     $result = parent::isValid($value, $context);
     if ($result) {
         $_ranges = $this->getValue();
         if (is_array($_ranges)) {
             $dateRange_validator = new Cible_Validate_DateRange('YY-mm-dd');
             $dateRange_validator->setMessages(array('dateNotYYYY-MM-DD' => Cible_Translation::getCibleText('validation_message_invalid_date_format'), 'endDateEarlier' => Cible_Translation::getCibleText('validation_message_endDate_earlier')));
             foreach ($_ranges as $_range) {
                 if (!$dateRange_validator->isValid($_range)) {
                     $this->addErrorMessages($dateRange_validator->getMessages());
                     $result = false;
                 }
             }
         }
         $errors = $this->getErrorMessages();
         $this->setErrorMessages(array_unique($errors));
     }
     return $result;
 }
예제 #4
0
 public function isValid($value, $context = null)
 {
     return Zend_Form_Element::isValid($value, $context);
 }