class SimulatorsAdminController extends BaseAdminController

The SimulatorsAdminController class is the controller that handles all actions of the simulator management interface.

These actions are:

  • Creation of a simulator
  • Modification of a simulator
  • Import / Export of a simulator
  • Publication of a simulator
  • Deletion of a simulator

Traits

This class implements common functions needed in G6KBundle controllers.

Constants

SQL_SELECT_KEYWORD

SQL_FROM_KEYWORD

SQL_WHERE_KEYWORD

SQL_ORDER_BY_KEYWORD

SQL_LIMIT_KEYWORD

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
Simulator|null $simu
private array $dataset
private array $actions
private array $rules
private array $steps
array $uricache

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

RedirectResponse|Response
index(Request $request, string|null $simulator = null, string|null $crud = null)

Entry point for the route paths begining by /admin/simulators

RedirectResponse|Response
runIndex(Request $request, string $simulator, string $crud)

Dispatches the index action to the appropriate processing based on the value of the crud parameter.

Response
regionalSettings(Request $request, string $locale)

Entry point for the route path /admin/regional-settings/{locale}

Response
validate(Request $request)

Entry point for the route path : /admin/validate

Response
runValidation(Request $request)

Validates the xml file of the simulator, whose name appears in the 'xml' field of the form passed by the query, against the XML schema

RedirectResponse
doCreate(string $simulator, array $form)

Creates a simulator with the data in the form fields.

void
update(string $simulator, mixed $form)

Updates the simulator whose name is in the $simulator parameter with the data in the form fields.

void
doDelete(string $simulator)

Deletes a simulator whose name is in the $simulator parameter

void
doRename(string $oldName, string $newName)

Renames a simulator

void
doDeleteWorkingVersion(string $simulator)

Deletes a simulator whose name is in the $simulator parameter

makeSource(array $source)

Creates a Source object from an associative array of source attributes

makeParameter(array $parameter, Source $sourceObj)

Creates a Parameter object for a Source from an associative array of parameter attributes

makeDataGroup(array $datagroup)

Creates a DataGroup object from an associative array of datagroup attributes

makeData(array $data)

Creates a Data object from an associative array of data attributes

makeStep(array $step)

Creates a Step object from an associative array of step attributes

makePanel(array $panel, Step $stepObj)

Creates a Panel object for a Step from an associative array of panel attributes

makeFieldSet(array $fieldset, Panel $panelObj)

Creates a FieldSet object for a Panel from an associative array of fieldset attributes

makeFieldRow(array $fieldrow, FieldSet $fieldsetObj)

Creates a FieldRow object for a FieldSet from an associative array of fieldrow attributes

makeField(array $field, FieldSet $fieldsetObj)

Creates a Field object for a FieldSet from an associative array of field attributes

makeBlockInfo(array $blockinfo, Panel $panelObj)

Creates a BlockInfo object for a Panel from an array associative of blockinfo attributes

makeChapter(array $chapter, BlockInfo $blockinfoObj)

Creates a Chapter object for a BlockInfo from an associative array of chapter attributes

makeSection(array $section, Chapter $chapterObj)

Creates a Section object for a Chapter from an associative array of section attributes

makeBusinessRule(array $brule)

Creates a BusinessRule object from an associative array of business rule attributes

makeRuleAction(int $id, array $action)

Creates a RuleAction object from an associative array of action attributes

makeProfiles(array $profiles)

Creates a Profiles object from an associative array of profiles attributes

makeProfile(array $profile)

Creates a Profile object from an associative array of profile attributes

makeAction(array $action, Step $stepObj)

Creates an Action button object for a Step from an associative array of action attributes

string
composeSimpleSQLRequest(array $source)

Composes a simple SQL request from the supplied elements in the source associative array

loadConnector(array $connector, Connector $parentConnector = null)

Creates a Connector or a Condition object from an associative array of attributes

Response
doExportSimulator(string $simu)

Exports a simulator

string
makeReportHeader(Request $request, string $simu, string $heading)

Makes the header for an action report

string
makeReportFooter(Request $request, string $simu)

Makes the footer for an action report

StreamedResponse
doPublishSimulator(Request $request, string $simu)

Publishes a simulator ie copies the xml file of the simulator from the work directory to the main directory of simulators

StreamedResponse
doDeploySimulator(Request $request, string $simu)

Deploys a simulator on front-end servers

StreamedResponse
doImportSimulator(Request $request)

Imports a simulator by copying the uploaded definition xml file into the main simulator directory as well as the css file into the css directory of the default view if this file is uploaded by the user.

string
makeCond(array $val)

