当前位置: 首页>>代码示例>>PHP>>正文


PHP Form::addText方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Form::addText方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addText方法的具体用法?PHP Form::addText怎么用?PHP Form::addText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Form的用法示例。


在下文中一共展示了Form::addText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createComponentRegistrationForm

 /**
  * Formulář pro registraci uživatele
  * @return Form
  */
 public function createComponentRegistrationForm()
 {
     $form = new Form();
     $form->addText('name', 'Jméno a příjmení:')->setRequired('Je nutné zadat jméno.');
     $form->addText('email', 'E-mail:')->setRequired('Je nutné zadat e-mail')->addRule(Form::EMAIL, 'Je nutné zadat platnou e-mailovou adresu.')->addRule(function (TextInput $input) {
         return !$this->usersModel->findByEmail($input->value);
     }, 'Uživatel s daným e-mailem již existuje.');
     $password = $form->addPassword('password', 'Heslo:')->setRequired('Je nutné zadat heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít minumálně 4 znaky.', 4);
     $form->addPassword('password2', 'Potvrzení hesla:')->addRule(Form::EQUAL, 'Zadaná hesla se neshodují.', $password);
     $form->addSubmit('ok', 'registrovat se')->onClick[] = function (SubmitButton $button) {
         //funkce pro vytvoření nového uživatelského účtu a automatick přihlášení uživatele
         $data = $button->form->getValues(true);
         $user = new User();
         $user->active = true;
         $user->name = $data['name'];
         $user->email = $data['email'];
         $user->password = User::encodePassword($data['password']);
         $user->role = User::DEFAULT_REGISTERED_ROLE;
         if ($this->usersModel->save($user)) {
             $this->flashMessage('Registrace byla úspěšně dokončena.');
             $this->usersModel->sendRegistrationMail($user);
         }
         $this->user->login($data['email'], $data['password']);
         $this->redirect('Homepage:default');
     };
     return $form;
 }
开发者ID:4iz278,项目名称:cviceni,代码行数:31,代码来源:UserPresenter.php

