diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-22 15:39:06 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-22 15:39:06 -0800 |
commit | 6c178d44858bbdfd582d09eb4568d32292c0b2c2 (patch) | |
tree | ef71ebbdd8629b8c66a52f8b14d0e9db16670499 /include/contact_widgets.php | |
parent | 8bd8af7d16d6b4fb40680bd33b99bbfd582a1208 (diff) | |
download | volse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.tar.gz volse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.tar.bz2 volse-hubzilla-6c178d44858bbdfd582d09eb4568d32292c0b2c2.zip |
article feature
Diffstat (limited to 'include/contact_widgets.php')
-rw-r--r-- | include/contact_widgets.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 9cc9f0baf..b36471924 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -150,6 +150,54 @@ function cardcategories_widget($baseurl,$selected = '') { } +function articlecategories_widget($baseurl,$selected = '') { + + if(! feature_enabled(App::$profile['profile_uid'],'categories')) + return ''; + + $sql_extra = item_permissions_sql(App::$profile['profile_uid']); + + $item_normal = "and item.item_hidden = 0 and item.item_type = 7 and item.item_deleted = 0 + and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 + and item.item_blocked = 0 "; + + $terms = array(); + $r = q("select distinct(term.term) + from term join item on term.oid = item.id + where item.uid = %d + and term.uid = item.uid + and term.ttype = %d + and term.otype = %d + and item.owner_xchan = '%s' + $item_normal + $sql_extra + order by term.term asc", + intval(App::$profile['profile_uid']), + intval(TERM_CATEGORY), + intval(TERM_OBJ_POST), + dbesc(App::$profile['channel_hash']) + ); + if($r && count($r)) { + foreach($r as $rr) + $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : '')); + + return replace_macros(get_markup_template('categories_widget.tpl'),array( + '$title' => t('Categories'), + '$desc' => '', + '$sel_all' => (($selected == '') ? 'selected' : ''), + '$all' => t('Everything'), + '$terms' => $terms, + '$base' => $baseurl, + + )); + } + return ''; +} + + + + + function common_friends_visitor_widget($profile_uid,$cnt = 25) { |