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


PHP Form::addButton方法代码示例

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


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

示例1: createComponentCreateSunglassesForm

 protected function createComponentCreateSunglassesForm()
 {
     $form = new Nette\Application\UI\Form();
     $unglasses = array("Červená" => "Červená", "Černá" => "Černá", "Bílá" => "Bílá", "Zelená" => "Zelená", "Žlutá" => "Žlutá", "Modrá" => "Modrá");
     $form->addSelect('color', "Barva brýlí", $unglasses)->setAttribute('onchange', 'changeSungalssesHomepageModal(this)')->setAttribute("class", "form-control");
     $form->addButton('create', "Navrhni si vlastní brýle")->setAttribute('onclick', 'showHomepageModalMore()')->setAttribute("id", "modalHomepageMoreButton");
     $form->addText('text', "Nápis")->setAttribute("placeholder", "Co by si měl rád na svých brýlích?")->setAttribute("class", "form-control")->setRequired('Přece by si nechtěl brýle nez nápisu. Něco si vymysli...')->addRule(Nette\Forms\Form::MAX_LENGTH, "Nápis může obsahovat maximálně %d znaků", 15);
     $form->addButton('next', "Pokračovat")->setAttribute('onclick', 'checkHeadlineHomePageModal()')->setAttribute("id", "modalHomepageNextButton");
     $form->addText('email', "Email")->setAttribute("placeholder", "Ještě nám prosím vyplň email a máš hotovo...")->setAttribute("class", "form-control")->addRule(Nette\Forms\Form::EMAIL, "Máš tam chybu, zkus to líp...");
     $form->addSubmit('save', "Dokončit");
     $form->onSuccess[] = $this->createSunglassesSucceeded;
     return $form;
 }
开发者ID:skokan8,项目名称:Coma,代码行数:13,代码来源:HomepagePresenter.php

示例2: create

 public function create()
 {
     $form = new Form();
     $form->addText('workStart', 'Začátek', 3, 5)->setRequired('Vyplňte pole "Začátek prac. doby".')->setDefaultValue($this->defaultItemTime['workStart'])->setHtmlId('workStart')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Začátek prac. doby" lze zadat pouze
                  čas v 24 hodinovém formátu po půlhodinách.', '([01]?[0-9]|2[0-3]):(0|3)0');
     $form->addText('workEnd', 'Konec', 3, 5)->setRequired('Vyplňte pole "Konec prac. doby".')->setDefaultValue($this->defaultItemTime['workEnd'])->setHtmlId('workEnd')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Konec prac. doby" lze zadat pouze
                  čas v 24 hodinovém formátu po půlhodinách.', '([01]?[0-9]|2[0-3]):(0|3)0');
     $form->addText('lunch', 'Oběd', 3, 5)->setRequired('Vyplňte pole "Oběd".')->setDefaultValue($this->defaultItemTime['lunch'])->setHtmlId('lunch')->setAttribute('class', 'input-time')->addRule(Form::PATTERN, 'Do pole "Oběd" lze zadat pouze
                  čas v ve formátu s čárkou. (např. 1 nebo 1,5)', '^(0|[1-9]|1[0-9]|2[0-3])(,(0|5))?$');
     $form->addText('otherHours', 'Ostatní hod.')->setDefaultValue($this->defaultItemTime['otherHours'])->setHtmlId('otherHours')->setAttribute('class', 'input-time')->addCondition(Form::FILLED)->addRule(Form::PATTERN, 'Do pole "Ostaní hodiny" lze zadat pouze
                  čas ve formátu s čárkou.(např. 6 nebo 6,5)', '^(0|[1-9]|1[0-9]|2[0-3])(,(0|5))?$');
     $form->addText('locality', 'Místo pracoviště', 28, 40)->setRequired('Vyplňte pole "Místo pracoviště".')->setHtmlId('locality')->getControlPrototype()->class = 'item-text-input';
     $form->addText('description', 'Popis práce', 28, 30)->getControlPrototype()->class = 'item-text-input';
     $form->addText('descOtherHours', 'Komentář k ostat. hod. (např. svátek)', 28, 30)->addConditionOn($form['otherHours'], Form::FILLED)->addCondition(Form::FILLED)->addRule(function ($item, $arg) {
         return \InvoiceTime::processTime($arg) == '00:00:00' ? false : true;
     }, self::OTHER_HOURS_ZERO_TIME_ERROR_MSG, $form['otherHours']);
     $form['descOtherHours']->getControlPrototype()->class = 'item-text-input';
     // time control buttons
     $form->addButton('workStartAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workStart']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 0, 'val' => -30]));
     $form->addButton('workStartSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workStart']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 0, 'val' => 30]));
     $form->addButton('workEndAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workEnd']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 1, 'val' => 30]));
     $form->addButton('workEndSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['workEnd']->control->attrs['id'], 'slider' => 'slider_range', 'pos' => 1, 'val' => -30]));
     $form->addButton('lunchAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['lunch']->control->attrs['id'], 'slider' => 'slider_lunch', 'val' => -30]));
     $form->addButton('lunchSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['lunch']->control->attrs['id'], 'slider' => 'slider_lunch', 'val' => 30]));
     $form->addButton('otherHoursAdd', '+')->setAttribute('class', self::BTN_TIME_ADD_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['otherHours']->control->attrs['id'], 'slider' => 'slider_time_other', 'val' => 0]));
     $form->addButton('otherHoursSub', '-')->setAttribute('class', self::BTN_TIME_SUB_CLASS)->setAttribute('data-time', Json::encode(['inputID' => $form['otherHours']->control->attrs['id'], 'slider' => 'slider_time_other', 'val' => 0]));
     $form->addSubmit('save', 'Uložit řádek');
     $form->getElementPrototype()->id = 'update-form';
     return $form;
 }
