Projekt

Obecné

Profil

Stáhnout (1.34 KB) Statistiky
| Větev: | Tag: | Revize:
1
<?php
2

    
3

    
4
namespace App\AdminModule\Presenters;
5

    
6

    
7
use App\AdminModule\Components\IUserEditFormFactory;
8
use App\AdminModule\Components\IUserGridFactory;
9
use App\Model\Facade\UserFacade;
10

    
11
class UserPresenter extends BaseAdminPresenter
12
{
13
    /**
14
     * @var IUserGridFactory
15
     */
16
    private $userGridFactory;
17
    /**
18
     * @var IUserEditFormFactory
19
     */
20
    private $userEditFormFactory;
21
    /**
22
     * @var UserFacade
23
     */
24
    private $userFacade;
25

    
26
    public function __construct(IUserGridFactory $userGridFactory,
27
                                IUserEditFormFactory $userEditFormFactory,
28
                                UserFacade $userFacade
29
    )
30
    {
31
        parent::__construct();
32

    
33
        $this->userGridFactory = $userGridFactory;
34
        $this->userEditFormFactory = $userEditFormFactory;
35
        $this->userFacade = $userFacade;
36
    }
37

    
38
    public function actionEdit(int $id)
39
    {
40
        $this['userEditForm']->setUser($id);
41
    }
42

    
43
    public function handleDeleteUser(int $id)
44
    {
45
        if ($this->isAjax())
46
        {
47
            $this->userFacade->deleteUser($id);
48
            $this['userGrid']->reload();
49
        }
50
    }
51

    
52
    public function createComponentUserGrid()
53
    {
54
        return $this->userGridFactory->create();
55
    }
56

    
57
    public function createComponentUserEditForm()
58
    {
59
        return $this->userEditFormFactory->create();
60
    }
61
}
(6-6/6)