Revize cddd4e21
Přidáno uživatelem Filip Jani před téměř 6 roky(ů)
app/AdminModule/component/Book/BookEditForm.php | ||
---|---|---|
39 | 39 |
|
40 | 40 |
public function createComponentForm() |
41 | 41 |
{ |
42 |
$this->form->addText(BookRepository::COLUMN_BOOK_ABREV, 'Abbreviation') |
|
42 |
$this->form->addText(BookRepository::COLUMN_BOOK_ABBREV, 'Abbreviation')
|
|
43 | 43 |
->addRule(Form::REQUIRED, 'Field %label is required', TRUE); |
44 | 44 |
$this->form->addText(BookRepository::COLUMN_BOOK_AUTHOR, 'Author'); |
45 | 45 |
$this->form->addText(BookRepository::COLUMN_BOOK_NAME, 'Name') |
app/AdminModule/component/Book/BookGrid.php | ||
---|---|---|
31 | 31 |
public function init() |
32 | 32 |
{ |
33 | 33 |
$this->setPrimaryKey(BookRepository::COLUMN_ID); |
34 |
$this->setDataSource($this->bookRepository->findAll()->order(BookRepository::COLUMN_BOOK_ABREV)); |
|
34 |
$this->setDataSource($this->bookRepository->findAll()->order(BookRepository::COLUMN_BOOK_ABBREV));
|
|
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
/** |
... | ... | |
43 | 43 |
{ |
44 | 44 |
// Definice sloupečků |
45 | 45 |
$this->addColumnNumber(BookRepository::COLUMN_ID, 'ID')->setDefaultHide(TRUE); |
46 |
$this->addColumnText(BookRepository::COLUMN_BOOK_ABREV, 'Abbreviation')->setAlign('center'); |
|
46 |
$this->addColumnText(BookRepository::COLUMN_BOOK_ABBREV, 'Abbreviation')->setAlign('center');
|
|
47 | 47 |
$this->addColumnText(BookRepository::COLUMN_BOOK_AUTHOR, 'Author')->addAttributes(["width" => "10%"])->setAlign('center'); |
48 | 48 |
$this->addColumnText(BookRepository::COLUMN_BOOK_NAME, 'Name')->setAlign('center'); |
49 | 49 |
$this->addColumnText(BookRepository::COLUMN_BOOK_SUBTITLE, 'Alternate name')->setAlign('center'); |
... | ... | |
55 | 55 |
$this->addColumnText(BookRepository::COLUMN_VOLUME_NO, 'Volume No.')->setAlign('center'); |
56 | 56 |
|
57 | 57 |
// Definice filtrů |
58 |
$this->addFilterText(BookRepository::COLUMN_BOOK_ABREV, 'Abbreviation'); |
|
58 |
$this->addFilterText(BookRepository::COLUMN_BOOK_ABBREV, 'Abbreviation');
|
|
59 | 59 |
$this->addFilterText(BookRepository::COLUMN_BOOK_AUTHOR, 'Author'); |
60 | 60 |
$this->addFilterText(BookRepository::COLUMN_BOOK_NAME, 'Name'); |
61 | 61 |
$this->addFilterText(BookRepository::COLUMN_BOOK_SUBTITLE, 'Alternate name'); |
... | ... | |
71 | 71 |
->setTitle('Edit'); |
72 | 72 |
|
73 | 73 |
$this->addAction('delete', 'delete', 'deleteBook!', ['id' => BookRepository::COLUMN_ID]) |
74 |
->setConfirm('Do you really want to delete book %s.', BookRepository::COLUMN_BOOK_ABREV) |
|
74 |
->setConfirm('Do you really want to delete book %s.', BookRepository::COLUMN_BOOK_ABBREV)
|
|
75 | 75 |
->setTitle('Delete') |
76 | 76 |
->setClass('btn btn-xs btn-danger ajax'); |
77 | 77 |
} |
app/AdminModule/component/Transliteration/TransliterationEditForm.php | ||
---|---|---|
98 | 98 |
|
99 | 99 |
public function createComponentForm() |
100 | 100 |
{ |
101 |
$this->form->addSelect(TransliterationRepository::COLUMN_BOOK_ID, 'Book', $this->bookRepository->getBookAbbrevForSelect()); |
|
101 |
$this->form->addSelect(TransliterationRepository::COLUMN_BOOK_ID, 'Book', $this->bookRepository->getBooksAbbrevForSelect());
|
|
102 | 102 |
$this->form->addText(TransliterationRepository::COLUMN_CHAPTER, 'Chapter'); |
103 | 103 |
$this->form->addSelect(TransliterationRepository::COLUMN_MUSEUM_ID, 'Museum', $this->museumRepository->getMuseumNameForSelect()); |
104 | 104 |
$this->form->addText(TransliterationRepository::COLUMN_MUSEUM_NO, 'Museum No'); |
app/AdminModule/component/Transliteration/TransliterationGrid.php | ||
---|---|---|
99 | 99 |
$activeRow, |
100 | 100 |
BookRepository::TABLE_NAME, |
101 | 101 |
BookRepository::COLUMN_ID, |
102 |
BookRepository::COLUMN_BOOK_ABREV, |
|
102 |
BookRepository::COLUMN_BOOK_ABBREV,
|
|
103 | 103 |
TransliterationRepository::COLUMN_BOOK_ID, |
104 | 104 |
'Book:edit' |
105 | 105 |
); |
app/FrontModule/component/Catalogue/CatalogueSearchForm.latte | ||
---|---|---|
1 |
<div class="row"> |
|
2 |
<div class="col-5"> |
|
3 |
<fieldset> |
|
4 |
<legend>Enter your conditions</legend> |
|
5 |
|
|
6 |
{form form} |
|
7 |
{* Nastavení vyhledávání *} |
|
8 |
<div class="row mb-2"> |
|
9 |
<div class="col-12 form-inline"> |
|
10 |
{input match_condition} |
|
11 |
</div> |
|
12 |
</div> |
|
13 |
|
|
14 |
{* Book abbrevation *} |
|
15 |
<div class="row mb-2"> |
|
16 |
<div class="col-3"> |
|
17 |
{label book_abbrev_condition} |
|
18 |
</div> |
|
19 |
<div class="col-3"> |
|
20 |
{input book_abbrev_condition} |
|
21 |
</div> |
|
22 |
<div class="col-6"> |
|
23 |
{input \App\Model\Repository\BookRepository::COLUMN_BOOK_ABBREV} |
|
24 |
</div> |
|
25 |
</div> |
|
26 |
|
|
27 |
{* Book name *} |
|
28 |
<div class="row mb-2"> |
|
29 |
<div class="col-3"> |
|
30 |
{label book_name_condition} |
|
31 |
</div> |
|
32 |
<div class="col-3"> |
|
33 |
{input book_name_condition} |
|
34 |
</div> |
|
35 |
<div class="col-6"> |
|
36 |
{input \App\Model\Repository\BookRepository::COLUMN_BOOK_NAME} |
|
37 |
</div> |
|
38 |
</div> |
|
39 |
|
|
40 |
{* Book type *} |
|
41 |
<div class="row mb-2"> |
|
42 |
<div class="col-3"> |
|
43 |
{label book_type_condition} |
|
44 |
</div> |
|
45 |
<div class="col-3"> |
|
46 |
{input book_type_condition} |
|
47 |
</div> |
|
48 |
<div class="col-6"> |
|
49 |
{input \App\Model\Repository\TransliterationRepository::COLUMN_BOOK_TYPE_ID} |
|
50 |
</div> |
|
51 |
</div> |
|
52 |
|
|
53 |
{* Author *} |
|
54 |
<div class="row mb-2"> |
|
55 |
<div class="col-3"> |
|
56 |
{label author_condition} |
|
57 |
</div> |
|
58 |
<div class="col-3"> |
|
59 |
{input author_condition} |
|
60 |
</div> |
|
61 |
<div class="col-6"> |
|
62 |
{input \App\Model\Repository\BookRepository::COLUMN_BOOK_AUTHOR} |
|
63 |
</div> |
|
64 |
</div> |
|
65 |
|
|
66 |
{* Book chapter *} |
|
67 |
<div class="row mb-2"> |
|
68 |
<div class="col-3"> |
|
69 |
{label book_chapter_condition} |
|
70 |
</div> |
|
71 |
<div class="col-3"> |
|
72 |
{input book_chapter_condition} |
|
73 |
</div> |
|
74 |
<div class="col-6"> |
|
75 |
{input \App\Model\Repository\TransliterationRepository::COLUMN_CHAPTER} |
|
76 |
</div> |
|
77 |
</div> |
|
78 |
|
|
79 |
{* Museum *} |
|
80 |
<div class="row mb-2"> |
|
81 |
<div class="col-3"> |
|
82 |
{label museum_condition} |
|
83 |
</div> |
|
84 |
<div class="col-3"> |
|
85 |
{input museum_condition} |
|
86 |
</div> |
|
87 |
<div class="col-6"> |
|
88 |
{input \App\Model\Repository\TransliterationRepository::COLUMN_MUSEUM_ID} |
|
89 |
</div> |
|
90 |
</div> |
|
91 |
|
|
92 |
{* Museum number *} |
|
93 |
<div class="row mb-2"> |
|
94 |
<div class="col-3"> |
|
95 |
{label museum_number_condition} |
|
96 |
</div> |
|
97 |
<div class="col-3"> |
|
98 |
{input museum_number_condition} |
|
99 |
</div> |
|
100 |
<div class="col-6"> |
|
101 |
{input \App\Model\Repository\TransliterationRepository::COLUMN_MUSEUM_NO} |
|
102 |
</div> |
|
103 |
</div> |
|
104 |
|
|
105 |
{* Origin *} |
|
106 |
<div class="row mb-2"> |
|
107 |
<div class="col-3"> |
|
108 |
{label origin_condition} |
|
109 |
</div> |
|
110 |
<div class="col-3"> |
|
111 |
{input origin_condition} |
|
112 |
</div> |
|
113 |
<div class="col-6"> |
|
114 |
{input \App\Model\Repository\TransliterationRepository::COLUMN_ORIGIN_ID} |
|
115 |
</div> |
|
116 |
</div> |
|
117 |
|
|
118 |
{* Pouze katalog *} |
|
119 |
<div class="row mb-2"> |
|
120 |
<div class="col-6"> |
|
121 |
View only catalogue informations |
|
122 |
</div> |
|
123 |
<div class="col-6 mt-1"> |
|
124 |
{input only_catalogue} |
|
125 |
</div> |
|
126 |
</div> |
|
127 |
|
|
128 |
{* Odesílací tlačítko *} |
|
129 |
<div class="row"> |
|
130 |
<div class="col-12"> |
|
131 |
{input submit class => 'btn btn-sm btn-outline-dark float-right'} |
|
132 |
</div> |
|
133 |
</div> |
|
134 |
|
|
135 |
{/form} |
|
136 |
</fieldset> |
|
137 |
</div> |
|
138 |
</div> |
app/FrontModule/component/Catalogue/CatalogueSearchForm.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Enum\ESearchFormOperators; |
|
8 |
use App\Model\CatalogueSearchModel; |
|
9 |
use App\Model\Repository\BookRepository; |
|
10 |
use App\Model\Repository\BookTypeRepository; |
|
11 |
use App\Model\Repository\MuseumRepository; |
|
12 |
use App\Model\Repository\OriginRepository; |
|
13 |
use App\Model\Repository\TransliterationRepository; |
|
14 |
use App\Utils\Form; |
|
15 |
use Nette\Application\UI\Control; |
|
16 |
|
|
17 |
class CatalogueSearchForm extends Control |
|
18 |
{ |
|
19 |
const MATCH_ALL = 0; |
|
20 |
const MATCH_ANY = 1; |
|
21 |
/** |
|
22 |
* @var BookRepository |
|
23 |
*/ |
|
24 |
private $bookRepository; |
|
25 |
/** |
|
26 |
* @var BookTypeRepository |
|
27 |
*/ |
|
28 |
private $bookTypeRepository; |
|
29 |
/** |
|
30 |
* @var MuseumRepository |
|
31 |
*/ |
|
32 |
private $museumRepository; |
|
33 |
/** |
|
34 |
* @var OriginRepository |
|
35 |
*/ |
|
36 |
private $originRepository; |
|
37 |
/** |
|
38 |
* @var CatalogueSearchModel |
|
39 |
*/ |
|
40 |
private $catalogueSearchModel; |
|
41 |
|
|
42 |
public function __construct(BookRepository $bookRepository, |
|
43 |
BookTypeRepository $bookTypeRepository, |
|
44 |
MuseumRepository $museumRepository, |
|
45 |
OriginRepository $originRepository, |
|
46 |
CatalogueSearchModel $catalogueSearchModel |
|
47 |
) |
|
48 |
{ |
|
49 |
parent::__construct(); |
|
50 |
|
|
51 |
$this->bookRepository = $bookRepository; |
|
52 |
$this->bookTypeRepository = $bookTypeRepository; |
|
53 |
$this->museumRepository = $museumRepository; |
|
54 |
$this->originRepository = $originRepository; |
|
55 |
$this->catalogueSearchModel = $catalogueSearchModel; |
|
56 |
} |
|
57 |
|
|
58 |
public function render() |
|
59 |
{ |
|
60 |
$this->template->setFile(__DIR__ . '/CatalogueSearchForm.latte'); |
|
61 |
$this->template->render(); |
|
62 |
} |
|
63 |
|
|
64 |
public function createComponentForm() |
|
65 |
{ |
|
66 |
$form = new Form; |
|
67 |
|
|
68 |
$notSelectedArray = ESearchFormOperators::$selectCatalogueLabels; |
|
69 |
|
|
70 |
// Nastavení vyhledávání |
|
71 |
$form->addRadioList('match_condition', NULL, |
|
72 |
[ |
|
73 |
self::MATCH_ALL => 'Match all conditions on page (AND)', |
|
74 |
self::MATCH_ANY => 'Match any condition on page (OR)' |
|
75 |
] |
|
76 |
)->setDefaultValue(self::MATCH_ALL) |
|
77 |
->setHtmlAttribute('class', 'ml-4'); |
|
78 |
|
|
79 |
// Book abbreviation |
|
80 |
$form->addSelect('book_abbrev_condition', 'Book abbrev.', ESearchFormOperators::$selectEqualsOperatorLabels); |
|
81 |
$form->addSelect(BookRepository::COLUMN_BOOK_ABBREV, NULL, array_merge($notSelectedArray, $this->bookRepository->getBooksAbbrevForCatalogueSelect())); |
|
82 |
|
|
83 |
// Book name |
|
84 |
$form->addSelect('book_name_condition', 'Book name', ESearchFormOperators::$selectLikeOperatorLabels) |
|
85 |
->setDefaultValue(ESearchFormOperators::CONTAINS); |
|
86 |
$form->addText(BookRepository::COLUMN_BOOK_NAME); |
|
87 |
|
|
88 |
// Book type |
|
89 |
$form->addSelect('book_type_condition', 'Type', ESearchFormOperators::$selectEqualsOperatorLabels); |
|
90 |
$form->addSelect(TransliterationRepository::COLUMN_BOOK_TYPE_ID, NULL, $this->bookTypeRepository->getTypesForSelect()); |
|
91 |
|
|
92 |
// Author |
|
93 |
$form->addSelect('author_condition', 'Author', ESearchFormOperators::$selectLikeOperatorLabels) |
|
94 |
->setDefaultValue(ESearchFormOperators::CONTAINS); |
|
95 |
$form->addText(BookRepository::COLUMN_BOOK_AUTHOR); |
|
96 |
|
|
97 |
// Book chapter |
|
98 |
$form->addSelect('book_chapter_condition', 'Book chapter', ESearchFormOperators::$selectLikeOperatorLabels) |
|
99 |
->setDefaultValue(ESearchFormOperators::CONTAINS); |
|
100 |
$form->addText(TransliterationRepository::COLUMN_CHAPTER); |
|
101 |
|
|
102 |
// Museum |
|
103 |
$form->addSelect('museum_condition', 'Museum', ESearchFormOperators::$selectEqualsOperatorLabels); |
|
104 |
$form->addSelect(TransliterationRepository::COLUMN_MUSEUM_ID, NULL, array_merge($notSelectedArray, $this->museumRepository->getMuseumNameForSelect())); |
|
105 |
|
|
106 |
// Museum number |
|
107 |
$form->addSelect('museum_number_condition', 'Museum number', ESearchFormOperators::$selectLikeOperatorLabels) |
|
108 |
->setDefaultValue(ESearchFormOperators::CONTAINS); |
|
109 |
$form->addText(TransliterationRepository::COLUMN_MUSEUM_NO); |
|
110 |
|
|
111 |
// Origin |
|
112 |
$form->addSelect('origin_condition', 'Origin', ESearchFormOperators::$selectEqualsOperatorLabels); |
|
113 |
$form->addSelect(TransliterationRepository::COLUMN_ORIGIN_ID, NULL, $this->originRepository->getOriginsForSelect()); |
|
114 |
|
|
115 |
// Zobrazit pouze informace bez transliterací |
|
116 |
$form->addCheckbox('only_catalogue'); |
|
117 |
|
|
118 |
$form->addSubmit('submit', 'Search'); |
|
119 |
|
|
120 |
$form->onSuccess[] = [$this, 'formSuccess']; |
|
121 |
|
|
122 |
return $form; |
|
123 |
} |
|
124 |
|
|
125 |
public function formSuccess(Form $form) |
|
126 |
{ |
|
127 |
$values = $form->getValues(); |
|
128 |
$this->catalogueSearchModel->setSearchTerms($values); |
|
129 |
$this->presenter->redirect('Catalogue:searchResult'); |
|
130 |
|
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
interface ICatalogueSearchFormFactory |
|
135 |
{ |
|
136 |
/** |
|
137 |
* @return CatalogueSearchForm |
|
138 |
*/ |
|
139 |
public function create(); |
|
140 |
} |
app/FrontModule/component/Catalogue/CatalogueSearchResultList.latte | ||
---|---|---|
1 |
{snippet resultList} |
|
2 |
<div class="row h-100 pagination-header"> |
|
3 |
<div class="col my-auto"> |
|
4 |
<div class="text-muted results-found"> |
|
5 |
Total results found: {$paginator->getItemCount()} |
|
6 |
</div> |
|
7 |
{if $paginator->getPageCount() > 1} |
|
8 |
<nav aria-label="Page navigation example"> |
|
9 |
<ul class="pagination"> |
|
10 |
<li class="page-item"> |
|
11 |
<a class="page-link ajax" |
|
12 |
href="{link changePage!, $paginator->first()->getPageNumber()}"> |
|
13 |
<span aria-hidden="true">«</span> |
|
14 |
<span class="sr-only">First</span> |
|
15 |
</a> |
|
16 |
</li> |
|
17 |
<li class="page-item"> |
|
18 |
<a class="page-link ajax" |
|
19 |
href="{link changePage!, $paginator->previous()->getPageNumber()}"> |
|
20 |
<span aria-hidden="true">‹</span> |
|
21 |
<span class="sr-only">Previous</span> |
|
22 |
</a> |
|
23 |
</li> |
|
24 |
{for $i = $paginator->getStartingPage(); $i <= $paginator->getEndingPage(); $i++} |
|
25 |
<li class="page-item{if $paginator->getPageNumber() == $i} active{/if}"> |
|
26 |
<a class="page-link ajax" href="{link changePage!, $i}"> |
|
27 |
{$i} |
|
28 |
</a> |
|
29 |
</li> |
|
30 |
{/for} |
|
31 |
<li class="page-item"> |
|
32 |
<a class="page-link ajax" |
|
33 |
href="{link changePage!, $paginator->next()->getPageNumber()}"> |
|
34 |
<span aria-hidden="true">›</span> |
|
35 |
<span class="sr-only">Next</span> |
|
36 |
</a> |
|
37 |
</li> |
|
38 |
<li class="page-item"> |
|
39 |
<a class="page-link ajax" |
|
40 |
href="{link changePage!, $paginator->last()->getPageNumber()}"> |
|
41 |
<span aria-hidden="true">»</span> |
|
42 |
<span class="sr-only">Last</span> |
|
43 |
</a> |
|
44 |
</li> |
|
45 |
</ul> |
|
46 |
</nav> |
|
47 |
{/if} |
|
48 |
|
|
49 |
</div> |
|
50 |
</div> |
|
51 |
|
|
52 |
{control transliterationView $row->id, $showAll} |
|
53 |
{/snippet} |
|
54 |
|
|
55 |
{block scripts} |
|
56 |
<script> |
|
57 |
$(function () |
|
58 |
{ |
|
59 |
$.nette.init(); |
|
60 |
}); |
|
61 |
</script> |
app/FrontModule/component/Catalogue/CatalogueSearchResultList.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Enum\EFlashMessage; |
|
8 |
use App\Model\CatalogueSearchModel; |
|
9 |
use App\Model\Repository\TransliterationRepository; |
|
10 |
use App\Utils\Paginator; |
|
11 |
use Nette\Application\UI\Control; |
|
12 |
|
|
13 |
class CatalogueSearchResultList extends Control |
|
14 |
{ |
|
15 |
/** @var Paginator */ |
|
16 |
private $paginator; |
|
17 |
|
|
18 |
/** |
|
19 |
* @persistent |
|
20 |
*/ |
|
21 |
public $page; |
|
22 |
|
|
23 |
/** |
|
24 |
* @persistent |
|
25 |
*/ |
|
26 |
private $searchTerms; |
|
27 |
private $totalCount; |
|
28 |
private $resultRow; |
|
29 |
|
|
30 |
/** |
|
31 |
* @var CatalogueSearchModel |
|
32 |
*/ |
|
33 |
private $catalogueSearchModel; |
|
34 |
/** |
|
35 |
* @var TransliterationRepository |
|
36 |
*/ |
|
37 |
private $transliterationRepository; |
|
38 |
/** |
|
39 |
* @var ITransliterationViewFactory |
|
40 |
*/ |
|
41 |
private $transliterationViewFactory; |
|
42 |
|
|
43 |
/** |
|
44 |
* CatalogueSearchResultList constructor. |
|
45 |
* @param CatalogueSearchModel $catalogueSearchModel |
|
46 |
* @param TransliterationRepository $transliterationRepository |
|
47 |
* @param ITransliterationViewFactory $transliterationViewFactory |
|
48 |
* @throws \Nette\Application\AbortException |
|
49 |
*/ |
|
50 |
public function __construct(CatalogueSearchModel $catalogueSearchModel, |
|
51 |
TransliterationRepository $transliterationRepository, |
|
52 |
ITransliterationViewFactory $transliterationViewFactory |
|
53 |
) |
|
54 |
{ |
|
55 |
parent::__construct(); |
|
56 |
|
|
57 |
$this->catalogueSearchModel = $catalogueSearchModel; |
|
58 |
$this->transliterationRepository = $transliterationRepository; |
|
59 |
$this->transliterationViewFactory = $transliterationViewFactory; |
|
60 |
|
|
61 |
if(!$this->page) |
|
62 |
{ |
|
63 |
$this->page = 1; |
|
64 |
} |
|
65 |
|
|
66 |
$this->paginator = new Paginator($this->page, 1); |
|
67 |
|
|
68 |
$this->searchTerms = $this->catalogueSearchModel->getSearchTerms(); |
|
69 |
$this->totalCount = $this->transliterationRepository->getTransliterationCatalogueSearchTotalCount($this->searchTerms); |
|
70 |
$this->resultRow = $this->transliterationRepository->transliterationCatalogueSearch($this->searchTerms, $this->paginator->getOffset(), $this->paginator->getPageSize())->fetch(); |
|
71 |
|
|
72 |
if (!$this->resultRow) |
|
73 |
{ |
|
74 |
$this->presenter->flashMessage('No result found by given criteria.', EFlashMessage::ERROR); |
|
75 |
$this->presenter->redirect('Catalogue:default'); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
public function render() |
|
80 |
{ |
|
81 |
$this->template->setFile(__DIR__ . '/CatalogueSearchResultList.latte'); |
|
82 |
|
|
83 |
|
|
84 |
$this->paginator->setPageCount($this->totalCount); |
|
85 |
|
|
86 |
$this->template->row = $this->resultRow; |
|
87 |
$this->template->showAll = !$this->searchTerms['only_catalogue']; |
|
88 |
$this->template->paginator = $this->paginator; |
|
89 |
|
|
90 |
$this->template->render(); |
|
91 |
} |
|
92 |
|
|
93 |
public function createComponentTransliterationView() |
|
94 |
{ |
|
95 |
return $this->transliterationViewFactory->create(); |
|
96 |
} |
|
97 |
|
|
98 |
public function handleChangePage($page) |
|
99 |
{ |
|
100 |
if($this->presenter->isAjax()) |
|
101 |
{ |
|
102 |
$this->page = $page; |
|
103 |
$this->paginator = new Paginator($page, 1); |
|
104 |
$this->redrawControl('resultList'); |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
interface ICatalogueSearchResultListFactory |
|
110 |
{ |
|
111 |
/** |
|
112 |
* @return CatalogueSearchResultList |
|
113 |
*/ |
|
114 |
public function create(); |
|
115 |
} |
app/FrontModule/component/Transliteration/TransliterationSearchResultList.latte | ||
---|---|---|
8 | 8 |
<nav aria-label="Page navigation example"> |
9 | 9 |
<ul class="pagination"> |
10 | 10 |
<li class="page-item"> |
11 |
<a class="page-link" |
|
11 |
<a class="page-link ajax"
|
|
12 | 12 |
href="{link changePage!, $paginator->first()->getPageNumber(), $paginator->first()->getPageSize()}"> |
13 | 13 |
<span aria-hidden="true">«</span> |
14 | 14 |
<span class="sr-only">First</span> |
15 | 15 |
</a> |
16 | 16 |
</li> |
17 | 17 |
<li class="page-item"> |
18 |
<a class="page-link" |
|
18 |
<a class="page-link ajax"
|
|
19 | 19 |
href="{link changePage!, $paginator->previous()->getPageNumber(), $paginator->previous()->getPageSize()}"> |
20 | 20 |
<span aria-hidden="true">‹</span> |
21 | 21 |
<span class="sr-only">Previous</span> |
... | ... | |
23 | 23 |
</li> |
24 | 24 |
{for $i = $paginator->getStartingPage(); $i <= $paginator->getEndingPage(); $i++} |
25 | 25 |
<li class="page-item{if $paginator->getPageNumber() == $i} active{/if}"> |
26 |
<a class="page-link" href="{link changePage!, $i, $paginator->getPageSize()}"> |
|
26 |
<a class="page-link ajax" href="{link changePage!, $i, $paginator->getPageSize()}">
|
|
27 | 27 |
{$i} |
28 | 28 |
</a> |
29 | 29 |
</li> |
30 | 30 |
{/for} |
31 | 31 |
<li class="page-item"> |
32 |
<a class="page-link" |
|
32 |
<a class="page-link ajax"
|
|
33 | 33 |
href="{link changePage!, $paginator->next()->getPageNumber(), $paginator->next()->getPageSize()}"> |
34 | 34 |
<span aria-hidden="true">›</span> |
35 | 35 |
<span class="sr-only">Next</span> |
36 | 36 |
</a> |
37 | 37 |
</li> |
38 | 38 |
<li class="page-item"> |
39 |
<a class="page-link" |
|
39 |
<a class="page-link ajax"
|
|
40 | 40 |
href="{link changePage!, $paginator->last()->getPageNumber(), $paginator->last()->getPageSize()}"> |
41 | 41 |
<span aria-hidden="true">»</span> |
42 | 42 |
<span class="sr-only">Last</span> |
... | ... | |
106 | 106 |
data: {'lines': lines} |
107 | 107 |
}) |
108 | 108 |
}); |
109 |
}) |
|
109 |
}); |
|
110 |
|
|
111 |
$(function () |
|
112 |
{ |
|
113 |
$.nette.init(); |
|
114 |
}); |
|
110 | 115 |
</script> |
111 | 116 |
{/block} |
112 | 117 |
{/snippet} |
app/FrontModule/component/Transliteration/TransliterationView.latte | ||
---|---|---|
1 |
<div class="display-6"> |
|
2 |
<div class="text-muted">Catalogue information</div> |
|
3 |
</div> |
|
4 |
<div> |
|
5 |
|
|
6 |
<div> |
|
7 |
<a href="{$presenter->link(':Admin:Book:edit', ['id' => $transliteration->id_book])}">edit book</a> | |
|
8 |
<a href="{$presenter->link(':Admin:Transliteration:edit#transliteration-info', ['id' => $transliteration->id])}">edit transliteration info</a> |
|
9 |
</div> |
|
10 |
|
|
11 |
</div> |
|
12 |
<div class="container-fluid"> |
|
13 |
<dl class="row"> |
|
14 |
|
|
15 |
<dt class="col-sm-3">Book abrev.</dt> |
|
16 |
<dd class="col-sm-9">{$transliteration->book_abrev}</dd> |
|
17 |
|
|
18 |
<dt class="col-sm-3">Book name</dt> |
|
19 |
<dd class="col-sm-9">{$transliteration->book_name}</dd> |
|
20 |
|
|
21 |
<dt class="col-sm-3">Book subtitle</dt> |
|
22 |
<dd class="col-sm-9">{$transliteration->book_subtitle}</dd> |
|
23 |
|
|
24 |
<dt class="col-sm-3">Book author</dt> |
|
25 |
<dd class="col-sm-9">{$transliteration->book_autor}</dd> |
|
26 |
|
|
27 |
<dt class="col-sm-3">Place of publication</dt> |
|
28 |
<dd class="col-sm-9">{$transliteration->place_of_pub}</dd> |
|
29 |
|
|
30 |
<dt class="col-sm-3">Date of publication</dt> |
|
31 |
<dd class="col-sm-9">{$transliteration->date_of_pub}</dd> |
|
32 |
|
|
33 |
<dt class="col-sm-3">Pages</dt> |
|
34 |
<dd class="col-sm-9">{$transliteration->pages}</dd> |
|
35 |
|
|
36 |
<dt class="col-sm-3">Book description</dt> |
|
37 |
<dd class="col-sm-9">{$transliteration->book_description}</dd> |
|
38 |
|
|
39 |
<dt class="col-sm-3">Volume</dt> |
|
40 |
<dd class="col-sm-9">{$transliteration->volume}</dd> |
|
41 |
|
|
42 |
<dt class="col-sm-3">Volume number</dt> |
|
43 |
<dd class="col-sm-9">{$transliteration->volume_no}</dd> |
|
44 |
|
|
45 |
<dt class="col-sm-3">Book type</dt> |
|
46 |
<dd class="col-sm-9">{$transliteration->book_type}</dd> |
|
47 |
|
|
48 |
<dt class="col-sm-3">Chapter</dt> |
|
49 |
<dd class="col-sm-9">{$transliteration->chapter}</dd> |
|
50 |
|
|
51 |
<dt class="col-sm-3">Museum</dt> |
|
52 |
<dd class="col-sm-9">{$transliteration->museum}{ifset $transliteration->place}, {$transliteration->place}{/ifset}</dd> |
|
53 |
|
|
54 |
<dt class="col-sm-3">Museum no.</dt> |
|
55 |
<dd class="col-sm-9">{$transliteration->museum_no}</dd> |
|
56 |
|
|
57 |
<dt class="col-sm-3">Reg. (Excavation) no.</dt> |
|
58 |
<dd class="col-sm-9">{$transliteration->reg_no}</dd> |
|
59 |
|
|
60 |
<dt class="col-sm-3">Date</dt> |
|
61 |
<dd class="col-sm-9">{$transliteration->date}</dd> |
|
62 |
|
|
63 |
<dt class="col-sm-3">Origin (Ancient name / Modern name)</dt> |
|
64 |
<dd class="col-sm-9">{$transliteration->old_name}/{$transliteration->origin}</dd> |
|
65 |
|
|
66 |
<dt class="col-sm-3">Note</dt> |
|
67 |
<dd class="col-sm-9">{$transliteration->note}</dd> |
|
68 |
|
|
69 |
<dt class="col-sm-3">References (handcopy)</dt> |
|
70 |
<dd class="col-sm-9"> |
|
71 |
{foreach $litReferences as $reference} |
|
72 |
{$reference->series} {$reference->number}, {$reference->plate}<br> |
|
73 |
{/foreach} |
|
74 |
</dd> |
|
75 |
|
|
76 |
</dl> |
|
77 |
</div> |
|
78 |
|
|
79 |
{if $showAll} |
|
80 |
<hr> |
|
81 |
<div class="display-6"> |
|
82 |
<div class="text-muted">Transliteration data</div> |
|
83 |
</div> |
|
84 |
|
|
85 |
|
|
86 |
<a href="{$presenter->link(':Admin:Transliteration:edit#transliteration-data', ['id' => $transliteration->id])}">edit</a> |
|
87 |
|
|
88 |
<div class="container-fluid"> |
|
89 |
{foreach $lineArray as $objectType => $surface} |
|
90 |
<b>{$objectType}</b> <br> |
|
91 |
{foreach $surface as $surfaceType => $lines} |
|
92 |
<div class="noname" id="tablet-div"> |
|
93 |
<hr> |
|
94 |
|
|
95 |
<i>{$surfaceType}</i> <br> |
|
96 |
{foreach $lines as $line} |
|
97 |
{$line['line_number']}. {$line['transliteration']} <br> |
|
98 |
{/foreach} |
|
99 |
</div> |
|
100 |
{/foreach} |
|
101 |
{/foreach} |
|
102 |
</div> |
|
103 |
<hr> |
|
104 |
<div class="display-6"> |
|
105 |
<div class="text-muted">Revision history</div> |
|
106 |
</div> |
|
107 |
<div class="container-fluid"> |
|
108 |
{foreach $revisionHistory as $revisionRecord} |
|
109 |
{$revisionRecord->date|date:'Y-m-d'} {ifset $revisionRecord->name} - {$revisionRecord->name}{/ifset} - {$revisionRecord->description} |
|
110 |
<br> |
|
111 |
{/foreach} |
|
112 |
</div> |
|
113 |
{/if} |
app/FrontModule/component/Transliteration/TransliterationView.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Model\Repository\LineRepository; |
|
8 |
use App\Model\Repository\LitReferenceRepository; |
|
9 |
use App\Model\Repository\RevHistoryRepository; |
|
10 |
use App\Model\Repository\TransliterationRepository; |
|
11 |
use Nette\Application\UI\Control; |
|
12 |
|
|
13 |
class TransliterationView extends Control |
|
14 |
{ |
|
15 |
/** |
|
16 |
* @var TransliterationRepository |
|
17 |
*/ |
|
18 |
private $transliterationRepository; |
|
19 |
/** |
|
20 |
* @var LineRepository |
|
21 |
*/ |
|
22 |
private $lineRepository; |
|
23 |
/** |
|
24 |
* @var LitReferenceRepository |
|
25 |
*/ |
|
26 |
private $litReferenceRepository; |
|
27 |
/** |
|
28 |
* @var RevHistoryRepository |
|
29 |
*/ |
|
30 |
private $revHistoryRepository; |
|
31 |
|
|
32 |
public function __construct(TransliterationRepository $transliterationRepository, |
|
33 |
LineRepository $lineRepository, |
|
34 |
LitReferenceRepository $litReferenceRepository, |
|
35 |
RevHistoryRepository $revHistoryRepository) |
|
36 |
{ |
|
37 |
parent::__construct(); |
|
38 |
|
|
39 |
$this->transliterationRepository = $transliterationRepository; |
|
40 |
$this->lineRepository = $lineRepository; |
|
41 |
$this->litReferenceRepository = $litReferenceRepository; |
|
42 |
$this->revHistoryRepository = $revHistoryRepository; |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* Vykreslení výsledků |
|
47 |
* |
|
48 |
* @param int $id : ID transliterace |
|
49 |
* @param bool $showAll : zobrazení katalogu i transliterací |
|
50 |
* @throws \Nette\Application\AbortException |
|
51 |
*/ |
|
52 |
public function render(int $id, bool $showAll = TRUE) |
|
53 |
{ |
|
54 |
$this->template->setFile(__DIR__ . '/TransliterationView.latte'); |
|
55 |
|
|
56 |
$transliteration = $this->transliterationRepository->getTransliterationDetail($id); |
|
57 |
if (!$transliteration) |
|
58 |
{ |
|
59 |
$this->presenter->flashMessage('Result was not found.'); |
|
60 |
$this->presenter->redirect($this->getPresenter()->getName()); |
|
61 |
} |
|
62 |
|
|
63 |
// Zobrazujeme i data transliterace |
|
64 |
if($showAll) |
|
65 |
{ |
|
66 |
$lines = $this->lineRepository->getAllLinesForTransliteration($id); |
|
67 |
$lineArray = []; |
|
68 |
foreach ($lines as $line) |
|
69 |
{ |
|
70 |
$lineArray[$line->object_type][$line->surface_type][] = array('transliteration' => $line->transliteration, 'line_number' => $line->line_number); |
|
71 |
} |
|
72 |
|
|
73 |
$this->template->lineArray = $lineArray; |
|
74 |
$this->template->revisionHistory = $this->revHistoryRepository->findBy([RevHistoryRepository::COLUMN_TRANSLITERATION_ID => $id]); |
|
75 |
} |
|
76 |
|
|
77 |
$this->template->transliteration = $transliteration; |
|
78 |
$this->template->litReferences = $this->litReferenceRepository->findBy([LitReferenceRepository::COLUMN_TRANSLITERATION_ID => $id]); |
|
79 |
$this->template->showAll = $showAll; |
|
80 |
|
|
81 |
$this->template->render(); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
interface ITransliterationViewFactory |
|
86 |
{ |
|
87 |
/** |
|
88 |
* @return TransliterationView |
|
89 |
*/ |
|
90 |
public function create(); |
|
91 |
} |
app/FrontModule/presenters/CataloguePresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\FrontModule\Presenters; |
|
5 |
|
|
6 |
|
|
7 |
use App\AdminModule\Presenters\BaseUserPresenter; |
|
8 |
use App\FrontModule\Components\ICatalogueSearchFormFactory; |
|
9 |
use App\FrontModule\Components\ICatalogueSearchResultListFactory; |
|
10 |
|
|
11 |
class CataloguePresenter extends BaseUserPresenter |
|
12 |
{ |
|
13 |
/** |
|
14 |
* @var ICatalogueSearchFormFactory |
|
15 |
*/ |
|
16 |
private $catalogueSearchFormFactory; |
|
17 |
/** |
|
18 |
* @var ICatalogueSearchResultListFactory |
|
19 |
*/ |
|
20 |
private $catalogueSearchResultListFactory; |
|
21 |
|
|
22 |
public function __construct(ICatalogueSearchFormFactory $catalogueSearchFormFactory, |
|
23 |
ICatalogueSearchResultListFactory $catalogueSearchResultListFactory |
|
24 |
) |
|
25 |
{ |
|
26 |
parent::__construct(); |
|
27 |
|
|
28 |
$this->catalogueSearchFormFactory = $catalogueSearchFormFactory; |
|
29 |
$this->catalogueSearchResultListFactory = $catalogueSearchResultListFactory; |
|
30 |
} |
|
31 |
|
|
32 |
public function createComponentCatalogueSearchForm() |
|
33 |
{ |
|
34 |
return $this->catalogueSearchFormFactory->create(); |
|
35 |
} |
|
36 |
|
|
37 |
public function createComponentCatalogueSearchResultList() |
|
38 |
{ |
|
39 |
return $this->catalogueSearchResultListFactory->create(); |
|
40 |
} |
|
41 |
} |
app/FrontModule/presenters/TransliterationPresenter.php | ||
---|---|---|
7 | 7 |
use App\FrontModule\Components\IKeyboard; |
8 | 8 |
use App\FrontModule\Components\ITransliterationSearchFormFactory; |
9 | 9 |
use App\FrontModule\Components\ITransliterationSearchResultListFactory; |
10 |
use App\FrontModule\Components\ITransliterationViewFactory; |
|
10 | 11 |
use App\Model\Repository\LineRepository; |
11 | 12 |
use App\Model\Repository\LitReferenceRepository; |
12 | 13 |
use App\Model\Repository\RevHistoryRepository; |
... | ... | |
39 | 40 |
|
40 | 41 |
/** @var IKeyboard */ |
41 | 42 |
private $keyboard; |
43 |
/** |
|
44 |
* @var ITransliterationViewFactory |
|
45 |
*/ |
|
46 |
private $transliterationViewFactory; |
|
42 | 47 |
|
43 | 48 |
public function __construct( |
44 | 49 |
ITransliterationSearchFormFactory $transliterationSearchFormFactory, |
... | ... | |
48 | 53 |
RevHistoryRepository $revHistoryRepository, |
49 | 54 |
LineRepository $lineRepository, |
50 | 55 |
ITransliterationSearchResultListFactory $transliterationSearchResultListFactory, |
51 |
IKeyboard $keyboard |
|
56 |
IKeyboard $keyboard, |
|
57 |
ITransliterationViewFactory $transliterationViewFactory |
|
52 | 58 |
) |
53 | 59 |
{ |
54 | 60 |
parent::__construct(); |
... | ... | |
61 | 67 |
$this->lineRepository = $lineRepository; |
62 | 68 |
$this->transliterationSearchResultListFactory = $transliterationSearchResultListFactory; |
63 | 69 |
$this->keyboard = $keyboard; |
70 |
$this->transliterationViewFactory = $transliterationViewFactory; |
|
64 | 71 |
} |
65 | 72 |
|
66 | 73 |
public function actionView($id) |
67 | 74 |
{ |
68 |
$transliteration = $this->transliterationRepository->getTransliterationDetail($id); |
|
69 |
if(!$transliteration) |
|
70 |
{ |
|
71 |
$this->presenter->flashMessage('Transliteration not found'); |
|
72 |
$this->redirect('Transliteration:search'); |
|
73 |
} |
|
74 |
$lines = $this->lineRepository->getAllLinesForTransliteration($id); |
|
75 |
$lineArray = []; |
|
76 |
foreach ($lines as $line) |
|
77 |
{ |
|
78 |
$lineArray[$line->object_type][$line->surface_type][] = array('transliteration' => $line->transliteration, 'line_number' => $line->line_number); |
|
79 |
} |
|
80 |
|
|
81 |
$this->template->transliteration = $transliteration; |
|
82 |
$this->template->litReferences = $this->litReferenceRepository->findBy([LitReferenceRepository::COLUMN_TRANSLITERATION_ID => $id]); |
|
83 |
$this->template->revisionHistory = $this->revHistoryRepository->findBy([RevHistoryRepository::COLUMN_TRANSLITERATION_ID => $id]); |
|
84 |
$this->template->lineArray = $lineArray; |
|
75 |
$this->template->id = $id; |
|
76 |
} |
|
77 |
|
|
78 |
public function createComponentTransliterationView() |
|
79 |
{ |
|
80 |
return $this->transliterationViewFactory->create(); |
|
85 | 81 |
} |
86 | 82 |
|
87 | 83 |
public function createComponentTransliterationSearchForm() |
app/FrontModule/templates/Catalogue/default.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="display-5">Search in catalog</div> |
|
3 |
|
|
4 |
{control catalogueSearchForm} |
app/FrontModule/templates/Catalogue/searchResult.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
<div class="row"> |
|
3 |
<div class="col-10"> |
|
4 |
<div class="display-5">Search in texts - Results</div> |
|
5 |
</div> |
|
6 |
<div class="col-2 text-right my-auto"> |
|
7 |
<a n:href="Catalogue:" class="btn btn-sm btn-success"><span class="fa fa-search"></span> Edit Search Criteria</a> |
|
8 |
</div> |
|
9 |
</div> |
|
10 |
|
|
11 |
{control catalogueSearchResultList} |
app/FrontModule/templates/Transliteration/searchResult.latte | ||
---|---|---|
4 | 4 |
<div class="display-5">Search in texts - Results</div> |
5 | 5 |
</div> |
6 | 6 |
<div class="col-2 text-right my-auto"> |
7 |
<a n:href="Transliteration:search" class="btn btn-sm btn-success"></span> Edit Search Criteria</a> |
|
7 |
<a n:href="Transliteration:search" class="btn btn-sm btn-success"><span class="fa fa-search"></span> Edit Search Criteria</a>
|
|
8 | 8 |
</div> |
9 | 9 |
</div> |
10 | 10 |
|
app/FrontModule/templates/Transliteration/view.latte | ||
---|---|---|
2 | 2 |
<div class="display-5">Transliteration info</div> |
3 | 3 |
<hr> |
4 | 4 |
|
5 |
<div class="display-6"> |
|
6 |
<div class="text-muted">Catalogue information</div> |
|
7 |
</div> |
|
8 |
<div> |
|
9 |
|
|
10 |
<div> |
|
11 |
<a n:href=":Admin:Book:edit $transliteration->id_book">edit book</a> | |
|
12 |
<a n:href=":Admin:Transliteration:edit#transliteration-info $transliteration->id">edit transliteration info</a> |
|
13 |
</div> |
|
14 |
|
|
15 |
</div> |
|
16 |
<div class="container-fluid"> |
|
17 |
<dl class="row"> |
|
18 |
|
|
19 |
<dt class="col-sm-3">Book abrev.</dt> |
|
20 |
<dd class="col-sm-9">{$transliteration->book_abrev}</dd> |
|
21 |
|
|
22 |
<dt class="col-sm-3">Book name</dt> |
|
23 |
<dd class="col-sm-9">{$transliteration->book_name}</dd> |
|
24 |
|
|
25 |
<dt class="col-sm-3">Book subtitle</dt> |
|
26 |
<dd class="col-sm-9">{$transliteration->book_subtitle}</dd> |
|
27 |
|
|
28 |
<dt class="col-sm-3">Book author</dt> |
|
29 |
<dd class="col-sm-9">{$transliteration->book_autor}</dd> |
|
30 |
|
|
31 |
<dt class="col-sm-3">Place of publication</dt> |
|
32 |
<dd class="col-sm-9">{$transliteration->place_of_pub}</dd> |
|
33 |
|
|
34 |
<dt class="col-sm-3">Date of publication</dt> |
|
35 |
<dd class="col-sm-9">{$transliteration->date_of_pub}</dd> |
|
36 |
|
|
37 |
<dt class="col-sm-3">Pages</dt> |
|
38 |
<dd class="col-sm-9">{$transliteration->pages}</dd> |
|
39 |
|
|
40 |
<dt class="col-sm-3">Book description</dt> |
|
41 |
<dd class="col-sm-9">{$transliteration->book_description}</dd> |
|
42 |
|
|
43 |
<dt class="col-sm-3">Volume</dt> |
|
44 |
<dd class="col-sm-9">{$transliteration->volume}</dd> |
|
45 |
|
|
46 |
<dt class="col-sm-3">Volume number</dt> |
|
47 |
<dd class="col-sm-9">{$transliteration->volume_no}</dd> |
|
48 |
|
|
49 |
<dt class="col-sm-3">Book type</dt> |
|
50 |
<dd class="col-sm-9">{$transliteration->book_type}</dd> |
|
51 |
|
|
52 |
<dt class="col-sm-3">Chapter</dt> |
|
53 |
<dd class="col-sm-9">{$transliteration->chapter}</dd> |
|
54 |
|
|
55 |
<dt class="col-sm-3">Museum</dt> |
|
56 |
<dd class="col-sm-9">{$transliteration->museum}{ifset $transliteration->place}, {$transliteration->place}{/ifset}</dd> |
|
57 |
|
|
58 |
<dt class="col-sm-3">Museum no.</dt> |
|
59 |
<dd class="col-sm-9">{$transliteration->museum_no}</dd> |
|
60 |
|
|
61 |
<dt class="col-sm-3">Reg. (Excavation) no.</dt> |
|
62 |
<dd class="col-sm-9">{$transliteration->reg_no}</dd> |
|
63 |
|
|
64 |
<dt class="col-sm-3">Date</dt> |
|
65 |
<dd class="col-sm-9">{$transliteration->date}</dd> |
|
66 |
|
|
67 |
<dt class="col-sm-3">Origin (Ancient name / Modern name)</dt> |
|
68 |
<dd class="col-sm-9">{$transliteration->old_name}/{$transliteration->origin}</dd> |
|
69 |
|
|
70 |
<dt class="col-sm-3">Note</dt> |
|
71 |
<dd class="col-sm-9">{$transliteration->note}</dd> |
|
72 |
|
|
73 |
<dt class="col-sm-3">References (handcopy)</dt> |
|
74 |
<dd class="col-sm-9"> |
|
75 |
{foreach $litReferences as $reference} |
|
76 |
{$reference->series} {$reference->number}, {$reference->plate}<br> |
|
77 |
{/foreach} |
|
78 |
</dd> |
|
79 |
|
|
80 |
</dl> |
|
81 |
</div> |
|
82 |
|
|
83 |
<hr> |
|
84 |
<div class="display-6"> |
|
85 |
<div class="text-muted">Transliteration data</div> |
|
86 |
</div> |
|
87 |
|
|
88 |
|
|
89 |
<a n:href=":Admin:Transliteration:edit#transliteration-data $transliteration->id">edit</a> |
|
90 |
|
|
91 |
<div class="container-fluid"> |
|
92 |
{foreach $lineArray as $objectType => $surface} |
|
93 |
<b>{$objectType}</b> <br> |
|
94 |
{foreach $surface as $surfaceType => $lines} |
|
95 |
<div class="noname" id="tablet-div"> |
|
96 |
<hr> |
|
97 |
|
|
98 |
<i>{$surfaceType}</i> <br> |
|
99 |
{foreach $lines as $line} |
|
100 |
{$line['line_number']}. {$line['transliteration']} <br> |
|
101 |
{/foreach} |
|
102 |
</div> |
|
103 |
{/foreach} |
|
104 |
{/foreach} |
|
105 |
</div> |
|
106 |
<hr> |
|
107 |
<div class="display-6"> |
|
108 |
<div class="text-muted">Revision history</div> |
|
109 |
</div> |
|
110 |
<div class="container-fluid"> |
|
111 |
{foreach $revisionHistory as $revisionRecord} |
|
112 |
{$revisionRecord->date|date:'Y-m-d'} {ifset $revisionRecord->name} - {$revisionRecord->name}{/ifset} - {$revisionRecord->description}<br> |
|
113 |
{/foreach} |
|
114 |
</div> |
|
5 |
{control transliterationView $id} |
|
115 | 6 |
{/block} |
app/config/components.neon | ||
---|---|---|
24 | 24 |
- App\AdminModule\Components\ITransliterationDataEditFormFactory |
25 | 25 |
- App\AdminModule\Components\IImportFormFactory |
26 | 26 |
- App\AdminModule\Components\IExportFormFactory |
27 |
- App\FrontModule\Components\ICatalogueSearchFormFactory |
|
28 |
- App\FrontModule\Components\IUserSettingsFormFactory |
|
27 | 29 |
|
28 | 30 |
- App\FrontModule\Components\IKeyboard |
29 | 31 |
- App\FrontModule\Components\ITransliterationSearchResultListFactory |
30 |
- App\FrontModule\Components\IUserSettingsFormFactory |
|
32 |
- App\FrontModule\Components\ICatalogueSearchResultListFactory |
|
33 |
- App\FrontModule\Components\ITransliterationViewFactory |
app/config/config.local.example.neon | ||
---|---|---|
5 | 5 |
dsn: 'mysql:host=filek.cz;dbname=aswi-obtc-new' |
6 | 6 |
user: |
7 | 7 |
password: |
8 |
|
|
9 |
application: |
|
10 |
catchExceptions: false |
app/config/model.neon | ||
---|---|---|
24 | 24 |
|
25 | 25 |
#Sessions |
26 | 26 |
- App\Model\TransliterationSearchModel |
27 |
- App\Model\TransportModel |
|
27 |
- App\Model\TransportModel |
|
28 |
- App\Model\CatalogueSearchModel |
app/enum/ESearchFormOperators.php | ||
---|---|---|
35 | 35 |
|
36 | 36 |
|
37 | 37 |
public static $selectLikeOperatorLabels = [ |
38 |
self::EQUALS => 'Equals',
|
|
39 |
self::NOT_EQUALS => 'Not equals',
|
|
40 |
self::CONTAINS => 'Contains',
|
|
41 |
self::BEGINS_WITH => 'Begins with',
|
|
42 |
self::ENDS_WITH => 'Ends with'
|
|
38 |
self::EQUALS => 'equals',
|
|
39 |
self::NOT_EQUALS => 'not equals',
|
|
40 |
self::CONTAINS => 'contains',
|
|
41 |
self::BEGINS_WITH => 'begins with',
|
|
42 |
self::ENDS_WITH => 'ends with'
|
|
43 | 43 |
]; |
44 | 44 |
|
45 | 45 |
public static $selectLikeOperatorQueryCondition = [ |
... | ... | |
52 | 52 |
|
53 | 53 |
|
54 | 54 |
public static $selectEqualsOperatorLabels = [ |
55 |
self::IS => 'Is',
|
|
56 |
self::IS_NOT => 'Is not'
|
|
55 |
self::IS => 'is',
|
|
56 |
self::IS_NOT => 'is not'
|
|
57 | 57 |
]; |
58 | 58 |
|
59 | 59 |
public static $selectEqualsOperatorQueryCondition = [ |
60 | 60 |
self::IS => ' = ? ', |
61 | 61 |
self::IS_NOT => ' <> ? ' |
62 | 62 |
]; |
63 |
|
|
64 |
public static $selectCatalogueLabels = [ |
|
65 |
self::NOT_USED => '- NOT SELECTED -' |
|
66 |
]; |
|
63 | 67 |
} |
app/model/CatalogueSearchModel.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\Model; |
|
5 |
|
|
6 |
|
|
7 |
use Nette\Http\Session; |
|
8 |
use Nette\Http\SessionSection; |
|
9 |
use Nette\Utils\ArrayHash; |
|
10 |
|
|
11 |
class CatalogueSearchModel |
|
12 |
{ |
|
13 |
const SECTION_NAME = 'CatalogueSearch'; |
|
14 |
const SECTION_EXPIRATION = 0; |
|
15 |
|
|
16 |
/** @var SessionSection */ |
|
17 |
private $section; |
|
18 |
|
|
19 |
public function __construct(Session $session) |
|
20 |
{ |
|
21 |
$this->section = $session->getSection(self::SECTION_NAME); |
|
22 |
$this->section->setExpiration(self::SECTION_EXPIRATION); |
|
23 |
} |
|
24 |
|
|
25 |
/** |
|
26 |
* @return SessionSection |
|
27 |
*/ |
|
28 |
public function getCatalogueSearchSection() |
|
29 |
{ |
|
30 |
return $this->section; |
|
31 |
} |
|
32 |
|
|
33 |
public function setSearchTerms(ArrayHash $searchTerms) |
|
34 |
{ |
|
35 |
$this->section->searchTerms = $searchTerms; |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* @return null|ArrayHash |
|
40 |
*/ |
|
41 |
public function getSearchTerms() |
|
42 |
{ |
|
43 |
return $this->section->searchTerms; |
|
44 |
} |
|
45 |
} |
app/model/facade/TransportFacade.php | ||
---|---|---|
62 | 62 |
$bookId = $this->getBookIdByName($book); |
63 | 63 |
if (!$bookId) |
64 | 64 |
{ |
65 |
$bookId = $this->bookRepository->insert([BookRepository::COLUMN_BOOK_ABREV => $book])->getPrimary(); |
|
65 |
$bookId = $this->bookRepository->insert([BookRepository::COLUMN_BOOK_ABBREV => $book])->getPrimary();
|
|
66 | 66 |
} |
67 | 67 |
} |
68 | 68 |
catch (\Exception $exception) |
app/model/repository/BookRepository.php | ||
---|---|---|
15 | 15 |
|
16 | 16 |
/** Sloupečky tabulky */ |
17 | 17 |
const COLUMN_ID = 'id_book'; |
18 |
const COLUMN_BOOK_ABREV = 'book_abrev'; |
|
18 |
const COLUMN_BOOK_ABBREV = 'book_abrev';
|
|
19 | 19 |
const COLUMN_BOOK_AUTHOR = 'book_autor'; |
20 | 20 |
const COLUMN_BOOK_DESCRIPTION = 'book_description'; |
21 | 21 |
const COLUMN_BOOK_NAME = 'book_name'; |
... | ... | |
35 | 35 |
*/ |
36 | 36 |
public function getBooksLikeBookAbbrev(string $bookName) |
37 | 37 |
{ |
38 |
return $this->findAll()->where(self::COLUMN_BOOK_ABREV . ' LIKE', '%' . $bookName . '%'); |
|
38 |
return $this->findAll()->where(self::COLUMN_BOOK_ABBREV . ' LIKE', '%' . $bookName . '%');
|
|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
/** |
... | ... | |
44 | 44 |
* @return \Nette\Database\Table\Selection |
45 | 45 |
*/ |
46 | 46 |
public function getBookByBookAbbrev(string $bookName){ |
47 |
return $this->findBy([self::COLUMN_BOOK_ABREV => $bookName]); |
|
47 |
return $this->findBy([self::COLUMN_BOOK_ABBREV => $bookName]);
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
/** |
... | ... | |
52 | 52 |
* |
53 | 53 |
* @return array |
54 | 54 |
*/ |
55 |
public function getBookAbbrevForSelect() |
|
55 |
public function getBooksAbbrevForSelect()
|
|
56 | 56 |
{ |
57 |
return $this->findAll()->fetchPairs(BookRepository::COLUMN_ID, BookRepository::COLUMN_BOOK_ABREV); |
|
57 |
return $this->findAll() |
|
58 |
->order(BookRepository::COLUMN_BOOK_ABBREV) |
|
59 |
->fetchPairs(BookRepository::COLUMN_ID, BookRepository::COLUMN_BOOK_ABBREV); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Vrátí všechny abbrev pro katalog formuláře |
|
64 |
* |
|
65 |
* @return array |
|
66 |
*/ |
|
67 |
public function getBooksAbbrevForCatalogueSelect() |
|
68 |
{ |
|
69 |
return $this->findAll() |
|
70 |
->order(BookRepository::COLUMN_BOOK_ABBREV) |
|
71 |
->fetchPairs(BookRepository::COLUMN_BOOK_ABBREV, BookRepository::COLUMN_BOOK_ABBREV); |
|
58 | 72 |
} |
59 | 73 |
|
60 | 74 |
} |
app/model/repository/MuseumRepository.php | ||
---|---|---|
47 | 47 |
*/ |
48 | 48 |
public function getMuseumNameForSelect() |
49 | 49 |
{ |
50 |
return $this->findAll()->fetchPairs(MuseumRepository::COLUMN_ID,MuseumRepository::COLUMN_NAME);
|
|
50 |
return $this->findAll()->order(self::TABLE_NAME)->fetchPairs(self::COLUMN_ID,self::COLUMN_NAME);
|
|
51 | 51 |
} |
52 | 52 |
} |
app/model/repository/OriginRepository.php | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
public function getOriginsForSelect() |
26 | 26 |
{ |
27 |
$origins = $this->findAll()->fetchPairs(self::COLUMN_ID, self::COLUMN_ORIGIN); |
|
27 |
$origins = $this->findAll()->order(self::COLUMN_ORIGIN)->fetchPairs(self::COLUMN_ID, self::COLUMN_ORIGIN);
|
|
28 | 28 |
$origins[0] = '- NOT SELECTED -'; |
29 | 29 |
return $origins; |
30 | 30 |
} |
app/model/repository/TransliterationRepository.php | ||
---|---|---|
3 | 3 |
namespace App\Model\Repository; |
4 | 4 |
|
5 | 5 |
use App\Enum\ESearchFormOperators; |
6 |
use App\FrontModule\Components\CatalogueSearchForm; |
|
6 | 7 |
use Nette\Utils\ArrayHash; |
7 | 8 |
use Tracy\Debugger; |
8 | 9 |
|
... | ... | |
37 | 38 |
* @param $limit null|int |
38 | 39 |
* @return \Nette\Database\ResultSet |
39 | 40 |
*/ |
40 |
public function transliterationsFulltextSearch(ArrayHash $queryParams,int $offset = null,int $limit = null)
|
|
41 |
public function transliterationsFulltextSearch(ArrayHash $queryParams, int $offset = null, int $limit = null)
|
|
41 | 42 |
{ |
42 | 43 |
$where = ''; |
43 | 44 |
$whereArgs = []; |
... | ... | |
213 | 214 |
)->fetch(); |
214 | 215 |
} |
215 | 216 |
|
216 |
public function getTransliterationByChapterNameAndBookId(int $bookId, string $chapterName){ |
|
217 |
public function getTransliterationByChapterNameAndBookId(int $bookId, string $chapterName) |
|
218 |
{ |
|
217 | 219 |
return $this->findBy([self::COLUMN_BOOK_ID => $bookId, self::COLUMN_CHAPTER => $chapterName]); |
218 | 220 |
} |
221 |
|
|
222 |
/** |
|
223 |
* Vyhledává v katalogu textů podle zadaných parametrů |
|
224 |
* |
|
225 |
* @param ArrayHash $queryParams : parametry hledání |
|
226 |
* @param int|null $offset |
|
227 |
* @param int|null $limit |
|
228 |
* @return \Nette\Database\ResultSet |
|
229 |
*/ |
|
230 |
public function transliterationCatalogueSearch(ArrayHash $queryParams, int $offset = null, int $limit = null) |
|
231 |
{ |
|
232 |
/** |
|
233 |
* @var $mc string : udává jestli je mezi vyhledávanými parametry logické AND nebo OR |
|
234 |
*/ |
|
235 |
$mc = 'AND '; |
|
236 |
if (isset($queryParams['match_condition']) && $queryParams['match_condition'] == CatalogueSearchForm::MATCH_ANY) |
|
237 |
{ |
|
238 |
$mc = 'OR '; |
|
239 |
} |
|
240 |
|
|
241 |
$where = ''; |
|
242 |
$whereArgs = []; |
|
243 |
|
|
244 |
// Book abbreviation |
|
245 |
if (isset($queryParams['book_abbrev_condition']) && !empty($queryParams[BookRepository::COLUMN_BOOK_ABBREV])) |
|
246 |
{ |
|
247 |
$where .= $mc . "b." . BookRepository::COLUMN_BOOK_ABBREV . " " . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['book_abbrev_condition']]; |
|
248 |
$whereArgs[] = $queryParams[BookRepository::COLUMN_BOOK_ABBREV]; |
|
249 |
} |
|
250 |
|
|
251 |
// Book name |
|
252 |
if (isset($queryParams['book_name_condition']) && !empty($queryParams[BookRepository::COLUMN_BOOK_NAME])) |
|
253 |
{ |
|
254 |
$where .= $mc . "b." . BookRepository::COLUMN_BOOK_NAME . " " . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['book_name_condition']]; |
|
255 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams[BookRepository::COLUMN_BOOK_NAME], $queryParams['book_name_condition']); |
|
256 |
} |
|
257 |
|
|
258 |
// Book type |
|
259 |
if (isset($queryParams['book_type_condition']) && !empty($queryParams[TransliterationRepository::COLUMN_BOOK_TYPE_ID])) |
|
260 |
{ |
|
261 |
$where .= $mc . "t." . TransliterationRepository::COLUMN_BOOK_TYPE_ID . " " . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['book_type_condition']]; |
|
262 |
$whereArgs[] = $queryParams[TransliterationRepository::COLUMN_BOOK_TYPE_ID]; |
|
263 |
} |
|
264 |
|
|
265 |
// Author |
|
266 |
if (isset($queryParams['author_condition']) && !empty($queryParams[BookRepository::COLUMN_BOOK_AUTHOR])) |
|
267 |
{ |
|
268 |
$where .= $mc . "b." . BookRepository::COLUMN_BOOK_AUTHOR . " " . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['author_condition']]; |
|
269 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams[BookRepository::COLUMN_BOOK_AUTHOR], $queryParams['author_condition']); |
|
270 |
} |
|
271 |
|
|
272 |
// Book chapter |
|
273 |
if (isset($queryParams['book_chapter_condition']) && !empty($queryParams[TransliterationRepository::COLUMN_CHAPTER])) |
|
274 |
{ |
|
275 |
$where .= $mc . "t." . TransliterationRepository::COLUMN_CHAPTER . " " . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['book_chapter_condition']]; |
|
276 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams[TransliterationRepository::COLUMN_CHAPTER], $queryParams['book_chapter_condition']); |
|
277 |
} |
|
278 |
|
|
279 |
// Museum |
|
280 |
if (isset($queryParams['museum_condition']) && !empty($queryParams[TransliterationRepository::COLUMN_MUSEUM_ID])) |
|
281 |
{ |
|
282 |
$where .= $mc . "t." . TransliterationRepository::COLUMN_MUSEUM_ID . " " . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['museum_condition']]; |
|
283 |
$whereArgs[] = $queryParams[TransliterationRepository::COLUMN_MUSEUM_ID]; |
|
284 |
} |
|
285 |
|
|
286 |
// Museum number |
|
287 |
if (isset($queryParams['museum_number_condition']) && !empty($queryParams[TransliterationRepository::COLUMN_MUSEUM_NO])) |
|
288 |
{ |
|
289 |
$where .= $mc . "t." . TransliterationRepository::COLUMN_MUSEUM_NO . " " . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['museum_number_condition']]; |
|
290 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams[TransliterationRepository::COLUMN_MUSEUM_NO], $queryParams['museum_number_condition']); |
|
291 |
} |
|
292 |
|
|
293 |
// Origin |
|
294 |
if(isset($queryParams['origin_condition']) && !empty($queryParams[TransliterationRepository::COLUMN_ORIGIN_ID])) |
|
295 |
{ |
|
296 |
$where .= $mc . "t." . TransliterationRepository::COLUMN_ORIGIN_ID . " " . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['origin_condition']]; |
|
297 |
$whereArgs[] = $queryParams[TransliterationRepository::COLUMN_ORIGIN_ID]; |
|
298 |
} |
|
299 |
|
|
300 |
// Odstranění AND nebo OR pokud se nachází na začátku dotazu |
|
301 |
if (strpos($where, $mc) === 0) |
|
302 |
{ |
|
303 |
$where = substr($where, strlen($mc)); |
|
304 |
} |
|
305 |
|
|
306 |
$query = "SELECT |
|
307 |
t.id_transliteration as id, |
|
308 |
s.id_surface as surface_id, |
|
309 |
b.book_abrev, |
|
310 |
t.chapter, |
|
311 |
l.transliteration, |
|
312 |
l.id_line as line_id, |
|
313 |
l.line_number |
|
314 |
FROM transliteration t |
|
315 |
LEFT JOIN surface s ON s.id_transliteration = t.id_transliteration |
|
316 |
LEFT JOIN line l ON l.id_surface = s.id_surface |
|
317 |
LEFT JOIN book b ON t.id_book = b.id_book "; |
|
318 |
|
|
319 |
if (!empty($where)) |
|
320 |
{ |
|
321 |
$query .= "WHERE " . $where; |
|
322 |
} |
|
323 |
|
|
324 |
$query .= " ORDER BY t.chapter "; |
|
325 |
|
|
326 |
if($offset !== NULL && $limit !== NULL){ |
|
327 |
$query .= ' LIMIT ?, ? '; |
|
328 |
$whereArgs[] = (int) $offset; |
|
329 |
$whereArgs[] = (int) $limit; |
|
330 |
} |
|
331 |
|
|
332 |
$result = $this->context->queryArgs($query, $whereArgs); |
|
333 |
|
|
334 |
return $result; |
|
335 |
} |
Také k dispozici: Unified diff
Re #7595 vyhledávání v katalogu