ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAdvancedSearch Class Reference
+ Inheritance diagram for ilAdvancedSearch:
+ Collaboration diagram for ilAdvancedSearch:

Public Member Functions

 setMode (string $a_mode)
 
 getMode ()
 
 setOptions (array &$options)
 
 performSearch ()
 
__searchTitleDescription ()
 
 __searchTitle ()
 
 __searchDescription ()
 
 __searchGeneral ()
 
 __searchLanguage ()
 
 __searchContribute ()
 
 __searchEntity ()
 
 __searchRequirement ()
 
 __searchEducational ()
 
 __searchTypicalAgeRange ()
 
 __searchRights ()
 
 __searchClassification ()
 
 __searchTaxon ()
 
 __searchKeyword (bool $a_in_classification=false)
 
 __searchLifecycle ()
 
 __searchFormat ()
 
 __createRightsWhere ()
 
 __createClassificationWhere ()
 
 __createEducationalWhere ()
 
 __getDifference (int $a_val1, int $a_val2, array $options)
 
 __getInStatement (array $a_fields)
 
- Public Member Functions inherited from ilAbstractSearch
 __construct (ilQueryParser $qp_obj)
 
 setFields (array $a_fields)
 
 getFields ()
 
 setFilter (array $a_filter)
 
 setIdFilter (array $a_id_filter)
 
 getIdFilter ()
 
 appendToFilter (string $a_type)
 
 getFilter ()
 
 __createLocateString ()
 
 __prepareFound (object $row)
 
 performSearch ()
 

Protected Member Functions

 searchObjectProperties (string ... $fields)
 
 joinOnRessourceIDs (string ... $individual_queries)
 
- Protected Member Functions inherited from ilAbstractSearch
 getValidObjectTypes (ilObjectDefinition $object_definition)
 

Protected Attributes

array $options = []
 
- Protected Attributes inherited from ilAbstractSearch
ilDBInterface $db
 
ilQueryParser $query_parser
 
ilSearchResult $search_result
 
array $object_types = []
 

Private Attributes

string $mode = ''
 

Detailed Description

Definition at line 33 of file class.ilAdvancedSearch.php.

Member Function Documentation

◆ __createClassificationWhere()

ilAdvancedSearch::__createClassificationWhere ( )

Definition at line 575 of file class.ilAdvancedSearch.php.

575 : string
576 {
577 $counter = 0;
578 $where = 'WHERE ';
579
580
581 if ($this->options['lom_purpose'] ?? null) {
582 $and = $counter++ ? 'AND ' : ' ';
583 $where .= ($and . "purpose = " . $this->db->quote($this->options['lom_purpose'], ilDBConstants::T_TEXT) . " ");
584 }
585 return $counter ? $where : '';
586 }
$counter

References $counter, and ilDBConstants\T_TEXT.

Referenced by __searchClassification().

+ Here is the caller graph for this function:

◆ __createEducationalWhere()

ilAdvancedSearch::__createEducationalWhere ( )

Definition at line 587 of file class.ilAdvancedSearch.php.

587 : string
588 {
589 $counter = 0;
590 $where = 'WHERE ';
591
592
593 if ($this->options['lom_interactivity'] ?? null) {
594 $and = $counter++ ? 'AND ' : ' ';
595 $where .= ($and . "interactivity_type = " . $this->db->quote($this->options['lom_interactivity'], 'text') . " ");
596 }
597 if (
598 ($this->options['lom_level_start'] ?? null) or
599 ($this->options['lom_level_end'] ?? null)) {
600 $and = $counter++ ? 'AND ' : ' ';
601
602 $fields = $this->__getDifference(
603 (int) $this->options['lom_level_start'],
604 (int) $this->options['lom_level_end'],
605 array('VeryLow','Low','Medium','High','VeryHigh')
606 );
607
608 $where .= ($and . "interactivity_level " . $this->__getInStatement($fields));
609 }
610 if (
611 ($this->options['lom_density_start'] ?? null) or
612 ($this->options['lom_density_end'] ?? null)
613 ) {
614 $and = $counter++ ? 'AND ' : ' ';
615
616 $fields = $this->__getDifference(
617 (int) $this->options['lom_density_start'],
618 (int) $this->options['lom_density_end'],
619 array('VeryLow','Low','Medium','High','VeryHigh')
620 );
621
622 $where .= ($and . "semantic_density " . $this->__getInStatement($fields));
623 }
624 if (
625 ($this->options['lom_difficulty_start'] ?? null) or
626 ($this->options['lom_difficulty_end'] ?? null)
627 ) {
628 $and = $counter++ ? 'AND ' : ' ';
629
630 $fields = $this->__getDifference(
631 (int) $this->options['lom_difficulty_start'],
632 (int) $this->options['lom_difficulty_end'],
633 array('VeryEasy','Easy','Medium','Difficult','VeryDifficult')
634 );
635
636 $where .= ($and . "difficulty " . $this->__getInStatement($fields));
637 }
638
639 return $counter ? $where : '';
640 }
__getInStatement(array $a_fields)
__getDifference(int $a_val1, int $a_val2, array $options)

References $counter, ilAbstractSearch\$fields, __getDifference(), and __getInStatement().

Referenced by __searchEducational().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __createRightsWhere()

ilAdvancedSearch::__createRightsWhere ( )

Definition at line 559 of file class.ilAdvancedSearch.php.

559 : string
560 {
561 $counter = 0;
562 $where = 'WHERE ';
563
564
565 if ($this->options['lom_costs'] ?? null) {
566 $and = $counter++ ? 'AND ' : ' ';
567 $where .= ($and . "costs = " . $this->db->quote($this->options['lom_costs'], 'text') . " ");
568 }
569 if ($this->options['lom_copyright'] ?? null) {
570 $and = $counter++ ? 'AND ' : ' ';
571 $where .= ($and . "cpr_and_or = " . $this->db->quote($this->options['lom_copyright'], 'text') . " ");
572 }
573 return $counter ? $where : '';
574 }

References $counter.

Referenced by __searchRights().

+ Here is the caller graph for this function:

◆ __getDifference()

ilAdvancedSearch::__getDifference ( int  $a_val1,
int  $a_val2,
array  $options 
)
Returns
string[]

Definition at line 645 of file class.ilAdvancedSearch.php.

645 : array
646 {
647 $a_val2 = $a_val2 ?: count($options);
648 // Call again if a > b
649 if ($a_val1 > $a_val2) {
650 return $this->__getDifference($a_val2, $a_val1, $options);
651 }
652
653 $counter = 0;
654 $fields = [];
655 foreach ($options as $option) {
656 if ($a_val1 > ++$counter) {
657 continue;
658 }
659 if ($a_val2 < $counter) {
660 break;
661 }
662 $fields[] = $option;
663 }
664 return $fields;
665 }

References $counter, ilAbstractSearch\$fields, $options, and __getDifference().

Referenced by __createEducationalWhere(), and __getDifference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getInStatement()

ilAdvancedSearch::__getInStatement ( array  $a_fields)

Definition at line 667 of file class.ilAdvancedSearch.php.

667 : string
668 {
669 if (!$a_fields) {
670 return '';
671 }
672 $in = " IN ('";
673 $in .= implode("','", $a_fields);
674 $in .= "') ";
675
676 return $in;
677 }

Referenced by __createEducationalWhere(), __searchClassification(), __searchContribute(), __searchEducational(), __searchEntity(), __searchFormat(), __searchGeneral(), __searchKeyword(), __searchLanguage(), __searchLifecycle(), __searchRequirement(), __searchRights(), __searchTaxon(), and searchObjectProperties().

+ Here is the caller graph for this function:

◆ __searchClassification()

ilAdvancedSearch::__searchClassification ( )

Definition at line 415 of file class.ilAdvancedSearch.php.

416 {
417 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_classification ";
418
419 if (!strlen($where = $this->__createClassificationWhere())) {
420 return null;
421 }
422 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
423 $query = $query . $where . $and;
424 $res = $this->db->query($query);
425 #var_dump("<pre>",$query,"<pre>");
426 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
427 $this->search_result->addEntry(
428 (int) $row->rbac_id,
429 (string) $row->obj_type,
430 array(),
431 (int) $row->obj_id
432 );
433 }
435 }
ilSearchResult $search_result
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69

References $res, ilAbstractSearch\$search_result, __createClassificationWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ILIAS\Repository\int().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchContribute()

ilAdvancedSearch::__searchContribute ( )

Definition at line 235 of file class.ilAdvancedSearch.php.

236 {
237 if (!($this->options['lom_role'] ?? null)) {
238 return null;
239 }
240
241 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute " .
242 "WHERE role = " . $this->db->quote($this->options['lom_role'], 'text') . " " .
243 "AND obj_type " . $this->__getInStatement($this->getFilter());
244
245 $res = $this->db->query($query);
246 #var_dump("<pre>",$query,"<pre>");
247 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
248 $this->search_result->addEntry(
249 (int) $row->rbac_id,
250 (string) $row->obj_type,
251 array(),
252 (int) $row->obj_id
253 );
254 }
256 }

References $res, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchDescription()

ilAdvancedSearch::__searchDescription ( )

Definition at line 125 of file class.ilAdvancedSearch.php.

126 {
127 return $this->searchObjectProperties('description');
128 }
searchObjectProperties(string ... $fields)

References searchObjectProperties().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchEducational()

ilAdvancedSearch::__searchEducational ( )

Definition at line 322 of file class.ilAdvancedSearch.php.

323 {
324 $query_start = "SELECT rbac_id,obj_id,obj_type ";
325 $and = " AND obj_type " . $this->__getInStatement($this->getFilter());
326
327 $ed_query = $lr_type_query = $end_user_query = $context_query = '';
328 if ($where = $this->__createEducationalWhere()) {
329 $ed_query = $query_start . 'FROM il_meta_educational ' . $where . $and;
330 }
331 if ($this->options['lom_resource'] ?? null) {
332 $where = " WHERE learning_resource_type = " . $this->db->quote($this->options['lom_resource'], 'text');
333 $lr_type_query = $query_start . 'FROM il_meta_lr_type ' . $where . $and;
334 }
335 if ($this->options['lom_user_role'] ?? null) {
336 $where = " WHERE intended_end_user_role = " . $this->db->quote($this->options['lom_user_role'], 'text');
337 $end_user_query = $query_start . 'FROM il_meta_end_usr_role ' . $where . $and;
338 }
339 if ($this->options['lom_context'] ?? null) {
340 $where = " WHERE context = " . $this->db->quote($this->options['lom_context'], 'text');
341 $context_query = $query_start . 'FROM il_meta_context ' . $where . $and;
342 }
343
344 $query = $this->joinOnRessourceIDs(
345 $ed_query,
346 $lr_type_query,
347 $end_user_query,
348 $context_query
349 );
350 if ($query === '') {
351 return null;
352 }
353
354 $res = $this->db->query($query);
355 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
356 $this->search_result->addEntry(
357 (int) $row->rbac_id,
358 (string) $row->obj_type,
359 array(),
360 (int) $row->obj_id
361 );
362 }
364 }
joinOnRessourceIDs(string ... $individual_queries)

References $res, ilAbstractSearch\$search_result, __createEducationalWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and joinOnRessourceIDs().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchEntity()

ilAdvancedSearch::__searchEntity ( )

Definition at line 258 of file class.ilAdvancedSearch.php.

