Revize 793a2c68
Přidáno uživatelem Filip Jani před více než 5 roky(ů)
- ID 793a2c687f1328578258d5697ca7c92bd89edf95
- Rodič 6b983650
app/presenters/HomepagePresenter.php | ||
---|---|---|
3 | 3 |
namespace App\Presenters; |
4 | 4 |
|
5 | 5 |
use App\Components\IExampleGirdFactory; |
6 |
use App\Components\ILoginFormFactory; |
|
7 |
use App\Enum\EFlashMessage; |
|
6 | 8 |
use Nette; |
7 | 9 |
|
8 | 10 |
|
... | ... | |
10 | 12 |
{ |
11 | 13 |
/** @var IExampleGirdFactory */ |
12 | 14 |
private $exampleGridFactory; |
15 |
/** @var ILoginFormFactory */ |
|
16 |
private $loginFormFactory; |
|
13 | 17 |
|
14 |
public function __construct(IExampleGirdFactory $exampleGridFactory) |
|
18 |
public function __construct(IExampleGirdFactory $exampleGridFactory, ILoginFormFactory $loginFormFactory)
|
|
15 | 19 |
{ |
16 | 20 |
parent::__construct(); |
17 | 21 |
|
18 | 22 |
$this->exampleGridFactory = $exampleGridFactory; |
23 |
$this->loginFormFactory = $loginFormFactory; |
|
19 | 24 |
} |
20 | 25 |
|
21 |
public function actionDefault(){ |
|
26 |
public function actionDefault() |
|
27 |
{ |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
public function actionLogin() |
|
32 |
{ |
|
33 |
if ($this->user->isLoggedIn()) |
|
34 |
{ |
|
35 |
$this->redirect('Homepage:default'); |
|
36 |
} |
|
37 |
} |
|
22 | 38 |
|
39 |
public function actionLogout() |
|
40 |
{ |
|
41 |
if ($this->getUser()->isLoggedIn()) |
|
42 |
{ |
|
43 |
$this->user->logout(true); |
|
44 |
|
|
45 |
$this->flashMessage('Odhlášení bylo úspěšné.', EFlashMessage::SUCCESS); |
|
46 |
$this->redirect('Homepage:default'); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Komponenta přihlašovacího formuláře |
|
52 |
* |
|
53 |
* @return \App\Components\LoginForm |
|
54 |
*/ |
|
55 |
public function createComponentLoginForm() |
|
56 |
{ |
|
57 |
return $this->loginFormFactory->create(); |
|
23 | 58 |
} |
24 | 59 |
|
25 |
public function createComponentDataGrid(){ |
|
60 |
/** |
|
61 |
* Vytvoření ukázkového gridu |
|
62 |
*/ |
|
63 |
public function createComponentDataGrid() |
|
64 |
{ |
|
26 | 65 |
return $this->exampleGridFactory->create(); |
27 | 66 |
} |
28 | 67 |
} |
Také k dispozici: Unified diff
7216 přidání přihlašování uživatelů a úprava namespace pro repository