예제 #1
0
 /**
  * Validates the input string.
  *
  * @param Zikula_Form_View $view Reference to Zikula_Form_View object.
  *
  * @return void
  */
 public function validate(Zikula_Form_View $view)
 {
     parent::validate($view);
     if (!$this->isValid) {
         return;
     }
     if (strlen($this->text) > 0) {
         if ($this->includeTime) {
             $dateValue = DateUtil::transformInternalDateTime(DateUtil::parseUIDate($this->text, $this->ifFormat));
         } else {
             $dateValue = DateUtil::transformInternalDate(DateUtil::parseUIDate($this->text, $this->ifFormat));
         }
         if ($dateValue == null) {
             $this->setError(__('Error! Invalid date.'));
         } else {
             // the date validated so we can use the transformed date
             $this->text = $dateValue;
         }
     }
 }