Constructs a condition in a string from an associative array containing the name, operator and value of the condition.

string
conjonct(array $conds)

Converts an array of conditions connected with the connector 'all' to a string expression in conjunctive form

string
disjonct(array $conds)

Converts an array of conditions connected with the connector 'any' to a string expression in disjunctive form

string
infix(array $conds)

Converts a boolean expression from an array to an infixed string

void
loadBusinessRules()

Load business rules

array
loadBusinessRuleField(Field $field)

makes an array of attributes of the field from the field object

array
actionsData(int $ruleID, array $actions)

Builds an actions data array for the Javascript rule engine

string
findDisposition(RuleAction $action)

Finds the disposition of a fieldset where one of the elements is the target of a rule action

array
makeClause(array $fields)

Makes a clause from the fields of a rule cation

RichText|string
paragraphs(RichText|string $string)

Transforms the lines of a text into html paragraphs

string|null
findDataNameById(int $id)

Searches for the name of a data in the dataset from its identifier

array
getLocales()

Returns the available locales of the server

array
getLanguages()

Returns the languages for the current locale

array
getTimezones(string $locale)

Returns the time zones for the given locale

array
getCurrencySymbols()

Returns all the currency symbols

array
getRegionalSettings(string $locale)

Returns the regional settings for the given locale

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 177
RedirectResponse|Response index(Request $request, string|null $simulator = null, string|null $crud = null)

Entry point for the route paths begining by /admin/simulators

These route paths are :

  • /admin/simulators
  • /admin/simulators/{simulator}
  • /admin/simulators/{simulator}/{crud}

Parameters

Request $request The request
string|null $simulator (default: null) simulator name
string|null $crud (default: null) operation to execute on the simulator (create, save, import, doimport, export, publish)

Return Value

RedirectResponse|Response

at line 196
protected RedirectResponse|Response runIndex(Request $request, string $simulator, string $crud)

Dispatches the index action to the appropriate processing based on the value of the crud parameter.

If the crud parameter contains no value, shows the simulator management interface.

Parameters

Request $request The request
string $simulator simulator name
string $crud (default: null) operation to execute on the simulator (create, save, import, doimport, export, publish)

Return Value

RedirectResponse|Response

at line 485
Response regionalSettings(Request $request, string $locale)

Entry point for the route path /admin/regional-settings/{locale}

Parameters

Request $request The request
string $locale

Return Value

Response The regional settings in json format

at line 505
Response validate(Request $request)

Entry point for the route path : /admin/validate

Validates the xml file of the simulator against the XML schema.

Parameters

Request $request The request

Return Value

Response

at line 518
protected Response runValidation(Request $request)

Validates the xml file of the simulator, whose name appears in the 'xml' field of the form passed by the query, against the XML schema

Parameters

Request $request The request

Return Value

Response

at line 564
protected RedirectResponse doCreate(string $simulator, array $form)

Creates a simulator with the data in the form fields.

Route path : /admin/simulators/{simulator}/save

$form['create'] isset

Parameters

string $simulator simulator name
array $form The form fields

Return Value

RedirectResponse

at line 584
protected void update(string $simulator, mixed $form)

Updates the simulator whose name is in the $simulator parameter with the data in the form fields.

Route path : /admin/simulators/{simulator}/save

$form['update'] isset

Parameters

string $simulator simulator name
mixed $form The form fields

Return Value

void

at line 690
protected void doDelete(string $simulator)

Deletes a simulator whose name is in the $simulator parameter

Route path : /admin/simulators/{simulator}/delete

Parameters

string $simulator simulator name

Return Value

void

at line 719
protected void doRename(string $oldName, string $newName)

Renames a simulator

Parameters

string $oldName old name
string $newName new name

Return Value

void

at line 758
protected void doDeleteWorkingVersion(string $simulator)

Deletes a simulator whose name is in the $simulator parameter

Route path : /admin/simulators/{simulator}/delete-working-version

or /admin/simulators/{simulator}/save and $form['delete'] isset

Parameters

string $simulator simulator name

Return Value

void

at line 776
protected Source makeSource(array $source)

Creates a Source object from an associative array of source attributes

Parameters

array $source array of attributes

Return Value

Source the Source object

at line 815
protected Parameter makeParameter(array $parameter, Source $sourceObj)

Creates a Parameter object for a Source from an associative array of parameter attributes

Parameters

array $parameter array of attributes
Source $sourceObj the Source object

Return Value

Parameter the Parameter object

at line 837
protected DataGroup makeDataGroup(array $datagroup)

Creates a DataGroup object from an associative array of datagroup attributes

