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


PHP Form::addContainer方法代码示例

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


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

示例1: createForm

 protected function createForm()
 {
     $form = new Form();
     Container::extensionMethod('addLazyContainer', function ($container, $name, $factory) {
         return $container[$name] = new LazyContainer($factory);
     });
     $base = $form->addContainer('base');
     $base->addText('name', 'Název');
     $type = $base->addSelect('type', 'Typ položky', $this->menuTypeOptionFactory->getOptionsBySection($this->sectionId));
     $type->setDefaultValue(key($type->getItems()));
     $type->setAttribute('class', 'change-ajax-submit');
     $base->addCheckbox('show', 'Zobrazit')->setDefaultValue(TRUE);
     $parent = $form->addContainer('parent');
     $menu = $parent['id_menu'] = $this->menuFormItemFactory->create($this->sectionId);
     $menu->setPrompt('---');
     $menu->caption = 'Rodičovská kategorie';
     $form->addLazyContainer('content', function (LazyContainer $self) use($form, $type) {
         $values = $self->getFormValues();
         $itemType = $values['base']['type'];
         $this->lazyItemMap->get($itemType)->setup($self, $this->sectionId);
     });
     $form->addSubmit('save', 'Uložit');
     $form->onValidate[] = $this->validateNonCircular;
     $form->onValidate[] = $this->validateAjax;
     $form->onValidate[] = $this->validateLazyItem;
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:27,代码来源:MenuForm.php

示例2: createForm

 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createForm()
 {
     $form = new Form();
     $base = $form->addContainer('base');
     $password = $form->addContainer('password');
     $elections = $form->addContainer('elections');
     $base->addText('username', 'Uživatelské jméno')->addRule(Form::FILLED, "Vyplňte prosím uživatelské jméno");
     $base->addTextNull('name', 'Jméno')->addRule(Form::FILLED, "Vyplňte prosím jméno");
     $base->addTextNull('surname', 'Příjmení')->addRule(Form::FILLED, "Vyplňte prosím příjmení");
     $base->addText('email', 'Email')->setRequired()->addRule(Form::EMAIL, "Zadejte prosím validní emailovou adresu.");
     $password->addTextNull('password', 'Heslo')->setType('password')->setAttribute('autocomplete', 'off')->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Zadané heslo je příliš krátké, zvolte si heslo alespoň o %d znacích', 8);
     $password->addPassword('passwordCheck', 'Heslo pro kontrolu')->setOmitted()->setAttribute('autocomplete', 'off')->addConditionOn($password['password'], Form::FILLED)->addRule(Form::EQUAL, 'Heslo pro kontrolu se neshoduje', $password['password']);
     $elections['role'] = $this->roleFormItemFactory->create();
     $elections['role']->addRule(Form::FILLED, "Přiřaďte prosím uživateli roli");
     $elections['section'] = $this->sectionFormItemFactory->createMultiselectBox();
     $form->addSubmit('save', 'Uložit');
     $form->onValidate[] = function (Form $form) {
         $this->checkUsername($form);
     };
     $form->onValidate[] = function (Form $form) {
         $this->checkNewUserPassword($form);
     };
     $form->onValidate[] = function (Form $form) {
         $this->checkSectionBindins($form);
     };
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:30,代码来源:UserForm.php

示例3: createForm

 protected function createForm()
 {
     $form = new Form();
     if ($this->isFrontSection()) {
         $form->addContainer('section')['section'] = $this->sectionFormItemFactory->createMultiselectBox();
     }
     $base = $form->addContainer('base');
     $base->addTextNull('name', 'Název');
     $base->addCheckbox('show', 'Zobrazit')->setDefaultValue(TRUE);
     $base->addTextAreaNull('content', 'Obsah stránky')->setAttribute('class', 'mceEditorSimple');
     $form->addSubmit('save', 'Uložit');
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:13,代码来源:PageForm.php

示例4: createForm

 /**
  * @return \Nette\Application\UI\Form
  */
 protected function createForm()
 {
     $form = new Form();
     $base = $form->addContainer('base');
     $type = $form->addContainer('type');
     $base->addText('name', 'Název sekce');
     $base->addText('domain', 'Doména třetího řádu');
     $base->addText('priority', 'Priorita')->setDefaultValue(0);
     $base['module'] = $this->moduleFormItemFactory->create();
     $type->addMultiSelect('menu_type_code', 'Povolené typy položek menu', $this->menuTypeOptionFactory->getOptions())->setAttribute('class', 'select2');
     $form->addSubmit('save', 'Uložit');
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:16,代码来源:SectionForm.php

示例5: add

 /**
  * Add definition for builder
  *
  * @param array $definition
  * @return $this
  * @throws InvalidStateException
  */
 public function add($definition = array())
 {
     if (!isset($definition['propertyName'])) {
         throw new InvalidStateException("Missing property name!");
     }
     $propertyName = $definition['propertyName'];
     // load default rules
     $builderDefinition = $this->getPropertyRule($propertyName, !(isset($definition['componentType']) && $definition['componentType'] === BuilderDefinition::COMPONENT_TYPE_CONTAINER));
     if (isset($definition['componentType'])) {
         if ($definition['componentType'] === BuilderDefinition::COMPONENT_TYPE_CONTAINER) {
             $container = $this->form->addContainer($propertyName);
             $targetEntity = $this->invokeGetter($propertyName, $this->entity);
             if ($targetEntity === NULL) {
                 $className = $builderDefinition->getTargetEntity();
                 $targetEntity = new $className();
             }
             $isSpecified = isset($definition['settings']) && is_array($definition['settings']) && is_array($definition['settings'][0]);
             /** @var FormBuilder $builder */
             $builder = new self($this->entityFormMapper, $targetEntity, $this->entityManager, $this->dateParser, !$isSpecified, $container);
             if ($isSpecified) {
                 $builder->addAll($definition['settings']);
             }
             // try to map value
             $this->entityFormMapper->mapValueToComponent($targetEntity, $container);
             // end scope
             return $this;
         } else {
             $builderDefinition->setComponentType($definition['componentType']);
         }
     }
     if (isset($definition['settings'])) {
         $settings = $definition['settings'];
         if (isset($settings['required'])) {
             $builderDefinition->setRequired($settings['required']);
         }
         if (isset($settings['placeholder'])) {
             $builderDefinition->setPlaceholder($settings['placeholder']);
         }
         if (isset($settings['validationRules'])) {
             $builderDefinition->setValidationRules($settings['validationRules']);
         }
         if (isset($settings['label'])) {
             $builderDefinition->setLabel($settings['label']);
         }
         if (isset($settings['values']) && is_array($settings['values'])) {
             $builderDefinition->setValues($settings['values']);
         }
         if (isset($settings['value'])) {
             $builderDefinition->setValue($settings['value']);
         }
         if (isset($settings['appendValidationRules']) && is_array($settings['appendValidationRules'])) {
             foreach ($settings['appendValidationRules'] as $row) {
                 $builderDefinition->addValidationRuleRow($row);
             }
         }
     }
     // replace old
     $this->replaceFormControl($builderDefinition);
     return $this;
 }
开发者ID:KennyDaren,项目名称:doctrine-mapper,代码行数:67,代码来源:FormBuilder.php

示例6: createForm

 /**
  * @return Form
  */
 protected function createForm()
 {
     $form = new Form();
     $form->addGroup('Základní údaje');
     $basic = $form->addContainer('basic');
     $basic->addText('name', 'Name');
     $form->addSubmit('save', 'Uložit');
     return $form;
 }
开发者ID:kysela-petr,项目名称:generator-kysela,代码行数:12,代码来源:__form.php

示例7: editPrivileges

 private function editPrivileges(Form $form, $permissions)
 {
     $priv = $form->addContainer('privileges');
     $priv->addCheckboxList('FastNews', 'Rychlé zprávy:', ['add' => 'Přidat', 'moderate' => 'Upravovat, mazat všem']);
     $priv->addCheckboxList('NewActions', 'Nové akce: ', ['add' => 'Přidat', 'moderate' => 'Upravovat, mazat všem']);
     $priv->addCheckboxList('Article', 'Články: ', ['add' => 'Napsat', 'publish' => 'Publikovat', 'moderate' => 'Upravovat, mazat všem']);
     $priv->addCheckboxList('Comments', 'Komentáře: ', ['addAsAdmin' => 'Přidávat jako admin', 'moderate' => 'Upravovat, mazat']);
     $priv->addCheckboxList('User', 'Uživatele: ', ['add' => 'Přidávat neregistrované', 'see' => 'Zobrazit seznam', 'prohibit' => 'Udělit BAN', 'moderate' => 'Upravovat, mazat']);
     $priv->addCheckboxList('ArtTeam', 'Art team: ', ['see' => 'Zobrazit kontaky na členy', 'add' => 'Přidávat členy', 'moderate' => 'Upravovat, mazat jakékoliv členy']);
     $priv->addCheckboxList('MediaArchive', 'Media archiv: ', ['see' => 'Zobrazit media', 'add' => 'Přidávat do media archivu', 'moderate' => 'Upravovat, mazat jakýkoliv obsah']);
     $priv->addCheckboxList('Section', 'Skece k článkům:', ['moderate' => 'upravovat']);
     $priv->setDefaults($this->parseRole($permissions));
 }
开发者ID:kivi8,项目名称:ars-poetica,代码行数:13,代码来源:SettingFormFactory.php

示例8: createComponentRole

 protected function createComponentRole()
 {
     $form = new Form();
     $form->addHidden("id");
     $cont = $form->addContainer("role");
     $role = $this->uzivatele->getRolePairs();
     foreach ($role as $k => $v) {
         $cont->addCheckbox($k, $v);
     }
     $form->addSubmit("save", "Uložit");
     $form->onSuccess[] = $this->saveRole;
     return $form;
 }
开发者ID:stanley89,项目名称:piratskelisty,代码行数:13,代码来源:SpravcePresenter.php

示例9: addToFormContainer

 /**
  * Adds select box to filter form
  * @param Nette\Application\UI\Form $form
  */
 public function addToFormContainer($form)
 {
     $container = $form->addContainer($this->key);
     $container->addText('from', $this->name);
     $container->addText('to', $this->name_second);
     if ($placeholder = $this->getPlaceholder()) {
         if ($text_from = reset($placeholder)) {
             $form[$this->key]['from']->setAttribute('placeholder', $text_from);
         }
         if ($text_to = end($placeholder) && $text_to != $text_from) {
             $form[$this->key]['to']->setAttribute('placeholder', $text_to);
         }
     }
 }
开发者ID:JakubKontra,项目名称:datagrid,代码行数:18,代码来源:FilterRange.php

示例10: addToFormContainer

 /**
  * Adds select box to filter form
  * @param Nette\Application\UI\Form $form
  */
 public function addToFormContainer($form)
 {
     $container = $form->addContainer($this->key);
     $container->addText('from', $this->name)->setAttribute('data-provide', 'datepicker')->setAttribute('data-date-orientation', 'bottom')->setAttribute('data-date-format', $this->getJsFormat())->setAttribute('data-date-today-highlight', 'true')->setAttribute('data-date-autoclose', 'true');
     $container->addText('to', $this->name_second)->setAttribute('data-provide', 'datepicker')->setAttribute('data-date-orientation', 'bottom')->setAttribute('data-date-format', $this->getJsFormat())->setAttribute('data-date-today-highlight', 'true')->setAttribute('data-date-autoclose', 'true');
     if ($placeholder = $this->getPlaceholder()) {
         if ($text_from = reset($placeholder)) {
             $form[$this->key]['from']->setAttribute('placeholder', $text_from);
         }
         if ($text_to = end($placeholder) && $text_to != $text_from) {
             $form[$this->key]['to']->setAttribute('placeholder', $text_to);
         }
     }
 }
开发者ID:JakubKontra,项目名称:datagrid,代码行数:18,代码来源:FilterDateRange.php

示例11: create

 /**
  * @param string[] $websites
  * @param \App\Holder\PageRelated[] $duels
  * @return Form
  */
 public function create($websites, $duels)
 {
     $periods = array(RespondentWebsite::PERIOD_KNOW_AND_VISIT => "Znám a navštěvuji", RespondentWebsite::PERIOD_KNOW_THAT_EXISTS => "Pouze vím, že existuje", RespondentWebsite::PERIOD_DONT_KNOW => "Neznám");
     $form = new Form($this->parent, "finalForm");
     $form->addGroup("Znáte následující stránky?");
     $websites_container = $form->addContainer("website");
     foreach ($websites as $website_id => $website_name) {
         $website_container = $websites_container->addContainer($website_id);
         $website_container->addRadioList("period", $website_name, $periods)->setAttribute("class", "buttons-group");
     }
     $form->addGroup("Jaké stránky navštěvujete častěji?");
     $duels_container = $form->addContainer("duels");
     foreach ($duels as $page_related_holder) {
         $duel_container = $duels_container->addContainer($page_related_holder->getPageRelated()->id_page_related);
         $title = $page_related_holder->getPageA()->getWebsite()->name . " vs. " . $page_related_holder->getPageB()->getWebsite()->name;
         $options = array($page_related_holder->getPageA()->getPage()->id_page => $page_related_holder->getPageA()->getWebsite()->name, RespondentPageDuel::MORE_OFTEN_BOTH => "nastejno", $page_related_holder->getPageB()->getPage()->id_page => $page_related_holder->getPageB()->getWebsite()->name, RespondentPageDuel::MORE_OFTEN_NONE => "nenavštěvuji ani jeden web");
         $duel_container->addRadioList("page", $title, $options)->setAttribute("class", "buttons-group");
     }
     $form->addGroup(null);
     $form->addText("email", "E-mail")->setType("email");
     $form->addSubmit("send", "Dokončit dotazník")->setAttribute("class", "btn btn-lg btn-primary");
     return $form;
 }
开发者ID:bares43,项目名称:bachelor-thesis-survey,代码行数:28,代码来源:FinalForm.php

示例12: vytvorit

 public function vytvorit()
 {
     $form = new Form();
     $umiestnenie = $form->addContainer('umiestnenie');
     $umiestnenie->addText('nazov', '*Názov:')->setRequired();
     $umiestnenie->addText('sirka', 'Šírka:')->addCondition(Form::FILLED)->addRule(Form::FLOAT, 'Pole musi obsahovať iba čísla!');
     $umiestnenie->addText('dlzka', 'Dĺžka:')->addCondition(Form::FILLED)->addRule(Form::FLOAT, 'Pole musi obsahovať iba čísla!');
     $umiestnenie->addText('vyska', 'Výška:')->addCondition(Form::FILLED)->addRule(Form::FLOAT, 'Pole musi obsahovať iba čísla!');
     if ($this->mod == 0) {
         $klietka = $form->addContainer('klietka');
         $klietka->addText('typ', 'Typ:');
         $klietka->addText('podstielka', 'Podstielka:');
         $klietka->addText('lokacia', 'Lokácia:');
     } else {
         $vybeh = $form->addContainer('vybeh');
         $vybeh->addText('teren', 'Terén:');
         $vybeh->addText('povrch', 'Povrch:');
         $vybeh->addText('ohradenie', 'Ohradenie:');
     }
     $form->addSubmit('vytvorit', 'Vytvoriť');
     $form->onSuccess[] = array($this, 'uspesne');
     $form->setRenderer(new Bs3FormRenderer());
     return $form;
 }
开发者ID:Raiper34,项目名称:IIS-ZOO,代码行数:24,代码来源:VytvoritUmiestnenieForm.php

示例13: createComponentEditUserCollectionForm

 /**
  * @param string $name
  */
 public function createComponentEditUserCollectionForm($name)
 {
     $form = new Form($this, $name);
     $albumsContainer = $form->addContainer('albums');
     $albums = $this->albumModel->getAll();
     /**
      * @var Album $album
      */
     foreach ($albums as $album) {
         $label = $album->getAlbumName() . '(' . $album->getArtist() . ', ' . $album->getYear() . ')';
         $albumsContainer->addCheckbox($album->getAlbumId(), $label);
     }
     foreach ($this->user->getAlbums() as $userAlbums) {
         $albumsContainer[$userAlbums->getAlbumId()]->setDefaultValue(TRUE);
     }
     $form->addSubmit('assign', 'Assign');
     $form->onSuccess[] = $this->successEditUserCollectionForm;
 }
开发者ID:peterkrejci,项目名称:music-collection,代码行数:21,代码来源:EditUserCollectionControl.php

示例14: create

 public function create()
 {
     $form = new Form();
     $rows = $form->addContainer("rows");
     foreach ($this->targetList as $target) {
         $container = $rows->addContainer($target->id);
         $container->addText("seoTitle");
         $container->addTextArea("seoKeywords");
         $container->addTextArea("seoDescription");
         $container->addSelect("seoRobots", NULL, array("index" => "index", "noindex" => "noindex"));
         $container->addSelect("sitemapChangeFreq", NULL, array("always" => "always", "hourly" => "hourly", "daily" => "daily", "weekly" => "weekly", "monthly" => "monthly", "yearly" => "yearly", "never" => "never"));
         $container->addText("sitemapPriority", NULL)->setType("number")->setAttribute("step", "0.1")->addRule(Form::FLOAT, "Priority must be number between 0 and 1")->addRule(Form::RANGE, "Priority must be number between 0 and 1", array(0, 1));
         $container->addSubmit("save", "Save")->setValidationScope($container->getComponents())->onClick[] = $this->processSingleRow;
         $meta = $target->meta;
         $container->setDefaults(array("seoTitle" => $meta->seoTitle, "seoKeywords" => $meta->seoKeywords, "seoDescription" => $meta->seoDescription, "seoRobots" => $meta->seoRobots, "sitemapChangeFreq" => $meta->sitemapChangeFreq, "sitemapPriority" => $meta->sitemapPriority));
     }
     $form->addSubmit("send", "Save all")->onClick[] = $this->processEntireForm;
     return $form;
 }
开发者ID:brabijan,项目名称:nette-seo-components,代码行数:19,代码来源:SetTargetForm.php

示例15: create

 /**
  * @param Category[] $categories
  * @param string|null $code
  * @return Form
  */
 public function create($categories, $code = null)
 {
     $validaton_message = "Vyplňte prosím %s. Pomůže mi to lépe zpracovat výsledky průzkumu. Díky ;)";
     $form = new Form($this->parent, $this->name);
     $form->addGroup("Obecné");
     $sex = array(Respondent::GENDER_MALE => 'muž', Respondent::GENDER_FEMALE => 'žena');
     $form->addRadioList('gender', 'Pohlaví:', $sex)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "svoje pohlaví");
     $age = array(Respondent::AGE_15 => 'méne něž 15', Respondent::AGE_15_20 => '15-20', Respondent::AGE_21_30 => '21-30', Respondent::AGE_31_45 => '31-45', Respondent::AGE_46_60 => '46-60', Respondent::AGE_60 => 'více než 60');
     $form->addRadioList('age', 'Věk', $age)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "svůk věk");
     $truefalseoptions = array(1 => "Ano", 0 => "Ne");
     $form->addRadioList("english", "Navštěvuji anglické webové stránky", $truefalseoptions)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "zda navštěvujete i anglické webové stránky");
     $form->addRadioList("it", "Pracuji v oboru IT nebo tento obor studuji", $truefalseoptions)->setAttribute('class', 'buttons-group')->addRule(Form::REQUIRED, $validaton_message, "zda pracujete v oboru IT nebo ho studujete");
     if ($code !== null) {
         $form->addHidden("code", $code);
     }
     $form->addTextArea("sites", "Jaké stránky často navštěvuji");
     $devices = array(Respondent::DEVICE_COMPUTER => "Počítač nebo notebook", Respondent::DEVICE_PHONE => "Smartphone", Respondent::DEVICE_TABLET => "Tablet");
     $form->addCheckboxList('device', 'K přístupu na internet používám:', $devices)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "které zařízení používáte pro přístup k internetu");
     $form->addRadioList("device_most", "A z toho nejčastěji", $devices)->setAttribute("class", "buttons-group")->addRule(Form::REQUIRED, $validaton_message, "které zařízení nejčastěji používáte pro přístup k internetu");
     $period = array(EntityCategory::PERIOD_NEVER => "vůbec", EntityCategory::PERIOD_DAILY => "denně", EntityCategory::PERIOD_FEW_TIMES_A_WEEK => "několikrát týdně", EntityCategory::PERIOD_FEW_TIMES_A_MONTH => "několikrát měsíčně", EntityCategory::PERIOD_FEW_TIMES_A_YEAR => "několikrát ročně");
     $categories_container = $form->addContainer("category");
     foreach ($categories as $holder_category) {
         $category_container = $categories_container->addContainer($holder_category->getCategory()->id_category);
         $category_container->setCurrentGroup($categories_container->getForm()->addGroup($holder_category->getCategory()->label));
         $category_container->addRadioList("period", "Jak často?", $period)->setAttribute("class", "buttons-group");
         if ($holder_category->getChildren()) {
             $items = array();
             foreach ($holder_category->getChildren() as $child) {
                 $items[$child->id_category] = $child->label;
             }
             $category_container->addCheckboxList("items", $holder_category->getCategory()->child_label, $items)->setAttribute("class", "buttons-group");
         }
     }
     $form->setCurrentGroup(NULL);
     $form->addGroup("Zajímá mě to");
     $form->addText("nickname", "Nick (chci být v highscore)");
     $form->addText("email", "E-mail")->setType("email");
     $form->addTextArea("message", "Vzkaz");
     $form->addSubmit("validate", "Pokračovat")->setAttribute("class", "btn btn-primary");
     $form->addSubmit("nonvalidate", "Přejít rovnou k otázkám")->setValidationScope(FALSE)->setAttribute("class", "btn btn-default");
     return $form;
 }
开发者ID:bares43,项目名称:bachelor-thesis-survey,代码行数:47,代码来源:PersonalForm.php


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