ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilLikeUserDefinedFieldSearch.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once 'Services/Search/classes/class.ilUserDefinedFieldSearch.php';
5
18{
19
25 {
26 parent::ilUserDefinedFieldSearch($qp_obj);
27 }
28
34 public function setFields($a_fields)
35 {
36 foreach($a_fields as $field)
37 {
38 $fields[] = 'f_'.$field;
39 }
40 parent::setFields($fields ? $fields : array());
41 }
42
43
45 {
46 global $ilDB;
47
48 $fields = $this->getFields();
49 $field = $fields[0];
50
51 $and = " WHERE field_id = ".$ilDB->quote((int) substr($field, 2), "integer")." AND ( ";
52 $counter = 0;
53 foreach($this->query_parser->getQuotedWords() as $word)
54 {
55 if($counter++)
56 {
57 $and .= " OR ";
58 }
59
60 if(strpos($word,'^') === 0)
61 {
62 $and .= $ilDB->like("value", "text", substr($word,1)."%");
63 }
64 else
65 {
66 $and .= $ilDB->like("value", "text", "%".$word."%");
67 }
68 }
69 return $and.") ";
70 }
71}
72?>
getFields()
Get fields to search.
ilLikeUserDefinedFieldSearch(&$qp_obj)
Constructor @access public.
global $ilDB