Projekt

Obecné

Profil

Stáhnout (3.45 KB) Statistiky
| Větev: | Tag: | Revize:
1 3416b114 Jan Šedivý
<?php
2
3
namespace App\FrontModule\Presenters;
4
5
6
7
use App\FrontModule\Components\ITransliterationSearchFormFactory;
8 a4906fd1 Jan Šedivý
use App\FrontModule\Components\ITransliterationSearchResultListFactory;
9 8ef808c0 Jan Šedivý
use App\Model\Repository\LineRepository;
10
use App\Model\Repository\LitReferenceRepository;
11
use App\Model\Repository\RevHistoryRepository;
12 3416b114 Jan Šedivý
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 8ef808c0 Jan Šedivý
    /** @var LitReferenceRepository */
28
    private $litReferenceRepository;
29
30
    /** @var RevHistoryRepository */
31
    private $revHistoryRepository;
32
33
    /** @var LineRepository */
34
    private $lineRepository;
35
36 a4906fd1 Jan Šedivý
    /** @var ITransliterationSearchResultListFactory */
37
    private $transliterationSearchResultListFactory;
38
39 3416b114 Jan Šedivý
    public function __construct(
40
        ITransliterationSearchFormFactory $transliterationSearchFormFactory,
41
        TransliterationRepository $transliterationRepository,
42 8ef808c0 Jan Šedivý
        TransliterationSearchModel $transliterationSearchModel,
43
        LitReferenceRepository $litReferenceRepository,
44
        RevHistoryRepository $revHistoryRepository,
45 a4906fd1 Jan Šedivý
        LineRepository $lineRepository,
46
        ITransliterationSearchResultListFactory $transliterationSearchResultListFactory
47 3416b114 Jan Šedivý
    )
48
    {
49
        parent::__construct();
50
51
        $this->transliterationSearchFormFactory = $transliterationSearchFormFactory;
52
        $this->transliterationRepository = $transliterationRepository;
53
        $this->transliterationSearchModel = $transliterationSearchModel;
54 8ef808c0 Jan Šedivý
        $this->litReferenceRepository = $litReferenceRepository;
55
        $this->revHistoryRepository = $revHistoryRepository;
56
        $this->lineRepository = $lineRepository;
57 a4906fd1 Jan Šedivý
        $this->transliterationSearchResultListFactory = $transliterationSearchResultListFactory;
58 3416b114 Jan Šedivý
    }
59
60
61
    public function actionSearch()
62
    {
63
64
    }
65
66
    public function actionSearchResult()
67
    {
68
69
    }
70
71 8ef808c0 Jan Šedivý
    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 3416b114 Jan Šedivý
    public function createComponentTransliterationSearchForm()
93
    {
94
        return $this->transliterationSearchFormFactory->create();
95
    }
96 a4906fd1 Jan Šedivý
97
    public function createComponentTransliterationSearchResultList()
98
    {
99
        return $this->transliterationSearchResultListFactory->create();
100
    }
101 3416b114 Jan Šedivý
}