class HomeAdminController extends BaseAdminController

The HomeAdminController class is the controller that display the administration interface homepage.

Traits

This class implements common functions needed in G6KBundle controllers.

Properties

protected mixed $projectDir from BaseAdminController
protected mixed $translator from BaseAdminController
protected mixed $kernel from BaseAdminController
protected mixed $userManager from BaseAdminController
protected mixed $authorizationChecker from BaseAdminController
protected mixed $fileUploader from BaseAdminController
protected mixed $deployer from BaseAdminController
string $databasesDir from BaseAdminController
string $simulatorsDir from BaseAdminController
string $publicDir from BaseAdminController
string $viewsDir from BaseAdminController
private SimpleXMLElement $datasources

Methods

void
__construct(TranslatorInterface $translator, KernelInterface $kernel, AuthorizationCheckerInterface $authorizationChecker, UserManagerInterface $userManager, FileUploader $fileUploader, Deployer $deployer, mixed $projectDir)

Constructor of class BaseAdminController

Response
errorResponse(array $form, string $error)

Returns a JSON response formed with the data of a form and an error message.

zip(array $contents)

Zip file creation function.

int
unix2DosTime(int $unixtime = 0)

Converts unix time to MS DOS time

void
initialize()

Initialization of common directories

KernelInterface
getKernel()

Returns the Symfony kernel

TranslatorInterface
getTranslator()

Returns the translator interface

bool
hasParameter($parameters)

Checks if a parameter exists or not

string
getLocale()

Returns the 'locale' from config parameters

string
getLanguage()

Returns the 'app_language' from config parameters

string
getBrowserEngine(Request $request)

Returns the browser engine from the user agent

string|null
formatParamValue(Parameter $param)

Formats a source parameter value

getDatasource(Source $source)

Returns the data source accessed by a source query

mixed
processSource(Source $source)

Process a source query and returns the result of that query.

void
populateChoiceWithSource(Data $data)

Populates the list of values of a data item of type choice from a data source.

void
populateChoice(Data $data, ChoiceSource $choiceSource)

Populates the list of values of a data item of type choice from a data source where columns are in the given ChoiceSource object.

string
replaceVariable(array $matches)

Returns the formatted value of the data item where the ID is in the first element of the given array.

RichText|string
replaceVariables(RichText|string $target)

Replaces all data ID by their corresponding value into the given text.

string
replaceDataTag(array $matches)

Prefix with a # and returns the prefixed ID of the data item where the ID is in the first element of the given array.

RichText|string
replaceDataTagByVariable(RichText|string $target)

Replaces all the html tag data containing the ID of a data item by # followed by the ID

string
replaceDfnTag(array $matches)

Composes a footnote reference string [text^ID(title)] with the elements of the given array.

RichText|string
replaceDfnTagByFootnote(RichText|string $target)

Replaces all the html tag dfn containing the ID of a footnote by [text^ID(title)]

string
replaceSpecialTags(string $target)

Replaces all the html tag dfn and data with their text equivalent

array
getWidgets()

Returns the list of available widgets.

array
getWidgetsByType()

Returns the list of available widgets by type (g6k type).

array
getWidgetsByInputType()

Returns the list of available widgets by form input type.

array
getFunctions()

Returns the label of available functions.

Data|null
getDataById(int $id)

Retrieves the Data object of a data item of the current simulator by its ID.

array|null
findAction(string $name, array $fromNode)

Retrieves an action node by its name in the actions tree from the supplied node

array|null
findActionField(array $fields, array $currentNode)

Retrieves an action field node in the given fields list for the given current option node

array|null
findActionOption(string $name, string $value, array $node)

Retrieves an action field option node by its value in the field list of the given action node

string|null
makeDateString(array $dateArray)

Makes a date string from an array [year, month, day], according to the date format.

String
getRelativePath(String $base, String $path)

Return a relative path to a file or directory using base directory.

bool
runConsoleCommand(array $command, array|null $report = null)

Run a console command.

StreamedResponse
runStreamedConsoleCommand(array $command, callable $start, callable $end)

Run a streamed console command.

