class Simulator

This class allows the storage and retrieval of the attributes of a simulator.

Properties

private BaseController|BaseAdminController $controller
private string|int $name
private string $label
private string $category
private string $defaultView
private string $referer
private bool $dynamic
private bool $memo
private string $locale
private RichText $description
private string $dateFormat
private string $timezone
private string $decimalPoint
private string $groupingSeparator
private string $groupingSize
private string $moneySymbol
private string $symbolPosition
private array $datas
private Profiles $profiles
private array $steps
private array $sites
private array $databases
private array $datasources
private array $sources
private array $businessrules
private RichText $relatedInformations
private string $dependencies
private bool $error
private array $errorMessages
private bool $warning
private array $warningMessages

Methods

void
__construct(BaseController|BaseAdminController $controller)

Constructor of class Simulator

getController()

Returns the Controller Object that uses this Simulator object.

string|int
getName()

Returns the name of this simulator

void
setName(string|int $name)

Sets the name of this simulator

string
getLabel()

Returns the label of this simulator

void
setLabel(string $label)

Sets the label of this simulator

string
getCategory()

Returns the category of this simulator

void
setCategory(string $category)

Sets the category of this simulator

string
getReferer()

Returns the URL of the site page (main referer) that calls this simulator

void
setReferer(string $referer)

Sets the URL of the site page (main referer) that calls this simulator

string
getDefaultView()

Returns the name of the default view with which this simulator will be displayed

void
setDefaultView(string $defaultView)

Sets the name of the default view with which this simulator will be displayed

bool
isDynamic()

Returns the dynamic attribute of this simulator.

bool
getDynamic()

Returns the dynamic attribute of this simulator.

void
setDynamic(bool $dynamic)

Determines whether this simulator is dynamic (interactive) or not.

bool
isMemo()

Returns the memo attribute of this simulator. Alias of the getMemo method.

bool
hasMemo()

Returns the memo attribute of this simulator. Alias of the getMemo method.

bool
getMemo()

Returns the memo attribute of this simulator.

void
setMemo(bool $memo)

Determines whether the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use or not.

string
getLocale()

Returns the locale attribute of this simulator.

void
setLocale(string $locale)

Sets the locale attribute of this simulator.

getDescription()

Returns the description of this simulator

void
setDescription(RichText $description)

Sets the description of this simulator

string
getDateFormat()

Returns the date format in the display language of this simulator

void
setDateFormat(string $dateFormat)

Sets the date format in the display language of this simulator

string
getTimezone()

Returns the timezone for the locale used in this simulator

void
setTimezone(string $timezone)

Sets the timezone for the locale used in this simulator

string
getDecimalPoint()

Returns the timezone for the locale used in this simulator

void
setDecimalPoint(string $decimalPoint)

Sets the decimal point in the display language of this simulator

string
getGroupingSeparator()

Returns the grouping separator in the display language of this simulator

void
setGroupingSeparator(string $groupingSeparator)

Sets the grouping separator in the display language of this simulator

string
getGroupingSize()

Returns the grouping size in the display language of this simulator

void
setGroupingSize(string $groupingSize)

Sets the grouping size in the display language of this simulator

string
getMoneySymbol()

Returns the currency symbol in the country of use of this simulator

void
setMoneySymbol(string $moneySymbol)

Sets the currency symbol in the country of use of this simulator

string
getSymbolPosition()

Returns the position of the currency symbol relative to the amount in the country of use of this simulator

void
setSymbolPosition(string $symbolPosition)

Sets the position of the currency symbol relative to the amount in the country of use of this simulator

array
getDatas()

Returns the list of data used by this simulator.

void
setDatas(array $datas)

Sets the list of data used by this simulator.

void
addData(DatasetChild $data)

Adds a DatasetChild object in the list of data used by this simulator.

void
removeData(int $index)

Removes a DatasetChild object from the list of data used by this simulator.

Data|null
getDataById(int $id)

Retrieves a Data object by its ID

