mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 05:35:12 +00:00
replace app tagcloud with more traditional categories widget. One can always change this in the PDL
This commit is contained in:
parent
9b19a51fc6
commit
8ffdc4859b
3 changed files with 45 additions and 1 deletions
|
@ -79,12 +79,14 @@ function categories_widget($baseurl,$selected = '') {
|
|||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.type = %d
|
||||
and term.otype = %d
|
||||
and item.owner_xchan = '%s'
|
||||
and item.item_wall = 1
|
||||
$item_normal
|
||||
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)) {
|
||||
|
|
|
@ -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 '';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[region=aside]
|
||||
[widget=appselect][/widget]
|
||||
[widget=appcloud][/widget]
|
||||
[widget=appcategories][/widget]
|
||||
[/region]
|
||||
|
|
Loading…
Reference in a new issue