public function formCommentSucceeded(Form $form, $values) { $sub = $form->getHttpData(); $under = isset($sub['subcomment']) && $sub['subcomment'] > 0 && $sub['subcomment'] !== '0' ? $sub['subcomment'] : false; if (!$this->user->isLoggedIn()) { try { $this->captchaManager->checkCaptcha($values->captcha); $this->captchaManager->setNewQuestion(); } catch (\Exception $e) { if ($under !== false) { $this->template->currentSubComment = $under; } $this->template->badAnswer = true; $this->flashMessage($e->getMessage() . ' Klikněte na: nová otázka'); $this->redrawAjax(['captchaContainer', 'captchaStatic', 'flashMessageComment']); return; } } $this->commentsManager->addComment($values, $under); if ($under === false) { $this->setPage(1, true); $this->flashMessage('Přidán komentář'); $this->redrawAjax('commentContainerAll'); } else { $this->template->currentSubComment = $under; $this->flashMessage('Přidán podkomentář'); $this->redrawAjax('commentContainerAll'); } $this->redrawAjax(['captchaContainer', 'captchaStatic', 'flashMessageComment']); $form->setValues([], true); }
public function newWriterFormSucceeded($form, $values) { if (!$this->presenter->user->isLoggedIn()) { try { $this->captchaManager->checkCaptcha($values->captcha); } catch (\Exception $e) { $this->presenter->flashMessage($e->getMessage()); $this->presenter->redirect('this'); } $values->byUser = null; } else { $values->contact = $this->presenter->user->getIdentity()->mail; $values->byUser = $this->presenter->user->id; } try { $this->articleManager->addNewWriter($values); } catch (\Exception $e) { $form->addError($e->getMessage()); } }
/** * Form OK * @param Form $form * @param type $values */ public function registerFormSucceeded(Form $form, $values) { try { $this->captchaManager->checkCaptcha($values->captcha); } catch (\Exception $e) { $this->goHome($e->getMessage(), 'this'); } try { $this->userManager->registerNew($values->mail, $values->password, $values->nickName); } catch (\Exception $e) { $form->addError($e->getMessage()); } if ($form->success) { $this->goHome('Registrace byla úspěšná, vyčkejte na ověřovací mail. Můžete se nyní přihlásit.', 'Log:in', [], 'success'); } }