ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLikeUserMultiFieldSearch Class Reference
+ Inheritance diagram for ilLikeUserMultiFieldSearch:
+ Collaboration diagram for ilLikeUserMultiFieldSearch:

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 17 of file class.ilLikeUserMultiFieldSearch.php.

Constructor & Destructor Documentation

ilLikeUserMultiFieldSearch::__construct (   $qp_obj)

Constructor public.

Definition at line 24 of file class.ilLikeUserMultiFieldSearch.php.

{
}

Member Function Documentation

ilLikeUserMultiFieldSearch::__createWhereCondition ( )

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

References $ilDB, and ilAbstractSearch\getFields().

Referenced by performSearch().

{
global $ilDB;
$fields = $this->getFields();
$field = $fields[0];
$and = " WHERE field_id = ".$ilDB->quote($field, "text")." AND ( ";
$counter = 0;
foreach($this->query_parser->getQuotedWords() as $word)
{
if($counter++)
{
$and .= " OR ";
}
if(strpos($word,'^') === 0)
{
$and .= $ilDB->like("value", "text", substr($word,1)."%");
}
else
{
$and .= $ilDB->like("value", "text", "%".$word."%");
}
}
return $and.") ";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLikeUserMultiFieldSearch::performSearch ( )

Perform search.

Returns
type

Reimplemented from ilAbstractSearch.

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

References $GLOBALS, $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __createWhereCondition(), and DB_FETCHMODE_OBJECT.

{
$where = $this->__createWhereCondition();
$locate = $this->__createLocateString();
$query = "SELECT usr_id ".
$locate.
"FROM usr_data_multi ".
$where;
$GLOBALS['ilLog']->write(__METHOD__.': '.$query);
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->search_result->addEntry($row->usr_id,'usr',$this->__prepareFound($row));
}
}

+ Here is the call graph for this function:

ilLikeUserMultiFieldSearch::setFields (   $a_fields)
Parameters
@return

Reimplemented from ilAbstractSearch.

Definition at line 59 of file class.ilLikeUserMultiFieldSearch.php.

{
foreach($a_fields as $field)
{
$fields[] = $field;
}
parent::setFields($fields ? $fields : array());
}

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