{
"SELECT DISTINCT
abook.login login,
abook.firstname firstname,
abook.lastname lastname,
'addressbook' type
FROM addressbook abook
WHERE abook.user_id = ".$ilDB->quote($this->user_id,'integer')."
AND abook.login IS NOT NULL
AND (". $ilDB->like('abook.login', 'text', $a_search)."
OR ".$ilDB->like('abook.firstname', 'text', $a_search)."
OR ".$ilDB->like('abook.lastname', 'text', $a_search)."
)";
$union_query_1 = "SELECT DISTINCT
abook.email login,
abook.firstname firstname,
abook.lastname lastname,
'addressbook' type
FROM addressbook abook
WHERE abook.user_id = ".$ilDB->quote($this->user_id,'integer')."
AND abook.login IS NULL
AND (".$ilDB->like('abook.email', 'text', $a_search)."
OR ".$ilDB->like('abook.firstname', 'text', $a_search)."
OR ".$ilDB->like('abook.lastname', 'text', $a_search)."
)";
$union_query_2 = "SELECT DISTINCT
mail.rcp_to login,
'' firstname,
'' lastname,
'mail' type
FROM mail
WHERE ".$ilDB->like('mail.rcp_to', 'text', $a_search)."
AND sender_id = ".$ilDB->quote($this->user_id,'integer')."
AND mail.sender_id = mail.user_id";
$queries = array(
'mail' => $union_query_2
);
if($this->allow_smtp == 1)
$queries['addressbook_2'] = $union_query_1;
include_once 'Services/Utilities/classes/class.ilStr.php';
try
{
if($ilDB->getDbType() != 'oracle')
$queries['all'] = implode(' UNION ', $queries);
foreach($queries as $type =>
$query)
{
if('mail' == $type && $ilDB->getDbType() == 'oracle')
{
}
$ilDB->setLimit(0,20);
$query_res = $ilDB->query(
$query );
while(
$row = $ilDB->fetchObject($query_res))
{
{
if(strpos(
$row->login,
',') || strpos(
$row->login,
';'))
{
$parts = preg_split(
"/[ ]*[;,][ ]*/", trim(
$row->login));
foreach($parts as $part)
{
{
}
}
}
else
{
}
}
else
{
}
}
}
$result->response->total = count($this->result->response->results);
}