259 {
260 $this->setFields(array('entity'));
261
262 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
263 $where = $this->__createEntityWhereCondition();
264 $locate = $this->__createLocateString();
265
266 $query = "SELECT rbac_id,obj_id,obj_type " .
267 $locate .
268 "FROM il_meta_entity " .
269 $where . " " . $and . ' ';
270
271 $res = $this->db->query($query);
272 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
273 $found = $this->__prepareFound($row);
274 if (!in_array(0, $found)) {
275 $this->search_result->addEntry(
276 (int) $row->rbac_id,
277 (string) $row->obj_type,
278 $found,
279 (int) $row->obj_id
280 );
281 }
282 }
283
285 }
setFields(array $a_fields)

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchFormat()

ilAdvancedSearch::__searchFormat ( )

Definition at line 535 of file class.ilAdvancedSearch.php.

536 {
537 if (!($this->options['lom_format'] ?? null)) {
538 return null;
539 }
540
541 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_format " .
542 "WHERE format LIKE(" . $this->db->quote($this->options['lom_format'], ilDBConstants::T_TEXT) . ") " .
543 "AND obj_type " . $this->__getInStatement($this->getFilter());
544
545 $res = $this->db->query($query);
546 #var_dump("<pre>",$query,"<pre>");
547 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
548 $this->search_result->addEntry(
549 (int) $row->rbac_id,
550 (string) $row->obj_type,
551 array(),
552 (int) $row->obj_id
553 );
554 }
556 }

References $res, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilDBConstants\T_TEXT.

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchGeneral()

ilAdvancedSearch::__searchGeneral ( )

Definition at line 156 of file class.ilAdvancedSearch.php.

157 {
158 global $DIC;
159
160 $ilDB = $DIC->database();
161
162 $coverage_query = $general_query = '';
163 if ($this->options['lom_coverage'] ?? null) {
164 $this->setFields(array('coverage'));
165 $and = $this->__createCoverageAndCondition();
166 $locate = $this->__createLocateString();
167 $coverage_query = "SELECT rbac_id,obj_type,obj_id " .
168 $locate . " " .
169 "FROM il_meta_coverage " .
170 "WHERE obj_type " . $this->__getInStatement($this->getFilter()) . " " .
171 $and;
172 }
173 if ($this->options['lom_structure'] ?? null) {
174 $and = ("AND general_structure = " . $ilDB->quote($this->options['lom_structure'], ilDBConstants::T_TEXT) . " ");
175 $general_query = "SELECT rbac_id,obj_type,obj_id " .
176 "FROM il_meta_general " .
177 "WHERE obj_type " . $this->__getInStatement($this->getFilter()) . " " .
178 $and;
179 }
180
181 $query = $this->joinOnRessourceIDs($general_query, $coverage_query);
182 if ($query === '') {
183 return null;
184 }
185
186 $res = $this->db->query($query);
187 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
188 if ($this->options['lom_coverage'] ?? null) {
189 $found = $this->__prepareFound($row);
190 if (!in_array(0, $found)) {
191 $this->search_result->addEntry(
192 (int) $row->rbac_id,
193 (string) $row->obj_type,
194 $found,
195 (int) $row->obj_id
196 );
197 }
198 } else {
199 $this->search_result->addEntry(
200 (int) $row->rbac_id,
201 (string) $row->obj_type,
202 array(),
203 (int) $row->obj_id
204 );
205 }
206 }
207
209 }
global $DIC
Definition: shib_login.php:26

References $DIC, $ilDB, $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), joinOnRessourceIDs(), ilAbstractSearch\setFields(), and ilDBConstants\T_TEXT.

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchKeyword()

ilAdvancedSearch::__searchKeyword ( bool  $a_in_classification = false)

Definition at line 466 of file class.ilAdvancedSearch.php.