示例2: create

 /**
  * @return Form
  */
 public function create($otherUser = '', $privilegesEdit = false)
 {
     $form = new Form();
     if (!empty($otherUser)) {
         $user = $otherUser;
         $form->addHidden('id', $otherUser->id);
     } else {
         $user = $this->user;
     }
     $form->addUpload('photo', 'Fotka')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost fotky je 10MB', 80000000);
     $form->addText('nickName', 'Přihlašovací jméno')->setValue($user->nickName)->setOption('description', Html::el('p')->setHtml('Pokud chcete můžete pro jednodušší přihlašování zadat jméno'))->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Jméno musí mít alespoň %d znaky', 3);
     $form->addText('name', 'Jméno k zobrazení')->setValue($user->name);
     if ($privilegesEdit) {
         $form->addText('title', 'Titul')->setValue($user->title)->setOption('description', Html::el('p')->setHtml('Titul měnitelný administrátorem přidaný před jméno'));
     }
     $date = $this->parseDateForm();
     $form->addSelect('day', 'Den narození', $date['days'])->setValue($date['day']);
     $form->addSelect('month', 'Měsíc narození', $date['months'])->setValue($date['month']);
     $form->addSelect('year', 'Rok narození', $date['years'])->setValue($date['year']);
     $form->addSelect('gender', 'Pohlaví', ['ma' => 'Muž', 'fe' => 'Žena', 'no' => 'Neuvedeno'])->setValue($user->gender);
     $form->addCheckbox('wall', 'Povolit zeď')->setValue($user->wall == 1 ? true : false);
     $form->addCheckbox('mailList', 'Posílat od nás maily')->setValue($user->mailList == 1 ? true : false);
     $form->addTextArea('about', 'O mě')->setValue($user->about);
     if ($privilegesEdit) {
         $this->editPrivileges($form, $user->permissions);
     }
     $form->addSubmit('submit', 'Uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     $form->onSuccess[] = [$this, 'formSucceeded'];
     return $form;
 }
开发者ID:kivi8,项目名称:ars-poetica,代码行数:34,代码来源:SettingFormFactory.php

示例3: createComponentAddSetting

 protected function createComponentAddSetting()
 {
     $form = new Form();
     $form->addText('key', 'Klíč')->setRequired('Zadejte klíč nastavení');
     $form->addText('value', 'Hodnota')->setRequired('Zadejte hodnotu nastavení');
     $form->addSubmit('send', 'Zapsat');
     $form->onSuccess[] = function (Form $f) {
         try {
             $val = $f->values;
             $this->settings->set($val->key, $val->value);
             $this->settings->push();
             //Write
             $this->logger->log('System', 'edit', "%user% změnila(a) nastavení");
             $msg = $this->flashMessage("Nastavení bylo zapsáno", 'success');
             $msg->title = 'Yehet!';
             $msg->icon = 'check';
             $this->redirect('this');
         } catch (\PDOException $e) {
             \Nette\Diagnostics\Debugger::log($e);
             $msg = $this->flashMessage("Něco se podělalo. Zkuste to prosím později.", 'danger');
             $msg->title = 'Oh shit!';
             $msg->icon = 'warning';
         }
     };
     return $form;
 }
开发者ID:sg3tester,项目名称:songator,代码行数:26,代码来源:SystemPresenter.php

示例4: create

 /**
  * @return Form
  */
 public function create($role)
 {
     $rights = $this->database->table('rights')->fetchPairs('id', 'name');
     $form = new Form();
     $form->addHidden('id');
     $form->addText('username', 'uživatelské jméno: ')->addRule(Form::FILLED, 'Zadejte prosím jméno.');
     $form->addText('email', 'email: ')->addRule(Form::FILLED, 'Zadejte prosím email.')->addRule(Form::EMAIL, 'Email by měl mít platný formát');
     if (in_array("admin", $role)) {
         // editace prav jen adminem
         $form->addSelect('rights_id', 'level práv: ', $rights);
     }
     $form->addSubmit('submit', 'uložit');
     $form->addProtection('Vypršel časový limit, odešlete formulář znovu');
     //bootstrap vzhled
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = '';
     $renderer->wrappers['label']['container'] = 'div class="control-label col-sm-5"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     $form->getElementPrototype()->class('form-horizontal col-sm-12');
     return $form;
 }
开发者ID:JakubMarden,项目名称:bazenycz,代码行数:28,代码来源:userEditFormFactory.php

示例5: createComponentContactForm

 /**
  * Contact form
  */
 protected function createComponentContactForm()
 {
     // vytvoříme element
     $products = array('Zakladni' => 'Základní', 'Pokrocile' => 'Pokročilé', 'NaMiru' => 'Na Míru', 'Ostatni' => 'Ostatní');
     $form = new Form();
     $form->addText('name', 'Jméno ')->addRule(Form::FILLED, 'Zadejte jméno');
     $form->addSelect('product', 'Produkt:', $products)->setRequired()->setDefaultValue('Zakladni');
     $form->addText('phone', 'Telefon ');
     $form->addText('email', 'Email')->addRule(Form::FILLED, 'Zadejte email')->addRule(Form::EMAIL, 'Email nemá správný formát');
     $form->addTextarea('message', 'Zpráva', 999, 5)->addRule(Form::FILLED, 'Zadejte zprávu');
     $form->addSubmit('send', 'Odeslat');
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-12';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-12  text-center"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-green btn-block btn-lg' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     $form->onSuccess[] = $this->processContactForm;
     return $form;
 }
开发者ID:pzdesign,项目名称:patrik-zizka-nette,代码行数:38,代码来源:HomepagePresenter.php

示例6: createComponentPageForm

 protected function createComponentPageForm()
 {
     $form = new Form();
     $form->setTranslator($this->translator->domain('pageEditForm'));
     $form->getElementPrototype()->id = 'page-form';
     $form->addText('title', 'title.label', null, Page::LENGTH_TITLE)->setMaxLength(Page::LENGTH_TITLE)->setRequired('title.messages.required')->setAttribute('data-text-length', Page::LENGTH_TITLE)->addRule(Form::MAX_LENGTH, new Phrase('title.messages.maxLength', ['numChars' => Page::LENGTH_TITLE]), Page::LENGTH_TITLE);
     $form->addText('publishedAt', 'publishedAt.label', null, 16)->setHtmlId('datetimepicker')->setRequired('publishedAt.messages.required')->addCondition(Form::FILLED)->addRule(Form::MAX_LENGTH, new Phrase('publishedAt.messages.maxLength', ['numChars' => 16]), 16);
     $form->addTextArea('intro', 'intro.label', null, 7)->setMaxLength(Page::LENGTH_INTRO)->setRequired('intro.messages.required')->setAttribute('data-text-length', Page::LENGTH_INTRO)->addRule(Form::MAX_LENGTH, new Phrase('intro.messages.maxLength', ['numChars' => Page::LENGTH_INTRO]), Page::LENGTH_INTRO);
     $form->addTextArea('text', 'text.label', null, 25);
     //->setRequired('text.messages.required');
     $form->addText('url', 'url.label', null, 255);
     $form->addSelect('lang', 'lang.label')->setItems($this->availableLocales)->setDefaultValue($this->defaultLocale);
     if (isset($this->page)) {
         $form['lang']->setDisabled();
         //$form['lang']->setOmitted();
     }
     $form->addCheckbox('allowedComments', 'allowedComments.label')->setDefaultValue(true);
     $form->addText('keywords', 'keywords.label');
     $form->addText('description', 'description.label');
     $form->addSubmit('saveAndPublish', 'saveAndPublish.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAndPublish.title'))->onClick[] = [$this, 'processPageSavingAndPublishing'];
     $form->addSubmit('saveAsDraft', 'saveAsDraft.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAsDraft.title'))->onClick[] = [$this, 'processPageSavingAsDraft'];
     if (!$this->authorizator->isAllowed($this->user, 'page', 'create') or !$this->authorizator->isAllowed($this->user, 'page', 'edit')) {
         $form['saveAndPublish']->setDisabled();
         $form['saveAsDraft']->setDisabled();
     }
     $form->addProtection();
     return $form;
 }
