public function exportCsvAnswersAction(Exercise $exercise)
    {
        if (!$this->isAdmin($exercise)) {
            // Only administrator or Paper Managers can export Papers
            throw new AccessDeniedException();
        }

        return new StreamedResponse(function () use ($exercise) {
            $this->exerciseManager->exportResultsToCsv($exercise);
        }, 200, [
            'Content-Type' => 'application/force-download',
            'Content-Disposition' => 'attachment; filename="'.preg_replace('/[^A-Za-z0-9_\-]/', '_', $exercise->getResourceNode()->getName()).'.csv"',
        ]);
    }
public function exportCsvAnswersAction(Exercise $exercise)
    {
        if (!$this->isAdmin($exercise)) {
            // Only administrator or Paper Managers can export Papers
            throw new AccessDeniedException();
        }

        return new StreamedResponse(function () use ($exercise) {
            $this->exerciseManager->exportResultsToCsv($exercise);
        }, 200, [
            'Content-Type' => 'application/force-download',
            'Content-Disposition' => 'attachment; filename="'.preg_replace('/[^A-Za-z0-9_\-]/', '_', $exercise->getResourceNode()->getName()).'.csv"',
        ]);
    }
public function exportCsvAnswersAction ( Exercise $ exercise ) { if ( ! $ this -> isAdmin ( $ exercise ) ) { // Only administrator or Paper Managers can export Papers throw new AccessDeniedException ( ) ; } return new StreamedResponse ( function ( ) use ( $ exercise ) { $ this -> exerciseManager -> exportResultsToCsv ( $ exercise ) ; } , 200 , [ 'Content-Type' => 'application/force-download' , 'Content-Disposition' => 'attachment; filename="' . preg_replace ( '/[^A-Za-z0-9_\-]/' , '_' , $ exercise -> getResourceNode ( ) -> getName ( ) ) . '.csv"' , ] ) ; }
Exports papers into a csv file.

@EXT\Route("/export/papers/csv", name="exercise_papers_export_csv")
@EXT\Method("GET")

@param Exercise $exercise

@return StreamedResponse
Exports papers into a csv file .