aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-11 17:39:29 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-11 17:39:29 -0700
commit0c23843b615742af6d43514ca6211750567cf07b (patch)
treea14c27be04959dd47608719a8af830f233232492 /include
parent0a34b96e115711aa8bfd49ba48c4e0705d3d55d3 (diff)
downloadvolse-hubzilla-0c23843b615742af6d43514ca6211750567cf07b.tar.gz
volse-hubzilla-0c23843b615742af6d43514ca6211750567cf07b.tar.bz2
volse-hubzilla-0c23843b615742af6d43514ca6211750567cf07b.zip
untested forum widget
Diffstat (limited to 'include')
-rw-r--r--include/widgets.php40
1 files changed, 39 insertions, 1 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 36671e719..fe3b47353 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -980,10 +980,48 @@ function widget_rating($arr) {
}
// used by site ratings pages to provide a return link
-function widget_pubsites() {
+function widget_pubsites($arr) {
if(get_app()->poi)
return;
return '<div class="widget"><ul class="nav nav-pills"><li><a href="pubsites">' . t('Public Hubs') . '</a></li></ul></div>';
}
+function widget_forums($arr) {
+
+ $a = get_app();
+
+ if(! local_channel())
+ return '';
+
+ if(! count($a->contacts))
+ load_contact_links(local_channel());
+
+ $o = '';
+
+ if(is_array($arr) && array_key_exists('limit',$arr))
+ $limit = " limit " . intval($limit) . " ";
+ else
+ $limit = " limit 12 ";
+
+ $perms_sql = item_permissions_sql(local_channel()) . item_normal();
+
+ $r = q("select count(item_unseen) as unseen, owner_xchan, xchan.* from item left join xchan on owner_xchan = xchan_hash group by owner_xchan order by unseen desc limit item from xchan where xchan_pubforum = 1 and uid = %d $perms_sql group by owner_xchan $limit ",
+ intval(local_channel())
+ );
+ if($r) {
+ $o .= '<div class="widget">';
+ $o .= '<h3>' . t('Forums') . '</h3>';
+
+ foreach($r as $rr) {
+ if($a->contacts && array_key_exists($rr['owner_xchan'],$a->contacts))
+ $contact = $a->contacts[$rr['owner_xchan']];
+ if($contact)
+ $o .= '<ul class="nav nav-pills"><li><a href="network?f=&cid=' . $contact['abook_id'] . '" ><img src="' . $rr['xchan_photo_s'] . '" /> ' . $rr['xchan_name'] . '</a> ' . $rr['unseen'] . '</li>';
+ }
+ $o .= '</div>';
+ }
+ return $o;
+
+}
+