ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once 'Services/Search/classes/class.ilUserDefinedFieldSearch.php';
5 
18 {
19 
25  public function setFields($a_fields)
26  {
27  foreach($a_fields as $field)
28  {
29  $fields[] = 'f_'.$field;
30  }
31  parent::setFields($fields ? $fields : array());
32  }
33 
34 
36  {
37  global $ilDB;
38 
39  $fields = $this->getFields();
40  $field = $fields[0];
41 
42  $and = " WHERE field_id = ".$ilDB->quote((int) substr($field, 2), "integer")." AND ( ";
43  $counter = 0;
44  foreach($this->query_parser->getQuotedWords() as $word)
45  {
46  if($counter++)
47  {
48  $and .= " OR ";
49  }
50 
51  if(strpos($word,'^') === 0)
52  {
53  $and .= $ilDB->like("value", "text", substr($word,1)."%");
54  }
55  else
56  {
57  $and .= $ilDB->like("value", "text", "%".$word."%");
58  }
59  }
60  return $and.") ";
61  }
62 }
63 ?>
getFields()
Get fields to search.
$counter
Create styles array
The data for the language used.
global $ilDB