Exemplo n.º 1
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addText('q', '')->setDefaultValue($this->q)->setAttribute('placeholder', $this->translator->translate('common.form.search'));
     $f->addButtonSubmit('doSearch', '', 'search');
     $f->enableBootstrap(['primary' => ['doSearch']], FALSE, 3, 'sm', 'form-inline');
     return $f;
 }
Exemplo n.º 2
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addButtonSubmit('deleteItem', 'common.button.delete', 'trash');
     $f->addLinkSubmit('cancel', '', 'remove', $this->parent->link('this', ['view' => 'Default']));
     $f->addProtection();
     $f->enableBootstrap(['danger' => ['deleteItem'], 'default' => ['cancel']], TRUE, 3, 'sm', 'form-inline');
     return $f;
 }
Exemplo n.º 3
0
 public function createForm()
 {
     $f = parent::createForm();
     $loginLabel = 'auth.form.' . ($this->loginFacade->getLoginType() === Model\CMS\Auth::LOGIN_BY_EMAIL ? 'email' : 'username');
     $this->formSolvePlaceholderAdd('text', $f, 'login', $loginLabel);
     $this->formSolvePlaceholderAdd('password', $f, 'password', 'auth.form.password');
     $f->addCheckbox('remember', 'auth.form.remember');
     $f->addButtonSubmit('helloUser', 'auth.button.login', 'log-in');
     $f->addProtection();
     $f->enableBootstrap(['success' => ['helloUser']], FALSE, 3, 'sm', $this->formStyle);
     return $f;
 }
Exemplo n.º 4
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addEmail('to', 'mail.form.to')->setRequired();
     $params = $this->mailTemplate->getTemplateParameters();
     foreach ($params as $param) {
         $f->addText($param, '{$' . $param . '}')->setDefaultValue(rand(10, 100));
     }
     $f->addButtonSubmit('sendTestMail', 'mail.button.testMail', 'envelope');
     $f->enableBootstrap(['success' => ['sendTestMail']]);
     return $f;
 }
Exemplo n.º 5
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addText('name', 'system.form.username')->setRequired();
     $f->addText('email', 'system.form.email')->setRequired()->addRule($f::EMAIL);
     $f->addPassword('password', 'system.form.password')->setRequired();
     $f->addPassword('password2', 'system.form.passwordRepeat')->setRequired()->addRule($f::EQUAL, 'system.form.passwordNotMatch', $f['password']);
     $f->addButtonSubmit('createUser', 'system.button.createUser', 'user');
     $f->enableBootstrap(['success' => ['createUser']]);
     $f->autofocus('name');
     return $f;
 }
Exemplo n.º 6
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addText('name', 'common.form.uniqueName')->setRequired()->addRule(Form::MAX_LENGTH, NULL, 63)->addRule($f::PATTERN, 'form.error.alphanumeric', '([a-zA-Z0-9]+)');
     $f->addText('title', 'common.form.title')->setRequired()->addRule(Form::MAX_LENGTH, NULL, 255);
     $f->addProtection();
     $this->createSubmitButtons($f);
     if ($this->ajaxEnabled) {
         $f->enableAjax();
     }
     $f->autofocus('name');
     $f = $this->binder->entityToForm($this->page, $f);
     return $f;
 }
Exemplo n.º 7
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addText('name', 'user.form.username');
     $f->addText('email', 'user.form.email');
     $this->extendForm($f);
     $f->addProtection();
     $this->binder->entityToForm($this->selectedUser, $f);
     $f->addButtonSubmit('saveUser', 'common.button.save', 'ok');
     $f->addLinkSubmit('cancel', '', 'remove', $this->link('cancel!'));
     $f->enableBootstrap(['success' => ['saveUser'], 'default' => ['cancel']], TRUE);
     $f->autofocus('name');
     return $f;
 }
Exemplo n.º 8
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addStatic('name', 'common.form.uniqueName');
     $f->addEmail('from', 'mail.form.from')->setRequired();
     $f->addText('subject', 'mail.form.subject')->setRequired();
     $f->addTextArea('template', 'mail.form.template')->setRequired();
     $f->addCheckbox('toggleCopy', 'mail.form.copy')->setDefaultValue(count($this->mailTemplate->cc) + count($this->mailTemplate->bcc) > 0 ? TRUE : FALSE)->addCondition($f::EQUAL, TRUE)->toggle($this->getUniqueId() . '-cc')->toggle($this->getUniqueId() . '-bcc');
     $f->addArrayTextArea('cc', 'mail.form.cc')->setOption('id', $this->getUniqueId() . '-cc');
     $f->addArrayTextArea('bcc', 'mail.form.bcc')->setOption('id', $this->getUniqueId() . '-bcc');
     $f->addButtonSubmit('saveSettings', 'common.button.save', 'ok');
     $this->binder->entityToForm($this->mailTemplate, $f);
     $f->enableBootstrap(['success' => ['saveSettings']]);
     return $f;
 }
Exemplo n.º 9
0
 public function createForm()
 {
     $f = parent::createForm();
     $config = $this->loadConfig();
     $f->addText('host', 'system.form.dbHost');
     $f->addText('user', 'system.form.dbUser');
     $f->addText('password', 'system.form.dbPassword');
     $f->addText('database', 'system.form.dbDatabase');
     if (isset($config['parameters']['zax']['database'])) {
         $binder = new Zax\Forms\ArrayBinder();
         $binder->entityToForm($config['parameters']['zax.database'], $f);
     }
     $f->addButtonSubmit('test', 'system.button.testConnection', 'refresh');
     $f->enableBootstrap(['primary' => ['test']]);
     $f->autofocus('host');
     return $f;
 }
Exemplo n.º 10
0
 public function createForm()
 {
     $f = parent::createForm();
     if ($this->user->isAllowed('Users', 'Secure')) {
         $f->addSelect('userrole', 'user.form.role', $this->roleService->getFormSelectOptions())->setDefaultValue($this->selectedUser->role->id)->addCondition($f::EQUAL, $this->roleService->getAdminRole()->id)->toggle('superadminWarning');
         $f->addStatic('superadminWarning', '')->setValue($this->translator->translate('user.form.superadminWarning'))->setOption('id', 'superadminWarning')->getControlPrototype()->addClass('has-error');
     }
     if ($this->user->isAllowed('Users', 'Ban')) {
         $f->addCheckbox('banned', 'user.form.banned')->setDefaultValue($this->selectedUser->login->isBanned);
     }
     $this->binder->entityToForm($this->selectedUser, $f);
     $f->addProtection();
     $f->addButtonSubmit('saveSettings', 'common.button.save', 'ok');
     $f->addLinkSubmit('cancel', '', 'remove', $this->link('cancel!'));
     $f->enableBootstrap(['success' => ['saveSettings'], 'default' => ['cancel']], TRUE);
     return $f;
 }
Exemplo n.º 11
0
 public function createForm()
 {
     $f = parent::createForm();
     $f->addText('name', 'common.form.uniqueName')->setRequired()->addRule(Form::MAX_LENGTH, NULL, 63)->addRule($f::PATTERN, 'form.error.alphanumeric', '([a-zA-Z0-9]+)');
     $f->addText('displayName', 'common.form.displayName');
     $f->addTextArea('description', 'common.form.description');
     if ($this->role->parent !== NULL) {
         $f->addStatic('parent', 'role.form.inheritsFrom')->addFilter(function ($parent) {
             return $parent->displayName;
         });
     }
     $f->addProtection();
     $this->createSubmitButtons($f);
     $f->autofocus('name');
     $this->binder->entityToForm($this->role, $f);
     return $f;
 }
Exemplo n.º 12
0
 public function createForm()
 {
     $f = parent::createForm();
     $this->webContent->setTranslatableLocale($this->parent->getLocale());
     $this->webContentService->refresh($this->webContent);
     $f->addStatic('localeFlag', 'webContent.form.locale')->setDefaultValue($this->parent->getLocale())->addFilter(function ($locale) {
         return $this->translator->translate('common.lang.' . $locale);
     });
     $f->addStatic('lastUpdatedstat', 'webContent.form.lastUpdated')->addFilter(function ($value) {
         return $this->getWebContent()->lastUpdated === NULL ? Nette\Utils\Html::el('em')->setText($this->translator->translate('common.general.never')) : $this->presenter->getTemplateFactory()->createTemplateHelpers($this->translator)->beautifulDateTime($this->getWebContent()->lastUpdated);
         // dirty huehue
     });
     $f->addTexyArea('content', 'webContent.form.content')->getControlPrototype()->rows(10);
     $f->addHidden('locale', $this->getLocale());
     $this->binder->entityToForm($this->webContent, $f);
     $f->addProtection();
     $f->addButtonSubmit('editWebContent', 'common.button.saveChanges', 'pencil');
     $f->addButtonSubmit('previewWebContent', 'common.button.preview', 'search');
     $f->addLinkSubmit('cancel', 'common.button.close', 'remove', $this->link('cancel!'));
     $f->addStatic('note', '')->setDefaultValue($this->translator->translate('webContent.panel.previewIsBelow'));
     $f->enableBootstrap(['success' => ['editWebContent'], 'primary' => ['previewWebContent'], 'default' => ['cancel']], TRUE);
     //$f->autofocus('content');
     return $f;
 }
Exemplo n.º 13
0
 /** @secured Menu, Edit */
 protected function createComponentForm()
 {
     return parent::createComponentForm();
 }