ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
class.ilMDSearch.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
/*
5
+-----------------------------------------------------------------------------+
6
| ILIAS open source |
7
+-----------------------------------------------------------------------------+
8
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9
| |
10
| This program is free software; you can redistribute it and/or |
11
| modify it under the terms of the GNU General Public License |
12
| as published by the Free Software Foundation; either version 2 |
13
| of the License, or (at your option) any later version. |
14
| |
15
| This program is distributed in the hope that it will be useful, |
16
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
| GNU General Public License for more details. |
19
| |
20
| You should have received a copy of the GNU General Public License |
21
| along with this program; if not, write to the Free Software |
22
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23
+-----------------------------------------------------------------------------+
24
*/
25
33
class
ilMDSearch
34
{
35
private
string
$mode
=
''
;
36
37
private
ilQueryParser
$query_parser
;
38
private
ilDBInterface
$db
;
39
private
ilSearchResult
$search_result
;
40
41
public
function
__construct
(
ilQueryParser
$qp_obj)
42
{
43
global
$DIC
;
44
45
$this->query_parser = $qp_obj;
46
$this->db =
$DIC
->database();
47
$this->search_result =
new
ilSearchResult
();
48
}
49
50
public
function
setMode
(
string
$a_mode): void
51
{
52
$this->mode = $a_mode;
53
}
54
55
public
function
getMode
(): string
56
{
57
return
$this->mode
;
58
}
59
60
public
function
performSearch
(): ?
ilSearchResult
61
{
62
switch
($this->
getMode
()) {
63
case
'all'
:
64
break
;
65
case
'keyword'
:
66
return
$this->
__searchKeywordsOnly
();
67
break
;
68
69
default
:
70
echo
"ilMDSearch::performSearch() no mode given"
;
71
return
null
;
72
}
73
return
null
;
74
}
75
76
public
function
__searchKeywordsOnly
():
ilSearchResult
77
{
78
$where =
" WHERE "
;
79
$field =
" keyword "
;
80
$counter = 0;
81
foreach
($this->query_parser->getQuotedWords() as $word) {
82
if
($counter++) {
83
$where .= strtoupper($this->query_parser->getCombination());
84
}
85
$where .= $field;
86
$where .= (
"LIKE ("
. $this->db->quote(
"%"
. $word .
"%"
,
ilDBConstants::T_TEXT
) .
")"
);
87
}
88
89
$query
=
"SELECT * FROM il_meta_keyword"
.
90
$where .
91
"ORDER BY meta_keyword_id DESC"
;
92
93
$res
= $this->db->query(
$query
);
94
while
($row =
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
95
$this->search_result->addEntry($row->obj_id, $row->obj_type, $row->rbac_id);
96
}
97
return
$this->search_result
;
98
}
99
}
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:29
ilDBConstants\T_TEXT
const T_TEXT
Definition:
class.ilDBConstants.php:56
ilMDSearch
Definition:
class.ilMDSearch.php:34
ilMDSearch\getMode
getMode()
Definition:
class.ilMDSearch.php:55
ilMDSearch\setMode
setMode(string $a_mode)
Definition:
class.ilMDSearch.php:50
ilMDSearch\$db
ilDBInterface $db
Definition:
class.ilMDSearch.php:38
ilMDSearch\$query_parser
ilQueryParser $query_parser
Definition:
class.ilMDSearch.php:37
ilMDSearch\__searchKeywordsOnly
__searchKeywordsOnly()
Definition:
class.ilMDSearch.php:76
ilMDSearch\performSearch
performSearch()
Definition:
class.ilMDSearch.php:60
ilMDSearch\$mode
string $mode
Definition:
class.ilMDSearch.php:35
ilMDSearch\$search_result
ilSearchResult $search_result
Definition:
class.ilMDSearch.php:39
ilMDSearch\__construct
__construct(ilQueryParser $qp_obj)
Definition:
class.ilMDSearch.php:41
ilQueryParser
Definition:
class.ilQueryParser.php:32
ilSearchResult
Definition:
class.ilSearchResult.php:32
$DIC
global $DIC
Definition:
feed.php:28
ilDBInterface
Interface ilDBInterface.
Definition:
interface.ilDBInterface.php:27
$res
$res
Definition:
ltiservices.php:69
$query
$query
Definition:
proxy_ylocal.php:13
Services
MetaData
classes
class.ilMDSearch.php
Generated on Sun Nov 2 2025 22:01:41 for ILIAS by
1.9.4 (using
Doxyfile
)