<?php
namespace Modules\Admin\KamSalesTargets; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $fieldset = \Engine\Form\Container\Fieldset::create($this->lang['index']['form']['fieldsetGeneral']); $form->addContainer($fieldset); $el = new \App\Form\Input\Autocomplete_User($this->lang['index']['formFields']['idKam'], 'idKam', $this->values['idKam']); $el->setMandatory(); if ($this->controller->getAction()=='update') { $el->setDisabled(); } $fieldset->addElement($el); if ($this->controller->getAction()=='update') { $el = new \Engine\Form\Input\Text($this->lang['index']['formFields']['year'], 'year', $this->values['year']); $el->setDisabled(); } else { $el = new \Engine\Form\Input\Select($this->lang['index']['formFields']['year'], 'year', $this->values['year']); $start = TODAY_YEAR-1; $end = TODAY_YEAR+2; for ($y=$start; $y<=$end; $y++) { $el->setPossibleValue($y, $y); } $el->showDefaultOption(); } $el->setMandatory(); $fieldset->addElement($el); $fieldset = \Engine\Form\Container\Fieldset::create('SALES TARGETS'); $form->addContainer($fieldset); for ($i=1; $i<=12; $i++) { $el = new \Engine\Form\Input\Text($this->globalLang['date']['month']['long'][$i], 'salesTarget['.$i.']', $this->values['salesTarget'][$i]); $el->setCustomHTML(\App\Config\Currencies::getInstance()->getDefaultCurrency()); $fieldset->addElement($el); } $fieldset = \Engine\Form\Container\Fieldset::create('MEETINGS TARGETS'); $form->addContainer($fieldset); for ($i=1; $i<=12; $i++) { $el = new \Engine\Form\Input\Text($this->globalLang['date']['month']['long'][$i], 'contactsTarget['.$i.']', $this->values['contactsTarget'][$i]); $el->setCustomHTML('meetings'); $fieldset->addElement($el); } if ($this->controller->getAction()=='update') { $el = new \Engine\Form\Input\Hidden(null, 'idKam', $this->values['idKam']); $fieldset->addElement($el); $el = new \Engine\Form\Input\Hidden(null, 'year', $this->values['year']); $fieldset->addElement($el); } $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }