ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilLikeUserMultiFieldSearch.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
include_once
'./Services/Search/classes/class.ilAbstractSearch.php'
;
5
17
class
ilLikeUserMultiFieldSearch
extends
ilAbstractSearch
18
{
19
24
public
function
__construct
($qp_obj)
25
{
26
parent::__construct($qp_obj);
27
}
28
33
public
function
performSearch
()
34
{
35
$where = $this->
__createWhereCondition
();
36
$locate = $this->
__createLocateString
();
37
38
$query
=
"SELECT usr_id "
.
39
$locate .
40
"FROM usr_data_multi "
.
41
$where;
42
43
$res
= $this->db->query(
$query
);
44
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
45
$this->search_result->addEntry(
$row
->usr_id,
'usr'
, $this->__prepareFound(
$row
));
46
}
47
return
$this->search_result
;
48
}
49
50
56
public
function
setFields
($a_fields)
57
{
58
foreach
($a_fields as $field) {
59
$fields[] = $field;
60
}
61
parent::setFields($fields ? $fields :
array
());
62
}
63
64
65
public
function
__createWhereCondition
()
66
{
67
global
$ilDB
;
68
69
$fields = $this->
getFields
();
70
$field = $fields[0];
71
72
$and =
" WHERE field_id = "
. $ilDB->quote($field,
"text"
) .
" AND ( "
;
73
$counter
= 0;
74
foreach
($this->query_parser->getQuotedWords() as $word) {
75
if
(
$counter
++) {
76
$and .=
" OR "
;
77
}
78
79
if
(strpos($word,
'^'
) === 0) {
80
$and .= $ilDB->like(
"value"
,
"text"
, substr($word, 1) .
"%"
);
81
}
else
{
82
$and .= $ilDB->like(
"value"
,
"text"
,
"%"
. $word .
"%"
);
83
}
84
}
85
return
$and .
") "
;
86
}
87
}
ilAbstractSearch\getFields
getFields()
Get fields to search.
Definition:
class.ilAbstractSearch.php:72
ilAbstractSearch
Definition:
class.ilAbstractSearch.php:16
ilAbstractSearch\__createLocateString
__createLocateString()
build locate string in case of AND search
Definition:
class.ilAbstractSearch.php:141
ilLikeUserMultiFieldSearch\setFields
setFields($a_fields)
Definition:
class.ilLikeUserMultiFieldSearch.php:56
ilLikeUserMultiFieldSearch\performSearch
performSearch()
Perform search.
Definition:
class.ilLikeUserMultiFieldSearch.php:33
$counter
$counter
Definition:
config-scanner.php:59
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilLikeUserMultiFieldSearch\__construct
__construct($qp_obj)
Constructor public.
Definition:
class.ilLikeUserMultiFieldSearch.php:24
$query
$query
Definition:
proxy_ylocal.php:13
ilLikeUserMultiFieldSearch\__createWhereCondition
__createWhereCondition()
Definition:
class.ilLikeUserMultiFieldSearch.php:65
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilLikeUserMultiFieldSearch
Definition:
class.ilLikeUserMultiFieldSearch.php:17
ilAbstractSearch\$search_result
$search_result
Definition:
class.ilAbstractSearch.php:30
Services
Search
classes
Like
class.ilLikeUserMultiFieldSearch.php
Generated on Sat Jan 18 2025 19:01:37 for ILIAS by
1.8.13 (using
Doxyfile
)