ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilShopMetaDataSearch Class Reference
+ Inheritance diagram for ilShopMetaDataSearch:
+ Collaboration diagram for ilShopMetaDataSearch:

Public Member Functions

 __construct ($qp_obj)
 
 setCustomSearchResultObject ($a_search_result_obect)
 
 setFilterShopTopicId ($a_topic_id)
 
 getFilterShopTopicId ()
 
 setMode ($a_mode)
 
 getMode ()
 
 performSearch ()
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
- Public Member Functions inherited from ilAbstractSearch
 ilAbstractSearch (&$qp_obj)
 Constructor @access public. More...
 
 setFields ($a_fields)
 Set fields to search. More...
 
 getFields ()
 Get fields to search. More...
 
 setFilter ($a_filter)
 set object type to search in More...
 
 setIdFilter ($a_id_filter)
 Set id filter Filters search by given object id. More...
 
 getIdFilter ()
 Get Id filter. More...
 
 appendToFilter ($a_type)
 Append object type to filter. More...
 
 getFilter ()
 get object type to search in More...
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
performSearch ()
 

Data Fields

 $mode = ''
 
 $query_parser = null
 
 $db = null
 
- Data Fields inherited from ilAbstractSearch
 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Private Member Functions

 __createInStatement ()
 
 __searchContribute ()
 
 __searchKeywords ()
 
 __searchTitles ()
 
 __searchDescriptions ()
 

Private Attributes

 $filter_shop_topic_id = 0
 

Detailed Description

Definition at line 33 of file class.ilShopMetaDataSearch.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopMetaDataSearch::__construct (   $qp_obj)

Reimplemented in ilLikeShopMetaDataSearch.

Definition at line 46 of file class.ilShopMetaDataSearch.php.

47 {
48 parent::__construct($qp_obj);
49 }

Member Function Documentation

◆ __createInStatement()

ilShopMetaDataSearch::__createInStatement ( )
private

Definition at line 96 of file class.ilShopMetaDataSearch.php.

97 {
98 if(!$this->getFilter())
99 {
100 return '';
101 }
102 else
103 {
104 return ' AND ' . $this->db->in('obj_type', $this->getFilter(), false, 'text');
105 }
106 }
getFilter()
get object type to search in

References ilAbstractSearch\getFilter().

Referenced by __searchContribute(), __searchDescriptions(), __searchKeywords(), and __searchTitles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __createLocateString()

ilShopMetaDataSearch::__createLocateString ( )

build locate string in case of AND search

Returns
string @access public

Reimplemented from ilAbstractSearch.

Definition at line 261 of file class.ilShopMetaDataSearch.php.

262 {
263 global $ilDB;
264
265 if($this->query_parser->getCombination() == 'or')
266 {
267 return '';
268 }
269
270 if(!strlen($this->query_parser->getQueryString()))
271 {
272 return '';
273 }
274
275 $locate = '';
276
277 if(count($this->fields) > 1)
278 {
279 $tmp_fields = array();
280 foreach($this->fields as $field)
281 {
282 $tmp_fields[] = array($field,'text');
283 }
284 $complete_str = $ilDB->concat($tmp_fields);
285 }
286 else
287 {
288 $complete_str = $this->fields[0];
289 }
290
291 $counter = 0;
292 foreach($this->query_parser->getQuotedWords() as $word)
293 {
294 $locate .= ',';
295 $locate .= $ilDB->locate($ilDB->quote($word, 'text'), $complete_str, 1);
296 $locate .= (' found'.$counter++);
297 $locate .= ' ';
298 }
299
300 return $locate;
301 }
global $ilDB
$errors fields
Definition: imgupload.php:48

References $ilDB, and fields.

Referenced by __searchContribute(), __searchDescriptions(), __searchKeywords(), and __searchTitles().

+ Here is the caller graph for this function:

◆ __prepareFound()

ilShopMetaDataSearch::__prepareFound ( $row)

Reimplemented from ilAbstractSearch.

Definition at line 303 of file class.ilShopMetaDataSearch.php.

304 {
305 if($this->query_parser->getCombination() == 'or')
306 {
307 return array();
308 }
309
310 if(!strlen($this->query_parser->getQueryString()))
311 {
312 return array();
313 }
314
315 $counter = 0;
316 foreach($this->query_parser->getQuotedWords() as $word)
317 {
318 $res_found = 'found'.$counter++;
319 $found[] = $row->$res_found;
320 }
321 return $found ? $found : array();
322 }

