ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserFilter Class Reference

user filter More...

+ Collaboration diagram for ilUserFilter:

Public Member Functions

 ilUserFilter ($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)
 filter ($a_user_ids)
 Filter user accounts.
 getFolderIds ()
 Get accessible user folder (cat and usrf) ids.

Static Public Member Functions

static getInstance ()
 Singelton get instance.

Data Fields

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

Protected Member Functions

 __construct ()
 Singleton constructor.

Private Member Functions

 init ()
 Init.

Private Attributes

 $settings = null
 $folder_ids = array()

Static Private Attributes

static $instance = null

Detailed Description

user filter

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

ilUserFilter::__construct ( )
protected

Singleton constructor.

Returns

Definition at line 29 of file class.ilUserFilter.php.

References init().

{
$this->init();
}

+ Here is the call graph for this function:

Member Function Documentation

& ilUserFilter::__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 188 of file class.ilUserFilter.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:

ilUserFilter::__searchObjects ( )

Definition at line 142 of file class.ilUserFilter.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:

ilUserFilter::__storeEntries ( $new_res)

Definition at line 205 of file class.ilUserFilter.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:

ilUserFilter::__toArray (   $entries)

Definition at line 220 of file class.ilUserFilter.php.

Referenced by __searchObjects().

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

+ Here is the caller graph for this function:

ilUserFilter::disableField (   $key)

Definition at line 75 of file class.ilUserFilter.php.

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

Definition at line 71 of file class.ilUserFilter.php.

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

Definition at line 79 of file class.ilUserFilter.php.

{
$this->enabled_member_filter = $a_status;
}
ilUserFilter::filter (   $a_user_ids)

Filter user accounts.

Returns

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_ASSOC, and ilUserAccountSettings\getInstance().

{
global $ilDB;
if(!ilUserAccountSettings::getInstance()->isUserAccessRestricted())
{
return $a_user_ids;
}
$query = "SELECT usr_id FROM usr_data ".
"WHERE ".$ilDB->in('time_limit_owner',$this->folder_ids,false,'integer')." ".
"AND ".$ilDB->in('usr_id',$a_user_ids,false,'integer');
$res = $ilDB->query($query);
$filtered = array();
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$filtered[] = $row['usr_id'];
}
return $filtered;
}

+ Here is the call graph for this function:

ilUserFilter::getFolderIds ( )

Get accessible user folder (cat and usrf) ids.

Returns

Definition at line 77 of file class.ilUserFilter.php.

References $folder_ids.

{
return (array) $this->folder_ids;
}
static ilUserFilter::getInstance ( )
static

Singelton get instance.

Returns
object ilUserAccountSettings

Definition at line 38 of file class.ilUserFilter.php.

References $instance, and ilUserFilter().

Referenced by ilObjUser\_getUsersOnline(), ilUserAutoComplete\getList(), ilRepositorySearchGUI\performSearch(), and ilMailSearchGUI\showResults().

{
if(self::$instance)
{
}
return self::$instance = new ilUserFilter();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserFilter::getLimit ( )

Definition at line 90 of file class.ilUserFilter.php.

References $limit.

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

Definition at line 110 of file class.ilUserFilter.php.

References $_SESSION.

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

Definition at line 100 of file class.ilUserFilter.php.

References $usr_id.

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

Definition at line 116 of file class.ilUserFilter.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:

ilUserFilter::ilUserFilter (   $a_usr_id)

Definition at line 58 of file class.ilUserFilter.php.

References $ilDB.

Referenced by getInstance().

{
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();
}

+ Here is the caller graph for this function:

ilUserFilter::init ( )
private

Init.

Returns

Definition at line 86 of file class.ilUserFilter.php.

References ilLocalUser\_getFolderIds(), and ilUserAccountSettings\getInstance().

Referenced by __construct().

{
if(ilUserAccountSettings::getInstance()->isUserAccessRestricted())
{
include_once './Services/User/classes/class.ilLocalUser.php';
$this->folder_ids = ilLocalUser::_getFolderIds();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserFilter::limitReached ( )

Definition at line 95 of file class.ilUserFilter.php.

References $limit_reached.

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

Definition at line 229 of file class.ilUserFilter.php.

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

Definition at line 84 of file class.ilUserFilter.php.

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

Definition at line 105 of file class.ilUserFilter.php.

References $_SESSION.

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

Field Documentation

ilUserFilter::$db = null

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

ilUserFilter::$enabled_member_filter = false

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

ilUserFilter::$folder_ids = array()
private

Definition at line 22 of file class.ilUserFilter.php.

Referenced by getFolderIds().

ilUserFilter::$instance = null
staticprivate

Definition at line 18 of file class.ilUserFilter.php.

Referenced by getInstance().

ilUserFilter::$limit = 0

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

Referenced by getLimit().

ilUserFilter::$limit_reached = false

Definition at line 43 of file class.ilUserFilter.php.

Referenced by limitReached().

ilUserFilter::$possible_users = array()

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

Referenced by getUsers().

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

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

ilUserFilter::$settings = null
private

Definition at line 20 of file class.ilUserFilter.php.

ilUserFilter::$usr_id = null

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

Referenced by getUserId().


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