aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Activity_filter.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-05-31 13:05:32 +0200
committerMario Vavti <mario@mariovavti.com>2018-05-31 13:05:32 +0200
commitcbaaa1c57ffed0b0a11a7d4cf9a492c26e577194 (patch)
tree020b83c4ce7c0fd6a3d59941c5a989d7ff846385 /Zotlabs/Widget/Activity_filter.php
parent6bfc5aa96c44d3a16962242d0ef02ccfa879ab7b (diff)
downloadvolse-hubzilla-cbaaa1c57ffed0b0a11a7d4cf9a492c26e577194.tar.gz
volse-hubzilla-cbaaa1c57ffed0b0a11a7d4cf9a492c26e577194.tar.bz2
volse-hubzilla-cbaaa1c57ffed0b0a11a7d4cf9a492c26e577194.zip
merge groups and filed posts into activity filters
Diffstat (limited to 'Zotlabs/Widget/Activity_filter.php')
-rw-r--r--Zotlabs/Widget/Activity_filter.php80
1 files changed, 60 insertions, 20 deletions
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
index a60144239..e56d13fc1 100644
--- a/Zotlabs/Widget/Activity_filter.php
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -9,42 +9,82 @@ class Activity_filter {
if(! local_channel())
return '';
- $starred_active = '';
- $conv_active = '';
-
- if(x($_GET,'star')) {
- $starred_active = 'active';
- }
-
- if(x($_GET,'conv')) {
- $conv_active = 'active';
- }
-
$cmd = \App::$cmd;
- // tabs
$tabs = [];
if(feature_enabled(local_channel(),'personal_tab')) {
- $tabs[] = array(
+ if(x($_GET,'conv')) {
+ $conv_active = (($_GET['conv'] == 1) ? 'active' : '');
+ }
+
+ $tabs[] = [
'label' => t('Personal Posts'),
'icon' => 'user-circle',
- 'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . '&conv=1',
+ 'url' => z_root() . '/' . $cmd . '/?f=&conv=1',
'sel' => $conv_active,
- 'title' => t('Posts that mention or involve you'),
- );
+ 'title' => t('Show posts that mention or involve me'),
+ ];
}
if(feature_enabled(local_channel(),'star_posts')) {
- $tabs[] = array(
+ if(x($_GET,'star')) {
+ $starred_active = (($_GET['star'] == 1) ? 'active' : '');
+ }
+
+ $tabs[] = [
'label' => t('Starred Posts'),
'icon' => 'star',
- 'url'=>z_root() . '/' . $cmd . '/?f=' . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . '&star=1',
+ 'url'=>z_root() . '/' . $cmd . '/?f=&star=1',
'sel'=>$starred_active,
- 'title' => t('Favourite Posts'),
+ 'title' => t('Show posts that i have starred'),
+ ];
+ }
+
+ if(feature_enabled(local_channel(),'groups')) {
+ $groups = q("SELECT * FROM groups WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
+ intval(local_channel())
);
+
+ if($groups) {
+ foreach($groups as $g) {
+ if(x($_GET,'gid')) {
+ $group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => $g['gname'],
+ 'icon' => 'users',
+ 'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
+ 'sel' => $group_active,
+ 'title' => sprintf(t('Show posts related to the %s privacy group'), $g['gname']),
+ ];
+ }
+ }
}
+ if(feature_enabled(local_channel(),'filing')) {
+ $terms = q("select distinct term from term where uid = %d and ttype = %d order by term asc",
+ intval(local_channel()),
+ intval(TERM_FILE)
+ );
+
+ if($terms) {
+ foreach($terms as $t) {
+ if(x($_GET,'file')) {
+ $file_active = (($_GET['file'] == $t['term']) ? 'active' : '');
+ }
+
+ $tabs[] = [
+ 'label' => $t['term'],
+ 'icon' => 'folder',
+ 'url' => z_root() . '/' . $cmd . '/?f=&file=' . $t['term'],
+ 'sel' => $file_active,
+ 'title' => sprintf(t('Show posts that i have filed to %s'), $t['term']),
+ ];
+ }
+ }
+ }
$arr = ['tabs' => $tabs];
@@ -54,7 +94,7 @@ class Activity_filter {
if($arr['tabs']) {
return replace_macros($tpl, [
- '$title' => t('Additional Filters'),
+ '$title' => t('Activity Filters'),
'$tabs' => $arr['tabs'],
]);
}