Parameters

array $datagroup array of attributes

Return Value

DataGroup the DataGroup object

at line 860
protected Data makeData(array $data)

Creates a Data object from an associative array of data attributes

Parameters

array $data array of attributes

Return Value

Data the Data object

at line 926
protected Step makeStep(array $step)

Creates a Step object from an associative array of step attributes

Parameters

array $step array of attributes

Return Value

Step the Step object

at line 975
protected Panel makePanel(array $panel, Step $stepObj)

Creates a Panel object for a Step from an associative array of panel attributes

Parameters

array $panel array of attributes
Step $stepObj the Step object

Return Value

Panel the Panel object

at line 998
protected FieldSet makeFieldSet(array $fieldset, Panel $panelObj)

Creates a FieldSet object for a Panel from an associative array of fieldset attributes

Parameters

array $fieldset array of attributes
Panel $panelObj the Panel object

Return Value

FieldSet the FieldSet object

at line 1043
protected FieldRow makeFieldRow(array $fieldrow, FieldSet $fieldsetObj)

Creates a FieldRow object for a FieldSet from an associative array of fieldrow attributes

Parameters

array $fieldrow array of attributes
FieldSet $fieldsetObj the FieldSet object

Return Value

FieldRow the FieldRow object

at line 1064
protected Field makeField(array $field, FieldSet $fieldsetObj)

Creates a Field object for a FieldSet from an associative array of field attributes

Parameters

array $field array of attributes
FieldSet $fieldsetObj the FieldSet object

Return Value

Field the Field object

at line 1112
protected BlockInfo makeBlockInfo(array $blockinfo, Panel $panelObj)

Creates a BlockInfo object for a Panel from an array associative of blockinfo attributes

Parameters

array $blockinfo array of attributes
Panel $panelObj the Panel object

Return Value

BlockInfo the BlockInfo object

at line 1137
protected Chapter makeChapter(array $chapter, BlockInfo $blockinfoObj)

Creates a Chapter object for a BlockInfo from an associative array of chapter attributes

Parameters

array $chapter array of attributes
BlockInfo $blockinfoObj the BlockInfo object

Return Value

Chapter the Chapter object

at line 1158
protected Section makeSection(array $section, Chapter $chapterObj)

Creates a Section object for a Chapter from an associative array of section attributes

Parameters

array $section array of attributes
Chapter $chapterObj the Chapter object

Return Value

Section the Section object

at line 1187
protected BusinessRule makeBusinessRule(array $brule)

Creates a BusinessRule object from an associative array of business rule attributes

Parameters

array $brule array of attributes

Return Value

BusinessRule the BusinessRule object

at line 1216
protected RuleAction makeRuleAction(int $id, array $action)

Creates a RuleAction object from an associative array of action attributes

Parameters

int $id id of the latest rule action
array $action array of attributes

Return Value

RuleAction the RuleAction object

at line 1369
protected Profiles makeProfiles(array $profiles)

Creates a Profiles object from an associative array of profiles attributes

Parameters

array $profiles array of attributes

Return Value

Profiles the Profiles object

at line 1386
protected Profile makeProfile(array $profile)

Creates a Profile object from an associative array of profile attributes

Parameters

array $profile array of attributes

Return Value

Profile the Profile object

at line 1410
protected Action makeAction(array $action, Step $stepObj)

Creates an Action button object for a Step from an associative array of action attributes

Parameters

array $action array of attributes
Step $stepObj the Step object

Return Value

Action the Action object

at line 1429
private string composeSimpleSQLRequest(array $source)

Composes a simple SQL request from the supplied elements in the source associative array

Parameters

array $source

Return Value

string the SQL request string

at line 1482
private Connector|Condition loadConnector(array $connector, Connector $parentConnector = null)

Creates a Connector or a Condition object from an associative array of attributes

If the array contains the key 'all', 'any' or 'none' then a Connector object is returned else a Condition object is returned.

Parameters

array $connector array of attributes
Connector $parentConnector (default: null) Parent connector

Return Value

Connector|Condition

at line 1513
protected Response doExportSimulator(string $simu)

Exports a simulator

Route path : /admin/simulators/{simulator}/export

Creates a compressed file containing the XML definition and the stylesheet of the simulator for downloading by the user. The XML file is the working version if it exists otherwise it is the published version.

Parameters

string $simu simulator name

Return Value

Response

at line 1579
protected string makeReportHeader(Request $request, string $simu, string $heading)

Makes the header for an action report

Parameters

Request $request
string $simu The name of the simulator
string $heading The title of the header

Return Value

