| @@ 298-321 (lines=24) @@ | ||
| 295 | * |
|
| 296 | * @return bool True if ALL navigation filtering succeeded or there was no filtering at all otherwise false |
|
| 297 | */ |
|
| 298 | protected function applyNavigationFilter(&$filteredIds = array()) |
|
| 299 | { |
|
| 300 | // Iterate all applied navigation filters |
|
| 301 | foreach ($this->navigation as $navigation) { |
|
| 302 | // Create navigation-material query |
|
| 303 | $this->query->entity('\samson\activerecord\structurematerial') |
|
| 304 | ->where('StructureID', $navigation) |
|
| 305 | ->where('Active', 1) |
|
| 306 | ->groupBy('MaterialID'); |
|
| 307 | ||
| 308 | if (null !== $filteredIds) { |
|
| 309 | $this->query->where('MaterialID', $filteredIds); |
|
| 310 | } |
|
| 311 | ||
| 312 | // Perform request to get next portion of filtered material identifiers |
|
| 313 | if (!$this->query->fields('MaterialID', $filteredIds)) { |
|
| 314 | // This filter applying failed |
|
| 315 | return false; |
|
| 316 | } |
|
| 317 | } |
|
| 318 | ||
| 319 | // We have no navigation collection filters |
|
| 320 | return true; |
|
| 321 | } |
|
| 322 | ||
| 323 | /** |
|
| 324 | * Try to get all material identifiers filtered by additional field |
|
| @@ 331-354 (lines=24) @@ | ||
| 328 | * |
|
| 329 | * @return bool True if ALL field filtering succeeded or there was no filtering at all otherwise false |
|
| 330 | */ |
|
| 331 | protected function applyFieldFilter(&$filteredIds = array()) |
|
| 332 | { |
|
| 333 | // Iterate all applied field filters |
|
| 334 | foreach ($this->field as $field) { |
|
| 335 | // Create material-field query |
|
| 336 | $this->query->entity('\samson\activerecord\materialfield') |
|
| 337 | ->where('FieldID', $field[0]->id) |
|
| 338 | ->whereCondition($field[1]) |
|
| 339 | ->groupBy('MaterialID'); |
|
| 340 | ||
| 341 | if (null !== $filteredIds) { |
|
| 342 | $this->query->where('MaterialID', $filteredIds); |
|
| 343 | } |
|
| 344 | ||
| 345 | // Perform request to get next portion of filtered material identifiers |
|
| 346 | if (!$this->query->fields('MaterialID', $filteredIds)) { |
|
| 347 | // This filter applying failed |
|
| 348 | return false; |
|
| 349 | } |
|
| 350 | } |
|
| 351 | ||
| 352 | // We have no field collection filters |
|
| 353 | return true; |
|
| 354 | } |
|
| 355 | ||
| 356 | /** |
|
| 357 | * Try to find all materials which have fields similar to search strings |
|