aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Appcategories.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-15 20:11:28 -0700
committerzotlabs <mike@macgirvin.com>2017-03-15 20:11:28 -0700
commitdfd626548fc903a4ecffe3241570957a2df9a37a (patch)
treec5c4b30520864c7f8d7b439aa72f090bb0a611d4 /Zotlabs/Widget/Appcategories.php
parent92d7c32f61e8d8a72141629e73bb3bba38546278 (diff)
downloadvolse-hubzilla-dfd626548fc903a4ecffe3241570957a2df9a37a.tar.gz
volse-hubzilla-dfd626548fc903a4ecffe3241570957a2df9a37a.tar.bz2
volse-hubzilla-dfd626548fc903a4ecffe3241570957a2df9a37a.zip
more widget migrations
Diffstat (limited to 'Zotlabs/Widget/Appcategories.php')
-rw-r--r--Zotlabs/Widget/Appcategories.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Appcategories.php b/Zotlabs/Widget/Appcategories.php
new file mode 100644
index 000000000..490ec1abc
--- /dev/null
+++ b/Zotlabs/Widget/Appcategories.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Appcategories {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ return '';
+
+ $selected = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : '');
+
+ // @FIXME ??? $srchurl undefined here - commented out until is reviewed
+ //$srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&');
+ //$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
+
+ // Leaving this line which negates the effect of the two invalid lines prior
+ $srchurl = z_root() . '/apps';
+
+ $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
+ and term.term != 'nav_featured_app'
+ 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,
+
+ ));
+ }
+ }
+}