ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUserAutoComplete.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
13  public static function getList($a_str)
14  {
15  global $ilDB;
16 
17  /*
18  $search = explode(',', $a_str);
19  if(count($search) > 1)
20  {
21  $a_str = end($search);
22  }
23  */
24 
25  include_once './Services/JSON/classes/class.ilJsonUtil.php';
26  $result = new stdClass();
27  $result->response = new stdClass();
28  $result->response->results = array();
29  if (strlen($a_str) < 3)
30  {
32  }
33 
34  $set = $ilDB->query("SELECT login, firstname, lastname FROM usr_data WHERE ".
35  $ilDB->like("login", "text", $a_str."%")." OR ".
36  $ilDB->like("firstname", "text", $a_str."%")." OR ".
37  $ilDB->like("lastname", "text", $a_str."%").
38  " ORDER BY login");
39  $max = 20;
40  $cnt = 0;
41  while (($rec = $ilDB->fetchAssoc($set)) && $cnt < $max)
42  {
43  $result->response->results[$cnt] = new stdClass();
44  $result->response->results[$cnt]->login = $rec["login"];
45  $result->response->results[$cnt]->firstname = $rec["firstname"];
46  $result->response->results[$cnt]->lastname = $rec["lastname"];
47  $cnt++;
48  }
49 
51  }
52 
53 }
54 ?>