aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Activity_filter.php
blob: a60144239481a6febba92f1f250f414aa1daa1d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 '';
		}
	}

}