public function __construct($mid = 0) { if (ajax && !$mid) { $mid = $_REQUEST['_mid']; } $class_name = table::get_class_from_mid($mid); /** @var \classes\table $class */ $class = new $class_name(); $super_fields = $class->get_fields(); $fields = [form::create('field_boolean', 'deleted')->set_attr('label', 'Show deleted?')->set_attr('options', [25 => 25, 50 => 50, 75 => 75, 100 => 100, 0 => 'All'])->set_attr('required', false), form::create('field_select', 'npp')->set_attr('label', 'Number per page')->set_attr('options', [25 => 25, 50 => 50, 75 => 75, 100 => 100, 0 => 'All'])->set_attr('required', false), form::create('field_int', '_mid')->set_attr('hidden', true)]; /** @var \form\field $field */ foreach ($super_fields as $field) { if ($field->filter) { $field->required = false; $fields[] = $field; } } parent::__construct($fields); /** @var \form\field $field */ foreach ($fields as $field) { if (session::is_set('cms', 'filter', $mid, $field->field_name)) { $this->{$field->field_name} = session::get('cms', 'filter', $mid, $field->field_name); } } $this->id = 'filter_form'; $this->submit = 'Filter'; $this->_mid = $mid; }
public function get_link_module() { if (is_numeric($this->link_module)) { $this->link_module = table::get_class_from_mid($this->link_module); } return $this->link_module; }