本文整理汇总了PHP中Nette\Application\UI\Form::addGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addGroup方法的具体用法?PHP Form::addGroup怎么用?PHP Form::addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
示例2: createComponentForm
protected function createComponentForm()
{
$form = new Nette\Application\UI\Form();
$addEventHandler = callback($this, 'handleAddItem');
$removeEventHandler = callback($this, 'handleRemoveItem');
$form->addGroup('Footer menu');
$form->addDynamic('sections', function (Container $column) use($removeEventHandler, $addEventHandler) {
$column->addText('title', 'Column Title')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Column Title']);
$column->addDynamic('menuItems', function (Container $menuItems) use($removeEventHandler) {
$menuItems->addText('text', 'Text')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Text']);
$menuItems->addText('url', 'Url')->getControlPrototype()->addClass('col-sm-5')->addAttributes(['placeholder' => 'Url']);
$menuItems->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-danger btn-sm')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
$this->controlsInit($menuItems);
}, 1, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-success btn-sm')->addCreateOnClick(true, $addEventHandler);
$column->addSubmit('remove', '-')->setValidationScope(false)->setAttribute('class', 'btn-sm btn-danger')->setAttribute('data-replicator-item-remove', 'yes')->addRemoveOnClick($removeEventHandler);
$this->controlsInit($column);
}, 2, true)->addSubmit('add', '+')->setValidationScope(false)->setAttribute('class', 'btn btn-sm btn-success')->addCreateOnClick(true, $addEventHandler);
$form->addGroup();
$form->addSubmit('submit', 'Save');
$form->addSubmit('cancel', 'Cancel');
$this->controlsInit($form);
$form->getElementPrototype()->addClass('form-horizontal');
$form->onSuccess[] = $this->processForm;
$form->setRenderer(new Bs3FormRenderer());
return $form;
}
示例3: createComponentConfigForm
/**
* @return Nette\Application\UI\Form
*/
protected function createComponentConfigForm()
{
$form = new Nette\Application\UI\Form();
$form->addGroup('Server related');
$form->addText('ServerName', 'Server name')->setRequired();
$form->addSelect('timeZone', 'Time zone', ['Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe (Bucharest)', 'Europe (London)', 'Indian', 'Pacific']);
$form->addText('speed', 'Speed')->setDefaultValue(1);
$form->addText('troopSpeed', 'Troop speed')->setDefaultValue(1);
$form->addText('evasionSpeed', 'Evasion speed')->setDefaultValue(1);
$form->addText('traderMultiplier', 'Trader multiplier')->setDefaultValue(1);
$form->addText('crannyMultiplier', 'Cranny multiplier')->setDefaultValue(1);
$form->addText('storageMultiplier', 'Storage multiplier')->setDefaultValue(1);
$form->addText('trapMultiplier', 'Trap multiplier')->setDefaultValue(1);
$form->addText('natarMultiplier', 'Natar multiplier')->setDefaultValue(1);
$form->addText('worldSize', 'World size (square)')->setDefaultValue(100);
$form->addCheckbox('registrationOpen', 'Open registrations')->setDefaultValue(TRUE);
$form->addSelect('beginnerProtection', 'Beginner protection', [Nette\Utils\DateTime::HOUR * 2 => '2 Hours', Nette\Utils\DateTime::HOUR * 6 => '6 Hour', Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
$form->addSelect('plusLength', 'Plus length', [Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
$form->addSelect('productionBoostLength', 'Production boost length', [Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
$form->addSelect('natureRegeneration', 'Nature troops regeneration time', [Nette\Utils\DateTime::HOUR * 2 => '2 Hours', Nette\Utils\DateTime::HOUR * 6 => '6 Hour', Nette\Utils\DateTime::HOUR * 12 => '12 Hour', Nette\Utils\DateTime::DAY * 1 => '1 Day']);
$form->addSelect('medalInterval', 'Medal interval', [Nette\Utils\DateTime::DAY * 1 => '1 Day', Nette\Utils\DateTime::DAY * 2 => '2 Days', Nette\Utils\DateTime::DAY * 3 => '3 Days', Nette\Utils\DateTime::DAY * 7 => '7 Days']);
$form->addText('tourThreshold', 'Tour threshold')->setDefaultValue(20);
$form->addCheckbox('greatWorkshop', 'Great workshop');
$form->addCheckbox('worldWonder', 'World wonder');
$form->addCheckbox('showNatarStatistics', 'Show natars in statistics');
$form->addSelect('peaceSystem', 'Peace system', ['None', 'Normal', 'Christmas', 'New year', 'Easter']);
$form->addGroup('Admin account');
$form->addText('adminName', 'Admin name');
$form->addText('adminEmail', 'Admin email');
$form->addCheckbox('showAdminStatistics', 'Show admin in statistics');
$form->addGroup('Sql related');
$form->addText('hostname', 'Hostname');
$form->addText('username', 'Username');
$form->addPassword('password', 'Password');
$form->addText('dbName', 'Database name');
$form->addGroup('Other');
$form->addCheckbox('newsBoxOne', 'Newsbox 1');
$form->addCheckbox('newsBoxTwo', 'Newsbox 2');
$form->addCheckbox('newsBoxThree', 'Newsbox 3');
$form->addCheckbox('log', 'Log actions');
$form->addCheckbox('quest', 'Enable quests');
$form->addCheckbox('questExtended', 'Enable extended quests');
$form->addCheckbox('autoActivate', 'Auto activate accounts');
$form->addGroup('Start time');
$form->addText('startDate', 'Start date Year-month-day format')->setDefaultValue(Nette\Utils\DateTime::from('now')->format('Y-m-d'));
$form->addText('startTime', 'Start time')->setDefaultValue(Nette\Utils\DateTime::from('now')->format('H:i'));
$form->onSuccess[] = [$this, 'processConfig'];
$form->addSubmit('Next', 'Next');
return $form;
}
示例4: __construct
/**
* @param User $user
* @param DbTable\Registracia $registracia
* @param DbTable\Lang $lang
* @param DbTable\Hlavicka $hlavicka
* @param DbTable\Dlzka_novinky $dlzka_novinky
*/
public function __construct(User $user, DbTable\Registracia $registracia, DbTable\Lang $lang, DbTable\Hlavicka $hlavicka, DbTable\Dlzka_novinky $dlzka_novinky)
{
$this->user = $user;
$this->urovneReg = $registracia->urovneReg($this->user->isLoggedIn() ? $this->user->getIdentity()->id_registracia : 0);
$this->lang = $lang;
$this->hlavickaForm = $hlavicka->hlavickaForm();
$this->dlzkaNovinkyForm = $dlzka_novinky->dlzkaNovinkyForm();
}
/**
* Edit hlavne menu form component factory.
* @param int $uroven Uroven polozky v menu
* @param string $uloz Text tlacitka uloz
* @param boolean $vlastnik Vlastnictvo editovanej polozky
* @param boolean $edit Pre skrytie poloziek pri editacii
* @param boolean $opravnenia Opravnenia pre nevlastnikov
* @return Form
*/
public function form($uroven, $uloz, $vlastnik, $edit, $opravnenia)
{
$form = new Form();
$form->addProtection();
$form->addGroup();
$form->addHidden("id");
$form->addHidden("id_druh");
$form->addHidden("id_user_profiles");
$form->addHidden("spec_nazov");
$form->addHidden("langtxt");
$form->addHidden("id_hlavne_menu_cast");
$form->addHidden("uroven");
$form->addHidden("id_nadradenej");
$form->addHidden("modified");
if (!$edit) {
$form->addSelect('id_registracia', 'Povolené prezeranie pre min. úroveň:', $this->urovneReg);
}
if ($this->user->isInRole("admin")) {
$form->addText('nazov_ul_sub', 'Názov alternatívneho vzhľadu:', 20, 20);
$form->addText('ikonka', 'Názov class ikonky pre FontAwesome:', 90, 30);
if ($uroven) {
$form->addHidden('id_hlavicka');
} else {
$form->addSelect('id_hlavicka', 'Druh priradenej hlavičky:', $this->hlavickaForm)->addRule(Form::FILLED, 'Je nutné vybrať hlavičku.');
}
// $form->addCheckbox('zvyrazni', ' Zvýraznenie položky pri pridaní obsahu');
}
示例5: create
/**
* @return Form
*/
public function create()
{
$form = new Form();
$form->addGroup();
$form->addText('username', 'Login:')->setRequired('Zadejte prosím uživatelské jméno.');
$form->addPassword('password', 'Heslo:')->setRequired('Zadejte prosím heslo.');
$form->addCheckbox('remember', 'Zůstat přihlášen');
$form->addGroup();
$form->addSubmit('send', 'Přihlásit');
$form->addSubmit('cancel', 'Zpět')->setValidationScope(FALSE);
$form->setDefaults(array('username' => 'user', 'password' => NULL, 'remember' => TRUE));
$form->onSuccess[] = array($this, 'formSucceeded');
$form->setRenderer(new Bs3FormRenderer());
return $form;
}
示例6: 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;
}
示例7: 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;
}
示例8: create
public function create()
{
$form = new Form();
$form->addGroup("Set Google Webmaster tools");
$form->addUpload("file", "Google Webmaster tools file:")->setRequired("Upload Google Webmaster tools file");
$form->addSubmit("send", "Set Google Webmaster tools");
$form->onSuccess[] = $this->processForm;
return $form;
}
示例9: create
public function create()
{
$form = new Form();
$form->addGroup("Set base title");
$form->addText("baseTitle", "Base title:");
$form->addSubmit("send", "Set base title");
$form->onSuccess[] = $this->processForm;
$form->setDefaults(array("baseTitle" => $this->settingsDao->getBaseTitle()));
return $form;
}
示例10: createComponentPasswordForm
/**
* @return \Nette\Application\UI\Form
*/
public function createComponentPasswordForm()
{
$form = new Form();
$form->addGroup('Heslo');
$form->addPassword('newpass', 'Nové heslo:')->addRule(Form::FILLED, 'Zadejte prosím heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musí mít alespoň %d znaků.', 6);
$form->addHidden('changedId', NULL);
$form->addSubmit('submit', 'Odeslat');
$form->onSuccess[] = $this->passwordFormSubmitted;
return $form;
}
示例11: addOrder
/**
* @param \Nette\Application\UI\Form $form
* @param string[] Items
*/
protected function addOrder($form, $items)
{
$form->addGroup('Řazení');
$order = $form->addDynamic('order', function (Container $order) use($items) {
$order->addSelect('by', 'Položka', $items);
$order->addRadioList('dir', 'Směr', array('asc' => 'vzestupně', 'desc' => 'sestupně'));
$order->addSubmit('removeOrder', 'Odstranit')->setAttribute("class", "ajax btn btn-xs")->setValidationScope(FALSE)->onClick[] = array($this, 'removeItem');
});
$order->addSubmit('addOrder', 'Přidat řazení')->setValidationScope(FALSE)->setAttribute("class", "ajax btn btn-xs")->onClick[] = array($this, 'addItem');
}
示例12: create
public function create()
{
$form = new Form();
$form->addGroup("Set Google Analytics key");
$form->addText("key", "Google Analytics api key:")->setRequired('Fill Google Analytics api key');
$form->addSubmit("send", "Set Google Analytics key");
$form->onSuccess[] = $this->processForm;
$form->setDefaults(array("key" => $this->settingsDao->getGoogleAnalyticsKey()));
return $form;
}
示例13: create
public function create()
{
$form = new Form();
$form->addGroup("Set robots.txt");
$form->addTextArea("robots", "Robots.txt content:");
$form->addSubmit("send", "Set robots.txt");
$form->onSuccess[] = $this->processForm;
$form->setDefaults(array("robots" => $this->settingsDao->getRobots()));
return $form;
}
示例14: 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;
}
示例15: createComponentDemoForm
public function createComponentDemoForm()
{
$form = new Form();
if (class_exists('Instante\\Bootstrap3Renderer\\BootstrapRenderer')) {
$form->setRenderer(new BootstrapRenderer());
}
$form->addGroup('Text fields');
$form->addText('email', 'Email')->setType('email')->setOption('placeholder', 'Email');
$form->addTextArea('textarea', 'Textarea');
$form->addPassword('password', 'Heslo')->setOption('placeholder', 'Heslo');
$form->addGroup('Other fields');
$form->addSelect('select', 'Select', ['foo' => 'Foo', 'bar' => 'Bar'])->setPrompt('-choose-')->addError('This field is in an error state');
$form->addCheckboxList('checkboxlist', 'Checkbox List', ['foo' => 'Foo', 'bar' => 'Bar']);
$form->addRadioList('rlist', 'Radio List', ['foo' => 'Foo', 'bar' => 'Bar']);
$form->addCheckbox('remember', 'Neodhlašovat');
$form->addSubmit('send', 'Přihlásit')->setOption('btn-class', 'btn-primary');
$form->addSubmit('s2', 'Submit 2');
$form->addError('This is global form error');
return $form;
}