bool
isDevelopmentEnvironment()

Determines whether the symfony kernel is in development mode or not.

string
getEnvironment()

Returns the current environment

Response
index(Request $request)

Entry point of the root path /admin

Response
runIndex(Request $request)

Prepare the administration interface homepage and renders it.

Details

in BaseAdminController at line 150
void __construct(TranslatorInterface $translator, KernelInterface $kernel, AuthorizationCheckerInterface $authorizationChecker, UserManagerInterface $userManager, FileUploader $fileUploader, Deployer $deployer, mixed $projectDir)

Constructor of class BaseAdminController

Parameters

TranslatorInterface $translator
KernelInterface $kernel
AuthorizationCheckerInterface $authorizationChecker
UserManagerInterface $userManager
FileUploader $fileUploader
Deployer $deployer
mixed $projectDir

Return Value

void

in BaseAdminController at line 169
protected Response errorResponse(array $form, string $error)

Returns a JSON response formed with the data of a form and an error message.

Parameters

array $form The form fields
string $error The error message

Return Value

Response

in BaseAdminController at line 189
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

Parameters

array $contents The array of contents to be compressed

See also

Official ZIP file format: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

in BaseAdminController at line 264
protected int unix2DosTime(int $unixtime = 0)

Converts unix time to MS DOS time

Parameters

int $unixtime (default: 0) The unix time

Return Value

int The MS DOS time

in ControllersTrait at line 66
protected void initialize()

Initialization of common directories

Return Value

void

in ControllersTrait at line 81
KernelInterface getKernel()

Returns the Symfony kernel

Return Value

KernelInterface $kernel The Symfony kernel

in ControllersTrait at line 92
TranslatorInterface getTranslator()

Returns the translator interface

Return Value

TranslatorInterface The translator interface

in ControllersTrait at line 103
bool hasParameter($parameters)

Checks if a parameter exists or not

Parameters

$parameters

Return Value

bool true the parameter exists, false otherwise

in ControllersTrait at line 119
string getLocale()

Returns the 'locale' from config parameters

Return Value

string The locale

in ControllersTrait at line 130
string getLanguage()

Returns the 'app_language' from config parameters

Return Value

string The app_language

in ControllersTrait at line 142
protected string getBrowserEngine(Request $request)

Returns the browser engine from the user agent

Parameters

Request $request the active request

Return Value

string The browser engine

in ControllersTrait at line 187
protected string|null formatParamValue(Parameter $param)

Formats a source parameter value

Parameters

Parameter $param The source parameter

Return Value

string|null The formatted value

in ControllersTrait at line 247
protected DataSource getDatasource(Source $source)

Returns the data source accessed by a source query

Parameters

Source $source The source

Return Value

DataSource The data source

in ControllersTrait at line 265
mixed processSource(Source $source)

Process a source query and returns the result of that query.

Parameters

Source $source The source

Return Value

mixed The result of the query.

in ControllersTrait at line 442
void populateChoiceWithSource(Data $data)

Populates the list of values of a data item of type choice from a data source.

Parameters

Data $data &$data The data item of type choice

Return Value

void

in ControllersTrait at line 466
protected void populateChoice(Data $data, ChoiceSource $choiceSource)

Populates the list of values of a data item of type choice from a data source where columns are in the given ChoiceSource object.

Parameters

Data $data &$data The data item of type choice
ChoiceSource $choiceSource The given ChoiceSource object

Return Value

void

in ControllersTrait at line 505
protected string replaceVariable(array $matches)

Returns the formatted value of the data item where the ID is in the first element of the given array.

If the second element of the given array is 'L' and if the data item is a choice, the label is returned instead of the value.

Parameters

array $matches The given array

Return Value

string The formatted value of the data item

in ControllersTrait at line 559
RichText|string replaceVariables(RichText|string $target)

Replaces all data ID by their corresponding value into the given text.

Parameters

RichText|string $target The target text

Return Value

RichText|string The result text

in ControllersTrait at line 587
protected string replaceDataTag(array $matches)

Prefix with a # and returns the prefixed ID of the data item where the ID is in the first element of the given array.

