00001 <?php 00002 00015 // $Id: FormValidatorLocale.inc.php,v 1.4 2008/07/01 01:16:09 asmecher Exp $ 00016 00017 00018 class FormValidatorLocale extends FormValidator { 00024 function isValid() { 00025 $primaryLocale = Locale::getPrimaryLocale(); 00026 $value = $this->form->getData($this->field); 00027 return $this->type == 'optional' || (is_array($value) && !empty($value[$primaryLocale])); 00028 } 00029 00034 function isEmptyAndOptional() { 00035 $value = $this->form->getData($this->field); 00036 return $this->type == 'optional' && empty($value); 00037 } 00038 00043 function getField() { 00044 return $this->field; 00045 } 00046 00051 function getMessage() { 00052 $primaryLocale = Locale::getPrimaryLocale(); 00053 $allLocales = Locale::getAllLocales(); 00054 return parent::getMessage() . ' (' . $allLocales[$primaryLocale] . ')'; 00055 } 00056 00057 } 00058 00059 ?>
1.5.6