Compare commits

...

2 Commits

Author SHA1 Message Date
Marco Cavalli ea79b6604e remove old demo export file 2023-10-19 13:23:41 +02:00
Marco Cavalli bed5a26b5d create xls using PhpSpreadsheet 2023-10-19 13:23:27 +02:00
4 changed files with 397 additions and 30 deletions

View File

@ -2,9 +2,12 @@
namespace App\Http\Controllers;
use DateTime;
use OwenVoke\Gitea\Client;
use Illuminate\Http\Request;
use DateTime;
use PhpOffice\PhpSpreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xls;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
class GiteaApiController extends Controller
{
@ -65,18 +68,41 @@ class GiteaApiController extends Controller
private function create_csv(string $file_name, array $data)
{
$f = fopen('php://output', 'w'); // Configure fopen to create, open, and write data.
$reader = new Spreadsheet();
$spreadsheet = $reader->getActiveSheet();
$headers = array_keys($data[0]);
$data_new = array_unshift($data, $headers);
$spreadsheet->fromArray(
$data,
null,
'A1'
);
fputcsv($f, array_keys($data[0])); // Add the keys as the column headers
// Loop over the array and passing in the values only.
foreach ($data as $row) {
fputcsv($f, $row);
}
fclose($f);
// tell the browser it's going to be a csv file
header('Content-Type: text/csv');
// tell the browser we want to save it instead of displaying it
header('Content-Disposition: attachment; filename="' . $file_name . '.csv";');
//dd($spreadsheet);
$filename = $file_name . '.xls';
$writer = new Xls($reader);
$writer->save($filename);
//Define header information
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: 0");
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Content-Length: ' . filesize($filename));
header('Pragma: public');
//Clear system output buffer
flush();
//Read the size of the file
readfile($filename);
unlink($filename);
//Terminate from the script
die();
}
private function date_to_datetime(string $date)
@ -103,7 +129,7 @@ class GiteaApiController extends Controller
}
if (count($data) > 0) {
$file_name = $issues_params['state']."_issues_from_".$from_date."_to_".$to_date;
$file_name = $issues_params['state'] . "_issues_from_" . $from_date . "_to_" . $to_date;
$this->create_csv($file_name, $data);
return true;
}
@ -118,6 +144,7 @@ class GiteaApiController extends Controller
$from = $req->input('from_year') . '-' . $req->input('from_month') . '-01';
$to = $req->input('to_year') . '-' . $req->input('to_month') . '-31';
$res = $this->export_issues($from, $to, ['state' => $req->input('issues_type')]);
return view('backend', [
'token' => getenv('GITEA_TOKEN'),
'download' => $res

View File

@ -14,7 +14,8 @@
"guzzlehttp/guzzle": "^7.4",
"http-interop/http-factory-guzzle": "^1.2",
"laravel/lumen-framework": "^10.0",
"owenvoke/gitea": "dev-main as 0.1.6"
"owenvoke/gitea": "dev-main as 0.1.6",
"phpoffice/phpspreadsheet": "^1.29"
},
"repositories": [
{

356
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "485cac19b6c92421a3ec0f28d1b484c0",
"content-hash": "33c1d0aeac036ce3a7c0a65b6724e9e3",
"packages": [
{
"name": "brick/math",
@ -490,6 +490,67 @@
],
"time": "2023-10-06T06:47:41+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.16.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"shasum": ""
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0"
},
"time": "2022-09-18T07:06:19+00:00"
},
{
"name": "flipbox/lumen-generator",
"version": "9.2.0",
@ -2853,6 +2914,194 @@
},
"time": "2023-07-14T13:56:28+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "monolog/monolog",
"version": "3.4.0",
@ -3695,6 +3944,111 @@
},
"time": "2020-07-07T09:29:14+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0"
},
"time": "2023-06-14T22:48:31+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.1",

View File

