ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
$DIC
;
68
69
$ilDB
= $DIC[
'ilDB'
];
70
71
$fields = $this->
getFields
();
72
$field = $fields[0];
73
74
$and =
" WHERE field_id = "
.
$ilDB
->quote($field,
"text"
) .
" AND ( "
;
75
$counter = 0;
76
foreach
($this->query_parser->getQuotedWords() as $word) {
77
if
($counter++) {
78
$and .=
" OR "
;
79
}
80
81
if
(strpos($word,
'^'
) === 0) {
82
$and .=
$ilDB
->like(
"value"
,
"text"
, substr($word, 1) .
"%"
);
83
}
else
{
84
$and .=
$ilDB
->like(
"value"
,
"text"
,
"%"
. $word .
"%"
);
85
}
86
}
87
return
$and .
") "
;
88
}
89
}
ilAbstractSearch\getFields
getFields()
Get fields to search.
Definition:
class.ilAbstractSearch.php:74
ilAbstractSearch
Definition:
class.ilAbstractSearch.php:16
$DIC
global $DIC
Definition:
saml.php:7
ilAbstractSearch\__createLocateString
__createLocateString()
build locate string in case of AND search
Definition:
class.ilAbstractSearch.php:143
ilLikeUserMultiFieldSearch\setFields
setFields($a_fields)
Definition:
class.ilLikeUserMultiFieldSearch.php:56
ilLikeUserMultiFieldSearch\performSearch
performSearch()
Perform search.
Definition:
class.ilLikeUserMultiFieldSearch.php:33
$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
$row
$row
Definition:
migrateto20.php:360
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
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 Thu Jan 30 2025 19:02:04 for ILIAS by
1.8.13 (using
Doxyfile
)