ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLikeAdvancedSearch.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
24include_once 'Services/Search/classes/class.ilAdvancedSearch.php';
25
38{
43 public function __construct($qp)
44 {
45 parent::__construct($qp);
46 }
47
49 {
50 global $ilDB;
51
52 if ($this->options['lom_taxon']) {
53 $where = " WHERE (";
54
55 $counter = 0;
56 foreach ($this->query_parser->getQuotedWords() as $word) {
57 if ($counter++) {
58 $where .= "OR";
59 }
60
61 $where .= $ilDB->like('taxon', 'text', '%' . $word . '%');
62 }
63 $where .= ') ';
64 return $where;
65 }
66 return '';
67 }
68
70 {
71 global $ilDB;
72
73 $where = " WHERE (";
74
75 $counter = 0;
76 foreach ($this->query_parser->getQuotedWords() as $word) {
77 if ($counter++) {
78 $where .= "OR";
79 }
80
81 $where .= $ilDB->like('keyword', 'text', '%' . $word . '%');
82 }
83 $where .= ') ';
84 return $where;
85 }
86
88 {
89 global $ilDB;
90
91 if ($this->options['lom_version']) {
92 $where = " WHERE (";
93
94 $counter = 0;
95 foreach ($this->query_parser->getQuotedWords() as $word) {
96 if ($counter++) {
97 $where .= "OR";
98 }
99
100 $where .= $ilDB->like('meta_version', 'text', '%' . $word . '%');
101 }
102 $where .= ') ';
103 return $where;
104 }
105 return '';
106 }
107
109 {
110 global $ilDB;
111
112 if ($this->options['lom_role_entry']) {
113 $where = " WHERE (";
114
115 $counter = 0;
116 foreach ($this->query_parser->getQuotedWords() as $word) {
117 if ($counter++) {
118 $where .= "OR";
119 }
120
121 $where .= $ilDB->like('entity', 'text', '%' . $word . '%');
122 }
123 $where .= ') ';
124 return $where;
125 }
126 return '';
127 }
128
130 {
131 global $ilDB;
132
133 if ($this->options['lom_coverage']) {
134 $where = " AND (";
135
136 $counter = 0;
137 foreach ($this->query_parser->getQuotedWords() as $word) {
138 if ($counter++) {
139 $where .= "OR";
140 }
141
142 $where .= $ilDB->like('coverage', 'text', '%' . $word . '%');
143 }
144 $where .= ') ';
145 return $where;
146 }
147 return '';
148 }
149
151 {
152 global $ilDB;
153
154 $concat = $ilDB->concat(
155 array(
156 array('title','text'),
157 array('description','text'))
158 );
159
160 $where = " WHERE (";
161
162 $counter = 0;
163 foreach ($this->query_parser->getQuotedWords() as $word) {
164 if ($counter++) {
165 $where .= "OR";
166 }
167
168 $where .= $ilDB->like($concat, 'text', '%' . $word . '%');
169 }
170 $where .= ') ';
171
172 return $where;
173 }
174}
An exception for terminatinating execution or to throw for unit testing.
$counter
global $ilDB