ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLikeUserDefinedFieldSearch Class Reference
+ Inheritance diagram for ilLikeUserDefinedFieldSearch:
+ Collaboration diagram for ilLikeUserDefinedFieldSearch:

Public Member Functions

 setFields ($a_fields)
 
 __createWhereCondition ()
 
- Public Member Functions inherited from ilUserDefinedFieldSearch
 performSearch ()
 
- Public Member Functions inherited from ilAbstractSearch
 __construct ($qp_obj)
 Constructor public. More...
 
 setFields ($a_fields)
 Set fields to search. More...
 
 getFields ()
 Get fields to search. More...
 
 setFilter ($a_filter)
 set object type to search in More...
 
 setIdFilter ($a_id_filter)
 Set id filter Filters search by given object id. More...
 
 getIdFilter ()
 Get Id filter. More...
 
 appendToFilter ($a_type)
 Append object type to filter. More...
 
 getFilter ()
 get object type to search in More...
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
 performSearch ()
 

Additional Inherited Members

- Data Fields inherited from ilAbstractSearch
 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Detailed Description

Definition at line 17 of file class.ilLikeUserDefinedFieldSearch.php.

Member Function Documentation

◆ __createWhereCondition()

ilLikeUserDefinedFieldSearch::__createWhereCondition ( )

Definition at line 34 of file class.ilLikeUserDefinedFieldSearch.php.

References $DIC, $ilDB, and ilAbstractSearch\getFields().

35  {
36  global $DIC;
37 
38  $ilDB = $DIC['ilDB'];
39 
40  $fields = $this->getFields();
41  $field = $fields[0];
42 
43  $and = " WHERE field_id = " . $ilDB->quote((int) substr($field, 2), "integer") . " AND ( ";
44  $counter = 0;
45  foreach ($this->query_parser->getQuotedWords() as $word) {
46  if ($counter++) {
47  $and .= " OR ";
48  }
49 
50  if (strpos($word, '^') === 0) {
51  $and .= $ilDB->like("value", "text", substr($word, 1) . "%");
52  } else {
53  $and .= $ilDB->like("value", "text", "%" . $word . "%");
54  }
55  }
56  return $and . ") ";
57  }
getFields()
Get fields to search.
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the call graph for this function:

◆ setFields()

ilLikeUserDefinedFieldSearch::setFields (   $a_fields)
Parameters

Definition at line 25 of file class.ilLikeUserDefinedFieldSearch.php.

26  {
27  foreach ($a_fields as $field) {
28  $fields[] = 'f_' . $field;
29  }
30  parent::setFields($fields ? $fields : array());
31  }

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