ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMailAutoCompleteAddressbookLoginProvider.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once 'Services/Mail/classes/class.ilMailAutoCompleteRecipientProvider.php';
4 
9 {
14  public function current()
15  {
16 
17  return array(
18  'login' => $this->data['login'],
19  'firstname' => $this->data['firstname'],
20  'lastname' => $this->data['lastname']
21  );
22  }
23 
28  public function key()
29  {
30  return $this->data['login'];
31  }
32 
36  public function rewind()
37  {
38 
39  if($this->res)
40  {
41  $this->db->free($this->res);
42  $this->res = null;
43  }
44 
45  $query = "
46  SELECT DISTINCT
47  abook.login login,
48  abook.firstname firstname,
49  abook.lastname lastname
50  FROM addressbook abook
51  WHERE abook.user_id = " . $this->db->quote($this->user_id, 'integer') . "
52  AND abook.login IS NOT NULL
53  AND (" .
54  $this->db->like('abook.login', 'text', $this->quoted_term) . " OR " .
55  $this->db->like('abook.firstname', 'text', $this->quoted_term) . " OR " .
56  $this->db->like('abook.lastname', 'text', $this->quoted_term) . "
57 
58  )";
59  $this->res = $this->db->query($query);
60  }
61 }