From 2a154f8c9a772d61e7dabb5e3fd110ba00cc6007 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 14 Dec 2020 11:02:20 +0000 Subject: merge branch files_ng into dev --- include/contact_widgets.php | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'include/contact_widgets.php') diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 626a825b2..3b22a3c6d 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -93,7 +93,7 @@ function categories_widget($baseurl,$selected = '') { dbesc(ACTIVITY_UPDATE) ); } - else + else $r = unserialize($content); $terms = array(); @@ -206,6 +206,40 @@ function articlecategories_widget($baseurl,$selected = '') { return ''; } +function filecategories_widget($baseurl,$selected = '') { + + $perms = permissions_sql(App::$profile['profile_uid']); + + $terms = array(); + $r = q("select distinct(term.term) + from term join attach on term.oid = attach.id + where attach.uid = %d + and term.uid = attach.uid + and term.ttype = %d + and term.otype = %d + $perms + order by term.term asc", + intval(App::$profile['profile_uid']), + intval(TERM_CATEGORY), + intval(TERM_OBJ_FILE) + ); + + 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) { -- cgit v1.2.3