<?php
namespace Modules\Orders\GdsSalesReport;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$form = \Engine\Form\General::create('GdsSalesReport');
		$form->addContainer(\Engine\Form\Container\Fieldset::create());

		$systems = \App\GdsSalesReport\Parser\TraverserFactory::getInstance()->getFileFormats();

		$possibleValues = [];
		foreach ($systems->getAll() as $system) {
			$possibleValues[$system->code] = $system->label;
		}

		$system = new \Engine\Form\Input\Select($this->lang['index']['formFields']['system'], 'system', $this->values['system']);
		$system->setPossibleValues($possibleValues);
		$form->addElement($system);

		$file = new \Engine\Form\Input\File($this->lang['index']['formFields']['file'], 'file', $this->values['file']);
		$form->addElement($file);

		// submit button
		$form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1));

		return $form;
	}
}