ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailAddressbook Class Reference
+ Collaboration diagram for ilMailAddressbook:

Public Member Functions

 __construct ()
 getAddressbookAsync ($search)

Private Attributes

 $user_id = null

Detailed Description

Author
Nadia Krzywon
Version
$Id$

Definition at line 9 of file class.ilMailAddressbook.php.

Constructor & Destructor Documentation

ilMailAddressbook::__construct ( )

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

{
global $ilUser;
$this->user_id = $ilUser->getId();
}

Member Function Documentation

ilMailAddressbook::getAddressbookAsync (   $search)

Definition at line 20 of file class.ilMailAddressbook.php.

References $ilDB, $query, $result, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$ilDB->setLimit(0,20);
$query =
'SELECT DISTINCT
abook.login login,
abook.firstname firstname,
abook.lastname lastname
FROM addressbook abook
WHERE abook.user_id = '.$ilDB->quote($this->user_id, 'integer').'
AND ( '. $ilDB->like('abook.login', 'text', $search).'
OR '. $ilDB->like('abook.firstname', 'text', $search).'
OR '. $ilDB->like('abook.lastname', 'text', $search).'
)';
$query_res = $ilDB->query($query);
$result = new stdClass();
$result->response = new stdClass();
$result->response->results = array();
while ($row = $query_res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tmp = new stdClass();
$tmp->login = $row->login;
$tmp->firstname = $row->firstname;
$tmp->lastname = $row->lastname;
$result->response->results[] = $tmp;
}
$result->response->total = count($result->response->results);
return $result;
}

Field Documentation

ilMailAddressbook::$user_id = null
private

Definition at line 11 of file class.ilMailAddressbook.php.


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