public function filteringData($data, $filters) {
$filterData = $data;
foreach ($filterData as $strings => $string) {
foreach ($filters as $filter => $value) {
if (!is_array($value)) { //если не массив, т.е. одиночные значения
if ($string[$filter] != $value) {
unset($filterData[$strings]);
}
} elseif (is_integer($value[0]) and is_integer($value[1]) and count($value) == 2) {//если массив с диапазоном цен
if (!($string[$filter] > $value[0] and $string[$filter] < $value[1])) {
unset($filterData[$strings]);
}
} else {//если массив не с диапазоном цен
if (!in_array($string[$filter], $value)) {
unset($filterData[$strings]);
}
}
}
}
return $filterData;
}
namespace app\models;
use yii\base\Model;
class EntryForm extends Model
{
public $name;
public $email;
public function rules() {
return [
[['name'], 'integer'],
[['email'], 'string'],
[['sizerow'], 'string'],
[['dfgerg'], 'string'],
[['emagergdfgil'], 'string'],
[['emdfgdfgdail'], 'string'],
[['dfgre'], 'string'],
[['gesreg'], 'string'],
[['sgreg'], 'string'],
[['dsfger'], 'string'],
[['gergse'], 'string'],
[['sgreg'], 'string'],
[['dfgr'], 'string'],
[['dgesrg'], 'string'],
[['dfg'], 'string'],
[['emaergil'], 'string'],
[['sgrr'], 'string'],
[['rg'], 'string'],
[['erg'], 'string'],
[['erg'], 'string'],
[['gerg'], 'string'],
[['sgrseg'], 'string'],
[['sgerg'], 'string'],
[['gerg'], 'string'],
[['gegsg'], 'string'],
[['fwerf'], 'string'],
[['greger'], 'string'],
[['egrerg'], 'string'],
[['gergerg'], 'string'],
[['egerge'], 'string'],
];
}
>