1
|
<?php
|
2
|
|
3
|
|
4
|
namespace App\AdminModule\Presenters;
|
5
|
|
6
|
|
7
|
use App\AdminModule\Components\IBookEditFormFactory;
|
8
|
use App\AdminModule\Components\IBookOptionFormFactory;
|
9
|
use App\AdminModule\Components\ITransliterationDataEditFormFactory;
|
10
|
use App\AdminModule\Components\ITransliterationGridFactory;
|
11
|
use App\AdminModule\Components\ITransliterationEditFormFactory;
|
12
|
use App\AdminModule\Components\ITransliterationNewFormFactory;
|
13
|
use App\FrontModule\Components\IKeyboard;
|
14
|
use App\Model\Repository\TransliterationRepository;
|
15
|
|
16
|
class TransliterationPresenter extends BaseUserPresenter
|
17
|
{
|
18
|
/**
|
19
|
* @var ITransliterationGridFactory
|
20
|
*/
|
21
|
private $transliterationGridFactory;
|
22
|
|
23
|
/**
|
24
|
* @var ITransliterationEditFormFactory
|
25
|
*/
|
26
|
private $transliterationEditFormFactory;
|
27
|
|
28
|
/**
|
29
|
* @var TransliterationRepository
|
30
|
*/
|
31
|
private $transliterationRepository;
|
32
|
|
33
|
/**
|
34
|
* @var ITransliterationDataEditFormFactory
|
35
|
*/
|
36
|
private $transliterationDataEditFormFactory;
|
37
|
/**
|
38
|
* @var ITransliterationNewFormFactory
|
39
|
*/
|
40
|
private $transliterationNewFormFactory;
|
41
|
/**
|
42
|
* @var IBookOptionFormFactory
|
43
|
*/
|
44
|
private $bookOptionFormFactory;
|
45
|
/**
|
46
|
* @var IKeyboard
|
47
|
*/
|
48
|
private $keyboard;
|
49
|
|
50
|
public function __construct(ITransliterationGridFactory $transliterationGridFactory,
|
51
|
ITransliterationEditFormFactory $transliterationEditFormFactory,
|
52
|
TransliterationRepository $transliterationRepository,
|
53
|
ITransliterationDataEditFormFactory $transliterationDataEditFormFactory,
|
54
|
ITransliterationNewFormFactory $transliterationNewFormFactory,
|
55
|
IBookOptionFormFactory $bookOptionFormFactory,
|
56
|
IKeyboard $keyboard
|
57
|
)
|
58
|
{
|
59
|
parent::__construct();
|
60
|
$this->transliterationEditFormFactory = $transliterationEditFormFactory;
|
61
|
$this->transliterationGridFactory = $transliterationGridFactory;
|
62
|
$this->transliterationRepository = $transliterationRepository;
|
63
|
$this->transliterationDataEditFormFactory = $transliterationDataEditFormFactory;
|
64
|
$this->transliterationNewFormFactory = $transliterationNewFormFactory;
|
65
|
$this->bookOptionFormFactory = $bookOptionFormFactory;
|
66
|
$this->keyboard = $keyboard;
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* Handle používaný v TransliterationGrid pro smazání transliterace
|
71
|
*
|
72
|
* @param int $id : ID transliterace
|
73
|
*/
|
74
|
public function handleDeleteTransliteration(int $id)
|
75
|
{
|
76
|
if ($this->isAjax())
|
77
|
{
|
78
|
$this->transliterationRepository->findRow($id)->delete();
|
79
|
$this['transliterationGrid']->reload();
|
80
|
}
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* Editace informací o transliteraci
|
85
|
*
|
86
|
* @param int $id
|
87
|
*/
|
88
|
public function actionEdit(int $id)
|
89
|
{
|
90
|
$this['transliterationEditForm']->setTransliteration($id);
|
91
|
$this['transliterationDataEditForm']->setTransliteration($id);
|
92
|
}
|
93
|
|
94
|
public function createComponentTransliterationGrid()
|
95
|
{
|
96
|
return $this->transliterationGridFactory->create();
|
97
|
}
|
98
|
|
99
|
public function createComponentTransliterationEditForm()
|
100
|
{
|
101
|
return $this->transliterationEditFormFactory->create();
|
102
|
}
|
103
|
|
104
|
public function createComponentTransliterationDataEditForm()
|
105
|
{
|
106
|
return $this->transliterationDataEditFormFactory->create();
|
107
|
}
|
108
|
|
109
|
public function createComponentTransliterationNewForm()
|
110
|
{
|
111
|
return $this->transliterationNewFormFactory->create();
|
112
|
}
|
113
|
|
114
|
public function createComponentBookOptionForm()
|
115
|
{
|
116
|
return $this->bookOptionFormFactory->create();
|
117
|
}
|
118
|
|
119
|
public function createComponentKeyboard()
|
120
|
{
|
121
|
return $this->keyboard->create();
|
122
|
}
|
123
|
|
124
|
}
|