<?php
 namespace Modules\Admin\Config\Server\Email; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $label = new \Engine\Form\Input\Label(); $label->setDetails($this->lang['index']['descr']); $form->addElement($label); $fieldsetEmailAddresses = \Engine\Form\Container\Fieldset::create($this->lang['fieldsets']['emailAddresses']); $this->emailAddressesForm($fieldsetEmailAddresses); $form->addContainer($fieldsetEmailAddresses); $form->addElement(new \Engine\Form\Input\Hidden(null, 'save', 1)); $form->addButton(new \Engine\Form\Button\Submit('save')); return $form; } private function emailAddressesForm($fieldset) { $fldDetails = new \Engine\Form\Input\Label(); $fldDetails->setDetails($this->lang['emailAddresses']['form_details']); $fldDetails->setStyle("noLabel", true); $fieldset->addElement($fldDetails); $senderTypes = \App\Config\AutoEmailSender::getInstance()->getSenderTypes(); $emailAddresses = $this->values['autoSenderEmailAddress']; foreach($senderTypes as $emailType) { ${'fld'.$emailType.'Email'} = new \Engine\Form\Input\Text($this->lang['emailAddresses']['formFields'][$emailType.'Email'], 'autoSenderEmailAddress['.$emailType.'][email]', $emailAddresses[$emailType]['email']); ${'fld'.$emailType.'Email'}->setTooltip($this->lang['emailAddresses']['tooltips'][$emailType.'Email']); ${'fld'.$emailType.'Email'}->setValidator(['type'=>'email']); if (!in_array($emailType, ['invoice', 'cashing'])) { ${'fld'.$emailType.'Email'}->setMandatory(); } $fieldset->addElement(${'fld'.$emailType.'Email'}); ${'fld'.$emailType.'Name'}=new \Engine\Form\Input\Text($this->lang['emailAddresses']['formFields'][$emailType.'Name'], 'autoSenderEmailAddress['.$emailType.'][name]', $emailAddresses[$emailType]['name']); ${'fld'.$emailType.'Name'}->setTooltip($this->lang['emailAddresses']['tooltips'][$emailType.'Name']); $fieldset->addElement(${'fld'.$emailType.'Name'}); } } } 