<?php

namespace Modules\Utils\AppReports;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * (non-PHPdoc)
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		// NEW FORM ///////////////////////////////////////////////////////////////////////////////////////
		$form = \Engine\Form\General::create();

		// NEW CONTAINER ----------------------------------------------------------------------------------
		$fieldset=\Engine\Form\Container\Fieldset::create("Application report");
		$form->addContainer($fieldset);

		$fld = new \Engine\Form\Input\Text("Name", 'name', $this->values['name']);
		$fld->setMandatory(true);
		if ($this->controller->getAction()=="update") {
			$fld->setDisabled();
		}
		$fieldset->addElement($fld);

		$fld = new \Engine\Form\Input\Textarea("Sql", 'sql', $this->values['sql']);
		$fld->setMandatory(true);
		$fld->setDetails("Use [TABLE_YYYYMM] or [YYYYMM] in SQL to get a union of all monthly tables.");
		$fieldset->addElement($fld);

		$fld = new \Engine\Form\Input\Text("Monthly table", 'monthTable', $this->values['monthTable']);
		$fieldset->addElement($fld);

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

		return $form;

	}

}