From 642da17b86cce8f6455a68d2d863a288d3c125c8 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 27 Feb 2014 17:07:11 -0800 Subject: chatroom suggestions --- include/widgets.php | 36 ++++++++++++++++++++++++++++++++++++ view/pdl/mod_chat.pdl | 2 ++ view/tpl/bookmarkedchats.tpl | 10 ++++++++++ 3 files changed, 48 insertions(+) create mode 100644 view/tpl/bookmarkedchats.tpl diff --git a/include/widgets.php b/include/widgets.php index 4a5ae9de7..eb4565641 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -589,3 +589,39 @@ function widget_chatroom_list($arr) { )); } +function widget_bookmarkedchats($arr) { + $h = get_observer_hash(); + if(! $h) + return; + $r = q("select * from xchat where xchat_xchan = '%s' group by xchat_url order by xchat_desc", + dbesc($h) + ); + + for($x = 0; $x < count($r); $x ++) + $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); + return replace_macros(get_markup_template('bookmarkedchats.tpl'),array( + '$header' => t('Bookmarked Chatrooms'), + '$rooms' => $r + )); +} + +function widget_suggestedchats($arr) { + + // probably should restrict this to your friends, but then the widget will only work + // if you are logged in locally. + + $h = get_observer_hash(); + if(! $h) + return; + $r = q("select *, count(xchat_url) as total from xchat group by xchat_url order by total desc, xchat_desc", + dbesc($h) + ); + + for($x = 0; $x < count($r); $x ++) + $r[$x]['xchat_url'] = zid($r[$x]['xchat_url']); + return replace_macros(get_markup_template('bookmarkedchats.tpl'),array( + '$header' => t('Suggested Chatrooms'), + '$rooms' => $r + )); +} + diff --git a/view/pdl/mod_chat.pdl b/view/pdl/mod_chat.pdl index 6b1d2a15e..afc849868 100644 --- a/view/pdl/mod_chat.pdl +++ b/view/pdl/mod_chat.pdl @@ -1,3 +1,5 @@ [region=aside] [widget=profile][/widget] +[widget=bookmarkedchats][/widget] +[widget=suggestededchats][/widget] [/region] diff --git a/view/tpl/bookmarkedchats.tpl b/view/tpl/bookmarkedchats.tpl new file mode 100644 index 000000000..7635bb826 --- /dev/null +++ b/view/tpl/bookmarkedchats.tpl @@ -0,0 +1,10 @@ +{{if $rooms}} +
+

{{$header}}

+ +
+{{/if}} \ No newline at end of file -- cgit v1.2.3