ILIAS  Release_4_4_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.

References $ilUser.

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

Member Function Documentation

ilMailAddressbook::getAddressbookAsync (   $search)

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

References $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 = array();
while ($row = $query_res->fetchRow(DB_FETCHMODE_OBJECT))
{
$tmp = new stdClass();
$tmp->value = $row->login;
$label = $row->login;
if($row->firstname && $row->lastname)
{
$label .= " [" . $row->lastname . ", " . $row->firstname . "]";
}
$tmp->label = $label;
$result[] = $tmp;
}
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: