Loading module/Oscar/src/Oscar/Controller/ProjectController.php +15 −2 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ class ProjectController extends AbstractOscarController $format = $this->params()->fromQuery('f'); } $allowedFormat = [OscarFormatterConst::FORMAT_IO_CSV, OscarFormatterConst::FORMAT_IO_JSON]; $allowedFormat = [OscarFormatterConst::FORMAT_IO_CSV, OscarFormatterConst::FORMAT_IO_JSON, OscarFormatterConst::FORMAT_IO_EXCEL]; if (!in_array($format, $allowedFormat)) { return $this->getResponseInternalError(sprintf(_("Format '%s' inconnue"), $format)); Loading @@ -146,7 +146,7 @@ class ProjectController extends AbstractOscarController // Récupération des projets $projects = $this->getProjectService()->getProjectsByIds($projectIds); $formatter = $this->getProjectService()->getFormatter($format); $formatter = $this->getProjectService()->getFormatter($format == OscarFormatterConst::FORMAT_IO_JSON ?: OscarFormatterConst::FORMAT_IO_CSV); // Fichier temporaire $filename = uniqid('oscar_export_project_') . '.csv'; Loading @@ -166,7 +166,11 @@ class ProjectController extends AbstractOscarController fclose($handler); $downloader = new CSVDownloader(); if( $format == OscarFormatterConst::FORMAT_IO_CSV ){ $downloader->downloadCSV($filePath); } else { $downloader->downloadCSVToExcel($filePath); } unlink($filePath); die(); } catch (\Exception $e) { Loading @@ -174,6 +178,15 @@ class ProjectController extends AbstractOscarController } } public function emptyAction() { $projects = $this->getProjectService()->getEmptyProject(); return array( 'projects' => $projects, 'search' => '', ); } /** * Fiche projet. * Loading module/Oscar/view/oscar/project-grant/advanced-search.phtml +6 −1 Original line number Diff line number Diff line Loading @@ -638,9 +638,14 @@ <?php if($projectview == 'on' && count($projectsIds) > 0): ?> <form action="<?= $this->url('project/export-many') ?>" method="post"> <input type="hidden" value="<?= implode(',', $projectsIds) ?>" name="ids" /> Exporter les projets : <button type="submit" class="btn btn-primary" name="format" value="csv"> <i class="icon-download"></i> Exporter les projets (CSV) CSV </button> <button type="submit" class="btn btn-primary" name="format" value="excel"> <i class="icon-download"></i> Excel </button> </form> <?php endif; ?> Loading Loading
module/Oscar/src/Oscar/Controller/ProjectController.php +15 −2 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ class ProjectController extends AbstractOscarController $format = $this->params()->fromQuery('f'); } $allowedFormat = [OscarFormatterConst::FORMAT_IO_CSV, OscarFormatterConst::FORMAT_IO_JSON]; $allowedFormat = [OscarFormatterConst::FORMAT_IO_CSV, OscarFormatterConst::FORMAT_IO_JSON, OscarFormatterConst::FORMAT_IO_EXCEL]; if (!in_array($format, $allowedFormat)) { return $this->getResponseInternalError(sprintf(_("Format '%s' inconnue"), $format)); Loading @@ -146,7 +146,7 @@ class ProjectController extends AbstractOscarController // Récupération des projets $projects = $this->getProjectService()->getProjectsByIds($projectIds); $formatter = $this->getProjectService()->getFormatter($format); $formatter = $this->getProjectService()->getFormatter($format == OscarFormatterConst::FORMAT_IO_JSON ?: OscarFormatterConst::FORMAT_IO_CSV); // Fichier temporaire $filename = uniqid('oscar_export_project_') . '.csv'; Loading @@ -166,7 +166,11 @@ class ProjectController extends AbstractOscarController fclose($handler); $downloader = new CSVDownloader(); if( $format == OscarFormatterConst::FORMAT_IO_CSV ){ $downloader->downloadCSV($filePath); } else { $downloader->downloadCSVToExcel($filePath); } unlink($filePath); die(); } catch (\Exception $e) { Loading @@ -174,6 +178,15 @@ class ProjectController extends AbstractOscarController } } public function emptyAction() { $projects = $this->getProjectService()->getEmptyProject(); return array( 'projects' => $projects, 'search' => '', ); } /** * Fiche projet. * Loading
module/Oscar/view/oscar/project-grant/advanced-search.phtml +6 −1 Original line number Diff line number Diff line Loading @@ -638,9 +638,14 @@ <?php if($projectview == 'on' && count($projectsIds) > 0): ?> <form action="<?= $this->url('project/export-many') ?>" method="post"> <input type="hidden" value="<?= implode(',', $projectsIds) ?>" name="ids" /> Exporter les projets : <button type="submit" class="btn btn-primary" name="format" value="csv"> <i class="icon-download"></i> Exporter les projets (CSV) CSV </button> <button type="submit" class="btn btn-primary" name="format" value="excel"> <i class="icon-download"></i> Excel </button> </form> <?php endif; ?> Loading