@ -1,15 +0,0 @@
Progetto,#,Titolo,URL,Aperto_il,Chiuso_il,Etichette,Tempo
gruppo_co,2,"Sovrapposizione top bar e menu",https://git.congegni.net/GruppoCO/gruppo_co/issues/2,2023-09-29T11:06:55+02:00,2023-10-02T12:29:04+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
gruppo_co,1,"Pagina contatti non funziona mappa",https://git.congegni.net/GruppoCO/gruppo_co/issues/1,2023-09-21T16:55:03+02:00,2023-09-21T17:04:22+02:00,"Kind/Bug,Priority/Low,Status/Confirmed,",00:00:00
turinigroup_wordpress,1,"Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine",https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1,2023-09-27T10:26:00+02:00,2023-09-27T17:35:11+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
italy_law_firms_fiscalcode,1,"Integrazione testi pagina German",https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1,2023-09-27T15:38:47+02:00,2023-09-27T17:04:36+02:00,,00:00:00
beauty_san,2,"CNS e JB - modifiche Mail discovery kit",https://git.congegni.net/GruppoCO/beauty_san/issues/2,2023-09-28T16:39:54+02:00,2023-10-03T18:24:47+02:00,"Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:30:00
beauty_san,1,"Tuttotondo - Caricamento video YouTube",https://git.congegni.net/GruppoCO/beauty_san/issues/1,2023-09-27T18:40:54+02:00,2023-10-03T18:25:31+02:00,"Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved,",00:00:00
Progetto,#,Titolo,URL,Aperto_il,Chiuso_il,Etichette,Tempo
londinese,1,"Caricamento della cartella immagini nel backoffice o ftp",https://git.congegni.net/GruppoCO/londinese/issues/1,2023-09-27T16:37:06+02:00,2023-10-04T17:01:59+02:00,"Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:15:00
gruppo_co,2,"Sovrapposizione top bar e menu",https://git.congegni.net/GruppoCO/gruppo_co/issues/2,2023-09-29T11:06:55+02:00,2023-10-02T12:29:04+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
gruppo_co,1,"Pagina contatti non funziona mappa",https://git.congegni.net/GruppoCO/gruppo_co/issues/1,2023-09-21T16:55:03+02:00,2023-09-21T17:04:22+02:00,"Kind/Bug,Priority/Low,Status/Confirmed,",00:00:00
turinigroup_wordpress,1,"Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine",https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1,2023-09-27T10:26:00+02:00,2023-09-27T17:35:11+02:00,"Kind/Bug,Priority/Medium,Status/Resolved,",00:30:00
italy_law_firms_fiscalcode,1,"Integrazione testi pagina German",https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1,2023-09-27T15:38:47+02:00,2023-09-27T17:04:36+02:00,,00:00:00
beauty_san,2,"CNS e JB - modifiche Mail discovery kit",https://git.congegni.net/GruppoCO/beauty_san/issues/2,2023-09-28T16:39:54+02:00,2023-10-03T18:24:47+02:00,"Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved,",00:30:00
beauty_san,1,"Tuttotondo - Caricamento video YouTube",https://git.congegni.net/GruppoCO/beauty_san/issues/1,2023-09-27T18:40:54+02:00,2023-10-03T18:25:31+02:00,"Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved,",00:00:00
1 Progetto # Titolo URL Aperto_il Chiuso_il Etichette Tempo
2 gruppo_co 2 Sovrapposizione top bar e menu https://git.congegni.net/GruppoCO/gruppo_co/issues/2 2023-09-29T11:06:55+02:00 2023-10-02T12:29:04+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
3 gruppo_co 1 Pagina contatti non funziona mappa https://git.congegni.net/GruppoCO/gruppo_co/issues/1 2023-09-21T16:55:03+02:00 2023-09-21T17:04:22+02:00 Kind/Bug,Priority/Low,Status/Confirmed, 00:00:00
4 turinigroup_wordpress 1 Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1 2023-09-27T10:26:00+02:00 2023-09-27T17:35:11+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
5 italy_law_firms_fiscalcode 1 Integrazione testi pagina German https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1 2023-09-27T15:38:47+02:00 2023-09-27T17:04:36+02:00 00:00:00
6 beauty_san 2 CNS e JB - modifiche Mail discovery kit https://git.congegni.net/GruppoCO/beauty_san/issues/2 2023-09-28T16:39:54+02:00 2023-10-03T18:24:47+02:00 Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:30:00
7 beauty_san 1 Tuttotondo - Caricamento video YouTube https://git.congegni.net/GruppoCO/beauty_san/issues/1 2023-09-27T18:40:54+02:00 2023-10-03T18:25:31+02:00 Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved, 00:00:00
8 Progetto # Titolo URL Aperto_il Chiuso_il Etichette Tempo
9 londinese 1 Caricamento della cartella immagini nel backoffice o ftp https://git.congegni.net/GruppoCO/londinese/issues/1 2023-09-27T16:37:06+02:00 2023-10-04T17:01:59+02:00 Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:15:00
10 gruppo_co 2 Sovrapposizione top bar e menu https://git.congegni.net/GruppoCO/gruppo_co/issues/2 2023-09-29T11:06:55+02:00 2023-10-02T12:29:04+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
11 gruppo_co 1 Pagina contatti non funziona mappa https://git.congegni.net/GruppoCO/gruppo_co/issues/1 2023-09-21T16:55:03+02:00 2023-09-21T17:04:22+02:00 Kind/Bug,Priority/Low,Status/Confirmed, 00:00:00
12 turinigroup_wordpress 1 Schermata Bianca in WordPress Durante la Modifica di Articoli e Pagine https://git.congegni.net/GruppoCO/turinigroup_wordpress/issues/1 2023-09-27T10:26:00+02:00 2023-09-27T17:35:11+02:00 Kind/Bug,Priority/Medium,Status/Resolved, 00:30:00
13 italy_law_firms_fiscalcode 1 Integrazione testi pagina German https://git.congegni.net/GruppoCO/italy_law_firms_fiscalcode/issues/1 2023-09-27T15:38:47+02:00 2023-09-27T17:04:36+02:00 00:00:00
14 beauty_san 2 CNS e JB - modifiche Mail discovery kit https://git.congegni.net/GruppoCO/beauty_san/issues/2 2023-09-28T16:39:54+02:00 2023-10-03T18:24:47+02:00 Kind/Bug,Priority/Low,RequestBy/GruppoCO,Status/Resolved, 00:30:00
15 beauty_san 1 Tuttotondo - Caricamento video YouTube https://git.congegni.net/GruppoCO/beauty_san/issues/1 2023-09-27T18:40:54+02:00 2023-10-03T18:25:31+02:00 Kind/Enhancement,Priority/High,RequestBy/GruppoCO,Status/Resolved, 00:00:00