25 lines
572 B
PHP
25 lines
572 B
PHP
<?php
|
|
|
|
require_once 'abstract.php';
|
|
|
|
class Rule_Notnull extends Rule_Abstract
|
|
{
|
|
public function getErrorMsg()
|
|
{
|
|
return "Поле не должно быть пустым";
|
|
}
|
|
|
|
public function isValid(Collection $container, $status = null)
|
|
{
|
|
$data = $container->get($this->field);
|
|
if (is_array($data)) {
|
|
foreach($data as $c) {
|
|
if (trim($c) != '') return true;
|
|
}
|
|
return false;
|
|
} else {
|
|
$value = trim($data);
|
|
return $value != '';
|
|
}
|
|
}
|
|
}
|