本文整理汇总了PHP中Venne\Forms\Form::getSaveButton方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::getSaveButton方法的具体用法?PHP Form::getSaveButton怎么用?PHP Form::getSaveButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Venne\Forms\Form
的用法示例。
在下文中一共展示了Form::getSaveButton方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: 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');
}
示例3: formSuccess
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');
}
}
示例4: formSuccess
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');
}
示例5: formSuccess
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');
}
}
示例6: handleSave
public function handleSave(Form $form)
{
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
try {
$this->mapper->entityManager->getRepository(get_class($form->data))->save($form->data);
} catch (\Exception $e) {
$ok = true;
if (is_array($this->onCatchError) || $this->onCatchError instanceof \Traversable) {
foreach ($this->onCatchError as $handler) {
if (\Nette\Callback::create($handler)->invokeArgs(array($form, $e))) {
$ok = false;
break;
}
}
} elseif ($this->onCatchError !== NULL) {
$class = get_class($this);
throw new \Nette\UnexpectedValueException("Property {$class}::onCatchError must be array or NULL, " . gettype($this->onCatchError) . " given.");
}
if ($ok) {
throw $e;
}
}
}
}
示例7: overloadFormSuccess
public function overloadFormSuccess(Form $form)
{
if ($form->isSubmitted() === $form->getSaveButton() && !$form->errors) {
$this->redirect('default');
}
}
示例8: actionFormSuccess
public function actionFormSuccess(VForm $form)
{
$this->invalidateControl('actionForm');
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
$this->id = NULL;
$this->formName = NULL;
if (!$this->presenter->isAjax()) {
$this->redirect('this', array('formName' => NULL, 'id' => NULL, 'mode' => NULL));
}
$this->invalidateControl('table');
if ($this->mode === $this::MODE_PLACE) {
$this->invalidateControl('navbarFormContainer');
$this->invalidateControl('actionFormContainer');
}
$this->presenter->payload->url = $this->link('this', array('formName' => NULL, 'id' => NULL, 'mode' => NULL));
}
}
示例9: formSuccess
public function formSuccess(Form $form)
{
$values = $form->getValues();
$button = $form->isSubmitted();
if ($values->remember) {
$form->presenter->user->setExpiration('+ 14 days', FALSE);
} else {
$form->presenter->user->setExpiration('+ 20 minutes', TRUE);
}
if ($button === $form->getSaveButton()) {
try {
$form->presenter->user->login($values->username, $values->password);
} catch (AuthenticationException $e) {
$this->onError($this, $e->getMessage());
}
} else {
$this->redirect('login!', str_replace('_', ' ', $button->name));
}
$this->onSuccess($this);
$this->redirect('this');
}
示例10: handleSuccess
public function handleSuccess(Form $form)
{
if ($form->isSubmitted() === $form->getSaveButton()) {
$values = $form->values;
if ($values['type'] == 'component') {
$file = $this->getFileByClass($values['component']);
$baseName = $file->getBasename('.php') . '.latte';
$template = $file->getPath() . '/' . $baseName;
$target = $this->moduleHelpers->expandPath('@' . $values['target'] . 'Module', 'Resources/layouts');
if ($values['layout']) {
$target .= '/' . $values['layout'];
}
$target .= '/' . $baseName;
} else {
$presenter = explode(':', $values['presenter']);
$module = lcfirst($presenter[0]);
$page = lcfirst($presenter[2]);
$presenter = lcfirst($presenter[3]);
$template = $this->moduleHelpers->expandPath('@' . $module . 'Module/@' . $page . '.' . $presenter . '.latte', 'Resources/layouts');
$target = $this->moduleHelpers->expandPath('@' . $values['target'] . 'Module/' . ($values['layout'] ? $values['layout'] . '/' : '') . '@' . $page . '.' . $presenter . '.latte', 'Resources/layouts');
}
if (!copy($template, $target)) {
$form->addError("Unable to copy file '{$template}' to '{$target}'.");
}
}
}
示例11: formCreateSuccess
public function formCreateSuccess(\Venne\Forms\Form $form)
{
if ($form->hasSaveButton() && $form->isSubmitted() === $form->getSaveButton()) {
if (!$this->presenter->isAjax()) {
$this->redirect('create!', array('createForm' => NULL));
}
$this->getPresenter()->invalidateControl('content');
$this->presenter->payload->url = $this->link('create!', array('createForm' => NULL));
$this->createForm = NULL;
$this->handleCreate();
} else {
$this->invalidateControl('createForm');
}
}