/** * Přesměruje zpět na RequestButton a potlačí v uživatelských událostech případný redirect. * * @return self * @throw AbortException */ public function fireEvents() { try { parent::fireEvents(); } catch (AbortException $e) { } RequestButtonHelper::redirectBack($this); if (isset($e)) { throw $e; } }
protected function createComponentFileUploadForm() { $form = new \soundake\helpers\MyForm(); $form->renderStyle = \soundake\helpers\MyForm::SEMANTIC; $form->getElementPrototype()->addAttributes(array('class' => '')); $form->addUpload("image", "Vyberte soubory", true)->setRequired()->addRule(Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024)->getControlPrototype()->class('ui input'); $form->addHidden('id'); $form->addHidden('type'); $form->addSubmit('send', 'Nahrát'); $form->onSuccess[] = callback($this, 'fileUploadSuccess'); return $form; }
public function createComponentSearch() { $comp = new MyForm(); $comp->addSuggestInput('q', "DbSuggester (try eg. 'Milan', 'pet')")->setSuggestLink($this->link('suggestDb')); $comp->addSubmit('Hledej'); $comp->onSuccess[] = callback($this, 'searchSubmitted'); return $comp; }
public function saveGrab(MyForm $form) { $values = $form->getValues(); $template = $this->createTemplate(); $template->setFile(__DIR__ . "/../templates/mail-place-request.latte"); $template->values = $values; $template->user = $this->profile; $msg = new \Nette\Mail\Message(); $msg->setHtmlBody($template)->setFrom($values->email)->setSubject('Nová žádost o přidělení místa na portálu Peknyden.cz')->addTo('*****@*****.**'); $this->mailer->send($msg); $this->flashMessage('Děkujeme, žádost byla v pořádku odeslána. Během dvou pracovních dní ji vyřídíme a vyrozumíme vás o tom e-mailem.', 'success'); $this->redirect('this'); }
public function beforeSave(MyForm $form) { if (!$form->submitted instanceof \Nette\Forms\Controls\SubmitButton) { $session = $this->presenter->getSession(get_class($this)); $session->setExpiration(3600); $data = (array) $form->getValues(true); $session['form'] = $data; $this->redirect('this', array('set_subject_id' => $data['subject_id'], 'rewrite' => $data['rewrite'])); } }
public function saveProfile(MyForm $form) { $values = $form->getValues(); $this->profile->update($values); if ($form->onSuccess) { $this->flashMessage('Profil úspěšně uložen!', 'success'); $this->redirect('User:default'); } }