Auto completion class for user lists.
More...
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, $result, and ilJsonUtil\encode().
Referenced by ilUserLoginAutoCompleteInputGUI\echoAutoCompleteList().
{
include_once './Services/JSON/classes/class.ilJsonUtil.php';
$result->response =
new stdClass();
$result->response->results = array();
if (strlen($a_str) < 3)
{
}
$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++;
}
}
The documentation for this class was generated from the following file: