From d3ac3f8490ea4c5ab85848b1eaf0b820c56a7e8e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 5 Oct 2015 08:08:59 +0200 Subject: [PATCH] Added the contact menu to the search as well. --- mod/dirfind.php | 12 ++++++++++++ view/templates/match.tpl | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mod/dirfind.php b/mod/dirfind.php index b0d578a3c6..488e10fa16 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,6 +1,7 @@ results)) { + $id = 0; + $tpl = get_markup_template('match.tpl'); foreach($j->results as $jj) { @@ -120,9 +123,16 @@ function dirfind_content(&$a, $prefix = "") { if ($jj->cid > 0) { $connlnk = ""; $conntxt = ""; + $contact = q("SELECT * FROM `contact` WHERE `id` = %d", + intval($jj->cid)); + if ($contact) + $photo_menu = contact_photo_menu($contact[0]); + else + $photo_menu = array(); } else { $connlnk = $a->get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $conntxt = t('Connect'); + $photo_menu = array(array(t("Connect/Follow"), $connlnk)); } $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); @@ -134,6 +144,8 @@ function dirfind_content(&$a, $prefix = "") { '$tags' => $jj->tags, '$conntxt' => $conntxt, '$connlnk' => $connlnk, + '$photo_menu' => $photo_menu, + '$id' => ++$id, )); } } diff --git a/view/templates/match.tpl b/view/templates/match.tpl index 32f046e6aa..3ebabf1854 100644 --- a/view/templates/match.tpl +++ b/view/templates/match.tpl @@ -1,9 +1,25 @@
-
+
{{$name}} + {{if $photo_menu}} + menu +
+
    + {{foreach $photo_menu as $k=>$c}} + {{if $c.2}} +
  • {{$c.0}}
  • + {{else}} +
  • {{$c.0}}
  • + {{/if}} + {{/foreach}} +
+
+ {{/if}}