Browse Source

Add presences on contacts when searching

pull/199/merge
Timothée Jaussoin 10 years ago
parent
commit
1ac3dca957
  1. 15
      app/models/contact/ContactDAO.php
  2. 1
      app/widgets/Search/Search.php
  3. 10
      app/widgets/Search/_search_results.tpl

15
app/models/contact/ContactDAO.php

@ -493,9 +493,22 @@ class ContactDAO extends SQL {
rosterlink.rostername,
rosterlink.rostersubscription,
rosterlink.groupname,
rosterlink.chaton
rosterlink.chaton,
presence.value,
presence.delay,
presence.last
from rosterlink
left outer join contact
left outer join (
select a.*
from presence a
join (
select jid, min( id ) as id
from presence
where session = :session
group by jid
) as b on ( a.id = b.id )
) presence on contact.jid = presence.jid
on rosterlink.jid = contact.jid
where rosterlink.session = :session
and (rosterlink.jid like :jid

1
app/widgets/Search/Search.php

@ -29,6 +29,7 @@ class Search extends \Movim\Widget\Base
$view->assign('empty', true);
} else {
$view->assign('empty', false);
$view->assign('presencestxt', getPresencesTxt());
$pd = new PostnDAO;
$posts = $pd->search($key);

10
app/widgets/Search/_search_results.tpl

@ -38,11 +38,17 @@
<li>
{$url = $value->getPhoto('s')}
{if="$url"}
<span class="primary icon bubble">
<span class="primary icon bubble
{if="$value->value"}
status {$presencestxt[$value->value]}
{/if}">
<img src="{$url}">
</span>
{else}
<span class="primary icon bubble color {$valu->jid|stringToColor}">
<span class="primary icon bubble color {$value->jid|stringToColor}
{if="$value->value"}
status {$presencestxt[$value->value]}
{/if}">
<i class="zmdi zmdi-account"></i>
</span>
{/if}

Loading…
Cancel
Save