Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 29, 2018
1 parent 5c01974 commit 29ad855
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cs/forms.texy
Expand Up @@ -37,7 +37,7 @@ class HomepagePresenter extends UI\Presenter
} }


// volá se po úspěšném odeslání formuláře // volá se po úspěšném odeslání formuláře
public function registrationFormSucceeded(UI\Form $form, stdClass $values) public function registrationFormSucceeded(UI\Form $form, \stdClass $values)
{ {
// ... // ...
$this->flashMessage('Byl jste úspěšně registrován.'); $this->flashMessage('Byl jste úspěšně registrován.');
Expand Down
4 changes: 2 additions & 2 deletions cs/quickstart/authentication.texy
Expand Up @@ -82,7 +82,7 @@ Dále doplníme callback pro přihlášení uživatele, který bude volán hned
Callback pouze převezme uživatelské jméno a heslo, které uživatel vyplnil a předá to authenticatoru. Po přihlášení přesměrujeme na úvodní stránku. Callback pouze převezme uživatelské jméno a heslo, které uživatel vyplnil a předá to authenticatoru. Po přihlášení přesměrujeme na úvodní stránku.


/--php /--php
public function signInFormSucceeded(Form $form, stdClass $values) public function signInFormSucceeded(Form $form, \stdClass $values)
{ {
try { try {
$this->getUser()->login($values->username, $values->password); $this->getUser()->login($values->username, $values->password);
Expand Down Expand Up @@ -159,7 +159,7 @@ Poslední a **nejdůležitější věc** je **zabezpečit callbacky formulářů
Tomu můžeme zabránit přidáním jednoduchého *if*, který přidáme na začátek metody `postFormSucceeded`: Tomu můžeme zabránit přidáním jednoduchého *if*, který přidáme na začátek metody `postFormSucceeded`:


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
if (!$this->getUser()->isLoggedIn()) { if (!$this->getUser()->isLoggedIn()) {
$this->error('Pro vytvoření, nebo editování příspěvku se musíte přihlásit.'); $this->error('Pro vytvoření, nebo editování příspěvku se musíte přihlásit.');
Expand Down
2 changes: 1 addition & 1 deletion cs/quickstart/comments.texy
Expand Up @@ -92,7 +92,7 @@ $form->onSuccess[] = [$this, 'commentFormSucceeded'];
Předchozí zápis znamená "po úspěšném odeslání formuláře zavolej metodu `commentFormSucceeded` ze současného presenteru". Tato metoda však ještě neexistuje, pojďme ji tedy vytvořit. Předchozí zápis znamená "po úspěšném odeslání formuláře zavolej metodu `commentFormSucceeded` ze současného presenteru". Tato metoda však ještě neexistuje, pojďme ji tedy vytvořit.


/--php /--php
public function commentFormSucceeded(Form $form, stdClass $values) public function commentFormSucceeded(Form $form, \stdClass $values)
{ {
$postId = $this->getParameter('postId'); $postId = $this->getParameter('postId');


Expand Down
4 changes: 2 additions & 2 deletions cs/quickstart/creating-posts.texy
Expand Up @@ -78,7 +78,7 @@ Ukládání nového příspěvku z formuláře
Pokračujeme přidáním metody, která zpracuje data z formuláře: Pokračujeme přidáním metody, která zpracuje data z formuláře:


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
$post = $this->database->table('posts')->insert($values); $post = $this->database->table('posts')->insert($values);


Expand Down Expand Up @@ -122,7 +122,7 @@ Nyní vytvoříme další šablonu (`app/presenters/templates/Post/edit.latte`):
Rozšíříme také callback metodu: Rozšíříme také callback metodu:


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
$postId = $this->getParameter('postId'); $postId = $this->getParameter('postId');


Expand Down
2 changes: 1 addition & 1 deletion en/forms.texy
Expand Up @@ -37,7 +37,7 @@ class HomepagePresenter extends UI\Presenter
} }


// called after form is successfully submitted // called after form is successfully submitted
public function registrationFormSucceeded(UI\Form $form, stdClass $values) public function registrationFormSucceeded(UI\Form $form, \stdClass $values)
{ {
// ... // ...
$this->flashMessage('You have successfully signed up.'); $this->flashMessage('You have successfully signed up.');
Expand Down
4 changes: 2 additions & 2 deletions en/quickstart/authentication.texy
Expand Up @@ -82,7 +82,7 @@ We add also a *form handler* for signing in the user, that gets invoked right af
The handler will just take the username and password the user entered and will pass it to the authenticator defined earlier. After the user has logged in, we will redirect him to the homepage. The handler will just take the username and password the user entered and will pass it to the authenticator defined earlier. After the user has logged in, we will redirect him to the homepage.


/--php /--php
public function signInFormSucceeded(Form $form, stdClass $values) public function signInFormSucceeded(Form $form, \stdClass $values)
{ {
try { try {
$this->getUser()->login($values->username, $values->password); $this->getUser()->login($values->username, $values->password);
Expand Down Expand Up @@ -158,7 +158,7 @@ The last, and **the most important thing** is to **secure the form handler**. Be
It can be prevented with a simple *if* that we will add at the beginning of `postFormSucceeded` It can be prevented with a simple *if* that we will add at the beginning of `postFormSucceeded`


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
if (!$this->getUser()->isLoggedIn()) { if (!$this->getUser()->isLoggedIn()) {
$this->error('You need to log in to create or edit posts'); $this->error('You need to log in to create or edit posts');
Expand Down
2 changes: 1 addition & 1 deletion en/quickstart/comments.texy
Expand Up @@ -91,7 +91,7 @@ $form->onSuccess[] = [$this, 'commentFormSucceeded'];
It means "after the form is successfully submitted, call the method `commentFormSucceeded` of the current presenter". This method does not exist yet, so let’s create it. It means "after the form is successfully submitted, call the method `commentFormSucceeded` of the current presenter". This method does not exist yet, so let’s create it.


/--php /--php
public function commentFormSucceeded(Form $form, stdClass $values) public function commentFormSucceeded(Form $form, \stdClass $values)
{ {
$postId = $this->getParameter('postId'); $postId = $this->getParameter('postId');


Expand Down
4 changes: 2 additions & 2 deletions en/quickstart/creating-posts.texy
Expand Up @@ -78,7 +78,7 @@ Saving New Post from Form
Continue by adding a handler method. Continue by adding a handler method.


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
$post = $this->database->table('posts')->insert($values); $post = $this->database->table('posts')->insert($values);


Expand Down Expand Up @@ -122,7 +122,7 @@ Now create the template (`app/presenters/templates/Post/edit.latte`):
Let’s also extend the form handler: Let’s also extend the form handler:


/--php /--php
public function postFormSucceeded(Form $form, stdClass $values) public function postFormSucceeded(Form $form, \stdClass $values)
{ {
$postId = $this->getParameter('postId'); $postId = $this->getParameter('postId');


Expand Down

0 comments on commit 29ad855

Please sign in to comment.