1
|
<?php
|
2
|
|
3
|
namespace App\FrontModule\Presenters;
|
4
|
|
5
|
|
6
|
|
7
|
use App\FrontModule\Components\ITransliterationSearchFormFactory;
|
8
|
use App\FrontModule\Components\ITransliterationSearchResultListFactory;
|
9
|
use App\Model\Repository\LineRepository;
|
10
|
use App\Model\Repository\LitReferenceRepository;
|
11
|
use App\Model\Repository\RevHistoryRepository;
|
12
|
use App\Model\Repository\TransliterationRepository;
|
13
|
use App\Model\TransliterationSearchModel;
|
14
|
use Nette\Application\UI\Presenter;
|
15
|
|
16
|
class TransliterationPresenter extends Presenter
|
17
|
{
|
18
|
/** @var ITransliterationSearchFormFactory */
|
19
|
private $transliterationSearchFormFactory;
|
20
|
|
21
|
/** @var TransliterationRepository */
|
22
|
private $transliterationRepository;
|
23
|
|
24
|
/** @var TransliterationSearchModel */
|
25
|
private $transliterationSearchModel;
|
26
|
|
27
|
/** @var LitReferenceRepository */
|
28
|
private $litReferenceRepository;
|
29
|
|
30
|
/** @var RevHistoryRepository */
|
31
|
private $revHistoryRepository;
|
32
|
|
33
|
/** @var LineRepository */
|
34
|
private $lineRepository;
|
35
|
|
36
|
/** @var ITransliterationSearchResultListFactory */
|
37
|
private $transliterationSearchResultListFactory;
|
38
|
|
39
|
public function __construct(
|
40
|
ITransliterationSearchFormFactory $transliterationSearchFormFactory,
|
41
|
TransliterationRepository $transliterationRepository,
|
42
|
TransliterationSearchModel $transliterationSearchModel,
|
43
|
LitReferenceRepository $litReferenceRepository,
|
44
|
RevHistoryRepository $revHistoryRepository,
|
45
|
LineRepository $lineRepository,
|
46
|
ITransliterationSearchResultListFactory $transliterationSearchResultListFactory
|
47
|
)
|
48
|
{
|
49
|
parent::__construct();
|
50
|
|
51
|
$this->transliterationSearchFormFactory = $transliterationSearchFormFactory;
|
52
|
$this->transliterationRepository = $transliterationRepository;
|
53
|
$this->transliterationSearchModel = $transliterationSearchModel;
|
54
|
$this->litReferenceRepository = $litReferenceRepository;
|
55
|
$this->revHistoryRepository = $revHistoryRepository;
|
56
|
$this->lineRepository = $lineRepository;
|
57
|
$this->transliterationSearchResultListFactory = $transliterationSearchResultListFactory;
|
58
|
}
|
59
|
|
60
|
|
61
|
public function actionSearch()
|
62
|
{
|
63
|
|
64
|
}
|
65
|
|
66
|
public function actionSearchResult()
|
67
|
{
|
68
|
|
69
|
}
|
70
|
|
71
|
public function actionView($id)
|
72
|
{
|
73
|
$transliteration = $this->transliterationRepository->getTransliterationDetail($id);
|
74
|
if(!$transliteration)
|
75
|
{
|
76
|
$this->presenter->flashMessage('Transliteration not found');
|
77
|
$this->redirect('Transliteration:search');
|
78
|
}
|
79
|
$lines = $this->lineRepository->getAllLinesForTransliteration($id);
|
80
|
$lineArray = [];
|
81
|
foreach ($lines as $line)
|
82
|
{
|
83
|
$lineArray[$line->object_type][$line->surface_type][] = array('transliteration' => $line->transliteration, 'line_number' => $line->line_number);
|
84
|
}
|
85
|
|
86
|
$this->template->transliteration = $transliteration;
|
87
|
$this->template->litReferences = $this->litReferenceRepository->findBy([LitReferenceRepository::COLUMN_TRANSLITERATION_ID => $id]);
|
88
|
$this->template->revisionHistory = $this->revHistoryRepository->findBy([RevHistoryRepository::COLUMN_TRANSLITERATION_ID => $id]);
|
89
|
$this->template->lineArray = $lineArray;
|
90
|
}
|
91
|
|
92
|
public function createComponentTransliterationSearchForm()
|
93
|
{
|
94
|
return $this->transliterationSearchFormFactory->create();
|
95
|
}
|
96
|
|
97
|
public function createComponentTransliterationSearchResultList()
|
98
|
{
|
99
|
return $this->transliterationSearchResultListFactory->create();
|
100
|
}
|
101
|
}
|