ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.ilMetaDataSearch.php
Go to the documentation of this file.
1
<?
php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
35
include_once
'Services/Search/classes/class.ilAbstractSearch.php'
;
36
37
class
ilMetaDataSearch
extends
ilAbstractSearch
38
{
39
public
$mode
=
''
;
40
41
/*
42
* instance of query parser
43
*/
44
public
$query_parser
= null;
45
46
public
$db
= null;
47
54
public
function
setMode
($a_mode)
55
{
56
$this->mode = $a_mode;
57
}
58
public
function
getMode
()
59
{
60
return
$this->mode
;
61
}
62
63
64
public
function
performSearch
()
65
{
66
switch
($this->
getMode
()) {
67
case
'keyword'
:
68
return
$this->
__searchKeywords
();
69
70
case
'contribute'
:
71
return
$this->
__searchContribute
();
72
73
case
'title'
:
74
return
$this->
__searchTitles
();
75
76
case
'description'
:
77
return
$this->
__searchDescriptions
();
78
79
default
:
80
echo
"ilMDSearch::performSearch() no mode given"
;
81
return
false
;
82
}
83
}
84
85
86
87
// Private
88
public
function
__createInStatement
()
89
{
90
if
(!$this->
getFilter
()) {
91
return
''
;
92
}
else
{
93
$type
=
"('"
;
94
$type
.= implode(
"','"
, $this->
getFilter
());
95
$type
.=
"')"
;
96
97
$in
=
" AND obj_type IN "
.
$type
;
98
99
return
$in
;
100
}
101
}
102
public
function
__searchContribute
()
103
{
104
$this->
setFields
(array(
'entity'
));
105
106
$in
= $this->
__createInStatement
();
107
$where = $this->__createContributeWhereCondition();
108
$locate = $this->
__createLocateString
();
109
110
$query
=
"SELECT rbac_id,obj_id,obj_type "
.
111
$locate .
112
"FROM il_meta_entity "
.
113
$where .
" "
.
$in
.
' '
;
114
115
$res
= $this->db->query(
$query
);
116
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
117
$this->search_result->addEntry(
$row
->rbac_id,
$row
->obj_type, $this->__prepareFound(
$row
),
$row
->obj_id);
118
}
119
120
return
$this->search_result
;
121
}
122
123
124
public
function
__searchKeywords
()
125
{
126
$this->
setFields
(array(
'keyword'
));
127
128
$in
= $this->
__createInStatement
();
129
$where = $this->__createKeywordWhereCondition();
130
$locate = $this->
__createLocateString
();
131
132
$query
=
"SELECT rbac_id,obj_id,obj_type "
.
133
$locate .
134
"FROM il_meta_keyword "
.
135
$where .
" "
.
$in
.
' '
;
136
137
$res
= $this->db->query(
$query
);
138
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
139
$this->search_result->addEntry(
$row
->rbac_id,
$row
->obj_type, $this->__prepareFound(
$row
),
$row
->obj_id);
140
}
141
142
return
$this->search_result
;
143
}
144
public
function
__searchTitles
()
145
{
146
$this->
setFields
(array(
'title'
));
147
148
$in
= $this->
__createInStatement
();
149
$where = $this->__createTitleWhereCondition();
150
$locate = $this->
__createLocateString
();
151
152
$query
=
"SELECT rbac_id,obj_id,obj_type "
.
153
$locate .
154
"FROM il_meta_general "
.
155
$where .
" "
.
$in
.
' '
;
156
157
$res
= $this->db->query(
$query
);
158
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
159
$this->search_result->addEntry(
$row
->rbac_id,
$row
->obj_type, $this->__prepareFound(
$row
),
$row
->obj_id);
160
}
161
162
return
$this->search_result
;
163
}
164
public
function
__searchDescriptions
()
165
{
166
$this->
setFields
(array(
'description'
));
167
168
$in
= $this->
__createInStatement
();
169
$where = $this->__createDescriptionWhereCondition();
170
$locate = $this->
__createLocateString
();
171
172
$query
=
"SELECT rbac_id,obj_id,obj_type "
.
173
$locate .
174
"FROM il_meta_description "
.
175
$where .
" "
.
$in
.
' '
;
176
177
$res
= $this->db->query(
$query
);
178
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
179
$this->search_result->addEntry(
$row
->rbac_id,
$row
->obj_type, $this->__prepareFound(
$row
),
$row
->obj_id);
180
}
181
182
return
$this->search_result
;
183
}
184
}
ilAbstractSearch
Definition:
class.ilAbstractSearch.php:16
ilMetaDataSearch\performSearch
performSearch()
Definition:
class.ilMetaDataSearch.php:64
$type
$type
Definition:
proxy_ylocal.php:10
ilAbstractSearch\__createLocateString
__createLocateString()
build locate string in case of AND search
Definition:
class.ilAbstractSearch.php:143
ilMetaDataSearch\$query_parser
$query_parser
Definition:
class.ilMetaDataSearch.php:44
ilAbstractSearch\setFields
setFields($a_fields)
Set fields to search.
Definition:
class.ilAbstractSearch.php:64
ilAbstractSearch\getFilter
getFilter()
get object type to search in
Definition:
class.ilAbstractSearch.php:133
ilMetaDataSearch\__searchDescriptions
__searchDescriptions()
Definition:
class.ilMetaDataSearch.php:164
ilMetaDataSearch\__searchKeywords
__searchKeywords()
Definition:
class.ilMetaDataSearch.php:124
ilMetaDataSearch\$mode
$mode
Definition:
class.ilMetaDataSearch.php:39
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMetaDataSearch\$db
$db
Definition:
class.ilMetaDataSearch.php:46
ilMetaDataSearch
Definition:
class.ilMetaDataSearch.php:37
ilMetaDataSearch\__searchContribute
__searchContribute()
Definition:
class.ilMetaDataSearch.php:102
$query
$query
Definition:
proxy_ylocal.php:13
$row
$row
Definition:
migrateto20.php:360
$in
if(php_sapi_name() !='cli') $in
Definition:
Utf8Test.php:37
echo
ilMetaDataSearch\setMode
setMode($a_mode)
Define meta elements to search.
Definition:
class.ilMetaDataSearch.php:54
php
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMetaDataSearch\__createInStatement
__createInStatement()
Definition:
class.ilMetaDataSearch.php:88
ilMetaDataSearch\getMode
getMode()
Definition:
class.ilMetaDataSearch.php:58
ilAbstractSearch\$search_result
$search_result
Definition:
class.ilAbstractSearch.php:30
ilMetaDataSearch\__searchTitles
__searchTitles()
Definition:
class.ilMetaDataSearch.php:144
Services
Search
classes
class.ilMetaDataSearch.php
Generated on Thu Jan 16 2025 19:02:29 for ILIAS by
1.8.13 (using
Doxyfile
)