summaryrefslogtreecommitdiff
path: root/src/views/pages/users/index.csv.php
blob: 527e508e6cd5366f6996e2a4a60d2866999e3ab1 (plain)
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
<?php global $VARS;
$attribs = $VARS['template'];
$users = $VARS['users'];

function escape($value) {
	if (is_bool($value)) {
		return ($value?'true':'false');
	} else {
		$chars = "'" . '"' .  '\\' . ',';
		return addcslashes($str, $chars);
	}
}

$arr = array();
foreach ($attribs as $attrib) {
	$arr[] = escape($attrib['name']);
}
echo implode(',', $arr)."\n";

foreach ($users as $user) {
	$arr = array();
	foreach ($attribs as $attrib) {
		$props = $user[$attrib['key']];
		$arr[] = escape($props['value']);
	}
	echo implode(',', $arr)."\n";
}