add value to filter
This commit is contained in:
@ -7,10 +7,12 @@ abstract class Filter
|
||||
public string $html = '';
|
||||
public string|array $param;
|
||||
public string $name;
|
||||
public string $value;
|
||||
public function __construct(array $source)
|
||||
{
|
||||
$this->param = $source['param'] ?? '';
|
||||
$this->name = $source['name'];
|
||||
$this->value = $source['value'] ?? '';
|
||||
}
|
||||
|
||||
abstract public function fetch();
|
||||
|
@ -9,6 +9,6 @@ class InputFilter extends Filter
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
return "<td><input type='$this->param' name='$this->name'></td>";
|
||||
return "<td><input type='$this->param' name='$this->name' value ='$this->value'></td>";
|
||||
}
|
||||
}
|
@ -11,9 +11,13 @@ class SelectFilter extends Filter
|
||||
{
|
||||
$this->html = "<td><select name='$this->name'>";
|
||||
foreach ($this->param as $value) {
|
||||
$this->html .= "<option value='$value'>$value</option>";
|
||||
if ($value === $this->value) {
|
||||
$this->html .= "<option value='$value' selected>$value</option>";
|
||||
} else {
|
||||
$this->html .= "<option value='$value'>$value</option>";
|
||||
}
|
||||
}
|
||||
$this->html .= "</select></td>";
|
||||
$this->html .= "value='$this->value'</select></td>";
|
||||
return $this->html;
|
||||
}
|
||||
}
|
@ -286,7 +286,8 @@ class ListJsonTable extends JasonTable
|
||||
$filter = $this->getCurrentFilter($key);
|
||||
$class = new $filter['class']([
|
||||
'param' => $filter['param'],
|
||||
'name' => $key
|
||||
'name' => $key,
|
||||
'value' => $filter['value']
|
||||
]);
|
||||
$this->html .= $class->fetch();
|
||||
}
|
||||
|
Reference in New Issue
Block a user