Revize c73ae8f7
Přidáno uživatelem Filip Jani před více než 5 roky(ů)
app/FrontModule/component/Transliteration/TransliterationView.php | ||
---|---|---|
8 | 8 |
use App\Model\Repository\LitReferenceRepository; |
9 | 9 |
use App\Model\Repository\RevHistoryRepository; |
10 | 10 |
use App\Model\Repository\TransliterationRepository; |
11 |
use App\Model\TransliterationSearchModel; |
|
12 |
use App\Utils\WordHighlighter; |
|
11 | 13 |
use Nette\Application\UI\Control; |
12 | 14 |
|
13 | 15 |
class TransliterationView extends Control |
... | ... | |
28 | 30 |
* @var RevHistoryRepository |
29 | 31 |
*/ |
30 | 32 |
private $revHistoryRepository; |
33 |
/** |
|
34 |
* @var WordHighlighter |
|
35 |
*/ |
|
36 |
private $wordHighlighter; |
|
37 |
/** |
|
38 |
* @var TransliterationSearchModel |
|
39 |
*/ |
|
40 |
private $transliterationSearchModel; |
|
31 | 41 |
|
32 | 42 |
public function __construct(TransliterationRepository $transliterationRepository, |
33 | 43 |
LineRepository $lineRepository, |
34 | 44 |
LitReferenceRepository $litReferenceRepository, |
35 |
RevHistoryRepository $revHistoryRepository) |
|
45 |
RevHistoryRepository $revHistoryRepository, |
|
46 |
WordHighlighter $wordHighlighter, |
|
47 |
TransliterationSearchModel $transliterationSearchModel |
|
48 |
) |
|
36 | 49 |
{ |
37 | 50 |
parent::__construct(); |
38 | 51 |
|
... | ... | |
40 | 53 |
$this->lineRepository = $lineRepository; |
41 | 54 |
$this->litReferenceRepository = $litReferenceRepository; |
42 | 55 |
$this->revHistoryRepository = $revHistoryRepository; |
56 |
$this->wordHighlighter = $wordHighlighter; |
|
57 |
$this->transliterationSearchModel = $transliterationSearchModel; |
|
43 | 58 |
} |
44 | 59 |
|
45 | 60 |
/** |
... | ... | |
47 | 62 |
* |
48 | 63 |
* @param int $id : ID transliterace |
49 | 64 |
* @param bool $showAll : zobrazení katalogu i transliterací |
65 |
* @param bool $isCatalogue : určuje jestli byla komponenta zobrazena z katalogu nebo z vyhledávání textů |
|
66 |
* a podle toho zvýrazňuje texty |
|
50 | 67 |
* @throws \Nette\Application\AbortException |
51 | 68 |
*/ |
52 |
public function render(int $id, bool $showAll = TRUE) |
|
69 |
public function render(int $id, bool $showAll = TRUE, $isCatalogue = FALSE)
|
|
53 | 70 |
{ |
54 | 71 |
$this->template->setFile(__DIR__ . '/TransliterationView.latte'); |
55 | 72 |
|
... | ... | |
64 | 81 |
if($showAll) |
65 | 82 |
{ |
66 | 83 |
$lines = $this->lineRepository->getAllLinesForTransliteration($id); |
84 |
|
|
85 |
// Pokud se nejedná o vyhledávání z katalogu, tak zvýrazňujeme výsledky |
|
86 |
if (!$isCatalogue) |
|
87 |
{ |
|
88 |
$this->wordHighlighter->highlight($lines, $this->transliterationSearchModel->getSearchTerms()); |
|
89 |
} |
|
90 |
|
|
67 | 91 |
$lineArray = []; |
68 | 92 |
foreach ($lines as $line) |
69 | 93 |
{ |
Také k dispozici: Unified diff
Zvýrazňování hledaných slov i v detailu transliterace