<?php
namespace Modules\Admin\Server\Checks;


class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form for department insert/update.
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$fieldsValues = $this->values['listingParams']->getFilters();

		$form=\Engine\Form\Filters::create();
		$form->setColumns(2);

		// tag filter
		$possibleValues = [
			'EXTENSION' => "EXTENSION",
			'PHP' 		=> "PHP",
			'OS' 		=> "OS",
			'MYSQL' 	=> "MYSQL",
		];
		$tagFilter = new \Engine\Form\Input\Select($this->lang['index']['filters']['tag'], 'filters[tag]', $fieldsValues['tag']);
		$tagFilter->showDefaultOption();
		$tagFilter->setPossibleValues($possibleValues);
		$form->addElement($tagFilter);

		// label filter
		$labelFilter = new \Engine\Form\Input\Text($this->lang['index']['filters']['label'], 'filters[label]', $fieldsValues['label']);
		$form->addElement($labelFilter);

		$form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing');
		$form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters());
		return $form;

	}
}
