Revize da67aedb
Přidáno uživatelem Filip Jani před téměř 6 roky(ů)
app/AdminModule/component/Transliteration/TransliterationGrid.php | ||
---|---|---|
148 | 148 |
// =============== |
149 | 149 |
// Definice filtrů |
150 | 150 |
// =============== |
151 |
$allFilter = ['' => 'All']; |
|
151 | 152 |
$this->addFilterText(TransliterationRepository::COLUMN_BOOK_ID, 'Book') |
152 | 153 |
->setCondition(function (Selection $selection, $value) use ($bookRepository) |
153 | 154 |
{ |
... | ... | |
157 | 158 |
$selection->where(BookRepository::COLUMN_ID, $bookIds); |
158 | 159 |
}); |
159 | 160 |
$this->addFilterText(TransliterationRepository::COLUMN_CHAPTER, 'Chapter'); |
160 |
$this->addFilterText(TransliterationRepository::COLUMN_MUSEUM_ID, 'Museum') |
|
161 |
->setCondition(function (Selection $selection, $value) use ($museumRepository) |
|
162 |
{ |
|
163 |
$museumIds = $museumRepository->getMuseumsLikeName($value)->fetchField(MuseumRepository::COLUMN_ID); |
|
164 |
$museumIds = $museumIds ? $museumIds : NULL; |
|
165 |
|
|
166 |
$selection->where(MuseumRepository::COLUMN_ID, $museumIds); |
|
167 |
}); |
|
161 |
$this->addFilterSelect(TransliterationRepository::COLUMN_MUSEUM_ID, 'Museum', $allFilter + $this->museumRepository->getMuseumNameForSelect()); |
|
168 | 162 |
$this->addFilterText(TransliterationRepository::COLUMN_MUSEUM_NO, 'Museum No'); |
169 |
$this->addFilterSelect(TransliterationRepository::COLUMN_ORIGIN_ID, 'Origin', $this->getOriginFilterArray()); |
|
170 |
$this->addFilterSelect(TransliterationRepository::COLUMN_BOOK_TYPE_ID, 'Book Type', $this->getBookTypeFilterArray()); |
|
163 |
$this->addFilterSelect(TransliterationRepository::COLUMN_ORIGIN_ID, 'Origin', $allFilter + $this->getOriginFilterArray());
|
|
164 |
$this->addFilterSelect(TransliterationRepository::COLUMN_BOOK_TYPE_ID, 'Book Type', $allFilter + $this->getBookTypeFilterArray());
|
|
171 | 165 |
$this->addFilterText(TransliterationRepository::COLUMN_REG_NO, 'Reg No'); |
172 | 166 |
$this->addFilterText(TransliterationRepository::COLUMN_DATE, 'Date'); |
173 | 167 |
|
app/model/repository/MuseumRepository.php | ||
---|---|---|
47 | 47 |
*/ |
48 | 48 |
public function getMuseumNameForSelect() |
49 | 49 |
{ |
50 |
return $this->findAll()->order(self::TABLE_NAME)->fetchPairs(self::COLUMN_ID,self::COLUMN_NAME); |
|
50 |
$selectArray = []; |
|
51 |
$museums = $this->findAll()->order(self::COLUMN_NAME)->fetchAll(); |
|
52 |
|
|
53 |
foreach ($museums as $museum) |
|
54 |
{ |
|
55 |
$label = $museum->{self::COLUMN_NAME}; |
|
56 |
if (!empty($museum->{self::COLUMN_PLACE})) |
|
57 |
{ |
|
58 |
$label .= ' – ' . $museum->{self::COLUMN_PLACE}; |
|
59 |
} |
|
60 |
$selectArray[$museum->{self::COLUMN_ID}] = $label; |
|
61 |
} |
|
62 |
|
|
63 |
return $selectArray; |
|
51 | 64 |
} |
52 | 65 |
} |
app/model/repository/OriginRepository.php | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
public function getOriginsForSelect() |
26 | 26 |
{ |
27 |
$origins = $this->findAll()->order(self::COLUMN_ORIGIN)->fetchPairs(self::COLUMN_ID, self::COLUMN_ORIGIN); |
|
28 |
$origins[0] = '- NOT SELECTED -'; |
|
29 |
return $origins; |
|
27 |
$selectArray = []; |
|
28 |
|
|
29 |
$origins = $this->findAll()->order(self::COLUMN_ORIGIN)->fetchAll(); |
|
30 |
|
|
31 |
foreach ($origins as $origin) |
|
32 |
{ |
|
33 |
$label = $origin->{self::COLUMN_ORIGIN}; |
|
34 |
if (!empty($origin->{self::COLUMN_OLD_NAME})) |
|
35 |
{ |
|
36 |
$label .= ' / ' . $origin->{self::COLUMN_OLD_NAME}; |
|
37 |
} |
|
38 |
$selectArray[$origin->{self::COLUMN_ID}] = $label; |
|
39 |
} |
|
40 |
|
|
41 |
$selectArray[0] = '- NOT SELECTED -'; |
|
42 |
return $selectArray; |
|
30 | 43 |
} |
31 | 44 |
|
32 | 45 |
/** Vrací místa původu se názvem LIKE % $name % |
Také k dispozici: Unified diff
Grafické úpravy katalogu a filtrování v gridu transliterací