Data|null
getDataByName(string $name)

Retrieves a Data object by its name

DataGroup|null
getDataGroupById(int $id)

Retrieves a DataGroup object by its ID

DataGroup|null
getDataGroupByName(string $name)

Retrieves a DataGroup object by its name

getProfiles()

Returns the profiles container used in this simulator

void
setProfiles(Profiles $profiles)

Sets the profiles container used in this simulator

array
getSteps()

Returns the list of simulation steps defined by this simulator.

void
setSteps(array $steps)

Sets the list of simulation steps defined by this simulator.

void
addStep(Step $step)

Adds a Step object in the list of steps defined by this simulator.

void
removeStep(int $index)

Removes a Step object from the list of steps defined by this simulator.

Step|null
getStepById(int $id)

Retrieves a Step object by its ID

Step|null
getStepByName(string $name)

Retrieves a Step object by its name

array
getSources()

Returns the list of used sources by this simulator.

void
setSources(array $sources)

Sets the list of used sources by this simulator.

void
addSource(Source $source)

Adds a Source object in the list of used sources by this simulator.

void
removeSource(int $index)

Removes a Source object from the list of used sources by this simulator.

array
getBusinessRules()

Returns the list of business rules implemented by this simulator

void
setBusinessRules(array $businessrules)

Sets the list of business rules implemented by this simulator

void
addBusinessRule(BusinessRule $businessrules)

Adds a BusinessRule object in the list of business rules implemented by this simulator

void
removeBusinessRule(int $index)

Removes a BusinessRule object from the list of business rules implemented by this simulator

getBusinessRuleById(int $id)

Retrieves a BusinessRule object by its ID

getRelatedInformations()

Returns the informations related to this simulator.

void
setRelatedInformations(RichText $relatedInformations)

Sets the informations related to this simulator.

Site|null
getSiteById(int $id)

Retrieves a Site object by its ID

Database|null
getDatabaseById(int $id)

Retrieves a Database object by its ID

DataSource|null
getDatasourceById(int $id)

Retrieves a DataSource object by its ID

DataSource|null
getDatasourceByName(string $name)

Retrieves a DataSource object by its name

Source|null
getSourceById(int $id)

Retrieves a Source object by its ID

bool
isWarning()

Returns the warning attribute of this simulator

bool
getWarning()

Returns the warning attribute of this simulator

void
setWarning(bool $warning)

Determines whether an warning has been issued or not

array
getWarningMessages()

Returns the list of warning messages

void
setWarningMessages(array $warningMessages)

Sets the list list of warning messages

void
addWarningMessage(string $warningMessage)

Adds a warning message to the list of warning messages

void
removeWarningMessage(int $index)

Removes a warning message from the list of warning messages

bool
isError()

Returns the error attribute of this simulator

bool
getError()

Returns the error attribute of this simulator

void
setError(bool $error)

Determines whether an error has been detected or not

array
getErrorMessages()

Returns the list of error messages

void
setErrorMessages(array $errorMessages)

Sets the list of error messages

void
addErrorMessage(string $errorMessage)

Adds an error message to the list of error messages

void
removeErrorMessage(int $index)

Removes an error message from the list of error messages.

string
replaceIdByDataLabel(array $matches)

Returns the label (inside a HTML data) of a data item whose ID is the first element of the given array.

RichText|string
replaceByDataLabel(RichText|string $target)

