aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Activity_order.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2018-06-08 05:22:01 -0400
committerAndrew Manning <tamanning@zoho.com>2018-06-08 05:22:01 -0400
commitdf2d18160212ec546ec640dd1d2152fecada5557 (patch)
tree126504df4e5ab2d42defbee153a748fe40253b38 /Zotlabs/Widget/Activity_order.php
parented17e8a6499e48b032393be351c39f31a0edcbf3 (diff)
parent7bf1c5f27b8b8f0eea226e81a5db99585c5a56b3 (diff)
downloadvolse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.gz
volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.tar.bz2
volse-hubzilla-df2d18160212ec546ec640dd1d2152fecada5557.zip
Merge branch 'dev' of framagit.org:hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Widget/Activity_order.php')
-rw-r--r--Zotlabs/Widget/Activity_order.php128
1 files changed, 128 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php
new file mode 100644
index 000000000..534d6caee
--- /dev/null
+++ b/Zotlabs/Widget/Activity_order.php
@@ -0,0 +1,128 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Activity_order {
+
+ function widget($arr) {
+
+ if(! local_channel())
+ return '';
+
+ if(! feature_enabled(local_channel(),'order_tab')) {
+ set_pconfig(local_channel(), 'mod_network', 'order', 0);
+ return '';
+ }
+
+ $commentord_active = '';
+ $postord_active = '';
+ $unthreaded_active = '';
+
+ if(x($_GET, 'order')) {
+ switch($_GET['order']){
+ case 'post':
+ $postord_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 1);
+ break;
+ case 'comment':
+ $commentord_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 0);
+ break;
+ case 'unthreaded':
+ $unthreaded_active = 'active';
+ set_pconfig(local_channel(), 'mod_network', 'order', 2);
+ break;
+ default:
+ $commentord_active = 'active';
+ }
+ }
+ else {
+ $order = get_pconfig(local_channel(), 'mod_network', 'order', 0);
+ switch($order) {
+ case 0:
+ $commentord_active = 'active';
+ break;
+ case 1:
+ $postord_active = 'active';
+ break;
+ case 2:
+ $unthreaded_active = 'active';
+ break;
+ default:
+ $commentord_active = 'active';
+ }
+ }
+
+ // override order for search results and filer results
+ if(x($_GET,'search') || x($_GET,'file')) {
+ $unthreaded_active = 'active';
+ $commentord_active = $postord_active = 'disabled';
+ }
+
+ $cmd = \App::$cmd;
+
+ $filter = '';
+
+ if(x($_GET,'cid'))
+ $filter .= '&cid=' . $_GET['cid'];
+
+ if(x($_GET,'gid'))
+ $filter .= '&gid=' . $_GET['gid'];
+
+ if(x($_GET,'star'))
+ $filter .= '&star=' . $_GET['star'];
+
+ if(x($_GET,'conv'))
+ $filter .= '&conv=' . $_GET['conv'];
+
+ if(x($_GET,'file'))
+ $filter .= '&file=' . $_GET['file'];
+
+
+ // tabs
+ $tabs = [];
+
+ $tabs[] = [
+ 'label' => t('Commented Date'),
+ 'icon' => '',
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . $filter,
+ 'sel'=> $commentord_active,
+ 'title' => t('Order by last commented date'),
+ ];
+ $tabs[] = [
+ 'label' => t('Posted Date'),
+ 'icon' => '',
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=post' . $filter,
+ 'sel'=> $postord_active,
+ 'title' => t('Order by last posted date'),
+ ];
+ $tabs[] = array(
+ 'label' => t('Date Unthreaded'),
+ 'icon' => '',
+ 'url' => z_root() . '/' . $cmd . '?f=&order=unthreaded' . $filter,
+ 'sel' => $unthreaded_active,
+ 'title' => t('Order unthreaded by date'),
+ );
+
+ $arr = ['tabs' => $tabs];
+
+ call_hooks('network_tabs', $arr);
+
+ $o = '';
+
+ if($arr['tabs']) {
+ $content = replace_macros(get_markup_template('common_pills.tpl'), [
+ '$pills' => $arr['tabs'],
+ ]);
+
+ $o = replace_macros(get_markup_template('common_widget.tpl'), [
+ '$title' => t('Activity Order'),
+ '$content' => $content,
+ ]);
+ }
+
+ return $o;
+
+ }
+
+}