Beispiel #1
0
 public static function filterData(&$data, $model)
 {
     if (!empty($data)) {
         $unfilteredColumns = [];
         if (method_exists($model, 'getUnfilteredColumns')) {
             $unfilteredColumns = $model->getUnfilteredColumns();
         }
         $filterParams = AdminHREF::getFilterParams();
         if (!empty($filterParams)) {
             foreach ($filterParams as $filter => $filterValue) {
                 if (!is_array($filterValue)) {
                     $filterValue = [$filterValue];
                 }
                 foreach ($data as $key => $rows) {
                     if (array_key_exists($filter, $rows)) {
                         if (!in_array($rows[$filter], $filterValue)) {
                             unset($data[$key]);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
<?php

$unfiltered = [];
if (method_exists($model, 'getUnfilteredColumns')) {
    $unfiltered = $model->getUnfilteredColumns();
}
if (in_array($key, $unfiltered) || count($values) < 2) {
    echo $key;
} else {
    $prefix = Admin::getConfig('filterQueryPrefix');
    $values = array_unique($values);
    natcasesort($values);
    $values = array_combine(array_values($values), $values);
    $selected = null;
    $filterParams = AdminHREF::getFilterParams();
    if (isset($filterParams[$key])) {
        $selected = $filterParams[$key];
    }
    $attrs = ['multiple' => 'multiple', 'class' => 'sumoselect', 'placeholder' => $key];
    echo Form::select($prefix . AdminHREF::$prefixSeparator . $key . '[]', $values, $selected, $attrs);
}