Replaces, into the given text, the ID (prefixed with #) of all data by their label inside a HTML data.

string
replaceByDfnTag(array $matches)

Returns a HTML dfn tag with the elements of the given array.

RichText|string
replaceByFootnoteTag(RichText|string $target)

Replaces, into the given text, the footnote reference pattern string by the HTML dfn tag.

string
replaceBySpecialTags(string $target)

Replaces all special patterns by the corresponding html tag (data or dfn)

loadData(SimpleXMLElement $data)

Loads into a Data object, the data item extracted from the XML file of this simulator

void
load(string $url)

Loads the XML definition file of the simulator into this Simulator object.

void
loadEntities(SimpleXMLElement $simulator, SimpleXMLElement $datasources)

Loads the entities (elements) of the XML definition files of the simulator and data sources into this Simulator object.

loadField(SimpleXMLElement $field, FieldSet $fieldsetObj)

Loads into a Field object, the field extracted from the XML file of this simulator

loadRuleAction(SimpleXMLElement $action)

Loads into a RuleAction object, the business rule action extracted from the XML file of this simulator

void
loadSources(SimpleXMLElement $sources)

Loads into Source and Parameter objects, all the used sources extracted from the XML file of this simulator

void
loadDatabases(SimpleXMLElement $databases)

Loads into Database objects, all the databases declaration extracted from DataSources.xml

loadConnector(SimpleXMLElement $connector, Connector|null $parentConnector = null)

Loads into a Connector or a Condition object, the business rule connector extracted from the XML file of this simulator

void
loadForSource(string $url)

Loads Data, DataSource, Source objects in response of the Ajax request using route path : /{simu}/Default/source

string
addDependency(array $matches)

Adds a dependency for the data item whose ID is in the first element of the given array

string
addNoteDependency(array $matches)

Adds a note (field pre-note, field post-note, footnote) dependency for the data item is in the first element of the given array

string
replaceDataIdByName(array $matches)

Returns the name surrounded by '#(' and ')' of the data item whose ID is in the first element of the given array

string
replaceIdByName(string $target)

Replaces, into the given text, the ID (prefixed with # or inside a HTML data) of all data by their name surrounded by '#(' and ')'.

string
replaceIdByDataName(array $matches)

Returns the name of the data item whose ID is in the first element of the given array

string
replaceByDataName(string $target)

Replaces, into the given text, the ID (prefixed with # or inside a HTML data) of all data by their name.

RichText|string
paragraphs(RichText|string $string)

Converts the lines of the given text into HTML paragraphs

array
fieldProperties(SimpleXMLElement $field)

Converts a field extracted from the XML file of this simulator into an associative array for encoding in JSON format.

void
toJSONData(SimpleXMLElement $data, array $sources)

Converts a data item extracted from the XML file of this simulator into an associative array for encoding in JSON format.

array
actionData(int $ruleID, SimpleXMLElement $action, array $dataset)

Converts to an associative array representing one action (in the "then" part or the the "else" part) of a business rule extracted from the XML file.

string
toJSON(string $url, int $stepId = 0)

Converts the XML definition file of this simulator to JSON for use in Javascript for the given step.

array
ruleConnector(SimpleXMLElement $pconnector)

Converts a condition connector for a business rule extracted from the XML file into an associative array.

string
cleanRichText(RichText $richtext = null)

Cleans the text produced with the Javascript component "bootstrap3-wysihtml5" for its registration in the XML file of definition of this simulator

void
save(string $file)

Converts this Simulator object into an XML string and saves it to a file with the provided path.

string
makeRuleActionAttributes(RuleAction $action)

Converts the properties of a RuleAction object into an XML attributes string

void
saveConnector(Connector|Condition $connector, string $indent, array $xml)

Converts a Connector or Condition object to XML strings and inserts it into an array of indented lines

string
loadFileFromCache(string $url)

Loads an XML file from the APC cache

void
loadEmptySimulator()

Loads a simulator XML definition skeleton into this Simulator object.

Details

at line 300
void __construct(BaseController|BaseAdminController $controller)

Constructor of class Simulator

Parameters

BaseController|BaseAdminController $controller The controller that uses this Simulator object

Return Value

void

at line 315
BaseController|BaseAdminController getController()

Returns the Controller Object that uses this Simulator object.

Return Value

BaseController|BaseAdminController The Controller Object that uses this Simulator object

at line 326
string|int getName()

Returns the name of this simulator

Return Value

string|int The name of this simulator

at line 338
void setName(string|int $name)

Sets the name of this simulator

Parameters

string|int $name The name of this simulator

Return Value

void

at line 349
string getLabel()

Returns the label of this simulator

Return Value

string The label of this simulator

at line 361
void setLabel(string $label)

Sets the label of this simulator

Parameters

string $label The label of this simulator

Return Value

void

at line 372
string getCategory()

Returns the category of this simulator

Return Value

string The category of this simulator

at line 384
void setCategory(string $category)

Sets the category of this simulator

Parameters

string $category The category of this simulator

Return Value

void

at line 395
string getReferer()

Returns the URL of the site page (main referer) that calls this simulator

Return Value

string The URL of the site page

at line 407
void setReferer(string $referer)

Sets the URL of the site page (main referer) that calls this simulator

Parameters

string $referer The URL of the site page

Return Value

void

at line 418
string getDefaultView()

Returns the name of the default view with which this simulator will be displayed

Return Value

string The name of the default view

at line 430
void setDefaultView(string $defaultView)

Sets the name of the default view with which this simulator will be displayed

Parameters

string $defaultView The name of the default view

Return Value

void

at line 441
bool isDynamic()

Returns the dynamic attribute of this simulator.

Return Value

bool true if the simulation engine will use Javascript to give interactivity to the simulation, false otherwise

at line 452
bool getDynamic()

Returns the dynamic attribute of this simulator.

Return Value

bool true if the simulation engine will use Javascript to give interactivity to the simulation, false otherwise

at line 464
void setDynamic(bool $dynamic)

Determines whether this simulator is dynamic (interactive) or not.

Parameters

bool $dynamic true if the simulation engine will use Javascript to give interactivity to the simulation, false otherwise

Return Value

void

at line 475
bool isMemo()

Returns the memo attribute of this simulator. Alias of the getMemo method.

Return Value

bool true if the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use.

at line 486
bool hasMemo()

Returns the memo attribute of this simulator. Alias of the getMemo method.

Return Value

bool true if the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use.

at line 497
bool getMemo()

Returns the memo attribute of this simulator.

Return Value

bool true if the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use.

at line 509
void setMemo(bool $memo)

Determines whether the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use or not.

Parameters

bool $memo true if the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use.

Return Value

void

at line 520
string getLocale()

Returns the locale attribute of this simulator.

Return Value

string true The locale attribute.

at line 532
void setLocale(string $locale)

Sets the locale attribute of this simulator.

Parameters

string $locale The locale attribute (en-US, en-GB, fr-FR, fr-CA, ...).

Return Value

void

at line 543
RichText getDescription()

Returns the description of this simulator

Return Value

RichText The description of this simulator

at line 555
void setDescription(RichText $description)

Sets the description of this simulator

Parameters

RichText $description The description of this simulator

Return Value

void

at line 567
string getDateFormat()

Returns the date format in the display language of this simulator

Return Value

string The value of dateFormat

See also

http://php.net/manual/fr/function.date.php for the special characters that are recognized in the format

at line 580
void setDateFormat(string $dateFormat)

Sets the date format in the display language of this simulator

Parameters

string $dateFormat The date format

Return Value

void

See also

http://php.net/manual/fr/function.date.php for the special characters that are recognized in the format

at line 592
string getTimezone()

Returns the timezone for the locale used in this simulator

Return Value

string The value of timezone

at line 604
void setTimezone(string $timezone)

Sets the timezone for the locale used in this simulator

Parameters

string $timezone The timezone

Return Value

void

at line 616
string getDecimalPoint()

Returns the timezone for the locale used in this simulator

Return Value

string The timezone

at line 628
void setDecimalPoint(string $decimalPoint)

Sets the decimal point in the display language of this simulator

Parameters

string $decimalPoint The decimal point

Return Value

void

at line 642
string getGroupingSeparator()

Returns the grouping separator in the display language of this simulator

Return Value

string The grouping separator

at line 654
void setGroupingSeparator(string $groupingSeparator)

Sets the grouping separator in the display language of this simulator

Parameters

string $groupingSeparator The grouping separator

Return Value

void

at line 668
string getGroupingSize()

Returns the grouping size in the display language of this simulator

Return Value

string The grouping size

at line 680
void setGroupingSize(string $groupingSize)

Sets the grouping size in the display language of this simulator

Parameters

string $groupingSize The grouping size

Return Value

void

at line 694
string getMoneySymbol()

Returns the currency symbol in the country of use of this simulator

Return Value

string The currency symbol

at line 706
void setMoneySymbol(string $moneySymbol)

Sets the currency symbol in the country of use of this simulator

Parameters

string $moneySymbol The currency symbol

Return Value

void

at line 718
string getSymbolPosition()

Returns the position of the currency symbol relative to the amount in the country of use of this simulator

Return Value

string the value of symbolPosition

at line 730
void setSymbolPosition(string $symbolPosition)

Sets the position of the currency symbol relative to the amount in the country of use of this simulator

Parameters

string $symbolPosition

Return Value

void

at line 742
array getDatas()

Returns the list of data used by this simulator.

Return Value

array The list of data

at line 754
void setDatas(array $datas)

Sets the list of data used by this simulator.

Parameters

array $datas The list of data

Return Value

void

at line 766
void addData(DatasetChild $data)

Adds a DatasetChild object in the list of data used by this simulator.

Parameters

DatasetChild $data The DatasetChild object

Return Value

void

at line 778
void removeData(int $index)

Removes a DatasetChild object from the list of data used by this simulator.

Parameters

int $index The index of the data item in the list of data.

Return Value

void

at line 790
Data|null getDataById(int $id)

Retrieves a Data object by its ID

Parameters

int $id The id of the Data object

Return Value

Data|null The Data object

at line 811
Data|null getDataByName(string $name)

Retrieves a Data object by its name

Parameters

string $name The name of the Data object

Return Value

Data|null The Data object

at line 835
DataGroup|null getDataGroupById(int $id)

Retrieves a DataGroup object by its ID

Parameters

int $id The id of the DataGroup object

Return Value

DataGroup|null The DataGroup object

at line 852
DataGroup|null getDataGroupByName(string $name)

Retrieves a DataGroup object by its name

Parameters

string $name The name of the DataGroup object

Return Value

DataGroup|null The DataGroup object

at line 868
Profiles getProfiles()

Returns the profiles container used in this simulator

Return Value

Profiles The profiles container

at line 880
void setProfiles(Profiles $profiles)

Sets the profiles container used in this simulator

Parameters

Profiles $profiles The profiles container

Return Value

void

at line 891
array getSteps()

Returns the list of simulation steps defined by this simulator.

Return Value

array The list of simulation steps.

at line 903
void setSteps(array $steps)

Sets the list of simulation steps defined by this simulator.

Parameters

array $steps The list of simulation steps.

Return Value

void

at line 915
void addStep(Step $step)

Adds a Step object in the list of steps defined by this simulator.

Parameters

Step $step The Step object

Return Value

void

at line 927
void removeStep(int $index)

Removes a Step object from the list of steps defined by this simulator.

Parameters

int $index The index of the step in the list of steps.

Return Value

void

at line 939
Step|null getStepById(int $id)

Retrieves a Step object by its ID

Parameters

int $id

Return Value

Step|null the value of stepById

at line 956
Step|null getStepByName(string $name)

Retrieves a Step object by its name

Parameters

string $name

Return Value

Step|null the value of stepById

at line 972
array getSources()

Returns the list of used sources by this simulator.

Return Value

array The list of used sources.

at line 984
void setSources(array $sources)

Sets the list of used sources by this simulator.

Parameters

array $sources The list of used sources.

Return Value

void

at line 996
void addSource(Source $source)

Adds a Source object in the list of used sources by this simulator.

Parameters

Source $source The Source object

Return Value

void

at line 1008
void removeSource(int $index)

Removes a Source object from the list of used sources by this simulator.

Parameters

int $index

Return Value

void

at line 1019
array getBusinessRules()

Returns the list of business rules implemented by this simulator

Return Value

array The list of business rules

at line 1031
void setBusinessRules(array $businessrules)

Sets the list of business rules implemented by this simulator

Parameters

array $businessrules The list of business rules

Return Value

void

at line 1043
void addBusinessRule(BusinessRule $businessrules)

Adds a BusinessRule object in the list of business rules implemented by this simulator

Parameters

BusinessRule $businessrules The BusinessRule object

Return Value

void

at line 1055
void removeBusinessRule(int $index)

Removes a BusinessRule object from the list of business rules implemented by this simulator

Parameters

int $index The index of the business rule in the list of business rules.

Return Value

void

at line 1067
BusinessRule|null getBusinessRuleById(int $id)

Retrieves a BusinessRule object by its ID

Parameters

int $id

Return Value

BusinessRule|null the value of businessRuleById

at line 1083
RichText getRelatedInformations()

Returns the informations related to this simulator.

Return Value

RichText The informations related to this simulator

at line 1095
void setRelatedInformations(RichText $relatedInformations)

Sets the informations related to this simulator.

Parameters

RichText $relatedInformations The informations related to this simulator

Return Value

void

at line 1107
Site|null getSiteById(int $id)

Retrieves a Site object by its ID

Parameters

int $id

Return Value

Site|null the value of siteById

at line 1124
Database|null getDatabaseById(int $id)

Retrieves a Database object by its ID

Parameters

int $id

Return Value

Database|null the value of databaseById

at line 1141
DataSource|null getDatasourceById(int $id)

Retrieves a DataSource object by its ID

Parameters

int $id

Return Value

DataSource|null the value of datasourceById

at line 1158
DataSource|null getDatasourceByName(string $name)

Retrieves a DataSource object by its name

Parameters

string $name

Return Value

DataSource|null the value of datasourceByName

at line 1175
Source|null getSourceById(int $id)

Retrieves a Source object by its ID

Parameters

int $id

Return Value

Source|null the value of sourceById

at line 1191
bool isWarning()

Returns the warning attribute of this simulator

Return Value

bool true if an warning has been issued, false otherwise

at line 1202
bool getWarning()

Returns the warning attribute of this simulator

Return Value

bool true if an warning has been issued, false otherwise

at line 1214
void setWarning(bool $warning)

Determines whether an warning has been issued or not

Parameters

bool $warning true if an warning has been issued, false otherwise

Return Value

void

at line 1225
array getWarningMessages()

Returns the list of warning messages

Return Value

array The list of warning messages

at line 1237
void setWarningMessages(array $warningMessages)

Sets the list list of warning messages

Parameters

array $warningMessages The list of warning messages

Return Value

void

at line 1249
void addWarningMessage(string $warningMessage)

Adds a warning message to the list of warning messages

Parameters

string $warningMessage The warning message

Return Value

void

at line 1263
void removeWarningMessage(int $index)

Removes a warning message from the list of warning messages

Parameters

int $index

Return Value

void

at line 1274
bool isError()

Returns the error attribute of this simulator

Return Value

bool true if an error has been detected, false otherwise

at line 1285
bool getError()

Returns the error attribute of this simulator

Return Value

bool true if an error has been detected, false otherwise

at line 1297
void setError(bool $error)

Determines whether an error has been detected or not

Parameters

bool $error true if an error has been detected, false otherwise

Return Value

void

at line 1308
array getErrorMessages()

Returns the list of error messages

Return Value

array The list of error messages

at line 1320
void setErrorMessages(array $errorMessages)

Sets the list of error messages

Parameters

array $errorMessages The list of error messages

Return Value

void

at line 1332
void addErrorMessage(string $errorMessage)

Adds an error message to the list of error messages

Parameters

string $errorMessage The error message

Return Value

void

at line 1346
void removeErrorMessage(int $index)

Removes an error message from the list of error messages.

Parameters

int $index The index of the message in the list of error messages

Return Value

void

at line 1358
private string replaceIdByDataLabel(array $matches)

Returns the label (inside a HTML data) of a data item whose ID is the first element of the given array.

Parameters

array $matches An array where the first element is the ID of the data item.

Return Value

string The label inside a HTML data

at line 1372
RichText|string replaceByDataLabel(RichText|string $target)

Replaces, into the given text, the ID (prefixed with #) of all data by their label inside a HTML data.

Parameters

RichText|string $target The initial text

Return Value

RichText|string The replaced text with data labels

at line 1395
private string replaceByDfnTag(array $matches)

Returns a HTML dfn tag with the elements of the given array.

Parameters

array $matches An array with the element of the footnote reference.

Return Value

string The HTML dfn tag

at line 1410
RichText|string replaceByFootnoteTag(RichText|string $target)

Replaces, into the given text, the footnote reference pattern string by the HTML dfn tag.

Parameters

RichText|string $target The initial text

Return Value

RichText|string The replaced text with HTML dfn tag

at line 1433
string replaceBySpecialTags(string $target)

Replaces all special patterns by the corresponding html tag (data or dfn)

Parameters

string $target The target text

Return Value

string The result text

at line 1447
protected Data loadData(SimpleXMLElement $data)

Loads into a Data object, the data item extracted from the XML file of this simulator

Parameters

SimpleXMLElement $data The data item in XML format

Return Value

Data The Data object

at line 1515
void load(string $url)

Loads the XML definition file of the simulator into this Simulator object.

Parameters

string $url The path of the XML definition file

Return Value

void

at line 1538
protected void loadEntities(SimpleXMLElement $simulator, SimpleXMLElement $datasources)

Loads the entities (elements) of the XML definition files of the simulator and data sources into this Simulator object.

Parameters

SimpleXMLElement $simulator The XML definition file of the simulator
SimpleXMLElement $datasources The XML definition file of the data sources

Return Value

void

at line 1799
protected Field loadField(SimpleXMLElement $field, FieldSet $fieldsetObj)

Loads into a Field object, the field extracted from the XML file of this simulator

Parameters

SimpleXMLElement $field The field in XML format
FieldSet $fieldsetObj The field set that contains this field

Return Value

Field The Field object

at line 1834
protected RuleAction loadRuleAction(SimpleXMLElement $action)

Loads into a RuleAction object, the business rule action extracted from the XML file of this simulator

Parameters

SimpleXMLElement $action The business rule action in XML format

Return Value

RuleAction The RuleAction object

at line 1865
protected void loadSources(SimpleXMLElement $sources)

Loads into Source and Parameter objects, all the used sources extracted from the XML file of this simulator

Parameters

SimpleXMLElement $sources The sources in XML format

Return Value

void

at line 1898
protected void loadDatabases(SimpleXMLElement $databases)

Loads into Database objects, all the databases declaration extracted from DataSources.xml

Parameters

SimpleXMLElement $databases The databases declaration in XML format

Return Value

void

at line 1929
protected Condition|Connector loadConnector(SimpleXMLElement $connector, Connector|null $parentConnector = null)

Loads into a Connector or a Condition object, the business rule connector extracted from the XML file of this simulator

Parameters

SimpleXMLElement $connector The business rule connector in XML format
Connector|null $parentConnector (default: null) The Connector object that contains this connector or this condition

Return Value

Condition|Connector The Connector or the Condition object

at line 1948
void loadForSource(string $url)

Loads Data, DataSource, Source objects in response of the Ajax request using route path : /{simu}/Default/source

Parameters

string $url The path of the XML definition file of this sumulator

Return Value

void

at line 2016
private string addDependency(array $matches)

Adds a dependency for the data item whose ID is in the first element of the given array

Parameters

array $matches The given array

Return Value

string The name of the data item

at line 2039
private string addNoteDependency(array $matches)

Adds a note (field pre-note, field post-note, footnote) dependency for the data item is in the first element of the given array

Parameters

array $matches

Return Value

string The name of the data surrounded by '#(' and ')'

at line 2051
private string replaceDataIdByName(array $matches)

Returns the name surrounded by '#(' and ')' of the data item whose ID is in the first element of the given array

Parameters

array $matches The given array

Return Value

string The name of the data surrounded by '#(' and ')'

at line 2064
private string replaceIdByName(string $target)

Replaces, into the given text, the ID (prefixed with # or inside a HTML data) of all data by their name surrounded by '#(' and ')'.

Parameters

string $target The initial text

Return Value

string The replaced text with data names

at line 2085
private string replaceIdByDataName(array $matches)

Returns the name of the data item whose ID is in the first element of the given array

Parameters

array $matches Tha given array

Return Value

string the name of the data item

at line 2098
private string replaceByDataName(string $target)

Replaces, into the given text, the ID (prefixed with # or inside a HTML data) of all data by their name.

Parameters

string $target The initial text

Return Value

string The replaced text with data names

at line 2114
RichText|string paragraphs(RichText|string $string)

Converts the lines of the given text into HTML paragraphs

Parameters

RichText|string $string

Return Value

RichText|string

at line 2153
private array fieldProperties(SimpleXMLElement $field)

Converts a field extracted from the XML file of this simulator into an associative array for encoding in JSON format.

Also completes the list of data dependencies

Parameters

SimpleXMLElement $field

Return Value

array

at line 2208
protected void toJSONData(SimpleXMLElement $data, array $sources)

Converts a data item extracted from the XML file of this simulator into an associative array for encoding in JSON format.

Also completes the list of sources dependencies

Parameters

SimpleXMLElement $data The data item
array $sources &$sources The list of sources dependencies

Return Value

void

at line 2329
private array actionData(int $ruleID, SimpleXMLElement $action, array $dataset)

Converts to an associative array representing one action (in the "then" part or the the "else" part) of a business rule extracted from the XML file.

Also completes the list of data dependencies

Parameters

int $ruleID The ID of the rule
SimpleXMLElement $action The action
array $dataset &$dataset The list of data dependencies

Return Value

array The associative array

at line 2601
string toJSON(string $url, int $stepId = 0)

Converts the XML definition file of this simulator to JSON for use in Javascript for the given step.

Parameters

string $url The path of the XML definition file
int $stepId (default: 0) The simulation step

Return Value

string The definition of this simulator in JSON format

at line 2963
protected array ruleConnector(SimpleXMLElement $pconnector)

Converts a condition connector for a business rule extracted from the XML file into an associative array.

Parameters

SimpleXMLElement $pconnector The connector to be convertd

Return Value

array The associative array

at line 2996
private string cleanRichText(RichText $richtext = null)

Cleans the text produced with the Javascript component "bootstrap3-wysihtml5" for its registration in the XML file of definition of this simulator

Parameters

RichText $richtext The text to clean

Return Value

string The cleaned text

at line 3027
void save(string $file)

Converts this Simulator object into an XML string and saves it to a file with the provided path.

Parameters

string $file The path to the saved XML document.

Return Value

void

at line 3580
private string makeRuleActionAttributes(RuleAction $action)

Converts the properties of a RuleAction object into an XML attributes string

Parameters

RuleAction $action The RuleAction object

Return Value

string The XML attributes string

at line 3646
private void saveConnector(Connector|Condition $connector, string $indent, array $xml)

Converts a Connector or Condition object to XML strings and inserts it into an array of indented lines

Parameters

Connector|Condition $connector The Connector or Condition object
string $indent The indentation spaces
array $xml &$xml array of indented lines

Return Value

void

at line 3680
private string loadFileFromCache(string $url)

Loads an XML file from the APC cache

Parameters

string $url The location of the file

Return Value

string The contents of the file

at line 3703
void loadEmptySimulator()

Loads a simulator XML definition skeleton into this Simulator object.

Used to create a new simulator.

Return Value

void