Add Task CSV export and Kanboard CLI
This commit is contained in:
34
app/Core/Tool.php
Normal file
34
app/Core/Tool.php
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user