开发者ID:blitzik,项目名称:vycetky,代码行数:30,代码来源:ItemUpdateFormFactory.php

示例3: create

 public function create()
 {
     $form = new Form();
     $form->getElementPrototype()->class("ajax");
     $form->addText("description")->addRule(Form::MAX_LENGTH, "Maximální délka popisu může být %d znaků.", Photo::MAX_DESCRIPTION_LENGTH)->setAttribute("size", 40)->setRequired("Zadej prosím popis fotografie.");
     $form->addText("source")->addRule(Form::MAX_LENGTH, "Maximální délka popisu může být %d znaků.", Photo::MAX_SOURCE_LENGTH)->setRequired("Zadej prosím zdroj fotografie.");
     $form->addText("photoTags")->setAttribute("size", 30);
     $form->addButton("addPhotoTag");
     $form->addSubmit("submit");
     $form->onSuccess[] = array($this, "addPhotoFormSucceeded");
     return $form;
 }
开发者ID:jaromir92,项目名称:Sportwin,代码行数:12,代码来源:AddPhotoForm.php

示例4: create

 public function create()
 {
     $form = new Form();
     $form->addText("title")->addRule(Form::MAX_LENGTH, "Maximální délka nadpisu může být %d znaků.", Article::MAX_TITLE_LENGTH)->setRequired("Zadej prosím nadpis článku.");
     $form->addTextArea("content")->setAttribute("rows", 15)->setAttribute("cols", 7)->setRequired("Zadej prosím text článku.");
     $form->addCheckboxList("categories", null, $this->categories)->setRequired("Vyber prosím alespoň jednu kategorii.");
     $form->addText("tags")->setAttribute("size", 30);
     $form->addButton("addTag");
     $form->addRadioList("publishedAt", null, array("now" => "Publikovat ihned", "noChange" => "Ponechat stávající", "later" => "Naplánovat na"))->setRequired("Zadej prosím datum vydání.");
     $form->addText("day")->setAttribute("size", 2)->setRequired("Zadej prosím den vydání.")->addRule(Form::RANGE, "Den musí být číselná hodnota v intervalu %d až %d.", array(1, 31))->setDefaultValue(date("j"));
     $form->addSelect("month")->setItems(DateTimeUtils::getMonths(), true)->setDefaultValue(date("n"));
     $form->addSelect("year")->setItems(DateTimeUtils::getYears(), false)->setDefaultValue(date("Y"));
     $form->addText("hour")->setAttribute("size", 2)->setRequired("Zadej prosím hodinu vydání.")->addRule(Form::RANGE, "Hodina musí být číselná hodnota v intervalu %d až %d.", array(0, 23))->setDefaultValue(date("H"));
     $form->addText("minute")->setAttribute("size", 2)->setRequired("Zadej prosím minutu vydání.")->addRule(Form::RANGE, "Minuta musí být číselná hodnota v intervalu %d až %d.", array(0, 59))->setDefaultValue(date("i"));
     $form->addSubmit("submit");
     $form->onValidate[] = array($this, "validateAddArticleForm");
     $form->onSuccess[] = array($this, "addArticleFormSucceeded");
     return $form;
 }