References $row.

◆ __searchContribute()

ilShopMetaDataSearch::__searchContribute ( )
private

Definition at line 108 of file class.ilShopMetaDataSearch.php.

109 {
110 $types = array();
111 $values = array();
112
113 $this->setFields(array('entity'));
114
115 $in = $this->__createInStatement();
116 $where = $this->__createContributeWhereCondition();
117 $locate = $this->__createLocateString();
118
119 $query = "SELECT object_reference.ref_id,rbac_id,il_meta_entity.obj_id,obj_type ".$locate."
120 FROM payment_objects
121 INNER JOIN object_reference ON object_reference.ref_id = payment_objects.ref_id
122 INNER JOIN il_meta_entity ON il_meta_entity.obj_id = object_reference.obj_id ";
123
124 $query .= $where['query'];
125 $types = array_merge($types, $where['types']);
126 $values = array_merge($values, $where['values']);
127 $query .= $in;
128
129 $query .= " GROUP BY object_reference.ref_id,il_meta_entity.obj_id,rbac_id,obj_type,il_meta_entity.entity ";
130
131 $statement = $this->db->queryf(
132 $query,
133 $types,
134 $values
135 );
136
137 while($row = $statement->fetchRow(DB_FETCHMODE_OBJECT))
138 {
139 $this->search_result->addEntry($row->ref_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
140 }
141
143 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setFields($a_fields)
Set fields to search.
__createLocateString()
build locate string in case of AND search

References $in, $query, $row, ilAbstractSearch\$search_result, __createInStatement(), __createLocateString(), DB_FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchDescriptions()

ilShopMetaDataSearch::__searchDescriptions ( )
private

Definition at line 219 of file class.ilShopMetaDataSearch.php.

220 {
221 $types = array();
222 $values = array();
223
224 $this->setFields(array('description'));
225
226 $in = $this->__createInStatement();
227 $where = $this->__createDescriptionWhereCondition();
228 $locate = $this->__createLocateString();
229
230 $query = "SELECT object_reference.ref_id,rbac_id,il_meta_description.obj_id,obj_type ".$locate."
231 FROM payment_objects
232 INNER JOIN object_reference ON object_reference.ref_id = payment_objects.ref_id
233 INNER JOIN il_meta_description ON il_meta_description.obj_id = object_reference.obj_id ";
234
235 $query .= $where['query'];
236 $types = array_merge($types, $where['types']);
237 $values = array_merge($values, $where['values']);
238 $query .= $in;
239
240 $query .= " GROUP BY object_reference.ref_id,il_meta_description.obj_id,rbac_id,obj_type,il_meta_description.description ";
241
242 $statement = $this->db->queryf(
243 $query,
244 $types,
245 $values
246 );
247
248 while($row = $statement->fetchRow(DB_FETCHMODE_OBJECT))
249 {
250 $this->search_result->addEntry($row->ref_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
251 }
252
254 }

References $in, $query, $row, ilAbstractSearch\$search_result, __createInStatement(), __createLocateString(), DB_FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchKeywords()

ilShopMetaDataSearch::__searchKeywords ( )
private

Definition at line 145 of file class.ilShopMetaDataSearch.php.

146 {
147 $types = array();
148 $values = array();
149
150 $this->setFields(array('keyword'));
151
152 $in = $this->__createInStatement();
153 $where = $this->__createKeywordWhereCondition();
154 $locate = $this->__createLocateString();
155
156 $query = "SELECT object_reference.ref_id,rbac_id,il_meta_keyword.obj_id,obj_type ".$locate."
157 FROM payment_objects
158 INNER JOIN object_reference ON object_reference.ref_id = payment_objects.ref_id
159 INNER JOIN il_meta_keyword ON il_meta_keyword.obj_id = object_reference.obj_id ";
160
161 $query .= $where['query'];
162 $types = array_merge($types, $where['types']);
163 $values = array_merge($values, $where['values']);
164 $query .= $in;
165
166 $query .= " GROUP BY object_reference.ref_id,il_meta_keyword.obj_id,rbac_id,obj_type,il_meta_keyword.keyword ";
167
168 $statement = $this->db->queryf(
169 $query,
170 $types,
171 $values
172 );
173
174 while($row = $statement->fetchRow(DB_FETCHMODE_OBJECT))
175 {
176 $this->search_result->addEntry($row->ref_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
177 }
178
180 }

References $in, $query, $row, ilAbstractSearch\$search_result, __createInStatement(), __createLocateString(), DB_FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTitles()

ilShopMetaDataSearch::__searchTitles ( )
private

Definition at line 182 of file class.ilShopMetaDataSearch.php.

183 {
184 $types = array();
185 $values = array();
186
187 $this->setFields(array('title'));
188
189 $in = $this->__createInStatement();
190 $where = $this->__createTitleWhereCondition();
191 $locate = $this->__createLocateString();
192
193 $query = "SELECT object_reference.ref_id,rbac_id,il_meta_general.obj_id,obj_type ".$locate."
194 FROM payment_objects
195 INNER JOIN object_reference ON object_reference.ref_id = payment_objects.ref_id
196 INNER JOIN il_meta_general ON il_meta_general.obj_id = object_reference.obj_id ";
197
198 $query .= $where['query'];
199 $types = array_merge($types, $where['types']);
200 $values = array_merge($values, $where['values']);
201 $query .= $in;
202
203 $query .= " GROUP BY object_reference.ref_id,il_meta_general.obj_id,rbac_id,obj_type,il_meta_general.title ";
204
205 $statement = $this->db->queryf(
206 $query,
207 $types,
208 $values
209 );
210
211 while($row = $statement->fetchRow(DB_FETCHMODE_OBJECT))
212 {
213 $this->search_result->addEntry($row->ref_id,$row->obj_type,$this->__prepareFound($row),$row->obj_id);
214 }
215
217 }

References $in, $query, $row, ilAbstractSearch\$search_result, __createInStatement(), __createLocateString(), DB_FETCHMODE_OBJECT, and ilAbstractSearch\setFields().

Referenced by performSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilterShopTopicId()

◆ getMode()

ilShopMetaDataSearch::getMode ( )

Definition at line 69 of file class.ilShopMetaDataSearch.php.

References $mode.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ performSearch()

ilShopMetaDataSearch::performSearch ( )

Reimplemented from ilAbstractSearch.

Definition at line 74 of file class.ilShopMetaDataSearch.php.

75 {
76 switch($this->getMode())
77 {
78 case 'keyword':
79 return $this->__searchKeywords();
80
81 case 'contribute':
82 return $this->__searchContribute();
83
84 case 'title':
85 return $this->__searchTitles();
86
87 case 'description':
88 return $this->__searchDescriptions();
89
90 default:
91 echo __METHOD__.' no mode given';
92 return false;
93 }
94 }

References __searchContribute(), __searchDescriptions(), __searchKeywords(), __searchTitles(), and getMode().

+ Here is the call graph for this function:

◆ setCustomSearchResultObject()

ilShopMetaDataSearch::setCustomSearchResultObject (   $a_search_result_obect)

Definition at line 51 of file class.ilShopMetaDataSearch.php.

52 {
53 $this->search_result = $a_search_result_obect;
54 }

◆ setFilterShopTopicId()

ilShopMetaDataSearch::setFilterShopTopicId (   $a_topic_id)

Definition at line 56 of file class.ilShopMetaDataSearch.php.

57 {
58 $this->filter_shop_topic_id = $a_topic_id;
59 }

◆ setMode()

ilShopMetaDataSearch::setMode (   $a_mode)

Definition at line 65 of file class.ilShopMetaDataSearch.php.

66 {
67 $this->mode = $a_mode;
68 }

Field Documentation

◆ $db

ilShopMetaDataSearch::$db = null

Definition at line 42 of file class.ilShopMetaDataSearch.php.

◆ $filter_shop_topic_id

ilShopMetaDataSearch::$filter_shop_topic_id = 0
private

Definition at line 44 of file class.ilShopMetaDataSearch.php.

Referenced by getFilterShopTopicId().

◆ $mode

ilShopMetaDataSearch::$mode = ''

Definition at line 35 of file class.ilShopMetaDataSearch.php.

Referenced by getMode().

◆ $query_parser

ilShopMetaDataSearch::$query_parser = null

Definition at line 40 of file class.ilShopMetaDataSearch.php.


The documentation for this class was generated from the following file: