ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserSearchFilter Class Reference
+ Collaboration diagram for ilUserSearchFilter:

Public Member Functions

 __construct ($a_usr_id)
 enableField ($key)
 disableField ($key)
 enableMemberFilter ($a_status)
 setPossibleUsers ($a_users)
 getLimit ()
 limitReached ()
 getUserId ()
 storeQueryStrings ($a_strings)
 getQueryString ($a_field)
 getUsers ()
 __searchObjects ()
__parseQueryString ($a_string)
 parse query string, using query parser instance
 __storeEntries (&$new_res)
 __toArray ($entries)
 memberFilter ($a_usr_id, $entry_data)

Data Fields

 $limit = 0
 $limit_reached = false
 $search_fields
 $enabled_member_filter = false
 $possible_users = array()
 $usr_id = null
 $db = null

Detailed Description

Definition at line 39 of file class.ilUserSearchFilter.php.

Constructor & Destructor Documentation

ilUserSearchFilter::__construct (   $a_usr_id)

Definition at line 57 of file class.ilUserSearchFilter.php.

{
global $ilDB,$ilias;
$this->usr_id = $a_usr_id;
$this->db =& $ilDB;
// Limit of filtered objects is search max hits
$this->limit = $ilias->getSetting('search_max_hits',50);
$this->result_obj = new ilSearchResult();
}

Member Function Documentation

& ilUserSearchFilter::__parseQueryString (   $a_string)

parse query string, using query parser instance

Returns
object of query parser or error message if an error occured public

Definition at line 187 of file class.ilUserSearchFilter.php.

References QP_COMBINATION_OR, and ilUtil\stripSlashes().

Referenced by __searchObjects().

{
include_once 'Services/Search/classes/class.ilQueryParser.php';
$query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
$query_parser->setCombination(QP_COMBINATION_OR);
$query_parser->setMinWordLength(1,true);
$query_parser->parse();
if(!$query_parser->validate())
{
return $query_parser->getMessage();
}
return $query_parser;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserSearchFilter::__searchObjects ( )

Definition at line 141 of file class.ilUserSearchFilter.php.

References $_SESSION, __parseQueryString(), __storeEntries(), __toArray(), ilObjectSearchFactory\_getUserSearchInstance(), QP_COMBINATION_OR, and ilUtil\sendInfo().

Referenced by getUsers().

{
foreach($this->search_fields as $field => $enabled)
{
// Disabled ?
if(!$enabled)
{
continue;
}
$query_string = $_SESSION['search_usr_filter'][$field];
if(!$query_string)
{
continue;
}
if(!is_object($query_parser = $this->__parseQueryString($query_string)))
{
ilUtil::sendInfo($query_parser);
return false;
}
$user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
$user_search->setFields(array($field));
// store entries
$this->__storeEntries($result_obj = $user_search->performSearch());
}
// no filter entries
if(is_object($this->result_obj))
{
if($this->enabled_member_filter)
{
$this->result_obj->addObserver($this,'memberFilter');
}
$this->result_obj->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
return $this->__toArray($this->result_obj->getResults());
}
return array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserSearchFilter::__storeEntries ( $new_res)

Definition at line 204 of file class.ilUserSearchFilter.php.

Referenced by __searchObjects().

{
if($this->stored == false)
{
$this->result_obj->mergeEntries($new_res);
$this->stored = true;
return true;
}
else
{
$this->result_obj->intersectEntries($new_res);
return true;
}
}

+ Here is the caller graph for this function:

ilUserSearchFilter::__toArray (   $entries)

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

Referenced by __searchObjects().

{
foreach($entries as $entry)
{
$users[] = $entry['obj_id'];
}
return $users ? $users : array();
}

+ Here is the caller graph for this function:

ilUserSearchFilter::disableField (   $key)

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

{
$this->search_fields[$key] = true;
}
ilUserSearchFilter::enableField (   $key)

Definition at line 70 of file class.ilUserSearchFilter.php.

{
$this->search_fields[$key] = true;
}
ilUserSearchFilter::enableMemberFilter (   $a_status)

Definition at line 78 of file class.ilUserSearchFilter.php.

{
$this->enabled_member_filter = $a_status;
}
ilUserSearchFilter::getLimit ( )

Definition at line 89 of file class.ilUserSearchFilter.php.

References $limit.

{
return $this->limit;
}
ilUserSearchFilter::getQueryString (   $a_field)

Definition at line 109 of file class.ilUserSearchFilter.php.

References $_SESSION.

{
return isset($_SESSION['search_usr_filter'][$a_field]) ? $_SESSION['search_usr_filter'][$a_field] : '';
}
ilUserSearchFilter::getUserId ( )

Definition at line 99 of file class.ilUserSearchFilter.php.

References $usr_id.

{
return $this->usr_id;
}
ilUserSearchFilter::getUsers ( )

Definition at line 115 of file class.ilUserSearchFilter.php.

References $_SESSION, $possible_users, and __searchObjects().

{
// Check if a query string is given
foreach($this->search_fields as $field => $enabled)
{
if(!$enabled)
{
continue;
}
if(strlen($_SESSION['search_usr_filter'][$field]))
{
$search = true;
break;
}
}
if($search)
{
return $this->__searchObjects();
}
else
{
}
}

+ Here is the call graph for this function:

ilUserSearchFilter::limitReached ( )

Definition at line 94 of file class.ilUserSearchFilter.php.

References $limit_reached.

{
}
ilUserSearchFilter::memberFilter (   $a_usr_id,
  $entry_data 
)

Definition at line 228 of file class.ilUserSearchFilter.php.

{
return in_array($a_usr_id,$this->possible_users);
}
ilUserSearchFilter::setPossibleUsers (   $a_users)

Definition at line 83 of file class.ilUserSearchFilter.php.

{
$this->possible_users = $a_users ? $a_users : array();
}
ilUserSearchFilter::storeQueryStrings (   $a_strings)

Definition at line 104 of file class.ilUserSearchFilter.php.

References $_SESSION.

{
$_SESSION['search_usr_filter'] = $a_strings;
}

Field Documentation

ilUserSearchFilter::$db = null

Definition at line 55 of file class.ilUserSearchFilter.php.

ilUserSearchFilter::$enabled_member_filter = false

Definition at line 49 of file class.ilUserSearchFilter.php.

ilUserSearchFilter::$limit = 0

Definition at line 41 of file class.ilUserSearchFilter.php.

Referenced by getLimit().

ilUserSearchFilter::$limit_reached = false

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

Referenced by limitReached().

ilUserSearchFilter::$possible_users = array()

Definition at line 50 of file class.ilUserSearchFilter.php.

Referenced by getUsers().

ilUserSearchFilter::$search_fields
Initial value:
array('login' => true,
'firstname' => true,
'lastname' => true)

Definition at line 45 of file class.ilUserSearchFilter.php.

ilUserSearchFilter::$usr_id = null

Definition at line 54 of file class.ilUserSearchFilter.php.

Referenced by getUserId().


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