SurveyResponsesExport
in package
implements
CommandInterface
Uses
AuthPermissionTrait
Table of Contents
Interfaces
Properties
- $exportSurvey : ExportSurveyResultsService
- Service responsible for exporting survey results.
- $permission : Permission
- Permission helper used to check survey permissions.
- $responseFactory : ResponseFactory
- Factory used to build API responses.
- $survey : Survey
- Survey model service used to fetch survey records.
- $surveyModel : Survey|null
- The loaded Survey instance for the current request.
- $allowedFormats : array<string|int, string>
- Allowed export formats.
- $permissionModel : Permission|null
Methods
- __construct() : mixed
- SurveyResponsesExport constructor.
- process() : array<string|int, mixed>
- Process the export request and perform the export.
- run() : Response
- setPermissionModel() : void
- getExportRequestData() : array<string|int, mixed>
- Read and validate export-related parameters from the request.
- getPermissionModel() : Permission
- hasGlobalPermission() : Response
- hasSurveyPermission() : Response
- streamFile() : never
- Stream the exported file for download.
Properties
$exportSurvey
Service responsible for exporting survey results.
protected
ExportSurveyResultsService
$exportSurvey
$permission
Permission helper used to check survey permissions.
protected
Permission
$permission
$responseFactory
Factory used to build API responses.
protected
ResponseFactory
$responseFactory
$survey
Survey model service used to fetch survey records.
protected
Survey
$survey
$surveyModel
The loaded Survey instance for the current request.
protected
Survey|null
$surveyModel
$allowedFormats
Allowed export formats.
private
array<string|int, string>
$allowedFormats
= ['csv', 'html']
$permissionModel
private
Permission|null
$permissionModel
= null
Methods
__construct()
SurveyResponsesExport constructor.
public
__construct(Survey $survey, Permission $permission, ResponseFactory $responseFactory, ExportSurveyResultsService $exportSurvey) : mixed
Parameters
- $survey : Survey
-
Survey model/service used to fetch surveys
- $permission : Permission
-
Permission helper for checking access
- $responseFactory : ResponseFactory
-
Factory to create API responses
- $exportSurvey : ExportSurveyResultsService
-
Service responsible for exporting survey results
process()
Process the export request and perform the export.
public
process(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Tags
Return values
array<string|int, mixed> —The export data with content/filePath and metadata
run()
public
run(Request $request) : Response
Parameters
- $request : Request
Return values
ResponsesetPermissionModel()
public
setPermissionModel(Permission $permissionModel) : void
Parameters
- $permissionModel : Permission
getExportRequestData()
Read and validate export-related parameters from the request.
protected
getExportRequestData(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Tags
Return values
array<string|int, mixed> —[type, language]
getPermissionModel()
protected
getPermissionModel() : Permission
Return values
PermissionhasGlobalPermission()
protected
hasGlobalPermission(string $sPermission, string $sCRUD[, int|null $iUserID = null ]) : Response
Parameters
- $sPermission : string
- $sCRUD : string
- $iUserID : int|null = null
Return values
Response —| boolean
hasSurveyPermission()
protected
hasSurveyPermission(int $iSurveyID, string $sPermission, string $sCRUD[, string|null $iUserID = null ]) : Response
Parameters
- $iSurveyID : int
- $sPermission : string
- $sCRUD : string
- $iUserID : string|null = null
Return values
Response —| boolean
streamFile()
Stream the exported file for download.
protected
streamFile(array<string|int, mixed> $exportData) : never
Parameters
- $exportData : array<string|int, mixed>
-
Export data from the export service