Projekt

Obecné

Profil

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

    
3

    
4
namespace App\AdminModule\Presenters;
5

    
6

    
7
use App\AdminModule\Components\ITransliterationDataEditFormFactory;
8
use App\AdminModule\Components\ITransliterationGridFactory;
9
use App\AdminModule\Components\ITransliterationEditFormFactory;
10
use App\Model\Repository\TransliterationRepository;
11

    
12
class TransliterationPresenter extends BaseUserPresenter
13
{
14
    /**
15
     * @var ITransliterationGridFactory
16
     */
17
    private $transliterationGridFactory;
18

    
19
    /**
20
     * @var ITransliterationEditFormFactory
21
     */
22
    private $transliterationEditFormFactory;
23

    
24
    /**
25
     * @var TransliterationRepository
26
     */
27
    private $transliterationRepository;
28

    
29
    /**
30
     * @var ITransliterationDataEditFormFactory
31
     */
32
    private $transliterationDataEditFormFactory;
33

    
34
    public function __construct(ITransliterationGridFactory $transliterationGridFactory,
35
                                ITransliterationEditFormFactory $transliterationEditFormFactory,
36
                                TransliterationRepository $transliterationRepository,
37
                                ITransliterationDataEditFormFactory $transliterationDataEditFormFactory
38
    )
39
    {
40
        parent::__construct();
41
        $this->transliterationEditFormFactory = $transliterationEditFormFactory;
42
        $this->transliterationGridFactory = $transliterationGridFactory;
43
        $this->transliterationRepository = $transliterationRepository;
44
        $this->transliterationDataEditFormFactory = $transliterationDataEditFormFactory;
45
    }
46

    
47
    /**
48
     * Handle používaný v TransliterationGrid pro smazání transliterace
49
     *
50
     * @param int $id : ID transliterace
51
     */
52
    public function handleDeleteTransliteration(int $id)
53
    {
54
        if ($this->isAjax())
55
        {
56
            $this->transliterationRepository->findRow($id)->delete();
57
            $this['transliterationGrid']->reload();
58
        }
59
    }
60

    
61
    /**
62
     * Editace informací o transliteraci
63
     *
64
     * @param int $id
65
     */
66
    public function actionEdit(int $id)
67
    {
68
        $this['transliterationEditForm']->setTransliteration($id);
69
        $this['transliterationDataEditForm']->setTransliteration($id);
70
    }
71

    
72
    public function createComponentTransliterationGrid()
73
    {
74
        return $this->transliterationGridFactory->create();
75
    }
76

    
77
    public function createComponentTransliterationEditForm()
78
    {
79
        return $this->transliterationEditFormFactory->create();
80
    }
81

    
82
    public function createComponentTransliterationDataEditForm()
83
    {
84
        return  $this->transliterationDataEditFormFactory->create();
85
    }
86

    
87
}
(10-10/11)