开发者ID:jaromir92,项目名称:Sportwin,代码行数:19,代码来源:AddArticleForm.php

示例5: createComponentOsobaEditForm

 protected function createComponentOsobaEditForm()
 {
     $form = new Form();
     $form->addText('jmeno', 'Jméno a příjmení')->addRule(Form::FILLED, 'Jméno a příjmení musí být vyplněno.');
     $form->addText('email', 'Email')->addRule(Form::EMAIL, 'Email musí být validní.');
     $form->addText('cisloJednotky', 'Číslo jednotky');
     $form->addCheckbox('chceMaily', 'Dostávat emaily?');
     if ($this->user->isInRole('spravce')) {
         $form->addMultiSelect('role', 'Role/oprávnění:', Model\UserManager::$roleDiakritika)->setAttribute('class', 'form-control');
     }
     $form->addHidden('id');
     $form->addSubmit('send', 'Uložit');
     if ($this->presenter->action == 'edit') {
         $form->addButton('delete', 'Smazat')->setAttribute('data-toggle', 'modal')->setAttribute('data-target', '#modal-delete')->setAttribute('class', 'btn btn-danger');
     }
     $form->onSuccess[] = array($this, 'osobaEditFormSucceeded');
     //$form->onValidate[] = array($this, 'validateLicenceForm');
     $form->setRenderer(new BootstrapRenderer());
     return $form;
 }
开发者ID:bkralik,项目名称:BarakIS,代码行数:20,代码来源:OsobyPresenter.php

示例6: createComponentForm

 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->id = "actionForm";
     $form->addText("name", "Jméno akce:")->setHtmlId("name")->setRequired("Prosím zadejte jméno akce.");
     $form->addText("humanName", "Lidský formát akce:")->setHtmlId("humanName")->setRequired("Prosím zadejte jméno akce v lidském formátu.");
     $form->addHidden("aclActionID");
     $form->addButton("cancel", "Storno")->setHtmlId("cancel");
     $form->addSubmit("sender", "Uložit změny")->setHtmlId("sender");
     if ($this->aclActionID) {
         $actionEntity = $this->actionRepository->get($this->aclActionID);
         if ($actionEntity) {
             $form['aclActionID']->setValue($actionEntity->aclActionID);
             $form['name']->setValue($actionEntity->name);
             $form['humanName']->setValue($actionEntity->humanName);
         }
     }
     $form->onSuccess[] = callback($this, "Submit");
     $form->onError[] = callback($this, "Error");
     return $form;
 }
开发者ID:vipercz,项目名称:sandbox,代码行数:24,代码来源:ActionForm.php

