DataSourcesAdminController
class DataSourcesAdminController extends BaseAdminController
The DataSourcesAdminController class is the controller that handles all actions of the datasources management interface.
These actions are:
- Creation of a data source
- Modification of a data source
- Deletion of a data source
- Creation of a data source table
- Modification of a data source table structure
- Dropping a data source table
- Adding a row in a data source table
- Updating a row in a data source table
- Deletion of a row in a data source table
- Restoring a row in a data source table
- Import / Export of a data source
Constants
SQL_SELECT_KEYWORD |
|
SQL_FROM_KEYWORD |
|
SQL_WHERE_KEYWORD |
|
SQL_ORDER_BY_KEYWORD |
|
SQL_LIMIT_KEYWORD |
|
SQL_UPDATE_KEYWORD |
|
SQL_CREATE_KEYWORD |
|
SQL_DELETE_KEYWORD |
|
Properties
ControllersHelper | $helper | from BaseAdminController | |
string | $databasesDir | from BaseAdminController | |
string | $simulatorsDir | from BaseAdminController | |
string | $publicDir | from BaseAdminController | |
string | $viewsDir | from BaseAdminController | |
private SimpleXMLElement | $datasources | ||
private Request | $request | ||
private int | $script | ||
private array | $datatypes |
Methods
Returns a JSON response formed with the data of a form and an error message.
Entry point for the route paths begining by /admin/datasources
Processes the index action
Dispatches the index action to the appropriate processing based on the value of the crud parameter.
Shows the data sources management interface.
Exports a data source
Imports a data source from a JSON data file and a JSON schema file
Imports a delimited text file into a table of a data source
Retrieves the choice values of a data in the result list of a query on a data source
Filters the result set of a query on the source return path
Filters the result set of a query on the source return path
Constructs a Database object
Checks the value of a column
Constructs a form fields with informations about the columns of a table
Creates a data source
Creates a database
Emulates a 'ALTER TABLE' for columns of a SQLite database.
Inserts a row into a table
Edits a data source
Drops a data source
Details
in BaseAdminController at line 93
protected Response
errorResponse(array $form, string $error)
Returns a JSON response formed with the data of a form and an error message.
in BaseAdminController at line 113
protected
zip(array $contents)
Zip file creation function.
Makes zip files. Derivated from PhpMyAdmin package The $contents parameter is an array of associative array where keys are : - name: name of the zip - modtime: modification time - data: data to compress
in BaseAdminController at line 188
protected int
unix2DosTime(int $unixtime)
Converts unix time to MS DOS time
at line 259
Response|RedirectResponse
indexAction(Request $request, int|null $dsid = null, string|null $table = null, string|null $crud = null)
Entry point for the route paths begining by /admin/datasources
These route paths are :
- /admin/datasources
- /admin/datasources/{dsid}
- /admin/datasources/{dsid}/{table}
- /admin/datasources/{dsid}/{table}/{crud}
at line 277
protected Response|RedirectResponse
runIndex(Request $request, int|null $dsid, string|null $table, string|null $crud)
Processes the index action
at line 310
protected Response|RedirectResponse
dispatch(Request $request, int|null $dsid, string|null $table, string|null $crud, array $form)
Dispatches the index action to the appropriate processing based on the value of the crud parameter.
at line 364
protected Response
showDatasources(int|null $dsid, string|null $table = null, string $action = 'show')
Shows the data sources management interface.
at line 643
protected Response
doExportDatasource(int $dsid)
Exports a data source
Route path : /admin/datasources/{dsid}/dummy/export-datasource
Creates a JSON data file and a JSON schema file from the source database. Compresses these two files into one for its download.
at line 700
protected RedirectResponse
doImportDatasource(array $files)
Imports a data source from a JSON data file and a JSON schema file
These files must have been exported from a G6K instance and must conform to the jsonschema.org specification.
Route path : /admin/datasources/0/dummy/doimport-datasource
at line 768
protected RedirectResponse|mixed
doImportTable(array $form, int $dsid, string|null $table, Database $database, array $files)
Imports a delimited text file into a table of a data source
Route path : /admin/datasources/{dsid}/{table}/doimport
at line 826
protected array
getChoicesFromSource(SimpleXMLElement $source, array|null $result)
Retrieves the choice values of a data in the result list of a query on a data source
at line 887
protected array|null
processSource(SimpleXMLElement $source)
Executes the query from a source
at line 948
protected array|null
filterResult(array $result, SimpleXMLElement $source)
Filters the result set of a query on the source return path
at line 973
protected array
filterResultByLines(array $result, string $filter)
Filters the result set of a query on the source return path
at line 1009
protected Database
getDatabase(int $dsid, bool $withDbName = true)
Constructs a Database object
at line 1030
protected string|bool
checkValue(string $name, array $info, string|null $value)
Checks the value of a column
at line 1109
protected array|null
tablesList(Database $database)
Returns the list of tables of a database
at line 1147
protected array|null
tableInfos(Database $database, string $table)
Returns informations about a table of a database
at line 1196
protected array
infosColumns(Database $database, string $table)
Returns informations about the columns of a table
at line 1253
protected array
infosColumnsToForm(string $table, array $infosColumns)
Constructs a form fields with informations about the columns of a table
at line 1283
protected RedirectResponse
createDatasource(array $form)
Creates a data source
at line 1307
protected string|true
migrateDB(int $dsid, string $dbtype, Database $fromDatabase)
Migrates data from a database to another.
at line 1360
protected string|true
createDB(int $dsid, string $dbtype)
Creates a database
at line 1405
protected string|true
createDBTable(array $form, Database $database)
Creates a table
at line 1480
protected string|true
editDBTable(array $form, string $table, Database $database)
Edits a table structure
at line 1667
protected bool
alterSQLiteTable(string $table, string $alterdefs, Database $database)
Emulates a 'ALTER TABLE' for columns of a SQLite database.
ALTER TABLE tbl_name alter_specification [, alter_specification] ...
alter_specification: ADD column_definition | DROP column_definition | CHANGE old_col_name column_definition
column_definition: same as for create table statements
at line 1786
protected string|bool
addDBTableRow(array $form, string $table, Database $database, bool $restore = false)
Inserts a row into a table
at line 1829
protected bool
updateDBTableRow(array $form, string $table, Database $database)
Updates a table row
at line 1871
protected string|true
deleteDBTableRow(array $form, string $table, Database $database)
Deletes a row from a table
at line 1889
protected string|true
dropDBTable(string $table, Database $database)
Drops a table
at line 1909
protected RedirectResponse
createTable(array $form, Database $database)
Creates a table
Route path : /admin/datasources/{dsid}/new/create
at line 1946
protected void
saveDatasources(DOMDocument $dom)
Saves DataSources.xml from a DOM document
at line 1970
protected Response
addTableRow(array $form, string $table, Database $database)
Adds a table row
Route path : /admin/datasources/{dsid}/{table}/add
at line 1996
protected Response
restoreTableRow(array $form, string $table, Database $database)
Restores a table row
Route path : /admin/datasources/{dsid}/{table}/restore
at line 2018
protected Response
updateTableRow(array $form, string $table, Database $database)
Updates a table row
Route path : /admin/datasources/{dsid}/{table}/update
at line 2043
protected Response
deleteTableRow(array $form, string $table, Database $database)
Deletes a table row
Route path : /admin/datasources/{dsid}/{table}/delete
at line 2068
protected RedirectResponse
doEditTable(array $form, string $table, Database $database)
Edits a table structure
Route path : /admin/datasources/{dsid}/{table}/doedit
at line 2123
protected void
addColumnsToTable(DOMDocument $dom, array $form, DOMElement $table)
Adds columns to a table
at line 2186
protected RedirectResponse
dropTable(string $table, Database $database)
Drops a table
Route path : /admin/datasources/{dsid}/{table}/drop
at line 2217
protected RedirectResponse
doEditDatasource(int $dsid, array $form)
Edits a data source
Route path : /admin/datasources/{dsid}/dummy/doedit-datasource
at line 2346
protected RedirectResponse
dropDatasource(int $dsid)
Drops a data source
Route path : /admin/datasources/{dsid}/dummy/drop-datasource