本文整理汇总了PHP中Venne\Forms\Form::addContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addContainer方法的具体用法?PHP Form::addContainer怎么用?PHP Form::addContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::addContainer方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addGroup();
$money = $form->addRadioList('money', 'Přispívám částkou')->setItems(array('1000' => '1 000,-', '100' => '100,-', '250' => '250,-', '500' => '500,-', '2500' => '2 500,-', '5000' => '5 000,-', 'other' => 'jinou'));
$money->setDefaultValue('1000')->addCondition($form::EQUAL, 'other')->toggle('group-other');
$form->addGroup()->setOption('id', 'group-other');
$form->addText('moneyOther', 'Částkou')->addConditionOn($money, $form::EQUAL, 'other')->addRule($form::INTEGER, 'Částka musí být celé kladné číslo');
$form->addGroup();
$form->addRadioList('ucely', 'Peníze použít na', array('1' => 'Nechám to na Vás', '2' => 'Kancelář', '4' => 'Internetová reklama', '8' => 'Billboardy', '16' => 'Kontaktní kampaň', '32' => 'Tiskoviny a reklamní materiály'))->setDefaultValue('1');
$person = $form->addRadioList('person', 'Osoba', array('fyzicka' => 'Fyzická osoba', 'pravnicka' => 'Právnická osoba'));
$person->addRule($form::FILLED, 'Prosím vyplňte osobu');
$person->addCondition($form::EQUAL, 'fyzicka')->toggle('group-fyzicka')->endCondition()->addCondition($form::EQUAL, 'pravnicka')->toggle('group-pravnicka')->endCondition()->addCondition($form::IS_IN, array('pravnicka', 'fyzicka'))->toggle('group-next');
$fyzicka = $form->addContainer('fyzicka');
$fyzicka->setCurrentGroup($form->addGroup()->setOption('id', 'group-fyzicka'));
$fyzicka->addText('name', 'Jméno a příjmení')->addConditionOn($person, $form::EQUAL, 'fyzicka')->addRule($form::FILLED, 'Prosím vyplňte jméno a příjmení');
$fyzicka->addText('bornDate', 'Datum narození')->setOption('description', '(vzor: 23.10.1980)')->addConditionOn($person, $form::EQUAL, 'fyzicka')->addRule($form::FILLED, 'Prosím vyplňte datum narození');
$pravnicka = $form->addContainer('pravnicka');
$pravnicka->setCurrentGroup($form->addGroup()->setOption('id', 'group-pravnicka'));
$pravnicka->addText('name', 'Název firmy')->addConditionOn($person, $form::EQUAL, 'pravnicka')->addRule($form::FILLED, 'Prosím vyplňte název firmy');
$pravnicka->addText('person', 'Jméno a příjmení zástupce')->addConditionOn($person, $form::EQUAL, 'pravnicka')->addRule($form::FILLED, 'Prosím vyplňte jméno a příjmení zástupce');
$pravnicka->addText('IC', 'IČ')->addConditionOn($person, $form::EQUAL, 'pravnicka')->addRule($form::FILLED, 'Prosím vyplňte IČ');
$form->addGroup()->setOption('id', 'group-next');
$form->addText('street', 'Ulice a číslo popisné')->addRule($form::FILLED, 'Prosím vyplňte ulici');
$form->addText('city', 'Město / obec')->addRule($form::FILLED, 'Prosím vyplňte město / obec');
$form->addText('psc', 'PSČ')->addRule($form::FILLED, 'Prosím vyplňte PSČ');
$email = $form->addText('email', 'E-mail');
$email->addRule($form::FILLED, 'Prosím vyplňte e-mail')->addRule($form::EMAIL, 'E-mail není ve správném tvaru');
$email->controlPrototype->placeholder = '@';
$form->setCurrentGroup();
$form->addText('_captcha', 'Opište text z obrázku');
$submit = $form->addSaveButton('Odeslat');
$submit->getControlPrototype()->class = 'btn-primary btn-block';
}
示例2: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$account = $form->addContainer('account');
$account->setCurrentGroup($form->addGroup("Account"));
$account->addCheckbox('activated', 'Activate')->addCondition($form::EQUAL, TRUE)->toggle('form-account-accountId');
$account->setCurrentGroup($form->addGroup()->setOption('id', 'form-account-accountId'));
$account->addText('accountId', 'Account ID');
$api = $form->addContainer('api');
$api->setCurrentGroup($form->addGroup('Access by API'));
$api->addCheckbox('activated', 'Activate')->addCondition($form::EQUAL, TRUE)->toggle('form-api');
$api->setCurrentGroup($form->addGroup()->setOption('id', 'form-api'));
$api->addText('applicationName', 'Application name');
$api->addText('clientId', 'Client ID')->getControlPrototype()->class[] = 'span12';
$api->addText('clientMail', 'Client mail')->getControlPrototype()->class[] = 'span12';
$gaId = $api->addText('gaId', 'GA ID or URL');
$gaId->getControlPrototype()->class[] = 'span12';
$gaId->getControlPrototype()->onChange[] = 'if ($(this).val().length > 20) { var url = $(this).val().split("p"); url = url[url.length - 1]; if(url.substr(url.length -1 , 1) == "/") { url = url.substr(0, url.length - 1); } $(this).val(url); }';
if (file_exists($this->googleanalyticsDir . '/key.p12')) {
$api->addCheckbox('keyFileNew', 'Change private key')->addCondition($form::EQUAL, TRUE)->toggle('group-keyFile');
}
$api->setCurrentGroup($form->addGroup()->setOption('id', 'group-keyFile'));
$api->addUpload('keyFile', 'Private key');
$form->addGroup();
$form->addSaveButton('Save');
}
示例3: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
// Facebook
$provider = $form->addContainer('facebook');
$provider->setCurrentGroup($form->addGroup('Facebook'));
$e = $provider->addCheckbox('enabled', 'Enable');
$e->addCondition($form::EQUAL, TRUE)->toggle('form-facebook');
$provider->setCurrentGroup($form->addGroup()->setOption('id', 'form-facebook'));
$provider->addText('appId', 'App ID')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
$provider->addText('secret', 'Secret')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
$provider->addText('scope', 'Scope');
// // Google
// $provider =$form->addContainer('google');
// $provider->setCurrentGroup($form->addGroup('Google'));
// $e = $provider->addCheckbox('enabled', 'Enable');
// $e->addCondition($form::EQUAL, TRUE)->toggle('form-google');
//
// $provider->setCurrentGroup($form->addGroup()->setOption('id', 'form-google'));
// $provider->addText('appId', 'App ID')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
// $provider->addText('secret', 'Secret')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
// $provider->addText('scope', 'Scope');
// // Twitter
// $provider =$form->addContainer('twitter');
// $provider->setCurrentGroup($form->addGroup('Twitter'));
// $e = $provider->addCheckbox('enabled', 'Enable');
// $e->addCondition($form::EQUAL, TRUE)->toggle('form-twitter');
//
// $provider->setCurrentGroup($form->addGroup()->setOption('id', 'form-twitter'));
// $provider->addText('key', 'Key')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
// $provider->addText('secret', 'Secret')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
// OpenID
$provider = $form->addContainer('openid');
$provider->setCurrentGroup($form->addGroup('OpenID'));
$provider->addCheckbox('enabled', 'Enable');
// Private OpenID
$provider = $form->addContainer('privateOpenid');
$provider->setCurrentGroup($form->addGroup('Private OpenID'));
$e = $provider->addCheckbox('enabled', 'Enable');
$e->addCondition($form::EQUAL, TRUE)->toggle('form-privateOpenid');
$provider->setCurrentGroup($form->addGroup()->setOption('id', 'form-privateOpenid'));
$provider->addText('server', 'Server')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED)->addRule($form::URL);
// Github
$provider = $form->addContainer('github');
$provider->setCurrentGroup($form->addGroup('Github'));
$e = $provider->addCheckbox('enabled', 'Enable');
$e->addCondition($form::EQUAL, TRUE)->toggle('form-github');
$provider->setCurrentGroup($form->addGroup()->setOption('id', 'form-github'));
$provider->addText('appId', 'App ID')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
$provider->addText('secret', 'Secret')->addConditionOn($e, $form::EQUAL, TRUE)->addRule($form::FILLED);
$provider->addText('scope', 'Scope');
$form->addGroup();
$form->addSubmit('_submit', 'Save');
}
示例4: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
/* containers */
$nette = $form->addContainer('nette');
$venne = $form->addContainer('venne');
$doctrine = $form->addContainer('doctrine');
/** @var $debugger \Nette\Forms\Container */
$debugger = $nette->addContainer('debugger');
$application = $nette->addContainer('application');
$routing = $nette->addContainer('routing');
$container = $nette->addContainer('container');
$security = $nette->addContainer('security');
/* application */
$application->setCurrentGroup($form->addGroup('Application'));
$application->addSelect('catchExceptions', 'Catch exceptions', array(TRUE => 'yes', FALSE => 'no'))->setDefaultValue(TRUE);
/* session */
$session = $venne->addContainer('session');
$session->setCurrentGroup($form->addGroup('Session'));
$session->addTextWithSelect('savePath', 'Save path')->setItems(array('%tempDir%/sessions' => '%tempDir%/sessions'));
/* debugger */
$debugger->setCurrentGroup($group = $form->addGroup('Debugger'));
$debugger->addSelect('strictMode', 'Strict mode')->setItems(array(TRUE => 'yes', FALSE => 'no'));
$debugger->addText('edit', 'Editor');
$debugger->addText('browser', 'Browser');
$debugger->addText('email', 'E-mail for logs')->addCondition($form::FILLED)->addRule($form::EMAIL);
$application->setCurrentGroup($group);
$application->addCheckbox('debugger', 'Debugger panel in bluescreen')->setDefaultValue(TRUE);
$routing->setCurrentGroup($group);
$routing->addCheckbox('debugger', 'Routing panel')->setDefaultValue(TRUE);
$container->setCurrentGroup($group);
$container->addCheckbox('debugger', 'DI panel')->setDefaultValue(TRUE);
$security->setCurrentGroup($group);
$security->addCheckbox('debugger', 'Security panel')->setDefaultValue(TRUE);
$doctrine->setCurrentGroup($group);
$doctrine->addCheckbox('debugger', 'Database panel')->setDefaultValue(TRUE);
/* session */
$container = $nette->addContainer('session');
$container->setCurrentGroup($form->addGroup('Sessions'));
$container->addCheckbox('autoStart', 'Autostart')->setDefaultValue(FALSE);
$container->addText('expiration', 'Expiration');
//->setItems(array('+ 1 day', '+ 10 days', '+ 30 days', '+ 1 year'), false);
$container->addText('cookiePath', 'Cookie path')->setDefaultValue('/');
$container->addText('cookieDomain', 'Cookie domain');
/* templating */
$nette->setCurrentGroup($form->addGroup('Templating'));
$nette->addSelect('xhtml', 'XHTML', array(TRUE => 'yes', FALSE => 'no'))->setDefaultValue(TRUE);
$doctrine->setCurrentGroup($form->addGroup('Doctrine'));
$doctrine->addSelect('cacheClass', 'Cache type', DoctrineExtension::getCaches());
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例5: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$container = $form->addContainer('_inputs');
$container->setCurrentGroup($form->addGroup());
$container->addText('_email', 'E-mail')->addRule($form::EMAIL)->setRequired(true);
$container->addText('_name', 'Name')->setRequired(true);
foreach ($form->data->inputs as $key => $input) {
if ($input->getType() === InputEntity::TYPE_GROUP) {
$container->setCurrentGroup($form->addGroup($input->getLabel()));
continue;
}
$control = $container->add($input->getType(), 'input_' . $key, $input->getLabel());
if ($input->required) {
$control->setRequired(true);
}
if (in_array($input->getType(), array(InputEntity::TYPE_SELECT, InputEntity::TYPE_CHECKBOX_LIST, InputEntity::TYPE_RADIO_LIST))) {
$items = array();
foreach ($input->getItems() as $item) {
$items[$item] = $item;
}
$control->setItems($items);
}
}
$form->addGroup();
$form->addSaveButton('Send');
}
示例6: configure
public function configure(Form $form)
{
$_this = $this;
$route = $form->addOne('route');
$group = $form->addGroup();
$route->setCurrentGroup($group);
$form->addText('name', 'Name');
$form->addText('price', 'Price')->setDefaultValue(0)->addCondition($form::FILLED)->addRule($form::FLOAT);
$form->addText('rrp', 'RRP')->addCondition($form::FILLED)->addRule($form::FLOAT);
$route->addTextArea('notation', 'Description');
$route->addFileEntityInput('photo', 'Image');
$form->addText('inStock', 'In stock')->addCondition($form::FILLED)->addRule($form::FLOAT);
$form->addGroup('');
$form->addManyToOne('category', 'Main category');
$form->addManyToMany('categories', 'Next categories');
$form->addGroup();
$form->addManyToMany('labels', 'Labels');
$tags = $form->addContainer('tags');
$tags->setCurrentGroup($group = $form->addGroup());
$form->addGroup('Types');
$form->addTags('typesAsArray', 'Types')->setSuggestCallback(function () use($_this, $form) {
$ret = array();
foreach ($_this->getTagsFromCategories($form) as $tag) {
$ret[$tag] = $tag;
}
return $ret;
})->setDelimiter('[;]+')->setJoiner(';');
$form->addGroup();
$form->addSaveButton('Save');
}
示例7: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$facebook = $form->addContainer('facebook');
$facebook->setCurrentGroup($form->addGroup('Facebook'));
$facebook->addText('name', 'Name')->addRule($form::FILLED);
$facebook->addText('appId', 'App ID');
$facebook->addText('secret', 'Secret');
$form->addSaveButton('Save');
}
示例8: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addText('username', 'E-mail')->setRequired('Please provide a e-mail.');
$form->addPassword('password', 'Password')->setRequired('Please provide a password.');
$form->addCheckbox('remember', 'Remember me on this computer');
$form->addSaveButton('Sign in')->getControlPrototype()->class[] = 'btn-primary';
$socialButtons = $form->addContainer('socialButtons');
foreach ($this->securityManager->getLoginProviders() as $loginProvider) {
$socialButtons->addSubmit(str_replace(' ', '_', $loginProvider), $loginProvider)->setValidationScope(FALSE);
}
}
示例9: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$route = $form->addContainer('mainRoute');
$group = $form->addGroup('Settings');
$form->addText('name', 'Name')->addRule($form::FILLED);
$route->setCurrentGroup($group);
$route->addTextArea('notation', 'Notation');
$form->addText('items', 'Items')->addRule($form::FILLED)->addRule($form::INTEGER);
$form->addGroup('Target');
$form->addSelect('class', 'Route type', $this->getClasses())->setPrompt('--------');
$form->addManyToMany('targetPages', 'Target pages');
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例10: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addOne('page')->setCurrentGroup($form->addGroup('General'))->addCheckbox($this->getSecuredColumnName(), 'Enable permissions');
if ($form->data->page->{$this->getSecuredColumnName()}) {
$permissions = $form->addContainer('permissions');
foreach ($this->getPrivileges($form) as $key => $name) {
$container = $permissions->addContainer($key);
$container->setCurrentGroup($form->addGroup(ucfirst($name)));
$container->addCheckbox('all', 'Allow for all')->addCondition($form::EQUAL, FALSE)->toggle($container->name . $key);
$group = $form->addGroup()->setOption('id', $container->name . $key);
$container->setCurrentGroup($group);
$container->addMultiSelect('permissions', 'Roles', $this->getRoles());
}
}
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例11: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addGroup();
$form->addText('name', 'Name')->addRule($form::FILLED, 'Please set name');
$form->addTextArea('notation', 'Notation', NULL, 3);
$form->addGroup('Langauge variants');
$languages = $form->addContainer('languages');
foreach ($this->getLanguageRepository()->findBy(array(), array('id' => 'ASC'), NULL, 1) as $language) {
$c = $form->addCheckbox('lang_' . $language->id, (string) $language);
$lang = $languages->addContainer($language->id);
$lang->setCurrentGroup($form->addGroup($language->name)->setOption('id', 'group-' . $language->id));
$lang->addText('name', 'Name')->addConditionOn($c, $form::EQUAL, TRUE)->addRule($form::FILLED);
$lang->addTextArea('notation', 'Notation', NULL, 3);
$c->addCondition($form::EQUAL, TRUE)->toggle('group-' . $language->id);
}
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例12: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$form->addGroup('Authentication');
$form->addSelect('autologin', 'Auto login')->setItems($this->securityManager->getLoginProviders(), FALSE)->setPrompt('Deactivated')->addCondition($form::EQUAL, '')->elseCondition()->toggle('form-autoregistration');
$form->addGroup()->setOption('id', 'form-autoregistration');
$form->addSelect('autoregistration', 'Auto registration')->setPrompt('Deactivated')->setItems(array_keys($this->registrations), FALSE);
$forgotPassword = $form->addContainer('forgotPassword');
$forgotPassword->setCurrentGroup($form->addGroup('Forgot password'));
$enabled = $forgotPassword->addCheckbox('enabled', 'Enabled');
$enabled->addCondition($form::EQUAL, TRUE)->toggle('form-reset');
$forgotPassword->setCurrentGroup($form->addGroup()->setOption('id', 'form-reset'));
$forgotPassword->addText('emailSubject', 'Subject')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
$forgotPassword->addText('emailSender', 'Sender')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
$forgotPassword->addText('emailFrom', 'From')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED)->addRule($form::EMAIL);
$forgotPassword->addTextArea('emailText', 'Text')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例13: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$codes = $this->getCodes();
$form->addGroup();
$form->addManyToOne('person', 'Person');
$c = $form->addManyToOne('bank', 'Bank')->addRule($form::FILLED);
foreach ($codes as $id => $code) {
$c->addCondition($form::EQUAL, $id)->toggle('form-' . $code);
}
$form->addDateTime('syncDate', 'Last sync. date')->addRule($form::FILLED);
$form->addText('name', 'Account number')->addRule($form::FILLED);
$form->addManyToOne('currency', 'Currency')->addRule($form::FILLED);
$form->addText('iban', 'IBAN');
$form->addText('bic', 'BIC');
$drivers = $form->addContainer('drivers');
foreach ($this->paymentManager->getDrivers() as $driver) {
$container = $drivers->addContainer($driver->getCode());
$container->setCurrentGroup($form->addGroup($driver->getName())->setOption('id', 'form-' . $driver->getCode()));
$driver->configureOptionsContainer($container);
}
$form->addGroup();
$form->addSaveButton('Save');
}
示例14: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$presenters = $this->administrationManager->getAdministrationPages();
/** @var $permissions \Nette\Security\Permission */
$permissions = $this->authorizatorFactory->getPermissionsByRoles(array($form->data->name));
foreach ($this->scanResources() as $resource => $privileges) {
$presenter = $this->presenterFactory->unformatPresenterClass($resource);
$container = $form->addContainer($this->formatName($resource));
$container->setCurrentGroup($form->addGroup(isset($presenters[$presenter . ':']) ? $presenters[$presenter . ':']['name'] : $resource));
$val = $permissions->isAllowed($form->data->name, $resource);
$container->addCheckbox('all', 'All')->setDefaultValue($val);
$privilegeContainer = $container->addContainer('privileges');
foreach ($privileges as $privilege) {
/** @var $checkbox \Nette\Forms\Controls\Checkbox */
$checkbox = $privilegeContainer->addCheckbox($privilege, $privilege);
$checkbox->setDefaultValue($permissions->isAllowed($form->data->name, $resource, $privilege));
if ($val) {
$checkbox->disabled = TRUE;
}
}
}
$form->setCurrentGroup();
$form->addSaveButton('Save');
}