|
@@ 281-306 (lines=26) @@
|
| 278 |
|
* @param array $filteredIds Collection of filtered material identifiers |
| 279 |
|
* @return bool True if ALL navigation filtering succeeded or there was no filtering at all otherwise false |
| 280 |
|
*/ |
| 281 |
|
protected function applyNavigationFilter(& $filteredIds = array()) |
| 282 |
|
{ |
| 283 |
|
// Iterate all applied navigation filters |
| 284 |
|
foreach ($this->navigation as $navigation) { |
| 285 |
|
// Create navigation-material query |
| 286 |
|
$this->query->className('structurematerial') |
| 287 |
|
|
| 288 |
|
->cond('StructureID', $navigation) |
| 289 |
|
->cond('Active', 1) |
| 290 |
|
->group_by('MaterialID') |
| 291 |
|
; |
| 292 |
|
|
| 293 |
|
if (isset($filteredIds)) { |
| 294 |
|
$this->query->cond('MaterialID', $filteredIds); |
| 295 |
|
} |
| 296 |
|
|
| 297 |
|
// Perform request to get next portion of filtered material identifiers |
| 298 |
|
if (!$this->query->fields('MaterialID', $filteredIds)) { |
| 299 |
|
// This filter applying failed |
| 300 |
|
return false; |
| 301 |
|
} |
| 302 |
|
} |
| 303 |
|
|
| 304 |
|
// We have no navigation collection filters |
| 305 |
|
return true; |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
/** |
| 309 |
|
* Try to get all material identifiers filtered by additional field |
|
@@ 315-339 (lines=25) @@
|
| 312 |
|
* @param array $filteredIds Collection of filtered material identifiers |
| 313 |
|
* @return bool True if ALL field filtering succeeded or there was no filtering at all otherwise false |
| 314 |
|
*/ |
| 315 |
|
protected function applyFieldFilter(& $filteredIds = array()) |
| 316 |
|
{ |
| 317 |
|
// Iterate all applied field filters |
| 318 |
|
foreach ($this->field as $field) { |
| 319 |
|
// Create material-field query |
| 320 |
|
$this->query->className('materialfield') |
| 321 |
|
->cond('FieldID', $field[0]->id) |
| 322 |
|
->cond($field[1]) |
| 323 |
|
->group_by('MaterialID') |
| 324 |
|
; |
| 325 |
|
|
| 326 |
|
if (isset($filteredIds)) { |
| 327 |
|
$this->query->cond('MaterialID', $filteredIds); |
| 328 |
|
} |
| 329 |
|
|
| 330 |
|
// Perform request to get next portion of filtered material identifiers |
| 331 |
|
if (!$this->query->fields('MaterialID', $filteredIds)) { |
| 332 |
|
// This filter applying failed |
| 333 |
|
return false; |
| 334 |
|
} |
| 335 |
|
} |
| 336 |
|
|
| 337 |
|
// We have no field collection filters |
| 338 |
|
return true; |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
/** |
| 342 |
|
* Try to find all materials which have fields similar to search strings |