aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Filer.php
blob: 6c5ac47a9c5c7d5212547aca6ee74606e6635b10 (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
<?php

/**
 *   * Name: Saved folders
 *   * Description: A menu containing saved folders
 *   * Requires: network
 */

namespace Zotlabs\Widget;

require_once('include/contact_widgets.php');

class Filer {

	function widget($arr) {
		if(! local_channel())
			return '';

		$selected = ((x($_REQUEST,'file')) ? $_REQUEST['file'] : '');

		$terms = array();
		$r = q("select distinct term from term where uid = %d and ttype = %d order by term asc",
			intval(local_channel()),
			intval(TERM_FILE)
		);
		if(! $r)
			return;

		foreach($r as $rr)
			$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));

		return replace_macros(get_markup_template('fileas_widget.tpl'),array(
			'$title' => t('Saved Folders'),
			'$desc' => '',
			'$sel_all' => (($selected == '') ? 'selected' : ''),
			'$all' => t('Everything'),
			'$terms' => $terms,
			'$base' => z_root() . '/' . \App::$cmd
		));
	}
}