467 {
468 $this->setFields(array('keyword'));
469
470 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
471 if ($a_in_classification) {
472 $and .= " AND parent_type = 'meta_classification' ";
473 }
474 $where = $this->__createKeywordWhereCondition();
475 $locate = $this->__createLocateString();
476
477 $query = "SELECT rbac_id,obj_id,obj_type " .
478 $locate .
479 "FROM il_meta_keyword " .
480 $where . " " . $and . ' ';
481
482 $res = $this->db->query($query);
483 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
484 $found = $this->__prepareFound($row);
485 if (!in_array(0, $found) or !$a_in_classification) {
486 $this->search_result->addEntry(
487 (int) $row->rbac_id,
488 (string) $row->obj_type,
489 $found,
490 (int) $row->obj_id
491 );
492 }
493 }
494
496 }

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchLanguage()

ilAdvancedSearch::__searchLanguage ( )

Definition at line 211 of file class.ilAdvancedSearch.php.

212 {
213 if (!($this->options['lom_language'] ?? null)) {
214 return null;
215 }
216
217 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_language " .
218 "WHERE language = " . $this->db->quote($this->options['lom_language'], 'text') . " " .
219 "AND obj_type " . $this->__getInStatement($this->getFilter()) . ' ' .
220 "AND parent_type = 'meta_general'";
221
222 $res = $this->db->query($query);
223 #var_dump("<pre>",$query,"<pre>");
224 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
225 $this->search_result->addEntry(
226 (int) $row->rbac_id,
227 (string) $row->obj_type,
228 array(),
229 (int) $row->obj_id
230 );
231 }
233 }

References $res, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchLifecycle()

ilAdvancedSearch::__searchLifecycle ( )

Definition at line 497 of file class.ilAdvancedSearch.php.

498 {
499 $this->setFields(array('meta_version'));
500
501 $locate = '';
502 if ($this->options['lom_version'] ?? null) {
503 $where = $this->__createLifecycleWhereCondition();
504 $locate = $this->__createLocateString();
505 } else {
506 $where = "WHERE 1 = 1 ";
507 }
508 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
509
510 if ($this->options['lom_status'] ?? null) {
511 $and .= (" AND lifecycle_status = " . $this->db->quote($this->options['lom_status'], 'text') . "");
512 }
513
514 $query = "SELECT rbac_id,obj_id,obj_type " .
515 $locate .
516 "FROM il_meta_lifecycle " .
517 $where . " " . $and . ' ';
518
519 $res = $this->db->query($query);
520 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
521 $found = $this->__prepareFound($row);
522 if (!in_array(0, $found)) {
523 $this->search_result->addEntry(
524 (int) $row->rbac_id,
525 (string) $row->obj_type,
526 $found,
527 (int) $row->obj_id
528 );
529 }
530 }
531
533 }

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchRequirement()

ilAdvancedSearch::__searchRequirement ( )

Definition at line 289 of file class.ilAdvancedSearch.php.

290 {
291 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_or_composite " .
292 "WHERE obj_type " . $this->__getInStatement($this->getFilter());
293
294 $os_query = $browser_query = '';
295 if ($this->options['lom_operating_system'] ?? null) {
296 $os_query = $query . " AND type = 'operating system' AND " .
297 "name = " . $this->db->quote($this->options['lom_operating_system'], ilDBConstants::T_TEXT);
298 }
299 if ($this->options['lom_browser'] ?? null) {
300 $browser_query = $query . " AND type = 'browser' AND " .
301 "name = " . $this->db->quote($this->options['lom_browser'], ilDBConstants::T_TEXT);
302 }
303
304 $query = $this->joinOnRessourceIDs($os_query, $browser_query);
305 if ($query === '') {
306 return null;
307 }
308
309 $res = $this->db->query($query);
310 #var_dump("<pre>",$query,"<pre>");
311 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
312 $this->search_result->addEntry(
313 (int) $row->rbac_id,
314 (string) $row->obj_type,
315 array(),
316 (int) $row->obj_id
317 );
318 }
320 }

References $res, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), joinOnRessourceIDs(), and ilDBConstants\T_TEXT.

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchRights()

ilAdvancedSearch::__searchRights ( )

Definition at line 393 of file class.ilAdvancedSearch.php.

