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

Auto completion class for user lists. More...

+ Collaboration diagram for ilUserAutoComplete:

Static Public Member Functions

static getList ($a_str)
 Get completion list.

Detailed Description

Auto completion class for user lists.

Definition at line 8 of file class.ilUserAutoComplete.php.

Member Function Documentation

static ilUserAutoComplete::getList (   $a_str)
static

Get completion list.

Definition at line 13 of file class.ilUserAutoComplete.php.

References $ilDB, $query, ilJsonUtil\encode(), ilUserAccountSettings\getInstance(), and ilUserFilter\getInstance().

Referenced by ilUserLoginAutoCompleteInputGUI\echoAutoCompleteList().

{
global $ilDB;
/*
$search = explode(',', $a_str);
if(count($search) > 1)
{
$a_str = end($search);
}
*/
include_once './Services/JSON/classes/class.ilJsonUtil.php';
$result = new stdClass();
$result->response = new stdClass();
$result->response->results = array();
if (strlen($a_str) < 3)
{
return ilJsonUtil::encode($result);
}
include_once './Services/User/classes/class.ilUserAccountSettings.php';
if(ilUserAccountSettings::getInstance()->isUserAccessRestricted())
{
include_once './Services/User/classes/class.ilUserFilter.php';
$query = "SELECT login, firstname, lastname FROM usr_data ".
"WHERE (".
$ilDB->like("login", "text", $a_str."%")." OR ".
$ilDB->like("firstname", "text", $a_str."%")." OR ".
$ilDB->like("lastname", "text", $a_str."%").
") AND ".$ilDB->in('time_limit_owner',ilUserFilter::getInstance()->getFolderIds(),false,'integer')." ".
"ORDER BY login ";
$set = $ilDB->query($query);
}
else
{
$set = $ilDB->query("SELECT login, firstname, lastname FROM usr_data WHERE ".
$ilDB->like("login", "text", $a_str."%")." OR ".
$ilDB->like("firstname", "text", $a_str."%")." OR ".
$ilDB->like("lastname", "text", $a_str."%").
" ORDER BY login");
}
$max = 20;
$cnt = 0;
while (($rec = $ilDB->fetchAssoc($set)) && $cnt < $max)
{
$result->response->results[$cnt] = new stdClass();
$result->response->results[$cnt]->login = $rec["login"];
$result->response->results[$cnt]->firstname = $rec["firstname"];
$result->response->results[$cnt]->lastname = $rec["lastname"];
$cnt++;
}
return ilJsonUtil::encode($result);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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