Parameters

array $matches The given array

Return Value

string The prefixed ID

in ControllersTrait at line 604
RichText|string replaceDataTagByVariable(RichText|string $target)

Replaces all the html tag data containing the ID of a data item by # followed by the ID

Parameters

RichText|string $target The target text

Return Value

RichText|string The result text

in ControllersTrait at line 627
protected string replaceDfnTag(array $matches)

Composes a footnote reference string [text^ID(title)] with the elements of the given array.

Parameters

array $matches The given array

Return Value

string The footnote reference string

in ControllersTrait at line 643
RichText|string replaceDfnTagByFootnote(RichText|string $target)

Replaces all the html tag dfn containing the ID of a footnote by [text^ID(title)]

Parameters

RichText|string $target The target text

Return Value

RichText|string The result text

in ControllersTrait at line 666
string replaceSpecialTags(string $target)

Replaces all the html tag dfn and data with their text equivalent

Parameters

string $target The target text

Return Value

string The result text

in ControllersTrait at line 679
array getWidgets()

Returns the list of available widgets.

Return Value

array The list of available widgets

in ControllersTrait at line 696
array getWidgetsByType()

Returns the list of available widgets by type (g6k type).

Return Value

array The list of available widgets

in ControllersTrait at line 726
array getWidgetsByInputType()

Returns the list of available widgets by form input type.

Return Value

array The list of available widgets

in ControllersTrait at line 756
array getFunctions()

Returns the label of available functions.

Return Value

array The label of available functions

in ControllersTrait at line 783
Data|null getDataById(int $id)

Retrieves the Data object of a data item of the current simulator by its ID.

Parameters

int $id The ID of the data item.

Return Value

Data|null The Data object

in ControllersTrait at line 796
array|null findAction(string $name, array $fromNode)

Retrieves an action node by its name in the actions tree from the supplied node

Parameters

string $name The name of the action
array $fromNode The supplied node

Return Value

array|null The action node

in ControllersTrait at line 814
array|null findActionField(array $fields, array $currentNode)

Retrieves an action field node in the given fields list for the given current option node

Parameters

array $fields The fields list
array $currentNode The current option node

Return Value

array|null The action field node

in ControllersTrait at line 837
array|null findActionOption(string $name, string $value, array $node)

Retrieves an action field option node by its value in the field list of the given action node

Parameters

string $name The field name
string $value The option value
array $node The action node

Return Value

array|null The action field option node

in ControllersTrait at line 860
protected string|null makeDateString(array $dateArray)

Makes a date string from an array [year, month, day], according to the date format.

Parameters

array $dateArray The given array

Return Value

string|null The date string

in ControllersTrait at line 898
private String getRelativePath(String $base, String $path)

Return a relative path to a file or directory using base directory.

Parameters

String $base A base path used to construct relative path. For example /website
String $path A full path to file or directory used to construct relative path. For example /website/store/library.php

Return Value

String

in ControllersTrait at line 916
private bool runConsoleCommand(array $command, array|null $report = null)

Run a console command.

Parameters

array $command The command
array|null $report &$report An array for receiving the output of the command

Return Value

bool

in ControllersTrait at line 954
private StreamedResponse runStreamedConsoleCommand(array $command, callable $start, callable $end)

Run a streamed console command.

Parameters

array $command The command
callable $start a callback function to be called at the begining of the stream
callable $end a callback function to be called at the end of the stream

Return Value

StreamedResponse

in ControllersTrait at line 980
bool isDevelopmentEnvironment()

Determines whether the symfony kernel is in development mode or not.

Return Value

bool true if the symfony kernel is in development mode, false otherwise

in ControllersTrait at line 991
string getEnvironment()

Returns the current environment

Return Value

string The first letters of the current environment

at line 61
Response index(Request $request)

Entry point of the root path /admin

Parameters

Request $request The request

Return Value

Response The administration interface homepage in a Response object

at line 75
protected Response runIndex(Request $request)

Prepare the administration interface homepage and renders it.

Parameters

Request $request The request

Return Value

Response The administration interface homepage in a Response object