summaryrefslogtreecommitdiff
path: root/app/Core/Response.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-07-19 22:08:07 -0230
committerFrédéric Guillot <fred@kanboard.net>2014-07-19 22:08:07 -0230
commit833bd3f8a90b604f4ab289dab9366c0032ce5216 (patch)
treed9dba860b725a2c837fe1a640cafd0bd0b418e43 /app/Core/Response.php
parent42ca8390d43080c7403c4ae4cdaf31296bc02576 (diff)
Add Task CSV export and Kanboard CLI
Diffstat (limited to 'app/Core/Response.php')
-rw-r--r--app/Core/Response.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/app/Core/Response.php b/app/Core/Response.php
index aee029af..1ccf9f5e 100644
--- a/app/Core/Response.php
+++ b/app/Core/Response.php
@@ -71,6 +71,22 @@ class Response
}
/**
+ * Send a CSV response
+ *
+ * @access public
+ * @param array $data Data to serialize in csv
+ * @param integer $status_code HTTP status code
+ */
+ public function csv(array $data, $status_code = 200)
+ {
+ $this->status($status_code);
+ $this->nocache();
+ header('Content-Type: text/csv');
+ Tool::csv($data);
+ exit;
+ }
+
+ /**
* Send a Json response
*
* @access public
@@ -83,7 +99,6 @@ class Response
$this->nocache();
header('Content-Type: application/json');
echo json_encode($data);
-
exit;
}
@@ -100,7 +115,6 @@ class Response
$this->nocache();
header('Content-Type: text/plain; charset=utf-8');
echo $data;
-
exit;
}
@@ -117,7 +131,6 @@ class Response
$this->nocache();
header('Content-Type: text/html; charset=utf-8');
echo $data;
-
exit;
}
@@ -134,7 +147,6 @@ class Response
$this->nocache();
header('Content-Type: text/xml; charset=utf-8');
echo $data;
-
exit;
}
@@ -169,7 +181,6 @@ class Response
header('Content-Transfer-Encoding: binary');
header('Content-Type: application/octet-stream');
echo $data;
-
exit;
}