本文整理汇总了PHP中Venne\Forms\Form类的典型用法代码示例。如果您正苦于以下问题:PHP Form类的具体用法?PHP Form怎么用?PHP Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleValidate
public function handleValidate(Form $form)
{
if (!isset($this->sessionSection->captcha) || $form['_captcha']->value != $this->sessionSection->captcha) {
$form->addError('Nesprávně opsaný obrázek, zkuste to prosím znovu');
$form['_captcha']->setOption('description', Html::el('img')->src($this->getCaptchaBuilder()->inline()));
}
}
示例2: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addText('appId', 'App ID');
$form->addText('secret', 'Secret');
$form->addSelect('cookie', 'Use cookie', array(TRUE => 'yes', FALSE => 'no'));
$form->addSaveButton('Save');
}
示例3: configure
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('name', 'Name');
$form->addOne('route')->setCurrentGroup($group)->addTextArea('notation', 'Notation', NULL, 4)->getControlPrototype()->attrs['class'] = 'input-block-level';
$form->addSaveButton('Save');
}
示例4: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addText('itemsPerPage', 'Items per page');
$form->addManyToMany('pages', 'Pages');
$form->addManyToMany('categories', 'Categories');
$form->addSaveButton('Save');
}
示例5: configure
/**
* @param Form $form
*/
protected function configure(Form $form)
{
$form->addText('name', 'Name');
$form->addSelect('file', 'File')->setItems($this->templateManager->getLayouts());
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例6: formSuccess
public function formSuccess(Form $form)
{
if ($form->isSubmitted() !== $form->getSaveButton()) {
return;
}
$values = $form->values;
$data = array('code' => 'K0ntrolaH3slem', 'jmeno' => $values['person'] == 'fyzicka' ? $values['fyzicka']['name'] : $values['pravnicka']['name'] . ' / ' . $values['pravnicka']['person'], 'narozeni' => $values['person'] == 'fyzicka' ? $values['fyzicka']['bornDate'] : $values['pravnicka']['IC'], 'ulice' => $values['street'], 'obec' => $values['city'], 'psc' => $values['psc'], 'email' => $values['email'], 'castka' => $values['money'] == 'other' ? $values['moneyOther'] : $values['money'], 'ip' => $this->httpRequest->remoteAddress);
$params = '';
foreach ($data as $key => $val) {
$params .= '&' . $key . '=' . urlencode($val);
}
$params = ltrim($params, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://s-dary.zvara.cz/inject.php');
curl_setopt($ch, CURLOPT_POST, count($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status == 200) {
$this->flashMessage('Děkujeme, částku prosím uhraďte na náš transparentní účet s variabilním symbolem ' . $result, 'success');
} elseif ($status == 403) {
$this->flashMessage('Server nemá povolení k provedení akce. Prosím kontaktujte administrátora. ', 'warning');
} else {
$this->flashMessage('Nastala chyba při ukládání, zopakujte prosím akci později', 'warning');
}
$this->redirect('this');
}
示例7: configure
public function configure(Form $form)
{
$group = $form->addGroup();
$form->addText('name', 'Name');
$form->addOne('route')->setCurrentGroup($group)->addTextArea('notation', 'Description', NULL, 4);
$form->addSaveButton('Save');
}
示例8: configure
public function configure(Form $form)
{
$form->addGroup('Nastavení API');
$form->addText('accountNumber', 'Číslo účtu');
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例9: handleCatchError
public function handleCatchError(Form $form, $e)
{
if ($e instanceof PermissionDeniedException) {
$form->addError('You have not writable permissions.');
return TRUE;
}
}
示例10: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addManyToMany('accounts', 'Accounts');
$form->addText('itemsPerPage', 'Items per page')->addRule($form::FILLED)->addRule($form::NUMERIC);
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例11: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addGroup('Settings');
$form->addText('itemsPerPage', 'Items per page');
$form->setCurrentGroup();
$form->addSaveButton('Save');
}
示例12: handleSave
public function handleSave(Form $form)
{
if ($form->isSubmitted() !== $form->getSaveButton()) {
return;
}
$data = array('toolbar' => array());
$i = TRUE;
foreach ($form['toolbar']->values as $items) {
if ($i) {
$i = FALSE;
} else {
$data['toolbar'][] = '/';
}
$r = array();
$i = TRUE;
foreach ($items['line'] as $value) {
if ($i) {
$i = FALSE;
} else {
$data['toolbar'][] = array('items' => $r);
$r = array();
}
foreach ($value['items'] as $item) {
$r[] = $item;
}
}
$data['toolbar'][] = array('items' => $r);
}
file_put_contents($this->ckeditorDir . '/backend.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}
示例13: handleSave
public function handleSave(Form $form)
{
$values = $form->values;
if ($values['file']->isOk()) {
if ($values['cleanout']) {
foreach ($this->userRepository->findAll() as $user) {
$this->userRepository->delete($user);
}
}
/** @var FileUpload $file */
$file = $values['file'];
$data = file_get_contents($file->getTemporaryFile());
foreach (explode("\n", $data) as $row) {
if (!$row) {
continue;
}
$items = explode(',', $row);
if (!count($items)) {
continue;
}
try {
$user = new UserEntity(trim($items[0]));
} catch (InvalidArgumentException $e) {
$form->addError($e->getMessage());
}
$this->userRepository->save($user);
}
}
}
示例14: configure
/**
* @param Form $form
*/
public function configure(Form $form)
{
$form->addHidden('provider')->setValue($this->provider);
$form['parameters'] = $this->securityManager->getLoginProviderByName($this->provider)->getFormContainer();
$form->addSaveButton('Sign in')->getControlPrototype()->class[] = 'btn-primary';
$form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE);
}
示例15: configure
/**
* @param Form $form
*/
public function configure(Venne\Forms\Form $form)
{
$form->addGroup('Template');
$form->addTextArea('template', 'Product template')->getControlPrototype()->attrs['class'] = 'input-block-level';
$form->addMailform('mailform');
$form->addSaveButton('Save');
}