开发者ID:blitzik,项目名称:CMS,代码行数:28,代码来源:PageFormControl.php

示例7: createComponentRaceForm

 public function createComponentRaceForm()
 {
     $validator = function ($item) {
         return $this->race->freeRaceid($item->value);
     };
     $form = new Form();
     $i = $form->addText('raceid', 'ID závodu:');
     if ($this->getAction() == 'add') {
         $i->setRequired('ID závodu je povinné')->addRule(Form::LENGTH, 'Délka ID musí být 4 - 8 znaků', array(4, 8))->addRule($validator, 'ID je již použito.');
     } else {
         $i->setDisabled(TRUE);
     }
     $form->addText('name', 'Název:');
     $form->addDateTimePicker('datetime_0', 'Datum a čas:')->setRequired('Datum a čas jsou povinné.');
     $form->addSelect('type', 'Typ závodu', self::$race_type);
     $form->addSelect('opt_preftype', 'Druh závodu', self::$race_kind);
     $form->addSelect('opt_incomplete', 'Při chybějící kontrole', self::$inco_list);
     $form->addCheckbox('opt_autocat', 'Automatická kategorie');
     $form->addCheckbox('opt_namefrsi', 'Doplnit jméno z SI čipu');
     $form->addCheckbox('opt_addnew', 'Hodnotit i nepřihlášené');
     $form->addTextArea('descr', 'Popis:');
     $form->addSubmit('send', 'OK');
     $form->addSubmit('cancel', 'Zpět')->setValidationScope(false)->onClick[] = [$this, 'formCancelled'];
     if ($this->getAction() == 'add') {
         $form->onSuccess[] = [$this, 'addRaceFormSucceeded'];
     } else {
         $form->onSuccess[] = [$this, 'editRaceFormSucceeded'];
     }
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
开发者ID:horakmar,项目名称:gorgon,代码行数:31,代码来源:RacePresenter.php

示例8: createComponentSignUpForm

 /**
  * Register form factory.
  * @return UI\Form
  */
 protected function createComponentSignUpForm()
 {
     $form = new UI\Form();
     $form->setTranslator($this->translator->domain('ui'));
     // 1. Antispam
     $form->addText(self::SPAM1)->setAttribute('style', 'display:none')->addRule(UI\Form::BLANK, 'this-field-should-be-blank');
     // 2. Antispam
     $form->addText(self::SPAM2, self::SPAM2)->setHtmlId('frm-signUpForm-antispam')->setAttribute('data-spam', self::SPAM2)->setRequired(self::SPAM2)->addRule(UI\Form::EQUAL, self::SPAM2, self::SPAM2);
     $form->addText('email2', 'your-email')->setType('email')->setAttribute('placeholder', 'e-g-email-example-com')->addRule(UI\Form::EMAIL, 'please-enter-your-a-valid-email-address-check-for-typos')->setRequired('please-enter-your-a-valid-email-address-check-for-typos')->setAttribute('autofocus');
     $form->addText('fullname', 'how-do-you-want-to-be-called')->setAttribute('placeholder', 'placeholder-fullname')->setRequired('please-choose-how-do-you-want-to-be-called-on-the-web');
     $form->addText('username', 'login-username')->setAttribute('placeholder', 'placeholder-username')->setRequired('please-choose-your-login-username');
     $form->addPassword('password', 'login-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-choose-your-login-password')->addRule(UI\Form::MIN_LENGTH, 'please-enter-at-least-d-characters-for-your-password', 8);
     $form->addPassword('passwordVerify', 'confirm-password')->setAttribute('placeholder', 'placeholder-password')->setRequired('please-confirm-your-login-password')->addRule(UI\Form::EQUAL, 'please-check-your-different-password', $form['password']);
     $form->addSubmit('send', 'register');
     $form->onSuccess[] = $this->signUpFormSucceeded;
     $form->getElementPrototype()->role('form');
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
开发者ID:buffus,项目名称:skeleton,代码行数:32,代码来源:SignUpPresenter.php

示例9: create

 /**
  * @return \Nette\Application\UI\Form
  */
 public function create()
 {
     $form = new Form();
     $form->addGroup($this->user ? 'Upravit uživatele' : 'Přidat uživatele');
     $form->addText("name", 'Jméno:')->setRequired('Vyplňte jméno');
     $form->addText("email", 'Email:')->setRequired('Vyplňte email')->addRule(function ($ctrl) {
         if ($this->user and $this->user->email == $ctrl->getValue()) {
             return TRUE;
         }
         return (bool) (!$this->userFacade->findUserByEmail($ctrl->getValue()));
     }, 'Email je obsazen, zvolte prosím jiný');
     $password = $form->addPassword("password", 'Heslo:');
     $password2 = $form->addPassword("password2", 'Heslo znovu:');
     if (!$this->user) {
         $password->setRequired('Vyplňte heslo');
         $password2->addRule(Form::FILLED, 'Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password);
     } else {
         $password2->addConditionOn($password, Form::FILLED)->setRequired('Vyplňte heslo znovu pro kontrolu')->addRule(Form::EQUAL, 'Hesla se neshodují', $password);
     }
     $form->addSubmit("send", $this->user ? 'Upravit uživatele' : 'Přidat uživatele');
     $form->setRenderer(new Bs3FormRenderer());
     $form->onSuccess[] = $this->processForm;
     if ($this->user) {
         $form->setDefaults(["name" => $this->user->name, "email" => $this->user->email]);
     }
     return $form;
 }
开发者ID:Kotys,项目名称:eventor.io,代码行数:30,代码来源:SetUserForm.php

示例10: create

  /**
 * Formular pre editaciu udajov
 * @param boolean $admin
 * @param array $druh
 * @return Nette\Application\UI\Form
 */
  public function create($admin, $druh, $ur_reg)
  {
      $this->ur_reg = $ur_reg;
      $form = new Form();
      $form->addProtection();
      $form->addGroup();
      $form->addHidden('id');
      $form->addHidden('id_udaje_typ');
      if ($admin) {
          $form->addText('nazov', 'Názov prvku:', 20, 20)->addRule(Form::MIN_LENGTH, 'Názov musí mať spoň %d znaky!', 2)->setAttribute('class', 'heading')->setRequired('Názov musí byť zadaný!');
          $form->addText('comment', 'Komentár k hodnote :', 90, 255)->addRule(Form::MIN_LENGTH, 'Komentár musí mať spoň %d znaky!', 2)->setRequired('Komentár musí byť zadaný!');
      } else {
          $form->addHidden('nazov');
          $form->addHidden('comment');
      }
      $form->addText('text', 'Hodnota prvku:', 90, 255)->setRequired('Hodnota prvku musí byť zadaná!');
      if ($admin) {
          $form->addCheckbox('spravca', ' Povolená zmena pre správcu')->setDefaultValue(1);
          $form->addCheckbox("druh_null", " Hodnota druhu je NULL")->setDefaultValue(1)->addCondition(Form::EQUAL, TRUE)->toggle("druh", FALSE);
          $form->addGroup()->setOption('container', Html::el('fieldset')->id("druh"));
          $form->addSelect('id_druh', 'Druhová skupina pre nastavenia:', $druh)->setDefaultValue(1);
          $form->setCurrentGroup(NULL);
开发者ID:petak23,项目名称:echo-msz,代码行数:28,代码来源:EditUdajeFormFactory.php

示例11: createComponentCourseRegistration

 protected function createComponentCourseRegistration()
 {
     $msgNameReq = "Zadejte prosím jméno a příjmení.";
     $msgEmailReq = "Zadejte prosím emailovou adresu.";
     $msgPhoneReq = "Zadejte prosím telefonní číslo.";
     $msgPhoneBad = "Telefon není správně vyplněn.";
     $msgDateReq = "Vyberte prosím termín akce.";
     $persons = array('1 osoba', '2 osoby', '3 osoby', '4 osoby', '5 osob');
     $dates = array();
     foreach ($this->context->parameters['courses'][$this->course]['dates'] as $date) {
         $dates[] = $this->template->date($date['date'], '%d.%m.%Y');
     }
     $form = new Form();
     $form->addText('name', 'Jméno', NULL, 60)->setAttribute('placeholder', 'Jméno a příjmení')->setAttribute('tabindex', 1)->addRule(~$form::EQUAL, $msgNameReq, $form['name']->control->attrs['placeholder'])->setRequired($msgNameReq);
     $form->addText('email', 'Email', NULL, 40)->setAttribute('placeholder', 'Email')->setAttribute('tabindex', 2)->addRule(~$form::EQUAL, $msgEmailReq, $form['email']->control->attrs['placeholder'])->setRequired($msgEmailReq)->addRule(Form::EMAIL, '%label není správně vyplněn.');
     $form->addText('phone', 'Telefon', NULL, 9)->setAttribute('placeholder', 'Telefon')->setAttribute('tabindex', 3)->addRule(~$form::EQUAL, $msgPhoneReq, $form['phone']->control->attrs['placeholder'])->setRequired($msgPhoneReq)->addRule(Form::INTEGER, $msgPhoneBad)->addRule(Form::LENGTH, $msgPhoneBad, 9);
     $form->addSelect('date', 'Termín konání')->setPrompt('Zvolte termín konání')->setItems($dates)->setRequired($msgDateReq);
     if (count($dates) == 1) {
         $form['date']->setDefaultValue(0);
     }
     $form->addSelect('person', 'Počet')->setItems($persons, FALSE);
     $form->addTextArea('note', 'Poznámka', NULL)->setAttribute('placeholder', 'Jakýkoli dotaz nebo zpráva.')->setAttribute('tabindex', 4)->addRule(Form::MAX_LENGTH, 'Poznámka může obsahovat maximálně 1000 znaků.', 1000);
     $form->addSubmit('send', 'Odeslat')->setAttribute('tabindex', 5)->setAttribute('class', 'button');
     $form->addSubmit('storno', 'Storno')->setAttribute('tabindex', 6)->setValidationScope(NULL)->setAttribute('class', 'button');
     $form->addHidden('spamtest')->addRule($form::EQUAL, 'Robot', array(NULL));
     $form->onSuccess[] = callback($this, 'submitRegistration');
     return $form;
 }
开发者ID:Repticus,项目名称:drs,代码行数:28,代码来源:WebPresenter.php

示例12: createComponentPageEditor

 protected function createComponentPageEditor()
 {
     $form = new Form();
     $form->addText('name', 'Název stránky')->setRequired();
     $form->addText('heading', 'Nadpis')->setRequired();
     $form->addTextArea('body', 'Obsah');
     $form->addCheckbox('hidden', 'Výstřižek stránky');
     $form->addHidden('id');
     $form->addSubmit('send', 'Uložit');
     $form->onSuccess[] = function (Form $f) {
         $val = $f->values;
         //Update page
         if ($val->id) {
             $this->pages->find($val->id)->update($val);
             $msg = $this->flashMessage("Stránka byla upravena", 'success');
             $msg->title = 'A je tam!';
             $msg->icon = 'check';
             $this->logger->log('CMS', 'edit', "%user% uprvila(a) stránku {$val->name}");
         } else {
             $r = $this->pages->create($val);
             $msg = $this->flashMessage("Stránka byla vytvořena.", 'success');
             $msg->title = 'A je tam!';
             $msg->icon = 'check';
             $this->redirect('this', ['id' => $r->id]);
             $this->logger->log('CMS', 'create', "%user% vytvořil(a) stránku {$val->name}");
         }
         $this->redirect('this');
     };
     return $form;
 }
开发者ID:sg3tester,项目名称:songator,代码行数:30,代码来源:CmsPresenter.php

示例13: createComponentTagForm

 protected function createComponentTagForm()
 {
     $form = new Form();
     $form->addText('title', 'title:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('slug', 'slug:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addText('color', 'color:')->setRequired()->getControlPrototype()->addClass('color {minV:0.9} form-control');
     $form->addText('bg_color', 'bg_color:')->setRequired()->getControlPrototype()->addClass('color {maxV:0.5} form-control');
     $form->addCheckbox('active', 'active:')->setRequired()->getControlPrototype()->addClass('form-control');
     $form->addSubmit('send', 'Save tag')->getControlPrototype()->setName('button')->addClass('btn btn-success')->setHtml('<span class="glyphicon glyphicon-ok"></span>');
     $form->onSuccess[] = array($this, 'tagFormSucceeded');
     // setup form rendering
     $renderer = $form->getRenderer();
     $renderer->wrappers['controls']['container'] = NULL;
     $renderer->wrappers['pair']['container'] = 'div class=form-group';
     $renderer->wrappers['pair']['.error'] = 'has-error';
     $renderer->wrappers['control']['container'] = 'div class=col-sm-10';
     $renderer->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
     $renderer->wrappers['control']['description'] = 'span class=help-block';
     $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
     // make form and controls compatible with Twitter Bootstrap
     $form->getElementPrototype()->class('form-horizontal');
     // <form class="form-horizontal">
     foreach ($form->getControls() as $control) {
         if ($control instanceof Controls\Button) {
             $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
             $usedPrimary = TRUE;
         } elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
             $control->getControlPrototype()->addClass('form-control');
         } elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
             $control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
         }
     }
     return $form;
 }
开发者ID:pw-press,项目名称:web-project,代码行数:34,代码来源:TagPresenter.php

示例14: createComponentVytvoritForm

 protected function createComponentVytvoritForm()
 {
     $form = new Form();
     //Zivocich
     $hodnotyZivocich = array();
     $zivocichy = $this->database->table('zivocich');
     //ziskam si vsetkych zivocichov
     foreach ($zivocichy as $zivocich) {
         $hodnotyZivocich[$zivocich->IDZivocicha] = $zivocich->meno;
     }
     $form->addSelect('IDZivocicha', '*Živočích:', $hodnotyZivocich)->setRequired();
     //Zamestnanec
     $hodnotyZamestnancov = array();
     if ($this->getUser()->roles[0] == 'riaditeľ') {
         $zamestnanci = $this->database->table('zamestnanec');
         //ziskam si vsetkych zamestnancov
         foreach ($zamestnanci as $zamestnanec) {
             $hodnotyZamestnancov[$zamestnanec->RodneCislo] = $zamestnanec->meno . " " . $zamestnanec->priezvisko;
         }
     } else {
         $hodnotyZamestnancov[$this->getUser()->id] = $this->getUser()->getIdentity()->data['meno'];
     }
     $form->addSelect('RodneCislo', '*Zamestnanec:', $hodnotyZamestnancov)->setRequired();
     $form->addText('hmotnostZivocicha', 'Hmotnosť živočícha:')->addCondition(Form::FILLED)->addRule(Form::FLOAT, 'Pole musi obsahovať iba čísla!');
     $form->addText('rozmerZivocicha', 'Rozmer živočícha:')->addCondition(Form::FILLED)->addRule(Form::FLOAT, 'Pole musi obsahovať iba čísla!');
     $form->addText('datumTestu', '*Dátum testu(YYYY-MM-DD):')->setRequired()->addRule(Form::PATTERN, 'Nesprávny fomrát', '([0-9]){4}-([0-9]){2}-([0-9]){2}');
     $form->addSubmit('vytvorit', 'Vytvoriť');
     $form->onSuccess[] = array($this, 'uspesne');
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
开发者ID:Raiper34,项目名称:IIS-ZOO,代码行数:31,代码来源:TestPresenter.php

示例15: createForm

 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createForm()
 {
     $form = new Form();
     $form->addText('code', 'Kód')->addRule(Form::FILLED, "Vyplňte prosím kód");
     $form->addText('name', 'Název')->addRule(Form::FILLED, "Vyplňte prosím název");
     $form->addSubmit('save', 'Uložit');
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:11,代码来源:RoleForm.php


注:本文中的Nette\Application\UI\Form::addText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。