<?php

namespace Modules\Admin\Config\Server\Proxy;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{

	/**
	 * Creates the form
	 * @see \App\Mvc\View_Utils_FormAbstract::getForm()
	 */
	public function getForm()
	{
		$form = \Engine\Form\General::create();

		$label = new \Engine\Form\Input\Label();
		$label->setDetails($this->lang['index']['description']);
		$form->addElement($label);

		$fieldset = \Engine\Form\Container\Fieldset::create($this->lang['index']['fieldsets']['general']);

		// host
		$fldHost = new \Engine\Form\Input\Text($this->lang['formFields']['host'], 'host', $this->values['host']);
		$fieldset->addElement($fldHost);

		// port
		$fldPort = new \Engine\Form\Input\Text($this->lang['formFields']['port'], 'port', $this->values['port']);
		$fldPort->setValidatorParam('type', 'digits');
		$fieldset->addElement($fldPort);

		// username
		$fldUser = new \Engine\Form\Input\Text($this->lang['formFields']['user'], 'user', $this->values['user']);
		$fieldset->addElement($fldUser);

		// password
		$fldPass = new \Engine\Form\Input\Password($this->lang['formFields']['pass'], 'pass', '');
		$fldPass->setTooltip($this->lang['tooltips']['password']);
		$fieldset->addElement($fldPass);

		$form->addContainer($fieldset);

		//save button
		$form->addElement(new \Engine\Form\Input\Hidden(null, 'save', 1));
		$form->addButton(new \Engine\Form\Button\Submit('save'));

		return $form;
	}
}