394 {
395 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_rights ";
396
397 if (!strlen($where = $this->__createRightsWhere())) {
398 return null;
399 }
400 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
401 $query = $query . $where . $and;
402 $res = $this->db->query($query);
403 #var_dump("<pre>",$query,"<pre>");
404 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
405 $this->search_result->addEntry(
406 (int) $row->rbac_id,
407 (string) $row->obj_type,
408 array(),
409 (int) $row->obj_id
410 );
411 }
413 }

References $res, ilAbstractSearch\$search_result, __createRightsWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ILIAS\Repository\int().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTaxon()

ilAdvancedSearch::__searchTaxon ( )

Definition at line 437 of file class.ilAdvancedSearch.php.

438 {
439 $this->setFields(array('taxon'));
440
441 $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
442 $where = $this->__createTaxonWhereCondition();
443 $locate = $this->__createLocateString();
444
445 $query = "SELECT rbac_id,obj_id,obj_type " .
446 $locate .
447 "FROM il_meta_taxon " .
448 $where . " " . $and . ' ';
449
450 $res = $this->db->query($query);
451 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
452 $found = $this->__prepareFound($row);
453 if (!in_array(0, $found)) {
454 $this->search_result->addEntry(
455 (int) $row->rbac_id,
456 (string) $row->obj_type,
457 $found,
458 (int) $row->obj_id
459 );
460 }
461 }
462
464 }

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTitle()

ilAdvancedSearch::__searchTitle ( )

Definition at line 120 of file class.ilAdvancedSearch.php.

121 {
122 return $this->searchObjectProperties('title');
123 }

References searchObjectProperties().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTitleDescription()

& ilAdvancedSearch::__searchTitleDescription ( )

Definition at line 114 of file class.ilAdvancedSearch.php.

115 {
116 $this->searchObjectProperties('title', 'description');
118 }

References ilAbstractSearch\$search_result, and searchObjectProperties().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTypicalAgeRange()

ilAdvancedSearch::__searchTypicalAgeRange ( )

Definition at line 366 of file class.ilAdvancedSearch.php.

367 {
368 if (
369 !($this->options['typ_age_1'] ?? null) or
370 !($this->options['typ_age_2'] ?? null)
371 ) {
372 return null;
373 }
374
375 $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_typical_age_range " .
376 "WHERE typical_age_range_min >= '" . (int) $this->options['typ_age_1'] . "' " .
377 "AND typical_age_range_max <= '" . (int) $this->options['typ_age_2'] . "'";
378
379
380 $res = $this->db->query($query);
381 #var_dump("<pre>",$query,"<pre>");
382 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
383 $this->search_result->addEntry(
384 (int) $row->rbac_id,
385 (string) $row->obj_type,
386 array(),
387 (int) $row->obj_id
388 );
389 }
391 }

References $res, ilAbstractSearch\$search_result, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilAdvancedSearch::getMode ( )

Definition at line 44 of file class.ilAdvancedSearch.php.

44 : string
45 {
46 return $this->mode;
47 }

References $mode.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ joinOnRessourceIDs()

ilAdvancedSearch::joinOnRessourceIDs ( string ...  $individual_queries)
protected

Definition at line 679 of file class.ilAdvancedSearch.php.

679 : string
680 {
681 $non_empty_queries = [];
682 foreach ($individual_queries as $query) {
683 if ($query !== '') {
684 $non_empty_queries[] = $query;
685 }
686 }
687
688 if (count($non_empty_queries) < 2) {
689 return $non_empty_queries[0] ?? '';
690 }
691
692 $total_query = '';
693 foreach ($non_empty_queries as $query) {
694 if ($total_query === '') {
695 $total_query = $query;
696 continue;
697 }
698 $total_query = "SELECT t1.rbac_id, t1.obj_type, t1.obj_id " .
699 "FROM (" . $total_query . ") AS t1 JOIN (" . $query .
700 ") AS t2 ON t1.rbac_id = t2.rbac_id AND t1.obj_type = t2.obj_type AND t1.obj_id = t2.obj_id";
701 }
702 return $total_query;
703 }

