aboutsummaryrefslogtreecommitdiffstats
path: root/include/widgets.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-05 00:45:38 -0700
committerredmatrix <git@macgirvin.com>2016-05-05 00:45:38 -0700
commit8ffdc4859baa9f2ae9567a4c443dfbb227919167 (patch)
tree673a2b141f399c445e0dc48376d75dee0892f583 /include/widgets.php
parent9b19a51fc6cf38c1b465be5c97f92c840f257a40 (diff)
downloadvolse-hubzilla-8ffdc4859baa9f2ae9567a4c443dfbb227919167.tar.gz
volse-hubzilla-8ffdc4859baa9f2ae9567a4c443dfbb227919167.tar.bz2
volse-hubzilla-8ffdc4859baa9f2ae9567a4c443dfbb227919167.zip
replace app tagcloud with more traditional categories widget. One can always change this in the PDL
Diffstat (limited to 'include/widgets.php')
-rw-r--r--include/widgets.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/widgets.php b/include/widgets.php
index 7384aa399..2641a718e 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -400,6 +400,48 @@ function widget_categories($arr) {
}
+function widget_appcategories($arr) {
+
+ if(! local_channel())
+ return '';
+
+ $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
+ $srchurl = App::$query_string;
+ $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
+
+ $terms = array();
+
+ $r = q("select distinct(term.term)
+ from term join app on term.oid = app.id
+ where app_channel = %d
+ and term.uid = app_channel
+ and term.otype = %d
+ order by term.term asc",
+ intval(local_channel()),
+ intval(TERM_OBJ_APP)
+ );
+ if($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' => $srchurl,
+
+ ));
+ }
+
+
+
+}
+
+
+
function widget_appcloud($arr) {
if(! local_channel())
return '';