ControllersTrait
trait ControllersTrait
This class implements common functions needed in G6KBundle controllers.
Methods
Initialization of common directories
Returns the Symfony kernel
Returns the translator interface
Checks if a parameter exists or not
Returns the 'locale' from config parameters
Returns the 'app_language' from config parameters
Returns the browser engine from the user agent
Populates the list of values of a data item of type choice from a data source.
Populates the list of values of a data item of type choice from a data source where columns are in the given ChoiceSource object.
Returns the formatted value of the data item where the ID is in the first element of the given array.
Replaces all data ID by their corresponding value into the given text.
Prefix with a # and returns the prefixed ID of the data item where the ID is in the first element of the given array.
Replaces all the html tag data containing the ID of a data item by # followed by the ID
Composes a footnote reference string [text^ID(title)] with the elements of the given array.
Replaces all the html tag dfn containing the ID of a footnote by [text^ID(title)]
Replaces all the html tag dfn and data with their text equivalent
Returns the list of available widgets.
Returns the list of available widgets by type (g6k type).
Returns the list of available widgets by form input type.
Returns the label of available functions.
Retrieves the Data object of a data item of the current simulator by its ID.
Retrieves an action node by its name in the actions tree from the supplied node
Retrieves an action field node in the given fields list for the given current option node
Retrieves an action field option node by its value in the field list of the given action node
Makes a date string from an array [year, month, day], according to the date format.
Return a relative path to a file or directory using base directory.
Run a console command.
Run a streamed console command.
Determines whether the symfony kernel is in development mode or not.
Returns the current environment
Details
at line 66
protected void
initialize()
Initialization of common directories
at line 81
KernelInterface
getKernel()
Returns the Symfony kernel
at line 92
TranslatorInterface
getTranslator()
Returns the translator interface
at line 103
bool
hasParameter($parameters)
Checks if a parameter exists or not
at line 119
string
getLocale()
Returns the 'locale' from config parameters
at line 130
string
getLanguage()
Returns the 'app_language' from config parameters
at line 142
protected string
getBrowserEngine(Request $request)
Returns the browser engine from the user agent
at line 187
protected string|null
formatParamValue(Parameter $param)
Formats a source parameter value
at line 247
protected DataSource
getDatasource(Source $source)
Returns the data source accessed by a source query
at line 265
mixed
processSource(Source $source)
Process a source query and returns the result of that query.
at line 442
void
populateChoiceWithSource(Data $data)
Populates the list of values of a data item of type choice from a data source.
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.
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.
at line 559
RichText|string
replaceVariables(RichText|string $target)
Replaces all data ID by their corresponding value into the given text.
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.
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
at line 627
protected string
replaceDfnTag(array $matches)
Composes a footnote reference string [text^ID(title)] with the elements of the given array.
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)]
at line 666
string
replaceSpecialTags(string $target)
Replaces all the html tag dfn and data with their text equivalent
at line 679
array
getWidgets()
Returns the list of available widgets.
at line 696
array
getWidgetsByType()
Returns the list of available widgets by type (g6k type).
at line 726
array
getWidgetsByInputType()
Returns the list of available widgets by form input type.
at line 756
array
getFunctions()
Returns the label of available functions.
at line 783
Data|null
getDataById(int $id)
Retrieves the Data object of a data item of the current simulator by its ID.
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
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
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
at line 860
protected string|null
makeDateString(array $dateArray)
Makes a date string from an array [year, month, day], according to the date format.
at line 898
private String
getRelativePath(String $base, String $path)
Return a relative path to a file or directory using base directory.
at line 916
private bool
runConsoleCommand(array $command, array|null $report = null)
Run a console command.
at line 954
private StreamedResponse
runStreamedConsoleCommand(array $command, callable $start, callable $end)
Run a streamed console command.
at line 980
bool
isDevelopmentEnvironment()
Determines whether the symfony kernel is in development mode or not.
at line 991
string
getEnvironment()
Returns the current environment