78 |
78 |
}
|
79 |
79 |
}
|
80 |
80 |
|
|
81 |
if($queryParams['book'])
|
|
82 |
{
|
|
83 |
$where .= ' AND b.book_name' . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['book_condition']];
|
|
84 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams['book'], $queryParams['book_condition']);
|
|
85 |
}
|
|
86 |
|
|
87 |
if($queryParams['museum'])
|
|
88 |
{
|
|
89 |
$where .= ' AND t.museum_no' . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['museum_condition']];
|
|
90 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams['museum'], $queryParams['museum_condition']);
|
|
91 |
}
|
|
92 |
|
|
93 |
if($queryParams['type'])
|
|
94 |
{
|
|
95 |
$where .= ' AND t.id_book_type' . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['type_condition']];
|
|
96 |
$whereArgs[] = $queryParams['type'];
|
|
97 |
}
|
|
98 |
|
|
99 |
if($queryParams['origin'])
|
|
100 |
{
|
|
101 |
$where .= ' AND t.id_origin' . ESearchFormOperators::$selectEqualsOperatorQueryCondition[$queryParams['origin_condition']];
|
|
102 |
$whereArgs[] = $queryParams['origin'];
|
|
103 |
}
|
|
104 |
|
|
105 |
if($queryParams['registration'])
|
|
106 |
{
|
|
107 |
$where .= ' AND t.reg_no' . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['registration_condition']];
|
|
108 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams['registration'], $queryParams['registration_condition']);
|
|
109 |
}
|
|
110 |
|
|
111 |
if($queryParams['date'])
|
|
112 |
{
|
|
113 |
$where .= ' AND t.date' . ESearchFormOperators::$selectLikeOperatorQueryCondition[$queryParams['date_condition']];
|
|
114 |
$whereArgs[] = $this->prepareQueryArgByOperator($queryParams['date'], $queryParams['date_condition']);
|
|
115 |
}
|
|
116 |
|
81 |
117 |
$query = "SELECT
|
82 |
118 |
t.id_transliteration as id,
|
83 |
119 |
b.book_abrev,
|
... | ... | |
87 |
123 |
FROM transliteration t
|
88 |
124 |
LEFT JOIN surface s ON s.id_transliteration = t.id_transliteration
|
89 |
125 |
LEFT JOIN line l ON l.id_surface = s.id_surface
|
90 |
|
LEFT JOIN book b on t.id_book = b.id_book
|
|
126 |
LEFT JOIN book b ON t.id_book = b.id_book
|
91 |
127 |
WHERE " . $where;
|
92 |
128 |
|
93 |
129 |
return $this->context->queryArgs($query, $whereArgs);
|
... | ... | |
109 |
145 |
return $regex;
|
110 |
146 |
}
|
111 |
147 |
|
|
148 |
/**
|
|
149 |
* Připraví argument pro dotaz podle zvoleného operátoru
|
|
150 |
* @param $word string
|
|
151 |
* @param $op string operátor pro porovnání s ESearchFormOperators
|
|
152 |
* @return string
|
|
153 |
*/
|
|
154 |
private function prepareQueryArgByOperator($word, $op)
|
|
155 |
{
|
|
156 |
switch ($op)
|
|
157 |
{
|
|
158 |
case ESearchFormOperators::CONTAINS:
|
|
159 |
return '%' . $word . '%';
|
|
160 |
case ESearchFormOperators::BEGINS_WITH:
|
|
161 |
return $word . '%';
|
|
162 |
case ESearchFormOperators::ENDS_WITH:
|
|
163 |
return '%' . $word;
|
|
164 |
default:
|
|
165 |
return $word;
|
|
166 |
}
|
|
167 |
}
|
|
168 |
|
112 |
169 |
/**
|
113 |
170 |
* @param int $id id transliterace
|
114 |
171 |
* @return bool|\Nette\Database\IRow|\Nette\Database\Row
|
Re #7328 výsledky vyhledávání textů s pokročilými filtry