16 import(
'lib.pkp.classes.form.validation.FormValidator');
34 function __construct(&$form, $field, $type, $message, $fields = array()) {
35 parent::__construct($form, $field, $type, $message);
36 $this->_fields = $fields;
37 $this->_errorFields = array();
62 if ($this->
getType() == FORM_VALIDATOR_OPTIONAL_VALUE)
return true;
65 if (!is_array($data))
return false;
68 foreach ($data as $key => $value) {
69 if (count($this->_fields) == 0) {
71 if (is_null($value) || trim((
string)$value) ==
'') {
73 array_push($this->_errorFields, $this->
getField().
"[{$key}]");
77 if (!is_array($value)) {
79 array_push($this->_errorFields, $this->
getField().
"[{$key}]");
84 foreach ($this->_fields as $field) {
85 if (!isset($value[$field]) || trim((
string)$value[$field]) ==
'') {
87 array_push($this->_errorFields, $this->
getField().
"[{$key}][{$field}]");