Detailed Description
CSVExportController exports instances of one type into a CSV file.
It uses the fputcsv function of PHP with the default values for delimiter, enclosing and escape character.
The controller supports the following actions:
| Parameter | Description |
|---|---|
in docFile | The name of the file to write to (path relative to script main location) (default: 'export.csv') |
in className | The entity type to export instances of or the source type, when exporting a relation (see sourceId, relation) |
in sortFieldName | The field name to sort the list by. Must be one of the fields of the type selected by the className parameter. If omitted, the sorting is undefined (optional) |
in sortDirection | The direction to sort the list. Must be either asc for ascending or desc for descending (optional, default: asc) |
in query | A query condition encoded in RQL to be used with StringQuery::setRQLConditionString() |
in translateValues | Boolean whether list values should be translated to their display values (optional, default: true) |
in sourceId | When exporting a relation: Id of the object to which the exported objects are related (determines the object id together with className) |
in relation | When exporting a relation: Name of the relation to the object defined by sourceId (determines the type of the returned objects) |
in nodesPerCall | The number of nodes to process in one call (default: 50) |
For additional actions and parameters see BatchController actions.
Definition at line 55 of file CSVExportController.php.
Inheritance diagram for CSVExportController:Public Member Functions | |
| initialize (Request $request, Response $response) | |
Public Member Functions inherited from Controller | |
| __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration) | |
| execute ($method=null) | |
| getRequest () | |
| getResponse () | |
Public Attributes | |
| const | DOCFILE = "export.csv" |
| const | NODES_PER_CALL = 50 |
Public Attributes inherited from BatchController | |
| const | REQUEST_VAR = 'request' |
| const | ONE_CALL_VAR = 'oneCall' |
| const | STEP_VAR = 'step' |
| const | NUM_STEPS_VAR = 'numSteps' |
| const | DOWNLOAD_STEP_VAR = 'downloadStep' |
| const | PACKAGES_VAR = 'packages' |
Public Attributes inherited from Controller | |
| const | CSRF_TOKEN_PARAM = 'csrf_token' |
Protected Member Functions | |
| validate () | |
| getWorkPackage ($number) | |
| getDownloadFile () | |
| initExport ($oids) | |
| exportNodes ($oids) | |
| cleanup () | |
Protected Member Functions inherited from BatchController | |
| doExecute ($method=null) | |
| getStepNumber () | |
| addWorkPackage ($name, $size, array $oids, $callback, $args=null) | |
| processPart ($step) | |
| getRequestValue ($name) | |
| getNumberOfSteps () | |
| getDisplayText ($step) | |
Protected Member Functions inherited from Controller | |
| executeSubAction ($action) | |
| redirect ($location, $key=null, $data=null) | |
| getLogger () | |
| getSession () | |
| getPersistenceFacade () | |
| getPermissionManager () | |
| getActionMapper () | |
| getLocalization () | |
| getMessage () | |
| getConfiguration () | |
| requireTransaction () | |
| endTransaction ($commit) | |
| isLocalizedRequest () | |
| checkLanguageParameter () | |
| generateCsrfToken ($name, $refresh=true) | |
| validateCsrfToken ($name, $invalidate=true) | |
| getLocalSessionValue ($key, $default=null) | |
| setLocalSessionValue ($key, $value) | |
| clearLocalSessionValues () | |
Member Function Documentation
◆ initialize()
- See also
- Controller::initialize()
Reimplemented from BatchController.
Definition at line 64 of file CSVExportController.php.
◆ validate()
|
protected |
- See also
- Controller::validate()
Reimplemented from Controller.
Definition at line 94 of file CSVExportController.php.
◆ getWorkPackage()
|
protected |
Reimplemented from BatchController.
Definition at line 153 of file CSVExportController.php.
◆ getDownloadFile()
|
protected |
Reimplemented from BatchController.
Definition at line 163 of file CSVExportController.php.
◆ initExport()
|
protected |
Initialize the CSV export (object ids parameter will be ignored)
- Parameters
-
$oids The object ids to process
- Note
- This is a callback method called on a matching work package, see BatchController::addWorkPackage()
Definition at line 172 of file CSVExportController.php.
◆ exportNodes()
|
protected |
Serialize all Nodes with given object ids to CSV.
- Parameters
-
$oids The object ids to process
- Note
- This is a callback method called on a matching work package, see BatchController::addWorkPackage()
Definition at line 241 of file CSVExportController.php.
◆ cleanup()
|
protected |
- See also
- BatchController::cleanup()
Reimplemented from BatchController.
Definition at line 280 of file CSVExportController.php.
Member Data Documentation
◆ DOCFILE
| const DOCFILE = "export.csv" |
Definition at line 58 of file CSVExportController.php.
◆ NODES_PER_CALL
| const NODES_PER_CALL = 50 |
Definition at line 59 of file CSVExportController.php.