From 6e3ecc6946385a657ea2d330d27acbec8e316b92 Mon Sep 17 00:00:00 2001 From: Yannick VERHENNE Date: Sat, 19 Jul 2025 09:41:07 +0200 Subject: [PATCH 1/3] ajout du fichier composer.lock dans gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 42306a1b53d..d01ecb4d7b7 100755 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ app/logs/* /app/config/mail.conf.php /app/config/profile.conf.php /app/config/configuration.php +composer.lock # Courses app/courses/* From 7f2d201c1c31eee90631f4064dab468d20db2f7f Mon Sep 17 00:00:00 2001 From: Yannick VERHENNE Date: Sat, 19 Jul 2025 10:09:09 +0200 Subject: [PATCH 2/3] Add PDF Export to time report --- main/mySpace/time_report.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/main/mySpace/time_report.php b/main/mySpace/time_report.php index e1ab30149fb..219422de5ef 100644 --- a/main/mySpace/time_report.php +++ b/main/mySpace/time_report.php @@ -83,6 +83,13 @@ ]; $formValidator->addElement('select', 'report_type', get_lang('ReportType'), $reportTypeValues); +// Export format selector allows XLS or PDF output +$formatValues = [ + 'xls' => get_lang('ExportExcel'), + 'pdf' => get_lang('ExportToPDF'), +]; +$formValidator->addElement('select', 'export_format', get_lang('Format'), $formatValues); + // Button to generate the report $formValidator->addButtonSend(get_lang('GenerateReport')); @@ -91,6 +98,9 @@ $formValidator->addRule('end_date', get_lang('ThisFieldIsRequired'), 'required'); $formValidator->addRule('users', get_lang('ThisFieldIsRequired'), 'required'); $formValidator->addRule('report_type', get_lang('ThisFieldIsRequired'), 'required'); +$formValidator->addRule('export_format', get_lang('ThisFieldIsRequired'), 'required'); + +$formValidator->setDefaults(['export_format' => 'xls']); if ($formValidator->validate()) { $values = $formValidator->exportValues(); @@ -98,7 +108,7 @@ $startDate = $values['start_date']; $endDate = $values['end_date']; $reportType = $values['report_type']; - $exportXls = isset($_POST['export']); + $format = $values['export_format']; if (empty($users)) { Display::addFlash(Display::return_message(get_lang('NoUsersSelected'), 'warning')); @@ -111,7 +121,12 @@ $rows = $data['rows']; array_unshift($rows, $headers); $fileName = get_lang('Export').'-'.$reportTypeValues[$reportType].'_'.api_get_local_time(); - Export::arrayToCsv($rows, $fileName); + if ($format === 'pdf') { + $html = Export::convert_array_to_html($rows); + Export::export_html_to_pdf($html, ['filename' => $fileName]); + } else { + Export::arrayToCsv($rows, $fileName); + } } } } @@ -121,4 +136,4 @@ $formValidator->display(); -Display::display_footer(); +Display::display_footer(); \ No newline at end of file From 1399f2f036e27b9a698e41f75a3f00491ef63500 Mon Sep 17 00:00:00 2001 From: Nicolas Ducoulombier Date: Tue, 29 Jul 2025 10:12:39 +0200 Subject: [PATCH 3/3] Internal: remove composer.lock from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index d01ecb4d7b7..42306a1b53d 100755 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ app/logs/* /app/config/mail.conf.php /app/config/profile.conf.php /app/config/configuration.php -composer.lock # Courses app/courses/*