Referenced by __searchEducational(), __searchGeneral(), and __searchRequirement().

+ Here is the caller graph for this function:

◆ performSearch()

ilAdvancedSearch::performSearch ( )

Reimplemented from ilAbstractSearch.

Definition at line 55 of file class.ilAdvancedSearch.php.

56 {
57 switch ($this->getMode()) {
58 case 'requirement':
59 return $this->__searchRequirement();
60
61 case 'educational':
62 return $this->__searchEducational();
63
64 case 'typical_age_range':
65 return $this->__searchTypicalAgeRange();
66
67 case 'rights':
68 return $this->__searchRights();
69
70 case 'classification':
71 return $this->__searchClassification();
72
73 case 'taxon':
74 return $this->__searchTaxon();
75
76 case 'keyword':
77 return $this->__searchKeyword();
78
79 case 'format':
80 return $this->__searchFormat();
81
82 case 'lifecycle':
83 return $this->__searchLifecycle();
84
85 case 'contribute':
86 return $this->__searchContribute();
87
88 case 'entity':
89 return $this->__searchEntity();
90
91 case 'general':
92 return $this->__searchGeneral();
93
94 case 'keyword_all':
95 return $this->__searchKeyword(false);
96
97 case 'title_description':
98 return $this->__searchTitleDescription();
99
100 case 'title':
101 return $this->__searchTitle();
102
103 case 'description':
104 return $this->__searchDescription();
105
106 case 'language':
107 return $this->__searchLanguage();
108
109 default:
110 throw new InvalidArgumentException('ilMDSearch: no valid mode given');
111 }
112 }
__searchKeyword(bool $a_in_classification=false)

References __searchClassification(), __searchContribute(), __searchDescription(), __searchEducational(), __searchEntity(), __searchFormat(), __searchGeneral(), __searchKeyword(), __searchLanguage(), __searchLifecycle(), __searchRequirement(), __searchRights(), __searchTaxon(), __searchTitle(), __searchTitleDescription(), __searchTypicalAgeRange(), and getMode().

+ Here is the call graph for this function:

◆ searchObjectProperties()

ilAdvancedSearch::searchObjectProperties ( string ...  $fields)
protected

Definition at line 130 of file class.ilAdvancedSearch.php.

131 {
132 $this->setFields($fields);
133
134 $and = ("AND type " . $this->__getInStatement($this->getFilter()));
135 $where = $this->__createObjectPropertiesWhereCondition(...$fields);
136 $locate = $this->__createLocateString();
137
138 $query = "SELECT obj_id,type " .
139 $locate .
140 "FROM object_data " .
141 $where . " " . $and . ' ' .
142 "ORDER BY obj_id DESC";
143
144 $res = $this->db->query($query);
145 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
146 $this->search_result->addEntry(
147 (int) $row->obj_id,
148 (string) $row->type,
149 $this->__prepareFound($row)
150 );
151 }
152
154 }

References ilAbstractSearch\$fields, $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by __searchDescription(), __searchTitle(), and __searchTitleDescription().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilAdvancedSearch::setMode ( string  $a_mode)

Definition at line 40 of file class.ilAdvancedSearch.php.

40 : void
41 {
42 $this->mode = $a_mode;
43 }

◆ setOptions()

ilAdvancedSearch::setOptions ( array &  $options)

Definition at line 49 of file class.ilAdvancedSearch.php.

49 : void
50 {
51 $this->options = &$options;
52 }

References $options.

Field Documentation

◆ $mode

string ilAdvancedSearch::$mode = ''
private

Definition at line 35 of file class.ilAdvancedSearch.php.

Referenced by getMode().

◆ $options

array ilAdvancedSearch::$options = []
protected

Definition at line 36 of file class.ilAdvancedSearch.php.

Referenced by __getDifference(), and setOptions().


The documentation for this class was generated from the following file: