Simulator
class Simulator
This class allows the storage and retrieval of the attributes of a simulator.
Properties
private BaseController|BaseAdminController | $controller | ||
private string | $name | ||
private string | $label | ||
private string | $defaultView | ||
private string | $referer | ||
private bool | $dynamic | ||
private bool | $memo | ||
private string | $description | ||
private string | $dateFormat | ||
private string | $decimalPoint | ||
private string | $moneySymbol | ||
private string | $symbolPosition | ||
private array | $datas | ||
private Profile | $profiles | ||
private array | $steps | ||
private array | $sites | ||
private array | $databases | ||
private array | $datasources | ||
private array | $sources | ||
private array | $businessrules | ||
private string | $relatedInformations | ||
private string | $dependencies | ||
private bool | $error | ||
private array | $errorMessages | ||
private bool | $warning | ||
private array | $warningMessages |
Methods
Returns the Controller Object that uses this Simulator object.
Returns the name of this simulator
Sets the name of this simulator
Returns the label of this simulator
Sets the label of this simulator
Returns the URL of the site page (main referer) that calls this simulator
Sets the URL of the site page (main referer) that calls this simulator
Returns the name of the default view with which this simulator will be displayed
Sets the name of the default view with which this simulator will be displayed
Returns the dynamic attribute of this simulator.
Returns the dynamic attribute of this simulator.
Determines whether this simulator is dynamic (interactive) or not.
Returns the memo attribute of this simulator. Alias of the getMemo method.
Returns the memo attribute of this simulator. Alias of the getMemo method.
Returns the memo attribute of this simulator.
Determines whether the simulation engine will be allowed to save the value of certain fields in the browser cookies for later use or not.
Returns the description of this simulator
Sets the description of this simulator
Returns the date format in the display language of this simulator
Sets the date format in the display language of this simulator
Returns the decimal point in the display language of this simulator
Sets the decimal point in the display language of this simulator
Returns the currency symbol in the country of use of this simulator
Sets the currency symbol in the country of use of this simulator
Returns the position of the currency symbol relative to the amount in the country of use of this simulator
Sets the position of the currency symbol relative to the amount in the country of use of this simulator
Returns the list of data used by this simulator.
Sets the list of data used by this simulator.
Removes a Data object from the list of data used by this simulator.
Retrieves a Data object by its ID
Retrieves a Data object by its name
Retrieves a DataGroup object by its ID
Retrieves a DataGroup object by its name
Returns the profiles container used in this simulator
Returns the list of simulation steps defined by this simulator.
Sets the list of simulation steps defined by this simulator.
Removes a Step object from the list of steps defined by this simulator.
Retrieves a Step object by its ID
Returns the list of used sources by this simulator.
Sets the list of used sources by this simulator.
Removes a Source object from the list of used sources by this simulator.
Returns the list of business rules implemented by this simulator
Sets the list of business rules implemented by this simulator
Adds a BusinessRule object in the list of business rules implemented by this simulator
Removes a BusinessRule object from the list of business rules implemented by this simulator
Retrieves a BusinessRule object by its ID
Returns the informations related to this simulator.
Sets the informations related to this simulator.
Retrieves a Site object by its ID
Retrieves a Database object by its ID
Retrieves a DataSource object by its ID
Retrieves a DataSource object by its name
Retrieves a Source object by its ID
Returns the warning attribute of this simulator
Returns the warning attribute of this simulator
Determines whether an warning has been issued or not
Returns the list of warning messages
Sets the list list of warning messages
Adds a warning message to the list of warning messages
Removes a warning message from the list of warning messages
Returns the error attribute of this simulator
Returns the error attribute of this simulator
Determines whether an error has been detected or not
Returns the list of error messages
Sets the list of error messages
Adds an error message to the list of error messages
Removes an error message from the list of error messages.
Returns the label (inside a HTML var) of a data item whose ID is the first element of the given array.
Replaces, into the given text, the ID (prefixed with #) of all data by their label inside a HTML var.
Loads into a Data object, the data item extracted from the XML file of this simulator
Loads the XML definition file of the simulator into this Simulator object.
Loads the entities (elements) of the XML definition files of the simulator and data sources into this Simulator object.
Loads into a Field object, the field extracted from the XML file of this simulator
Loads into a RuleAction object, the business rule action extracted from the XML file of this simulator
Loads into Source and Parameter objects, all the used sources extracted from the XML file of this simulator
Loads into Database objects, all the databases declaration extracted from DataSources.xml
Loads into a Connector or a Condition object, the business rule connector extracted from the XML file of this simulator
Loads Data, DataSource, Source objects in response of the Ajax request using route path : /{simu}/Default/source
Adds a dependency for the data item whose ID is in the first element of the given array
Adds a note (field pre-note, field post-note, footnote) dependency for the data item is in the first element of the given array
Returns the name surrounded by '#(' and ')' of the data item whose ID is in the first element of the given array
Replaces, into the given text, the ID (prefixed with # or inside a HTML var) of all data by their name surrounded by '#(' and ')'.
Returns the name of the data item whose ID is in the first element of the given array
Replaces, into the given text, the ID (prefixed with # or inside a HTML var) of all data by their name.
Converts the lines of the given text into HTML paragraphs
Converts a field extracted from the XML file of this simulator into an associative array for encoding in JSON format.
Converts a data item extracted from the XML file of this simulator into an associative array for encoding in JSON format.
Converts into an associative array, the list of actions (the "then" part or the the "else" part) of a business rule extracted from the XML file.
Converts the XML definition file of this simulator to JSON for use in Javascript for the given step.
Converts a condition connector for a business rule extracted from the XML file into an associative array.
Cleans the text produced with the Javascript component "bootstrap3-wysihtml5" for its registration in the XML file of definition of this simulator
Converts this Simulator object into an XML string and saves it to a file with the provided path.
Converts the properties of a RuleAction object into an XML attributes string
Converts a Connector or Condition object to XML strings and inserts it into an array of indented lines
Loads an XML file from the APC cache
Loads a simulator XML definition skeleton into this Simulator object.
Details
at line 255
void
__construct(BaseController|BaseAdminController $controller)
Constructor of class Simulator
at line 266
BaseController|BaseAdminController
getController()
Returns the Controller Object that uses this Simulator object.
at line 277
string
getName()
Returns the name of this simulator
at line 289
void
setName(string $name)
Sets the name of this simulator
at line 300
string
getLabel()
Returns the label of this simulator
at line 312
void
setLabel(string $label)
Sets the label of this simulator
at line 323
string
getReferer()
Returns the URL of the site page (main referer) that calls this simulator
at line 335
void
setReferer(string $referer)
Sets the URL of the site page (main referer) that calls this simulator
at line 346
string
getDefaultView()
Returns the name of the default view with which this simulator will be displayed
at line 358
void
setDefaultView(string $defaultView)
Sets the name of the default view with which this simulator will be displayed
at line 369
bool
isDynamic()
Returns the dynamic attribute of this simulator.
at line 380
bool
getDynamic()
Returns the dynamic attribute of this simulator.
at line 392
void
setDynamic(bool $dynamic)
Determines whether this simulator is dynamic (interactive) or not.
at line 403
bool
isMemo()
Returns the memo attribute of this simulator. Alias of the getMemo method.
at line 414
bool
hasMemo()
Returns the memo attribute of this simulator. Alias of the getMemo method.
at line 425
bool
getMemo()
Returns the memo attribute of this simulator.
at line 437
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.
at line 448
string
getDescription()
Returns the description of this simulator
at line 460
void
setDescription(string $description)
Sets the description of this simulator
at line 472
string
getDateFormat()
Returns the date format in the display language of this simulator
at line 485
void
setDateFormat(string $dateFormat)
Sets the date format in the display language of this simulator
at line 496
string
getDecimalPoint()
Returns the decimal point in the display language of this simulator
at line 508
void
setDecimalPoint(string $decimalPoint)
Sets the decimal point in the display language of this simulator
at line 519
string
getMoneySymbol()
Returns the currency symbol in the country of use of this simulator
at line 531
void
setMoneySymbol(string $moneySymbol)
Sets the currency symbol in the country of use of this simulator
at line 542
string
getSymbolPosition()
Returns the position of the currency symbol relative to the amount in the country of use of this simulator
at line 554
void
setSymbolPosition(string $symbolPosition)
Sets the position of the currency symbol relative to the amount in the country of use of this simulator
at line 565
array
getDatas()
Returns the list of data used by this simulator.
at line 577
void
setDatas(array $datas)
Sets the list of data used by this simulator.
at line 589
void
addData(Data $data)
Adds a Data object in the list of data used by this simulator.
at line 601
void
removeData(int $index)
Removes a Data object from the list of data used by this simulator.
at line 613
Data
getDataById(int $id)
Retrieves a Data object by its ID
at line 634
Data
getDataByName(string $name)
Retrieves a Data object by its name
at line 655
DataGroup
getDataGroupById(int $id)
Retrieves a DataGroup object by its ID
at line 672
DataGroup
getDataGroupByName(string $name)
Retrieves a DataGroup object by its name
at line 688
Profiles
getProfiles()
Returns the profiles container used in this simulator
at line 700
void
setProfiles(Profiles $profiles)
Sets the profiles container used in this simulator
at line 711
array
getSteps()
Returns the list of simulation steps defined by this simulator.
at line 723
void
setSteps(array $steps)
Sets the list of simulation steps defined by this simulator.
at line 735
void
addStep(Step $step)
Adds a Step object in the list of steps defined by this simulator.
at line 747
void
removeStep(int $index)
Removes a Step object from the list of steps defined by this simulator.
at line 759
Step
getStepById(int $id)
Retrieves a Step object by its ID
at line 775
array
getSources()
Returns the list of used sources by this simulator.
at line 787
void
setSources(array $sources)
Sets the list of used sources by this simulator.
at line 799
void
addSource(Source $source)
Adds a Source object in the list of used sources by this simulator.
at line 811
void
removeSource(int $index)
Removes a Source object from the list of used sources by this simulator.
at line 822
array
getBusinessRules()
Returns the list of business rules implemented by this simulator
at line 834
void
setBusinessRules(array $businessrules)
Sets the list of business rules implemented by this simulator
at line 846
void
addBusinessRule(BusinessRule $businessrules)
Adds a BusinessRule object in the list of business rules implemented by this simulator
at line 858
void
removeBusinessRule(int $index)
Removes a BusinessRule object from the list of business rules implemented by this simulator
at line 870
BusinessRule
getBusinessRuleById(int $id)
Retrieves a BusinessRule object by its ID
at line 886
string
getRelatedInformations()
Returns the informations related to this simulator.
at line 898
void
setRelatedInformations(string $relatedInformations)
Sets the informations related to this simulator.
at line 910
Site
getSiteById(int $id)
Retrieves a Site object by its ID
at line 927
Database
getDatabaseById(int $id)
Retrieves a Database object by its ID
at line 944
DataSource
getDatasourceById(int $id)
Retrieves a DataSource object by its ID
at line 961
DataSource
getDatasourceByName(string $name)
Retrieves a DataSource object by its name
at line 978
Source
getSourceById(int $id)
Retrieves a Source object by its ID
at line 994
bool
isWarning()
Returns the warning attribute of this simulator
at line 1005
bool
getWarning()
Returns the warning attribute of this simulator
at line 1017
void
setWarning(bool $warning)
Determines whether an warning has been issued or not
at line 1028
array
getWarningMessages()
Returns the list of warning messages
at line 1040
void
setWarningMessages(array $warningMessages)
Sets the list list of warning messages
at line 1052
void
addWarningMessage(string $warningMessage)
Adds a warning message to the list of warning messages
at line 1066
void
removeWarningMessage(int $index)
Removes a warning message from the list of warning messages
at line 1077
bool
isError()
Returns the error attribute of this simulator
at line 1088
bool
getError()
Returns the error attribute of this simulator
at line 1100
void
setError(bool $error)
Determines whether an error has been detected or not
at line 1111
array
getErrorMessages()
Returns the list of error messages
at line 1123
void
setErrorMessages(array $errorMessages)
Sets the list of error messages
at line 1135
void
addErrorMessage(string $errorMessage)
Adds an error message to the list of error messages
at line 1149
void
removeErrorMessage(int $index)
Removes an error message from the list of error messages.
at line 1161
private string
replaceIdByDataLabel(array $matches)
Returns the label (inside a HTML var) of a data item whose ID is the first element of the given array.
at line 1175
string
replaceByDataLabel(string $target)
Replaces, into the given text, the ID (prefixed with #) of all data by their label inside a HTML var.
at line 1191
protected Data
loadData(SimpleXMLElement $data)
Loads into a Data object, the data item extracted from the XML file of this simulator
at line 1258
void
load(string $url)
Loads the XML definition file of the simulator into this Simulator object.
at line 1281
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.
at line 1516
protected Field
loadField(SimpleXMLElement $field, FieldSet $fieldsetObj)
Loads into a Field object, the field extracted from the XML file of this simulator
at line 1551
protected RuleAction
loadRuleAction(SimpleXMLElement $action)
Loads into a RuleAction object, the business rule action extracted from the XML file of this simulator
at line 1582
protected void
loadSources(SimpleXMLElement $sources)
Loads into Source and Parameter objects, all the used sources extracted from the XML file of this simulator
at line 1615
protected void
loadDatabases(SimpleXMLElement $databases)
Loads into Database objects, all the databases declaration extracted from DataSources.xml
at line 1646
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
at line 1665
void
loadForSource(string $url)
Loads Data, DataSource, Source objects in response of the Ajax request using route path : /{simu}/Default/source
at line 1717
private string
addDependency(array $matches)
Adds a dependency for the data item whose ID is in the first element of the given array
at line 1740
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
at line 1752
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
at line 1765
private string
replaceIdByName(string $target)
Replaces, into the given text, the ID (prefixed with # or inside a HTML var) of all data by their name surrounded by '#(' and ')'.
at line 1786
private string
replaceIdByDataName(array $matches)
Returns the name of the data item whose ID is in the first element of the given array
at line 1799
private string
replaceByDataName(string $target)
Replaces, into the given text, the ID (prefixed with # or inside a HTML var) of all data by their name.
at line 1815
string
paragraphs(string $text)
Converts the lines of the given text into HTML paragraphs
at line 1836
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
at line 1891
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
at line 2003
private array
actionsData(int $ruleID, SimpleXMLElement $actions, array $dataset)
Converts into an associative array, the list of actions (the "then" part or the the "else" part) of a business rule extracted from the XML file.
Also completes the list of data dependencies
at line 2279
string
toJSON(string $url, int $stepId)
Converts the XML definition file of this simulator to JSON for use in Javascript for the given step.
at line 2583
protected array
ruleConnector(SimpleXMLElement $pconnector)
Converts a condition connector for a business rule extracted from the XML file into an associative array.
at line 2616
private string
cleanRichText(string $text)
Cleans the text produced with the Javascript component "bootstrap3-wysihtml5" for its registration in the XML file of definition of this simulator
at line 2637
void
save(string $file)
Converts this Simulator object into an XML string and saves it to a file with the provided path.
at line 3173
private string
makeRuleActionAttributes(RuleAction $action)
Converts the properties of a RuleAction object into an XML attributes string
at line 3239
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
at line 3273
private string
loadFileFromCache(string $url)
Loads an XML file from the APC cache
at line 3296
void
loadEmptySimulator()
Loads a simulator XML definition skeleton into this Simulator object.
Used to create a new simulator.