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())); } }
/** * @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'); }
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'); }
/** * @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'); }
/** * @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'); }
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'); }
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'); }
public function configure(Form $form) { $form->addGroup('Nastavení API'); $form->addText('accountNumber', 'Číslo účtu'); $form->setCurrentGroup(); $form->addSaveButton('Save'); }
public function handleCatchError(Form $form, $e) { if ($e instanceof PermissionDeniedException) { $form->addError('You have not writable permissions.'); return TRUE; } }
/** * @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'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addGroup('Settings'); $form->addText('itemsPerPage', 'Items per page'); $form->setCurrentGroup(); $form->addSaveButton('Save'); }
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)); }
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); } } }
/** * @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); }
/** * @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'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addText('startDepth', 'Start depth')->addCondition($form::FILLED)->addRule($form::INTEGER); $form->addText('maxDepth', 'Max depth')->addCondition($form::FILLED)->addRule($form::INTEGER); $form->addManyToOne('root', 'Root page'); $form->addSaveButton('Save'); }
public function formSuccess(Form $form) { if ($form->isSubmitted() === $form->getSaveButton()) { $x = $this->newsletterManager->sendNewsletter($form->data); $this->presenter->flashMessage('Newsletter byl odeslán na ' . $x . ' kontaktů.'); $this->redirect('this'); } }
/** * @param Form $form */ public function check($form) { if (!$form->getMapper() instanceof EntityMapper) { throw new \Nette\InvalidArgumentException("Form mapper must be instanceof 'EntityMapper'. '" . get_class($form->getMapper()) . "' is given."); } if (!$form->getData() instanceof \DoctrineModule\Entities\IEntity) { throw new \Nette\InvalidArgumentException("Form data must be instanceof 'IEntity'. '" . get_class($form->getData()) . "' is given."); } }
/** * @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'); }
public function handleSave(Form $form) { $values = $form->getValues(); if ($values['api']['keyFile']->isOk()) { $values['api']['keyFile']->move($this->googleanalyticsDir . '/key.p12'); } unset($form['api']['keyFile']); unset($form['api']['keyFileNew']); }
public function formSuccess(Form $form) { if ($form->isSubmitted() !== $form->getSaveButton()) { return; } $this->getImporter()->run($form); $this->flashMessage($this->translator->translate('Process has been finished'), 'success'); $this->redirect('this'); }
/** * @param Form $form */ public function configure(Form $form) { $route = $form->addOne('conditions')->addOne('route'); $route->setCurrentGroup($form->addGroup()->setOption('class', 'full')); $route->addContentEditor('text', NULL, NULL, 30)->getControlPrototype()->class[] = 'input-block-level'; $route['text']->getControlPrototype()->data['cms-route'] = $form->data->page->mainRoute->id; $route['text']->getControlPrototype()->data['cms-page'] = $form->data->page->id; $form->addSaveButton('Save'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addText('name', 'Name')->addRule($form::FILLED); $form->addText('domain', 'Domain')->addRule($form::FILLED); /** @var ManyToOne $page */ $page = $form->addOneToOne('page', 'Page'); $page->setQuery($this->pageRepository->createQueryBuilder('a')->orderBy('a.positionString', 'ASC')); $form->addSaveButton('Save'); }
public function formSuccess(Form $form) { if ($form->isSubmitted() !== $form->getSaveButton()) { return; } $this->flashMessage($this->translator->translate('Configuration has been saved.'), 'success'); if (!$this->isAjax()) { $this->redirect('this'); } }
public function handleAttached(Form $form) { $form->setCurrentGroup(); $form->addSaveButton('Save'); if ($form->isSubmitted()) { if (!$form['user']['password_new']->value) { unset($form['user']['password']); } } }
/** * @param Form $form */ public function configure(Form $form) { $page = $form->addOne('page'); $mainRoute = $page->addOne('mainRoute'); $mainRoute->setCurrentGroup($form->addGroup()); $mainRoute->addCheckbox('published', 'Publish'); $mainRoute->addDateTime('released', 'Release')->addRule($form::FILLED); $mainRoute->addDateTime('expired', 'Expire'); $form->setCurrentGroup(); $form->addSaveButton('Save'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addGroup(); $form->addText('itemsPerPage', 'Items per page'); $form->addManyToMany('pages', 'Pages'); $form->addManyToMany('categories', 'Categories'); $form->addGroup('Dimensions'); $form->addText('width', 'Width')->addCondition($form::FILLED)->addRule($form::INTEGER); $form->addText('height', 'Height')->addCondition($form::FILLED)->addRule($form::INTEGER); $form->addGroup(); $form->addSaveButton('Save'); }
/** * @param Form $form */ public function configure(Form $form) { $form->addGroup('Settings'); $form->addText('itemsPerPage', 'Items per page'); $form->addGroup('Notation'); $form->addCheckbox('notationInHtml', 'In HTML format'); $form->addCheckbox('autoNotation', 'Auto generate')->addCondition($form::EQUAL, true)->toggle('notationLength'); $form->addGroup()->setOption('id', 'notationLength'); $form->addText('notationLength', 'Length')->addRule($form::INTEGER); $form->addGroup(); $form->addSaveButton('Save'); }
public function handleCatchError(Form $form, $e) { if ($e instanceof InvalidArgumentException) { $form->addError($e->getMessage()); return TRUE; } else { if ($e instanceof DBALException && strpos($e->getMessage(), 'Duplicate entry') !== false) { $form->addError('Duplicate entry'); return TRUE; } } }
public function handleSave(Form $form) { /** @var $entity CategoryEntity */ $entity = $form->data; $data = $form->getValues(); $sort = json_decode($data['sort'], TRUE); foreach ($entity->getItems() as $photo) { if (($pos = array_search($photo->id, $sort)) !== false) { $photo->position = $pos; } } parent::handleSave($form); }