string

at line 1615
protected string makeReportFooter(Request $request, string $simu)

Makes the footer for an action report

Parameters

Request $request
string $simu The name of the simulator

Return Value

string

at line 1640
protected StreamedResponse doPublishSimulator(Request $request, string $simu)

Publishes a simulator ie copies the xml file of the simulator from the work directory to the main directory of simulators

Route path : /admin/simulators/{simulator}/publish

Parameters

Request $request The request
string $simu simulator name

Return Value

StreamedResponse

at line 1687
protected StreamedResponse doDeploySimulator(Request $request, string $simu)

Deploys a simulator on front-end servers

Route path : /admin/simulators/{simulator}/deploy

Parameters

Request $request
string $simu The name of the simulator to deploy

Return Value

StreamedResponse

at line 1729
protected StreamedResponse doImportSimulator(Request $request)

Imports a simulator by copying the uploaded definition xml file into the main simulator directory as well as the css file into the css directory of the default view if this file is uploaded by the user.

Before copying, the file is validated against the xml schema and if there is an error, a Response object is generated with the error message returned by the validator.

If a css file is not provided and it does not already exist in the view directory, a css file is created by importing common.css from the 'Demo' view.

Route path : /admin/simulators/{simulator}/doimport

Parameters

Request $request

Return Value

StreamedResponse

at line 1834
private string makeCond(array $val)

Constructs a condition in a string from an associative array containing the name, operator and value of the condition.

Parameters

array $val Name, operator and value of the condition

Return Value

string The condition

at line 1876
private string conjonct(array $conds)

Converts an array of conditions connected with the connector 'all' to a string expression in conjunctive form

Parameters

array $conds The array of conditions

Return Value

string The string expression in conjunctive form

at line 1908
private string disjonct(array $conds)

Converts an array of conditions connected with the connector 'any' to a string expression in disjunctive form

Parameters

array $conds The array of conditions

Return Value

string The string expression in disjunctive form

at line 1976
private string infix(array $conds)

Converts a boolean expression from an array to an infixed string

Conversion example:

$conds = array(
    'any' => array(
        array(
            'all' => array(
                array(
                    'name' => 'income',
                    'operator' => '>=',
                    'value' => 2000
                 ),
                 array(
                    'name' => 'rate',
                    'operator' => '>',
                    'value' => 15.5
                 )
            )
        ),
        array(
            'name' => 'nChildren',
            'operator' => '<',
            'value' => 5
        )
    )
);

is converted to:

"(#1 >= 2000 && #2 > 15.5) || #3 < 5"

where :

  • #1 is the id of the data whose name is 'income' prefixed by #
  • #2 is the id of the data whose name is 'rate' prefixed by #
  • #3 is the id of the data whose name is 'nChildren' prefixed by #

Parameters

array $conds The array of boolean expression

Return Value

string The infixed expression

at line 2001
protected void loadBusinessRules()

Load business rules

Return Value

void

at line 3573
protected array loadBusinessRuleField(Field $field)

makes an array of attributes of the field from the field object

Parameters

Field $field The field object

Return Value

array Array of attributes of the field

at line 3604
private array actionsData(int $ruleID, array $actions)

Builds an actions data array for the Javascript rule engine

Parameters

int $ruleID rule ID
array $actions array of RuleAction objects

Return Value

array The actions data array

at line 3817
private string findDisposition(RuleAction $action)

Finds the disposition of a fieldset where one of the elements is the target of a rule action

Parameters

RuleAction $action The rule action

Return Value

string

at line 3832
private array makeClause(array $fields)

Makes a clause from the fields of a rule cation

Parameters

array $fields The fields of the rule action

Return Value

array

at line 3850
private RichText|string paragraphs(RichText|string $string)

Transforms the lines of a text into html paragraphs

Parameters

RichText|string $string

Return Value

RichText|string

at line 3883
private string|null findDataNameById(int $id)

Searches for the name of a data in the dataset from its identifier

Parameters

int $id data id

Return Value

string|null data name

at line 3899
private array getLocales()

Returns the available locales of the server

Return Value

array The available locales

at line 3922
array getLanguages()

Returns the languages for the current locale

Return Value

array The available languages

at line 3955
array getTimezones(string $locale)

Returns the time zones for the given locale

Parameters

string $locale The given locale

Return Value

array The time zones

at line 3972
array getCurrencySymbols()

Returns all the currency symbols

Return Value

array The currency symbols

at line 3992
array getRegionalSettings(string $locale)

Returns the regional settings for the given locale

Parameters

string $locale The given locale

Return Value

array The regional settings