Beispiel #1
0
 protected function createComponentFormLogin($name)
 {
     $form = new \Tatami\Forms\BaseForm($this, $name);
     $identity = $this->getUser()->identity;
     if ($identity != null) {
         $form->addHidden('email', $identity->email);
     } else {
         $form->addText('email', 'Email:')->setRequired('Please provide your %name');
     }
     $form->addPassword('password', 'Password:'******'Please provide your %name');
     $form->addCheckbox('remember', 'Remember me');
     $form->addSubmit('btnLogin', 'Login');
     $form->onSuccess[] = callback($this, 'formLoginSubmitted');
 }
Beispiel #2
0
 protected function createComponentFormMailSetup($name)
 {
     $form = new \Tatami\Forms\BaseForm($this, $name);
     $form->addGroup('Basic settings')->setOption('container', Html::el('div'));
     $defaultFrom = 'tatami@' . $this->context->expand('%domain%');
     $form->addText('from', 'From')->setDefaultValue($defaultFrom)->setRequired('Please fill %name');
     $form->addText('fromName', 'From name')->setDefaultValue('Tatami');
     $mailers = array('mail' => 'mail() function - default', 'smtp' => 'custom smtp server');
     $mailer = $form->addRadioList('mailer', 'Select mailer', $mailers)->setDefaultValue('mail');
     $mailer->addCondition(Form::EQUAL, 'smtp')->toggle('smtp');
     $form->addCheckbox('ignore', 'Skip sending test email');
     $form->addGroup('Smtp settings')->setOption('container', Html::el('div')->id('smtp'));
     $smtp = $form->addContainer('smtp');
     $encryptions = array('none' => 'none', 'ssl' => 'SSL', 'tls' => 'TLS');
     $smtp->addRadioList('secure', 'Select encryption', $encryptions);
     $smtp->addText('host', 'Server');
     $smtp->addText('port', 'Port');
     $smtp->addText('username', 'Username');
     $smtp->addText('password', 'Password');
     $form->addGroup('')->setOption('container', Html::el(''));
     $form->addSubmit('btnPrevious', 'Previous')->setValidationScope(false)->onClick[] = callback($this, 'goToPreviousStep');
     $form->addSubmit('btnNext', 'Next')->onClick[] = callback($this, 'formMailSetupSubmitted');
     if (isset($this->session->mailSettings)) {
         $form->setDefaults($this->session->mailSettings);
     }
 }