示例7: createComponentForm

 /** Vytvoření komponenty
  *
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->addText("login", "Přihlašovací jméno:")->setAttribute("autocomplete", "off")->setRequired("Prosím zadejte přihlašovací jméno.");
     $form->addPassword("password1", "Heslo:")->setAttribute("class", "form-control")->setAttribute("autocomplete", "off");
     $form->addPassword("password2", "Heslo pro kontrolu:")->setAttribute("class", "form-control")->setAttribute("autocomplete", "off");
     $roles = $this->roleRepository->read()->where("name != ?", "root");
     if (!$this->user->isInRole("root")) {
         $roles->where("name NOT(?)", $this->user->getRoles());
     }
     $roles = $roles->fetchPairs("aclRoleID", "name");
     $form->addSelect("role", "Oprávnění:", $roles)->setAttribute("class", "form-control");
     $form->addCheckbox("active", "Aktivní");
     $form->addButton("cancel", "Storno")->setHtmlId("cancel");
     $form->addSubmit("sender", "Uložit změny")->setHtmlId("sender");
     $form->addHidden("userID");
     $form['password2']->addRule(Form::EQUAL, 'Hesla se neshodují', $form['password1']);
     if ($this->rsuserID) {
         $userEntity = $this->userRepository->get($this->rsuserID);
         if ($userEntity) {
             $form['login']->setValue($userEntity->login);
             $form['login']->setAttribute("readonly");
             $form['userID']->setValue($this->rsuserID);
             $form['active']->setValue($userEntity->getActive());
             if ($userEntity->getUserID() == $this->user->getId()) {
                 $form['role']->setDisabled();
             }
             if ($userEntity->getLogin() != "root" && $userEntity->getUserID() !== $this->user->getId()) {
                 $form['role']->setValue($userEntity->aclRoleID);
             }
         }
     } else {
         $form['password1']->setRequired("Prosím zadejte heslo.");
     }
     $form->onSuccess[] = callback($this, "Submit");
     $form->onError[] = callback($this, "FormError");
     return $form;
 }
开发者ID:vipercz,项目名称:sandbox,代码行数:42,代码来源:UserForm.php

示例8: createComponentUploadFile

 public function createComponentUploadFile()
 {
     $form = new \Nette\Application\UI\Form();
     $form->setTranslator($this->translator);
     $form->addUpload('file', 'File:')->setRequired()->addRule(\Nette\Application\UI\Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024);
     $form->addButton('send', 'Upload');
     $form->onSuccess[] = array($this, 'saveFile');
     return $form;
 }
开发者ID:soundake,项目名称:pd,代码行数:9,代码来源:OldFilesPresenter.php

示例9: createComponentDokumentEditForm

 protected function createComponentDokumentEditForm()
 {
     $form = new Form();
     $kategorie = $this->kategorie->getSelect();
     $form->addText('jmeno', 'Jméno souboru')->addRule(Form::FILLED, 'Jméno souboru musí být vyplněno.');
     $form->addText('popis', 'Popis')->addRule(Form::FILLED, 'Popis souboru musí být vyplněn.');
     $form->addSelect('kategorie_id', 'Kategorie', $kategorie);
     $form->addCheckbox('verejne', 'Veřejný soubor');
     $form->addSubmit('send', 'Uložit');
     $form->addButton('delete', 'Smazat')->setAttribute('data-toggle', 'modal')->setAttribute('data-target', '#modal-delete')->setAttribute('class', 'btn btn-danger');
     $form->addHidden('id');
     $form->onSuccess[] = array($this, 'dokumentEditFormSucceeded');
     //$form->onValidate[] = array($this, 'validateLicenceForm');
     $form->setRenderer(new BootstrapRenderer());
     return $form;
 }
开发者ID:bkralik,项目名称:BarakIS,代码行数:16,代码来源:DokumentyPresenter.php

示例10: createComponentAddFileForm

 public function createComponentAddFileForm()
 {
     $form = new AppForm();
     $form->addSelect('file_id', 'Add file:', $this->files->getFilesToSelect('image'));
     $form->addButton('add', 'Add');
     $form->onSuccess[] = array($this, 'saveFile');
     return $form;
 }
开发者ID:soundake,项目名称:pd,代码行数:8,代码来源:GalleriesPresenter.php

示例11: createComponentPasswdForm

 protected function createComponentPasswdForm()
 {
     $form = new Form();
     $form->getElementPrototype()->class('ajax');
     $form->addButton('passwd_but', 'Změnit heslo')->setAttribute('class', 'button')->setAttribute('id', 'change_passwd_but');
     $form->addPassword('current_passwd')->setAttribute('placeholder', 'Aktuální heslo')->setAttribute('id', 'current_passwd_input')->setAttribute('class', 'user_settings_input');
     $form->addPassword('new_passwd')->setAttribute('placeholder', 'Nové heslo')->setAttribute('id', 'new_passwd_input')->setAttribute('class', 'user_settings_input');
     $form->addPassword('new_passwd_again')->setAttribute('placeholder', 'Potvrzení nového hesla')->setAttribute('id', 'new_passwd_again_input')->setAttribute('class', 'user_settings_input');
     $form->addSubmit('change_passwd_but_save', 'Uložit')->setAttribute('class', 'button last_passwd');
     $form->addButton('passwd_storno', 'Storno')->setAttribute('class', 'button last_passwd')->setAttribute('id', 'storno_passwd_but');
     $form->onSuccess[] = array($this, 'passwdFormSucceeded');
     return $form;
 }
开发者ID:romanbartl,项目名称:BusinessPlann,代码行数:13,代码来源:SettingsPresenter.php

示例12: createComponentForm

 /** Vytvoření formuláře
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->id = "resourceForm";
     $form->addText("name", "Jméno modulu:")->setHtmlId("name")->setRequired("Prosím zadejte jméno modulu.");
     $form->addHidden("aclResourceID");
     $form->addButton("cancel", "Storno")->setHtmlId("cancel");
     $form->addSubmit("sender", "Uložit změny")->setHtmlId("sender");
     $actions = $this->actionRepository->read();
     $container = $form->addContainer("actions");
     foreach ($actions as $key => $action) {
         $container->addCheckbox($key, $action->humanName);
     }
     if ($this->aclResourceID) {
         $modelEntities = $this->modelRepository->read()->where("aclResourceID", $this->aclResourceID);
         $modelEntity = $modelEntities->fetch();
         if ($modelEntity) {
             $form['aclResourceID']->setValue($modelEntity->getAclResource()->getAclResourceID());
             $form['name']->setValue($modelEntity->getAclResource()->name);
             foreach ($modelEntities as $entity) {
                 $form["actions"][$entity->aclActionID]->setValue(TRUE);
             }
         } else {
             $resourceEntity = $this->resourceRepository->get($this->aclResourceID);
             if ($resourceEntity) {
                 $form['aclResourceID']->setValue($this->aclResourceID);
                 $form['name']->setValue($resourceEntity->getName());
             }
         }
     }
     $form->onSuccess[] = callback($this, "Submit");
     $form->onError[] = callback($this, "Error");
     return $form;
 }
开发者ID:vipercz,项目名称:sandbox,代码行数:38,代码来源:ResourceForm.php

示例13: createComponentForm

 /** Vytvoření formuláře
  * 
  * @return \Nette\Application\UI\Form
  */
 protected function createComponentForm()
 {
     $form = new Form();
     $form->getElementPrototype()->id = "roleForm";
     $form->addText("name", "Jméno skupiny:")->setHtmlId("name")->setRequired("Prosím zadejte jméno skupiny oprávnění.");
     $form->addHidden("aclRoleID");
     $form->addButton("cancel", "Storno")->setHtmlId("cancel");
     $form->addSubmit("sender", "Uložit změny")->setHtmlId("sender");
     $resources = $this->resourceRepository->read();
     foreach ($resources as $resource) {
         $container = $form->addContainer($resource->aclResourceID);
         $actions = $this->modelRepository->read()->where("aclResourceID", $resource->aclResourceID);
         foreach ($actions as $key => $action) {
             $checkbox = $container->addCheckbox($key, $action->getAclAction()->humanName);
             if ($this->aclRoleID) {
                 $permissions = $this->permissionRepository->read()->where("aclRoleID", $this->aclRoleID)->where("aclModel.aclResourceID", $resource->aclResourceID)->where("aclModel.aclActionID", $action->aclActionID)->where("allowed", TRUE);
                 if ($permissions->count() > 0) {
                     $checkbox->setValue(TRUE);
                 }
             }
         }
     }
     if ($this->aclRoleID) {
         $roleEntity = $this->roleRepository->get($this->aclRoleID);
         if ($roleEntity) {
             $form['aclRoleID']->setValue($roleEntity->aclRoleID);
             $form['name']->setValue($roleEntity->name);
         }
     }
     $form->onSuccess[] = callback($this, "Submit");
     $form->onError[] = callback($this, "Error");
     return $form;
 }
开发者ID:vipercz,项目名称:sandbox,代码行数:37,代码来源:RoleForm.php


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