aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-05-30 14:06:18 +0200
committerMario Vavti <mario@mariovavti.com>2018-05-30 14:06:18 +0200
commit8d6441704bdc8d0628149dbb32321b6921f097ba (patch)
treecfa87c133ebadf47a1ae4d9961e1ff83ae3dee49
parent9fcb3bf2e8fab84f9144eecceaf984b2026e6d08 (diff)
downloadvolse-hubzilla-8d6441704bdc8d0628149dbb32321b6921f097ba.tar.gz
volse-hubzilla-8d6441704bdc8d0628149dbb32321b6921f097ba.tar.bz2
volse-hubzilla-8d6441704bdc8d0628149dbb32321b6921f097ba.zip
add widget files and templates
-rw-r--r--Zotlabs/Widget/Activity_filter.php66
-rw-r--r--Zotlabs/Widget/Activity_order.php111
-rwxr-xr-xview/tpl/common_pills.tpl8
3 files changed, 185 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php
new file mode 100644
index 000000000..a60144239
--- /dev/null
+++ b/Zotlabs/Widget/Activity_filter.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Activity_filter {
+
+ function widget($arr) {
+
+ 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(
+ 'label' => t('Personal Posts'),
+ 'icon' => 'user-circle',
+ 'url' => z_root() . '/' . $cmd . '?f=' . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . '&conv=1',
+ 'sel' => $conv_active,
+ 'title' => t('Posts that mention or involve you'),
+ );
+ }
+
+ if(feature_enabled(local_channel(),'star_posts')) {
+ $tabs[] = array(
+ 'label' => t('Starred Posts'),
+ 'icon' => 'star',
+ 'url'=>z_root() . '/' . $cmd . '/?f=' . ((x($_GET,'order')) ? '&order=' . $_GET['order'] : '') . '&star=1',
+ 'sel'=>$starred_active,
+ 'title' => t('Favourite Posts'),
+ );
+ }
+
+
+ $arr = ['tabs' => $tabs];
+
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_pills.tpl');
+
+ if($arr['tabs']) {
+ return replace_macros($tpl, [
+ '$title' => t('Additional Filters'),
+ '$tabs' => $arr['tabs'],
+ ]);
+ }
+ else {
+ return '';
+ }
+ }
+
+}
diff --git a/Zotlabs/Widget/Activity_order.php b/Zotlabs/Widget/Activity_order.php
new file mode 100644
index 000000000..ba288965f
--- /dev/null
+++ b/Zotlabs/Widget/Activity_order.php
@@ -0,0 +1,111 @@
+<?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';
+ }
+ }
+
+ $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'];
+
+ // tabs
+ $tabs = [];
+
+ $tabs[] = [
+ 'label' => t('Commented Date'),
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=comment' . $filter,
+ 'sel'=> $commentord_active,
+ 'title' => t('Sort by Comment Date'),
+ ];
+ $tabs[] = [
+ 'label' => t('Posted Date'),
+ 'url'=>z_root() . '/' . $cmd . '?f=&order=post' . $filter,
+ 'sel'=> $postord_active,
+ 'title' => t('Sort by Post Date'),
+ ];
+ $tabs[] = array(
+ 'label' => t('Date Unthreaded'),
+ 'url' => z_root() . '/' . $cmd . '?f=&order=unthreaded' . $filter,
+ 'sel' => $unthreaded_active,
+ 'title' => t('Activity Stream - by date'),
+ );
+
+ $arr = ['tabs' => $tabs];
+
+ call_hooks('network_tabs', $arr);
+
+ $tpl = get_markup_template('common_pills.tpl');
+
+ if($arr['tabs']) {
+ return replace_macros($tpl, [
+ '$title' => t('Order Activity by'),
+ '$tabs' => $arr['tabs'],
+ ]);
+ }
+ else {
+ return '';
+ }
+ }
+
+}
diff --git a/view/tpl/common_pills.tpl b/view/tpl/common_pills.tpl
new file mode 100755
index 000000000..d10aa365b
--- /dev/null
+++ b/view/tpl/common_pills.tpl
@@ -0,0 +1,8 @@
+<div class="widget">
+ <h3>{{$title}}</h3>
+ <ul class="nav nav-pills flex-column">
+ {{foreach $tabs as $tab}}
+ <li class="nav-item"{{if $tab.id}} id="{{$tab.id}}"{{/if}}><a class="nav-link{{if $tab.sel}} {{$tab.sel}}{{/if}}" href="{{$tab.url}}"{{if $tab.title}} title="{{$tab.title}}"{{/if}}>{{if $tab.icon}}<i class="fa fa-fw fa-{{$tab.icon}}"></i> {{/if}}{{$tab.label}}</a></li>
+ {{/foreach}}
+ </ul>
+</div>