<?php

namespace Modules\Admin\Config\Gds\Pccs;

class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract
{
    /**
     * {@inheritDoc}
     * @see \App\Mvc\View_Utils_FormAbstract::getForm()
     */
    public function getForm()
    {
        // New form
        $form = \Engine\Form\General::create();
        $form->setStyle('width', 250);

        // New container
        $fieldset = \Engine\Form\Container\Fieldset::create();
        $form->addContainer($fieldset);

        // Code
        $codeInput = new \Engine\Form\Input\Text($this->lang['form']['fields']['code']['label'], 'id', $this->values['id']);
        $codeInput->setMandatory();
        if ($this->controller->getAction() == "update") {
            $codeInput->setDisabled();
        }
        $fieldset->addElement($codeInput);

        // Gds
        $gdsInput = new \App\Form\Input\Select_Gds($this->lang['form']['fields']['gds']['label'], 'gds', $this->values['gds']);
        $gdsInput->showDefaultOption();
        $gdsInput->setMandatory();
        $fieldset->addElement($gdsInput);

        // Alias
        $aliasInput = new \Engine\Form\Input\Text($this->lang['form']['fields']['alias']['label'], 'alias', $this->values['alias']);
        $fieldset->addElement($aliasInput);

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

        return $form;

    }
}