ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMailAutoCompleteAddressbookEmailProvider.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Mail/classes/class.ilMailAutoCompleteRecipientProvider.php';
5 
10 {
15  public function current()
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  if($this->res)
39  {
40  $this->db->free($this->res);
41  $this->res = null;
42  }
43 
44  $query = "
45  SELECT DISTINCT
46  abook.email login,
47  abook.firstname firstname,
48  abook.lastname lastname
49  FROM addressbook abook
50  WHERE abook.user_id = " . $this->db->quote($this->user_id, 'integer') . "
51  AND abook.login IS NULL
52  AND (" .
53  $this->db->like('abook.email', 'text', $this->quoted_term) . " OR " .
54  $this->db->like('abook.firstname', 'text', $this->quoted_term) . " OR " .
55  $this->db->like('abook.lastname', 'text', $this->quoted_term) . " )";
56  $this->res = $this->db->query($query);
57  }
58 }