diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-07-19 22:08:07 -0230 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-07-19 22:08:07 -0230 |
commit | 833bd3f8a90b604f4ab289dab9366c0032ce5216 (patch) | |
tree | d9dba860b725a2c837fe1a640cafd0bd0b418e43 /app/Core/Tool.php | |
parent | 42ca8390d43080c7403c4ae4cdaf31296bc02576 (diff) |
Add Task CSV export and Kanboard CLI
Diffstat (limited to 'app/Core/Tool.php')
-rw-r--r-- | app/Core/Tool.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/Core/Tool.php b/app/Core/Tool.php new file mode 100644 index 00000000..ade99cad --- /dev/null +++ b/app/Core/Tool.php @@ -0,0 +1,34 @@ +<?php + +namespace Core; + +/** + * Tool class + * + * @package core + * @author Frederic Guillot + */ +class Tool +{ + /** + * Write a CSV file + * + * @static + * @access public + * @param array $rows Array of rows + * @param string $filename Output filename + */ + public static function csv(array $rows, $filename = 'php://output') + { + $fp = fopen($filename, 'w'); + + if (is_resource($fp)) { + + foreach ($rows as $fields) { + fputcsv($fp, $fields); + } + + fclose($fp); + } + } +} |