Simulator
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
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 category of this simulator
Sets the category 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 locale attribute of this simulator.
Sets the locale attribute of this simulator.
Returns 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 timezone for the locale used in this simulator
Sets the timezone for the locale used in this simulator
Returns the timezone for the locale used in this simulator
Sets the decimal point in the display language of this simulator
Returns the grouping separator in the display language of this simulator
Sets the grouping separator in the display language of this simulator
Returns the grouping size in the display language of this simulator
Sets the grouping size 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 DatasetChild 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
Retrieves a Step object by its name
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 data) 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 data.
Returns a HTML dfn tag with the elements of the given array.
Replaces, into the given text, the footnote reference pattern string by the HTML dfn tag.
Replaces all special patterns by the corresponding html tag (data or dfn)
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 data) 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 data) of all data by their name.
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 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.
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 300
void
__construct(BaseController|BaseAdminController $controller)
Constructor of class Simulator
at line 315
BaseController|BaseAdminController
getController()
Returns the Controller Object that uses this Simulator object.
at line 326
string|int
getName()
Returns the name of this simulator
at line 338
void
setName(string|int $name)
Sets the name of this simulator
at line 349
string
getLabel()
Returns the label of this simulator
at line 361
void
setLabel(string $label)
Sets the label of this simulator
at line 372
string
getCategory()
Returns the category of this simulator
at line 384
void
setCategory(string $category)
Sets the category of this simulator
at line 395
string
getReferer()
Returns the URL of the site page (main referer) that calls this simulator
at line 407
void
setReferer(string $referer)
Sets the URL of the site page (main referer) that calls this simulator
at line 418
string
getDefaultView()
Returns the name of the default view with which this simulator will be displayed
at line 430
void
setDefaultView(string $defaultView)
Sets the name of the default view with which this simulator will be displayed
at line 441
bool
isDynamic()
Returns the dynamic attribute of this simulator.
at line 452
bool
getDynamic()
Returns the dynamic attribute of this simulator.
at line 464
void
setDynamic(bool $dynamic)
Determines whether this simulator is dynamic (interactive) or not.
at line 475
bool
isMemo()
Returns the memo attribute of this simulator. Alias of the getMemo method.
at line 486
bool
hasMemo()
Returns the memo attribute of this simulator. Alias of the getMemo method.
at line 497
bool
getMemo()
Returns the memo attribute of this simulator.
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.
at line 520
string
getLocale()
Returns the locale attribute of this simulator.
at line 532
void
setLocale(string $locale)
Sets the locale attribute of this simulator.
at line 543
RichText
getDescription()
Returns the description of this simulator
at line 555
void
setDescription(RichText $description)
Sets the description of this simulator
at line 567
string
getDateFormat()
Returns the date format in the display language of this simulator
at line 580
void
setDateFormat(string $dateFormat)
Sets the date format in the display language of this simulator
at line 592
string
getTimezone()
Returns the timezone for the locale used in this simulator
at line 604
void
setTimezone(string $timezone)
Sets the timezone for the locale used in this simulator
at line 616
string
getDecimalPoint()
Returns the timezone for the locale used in this simulator
at line 628
void
setDecimalPoint(string $decimalPoint)
Sets the decimal point in the display language of this simulator
at line 642
string
getGroupingSeparator()
Returns the grouping separator in the display language of this simulator
at line 654
void
setGroupingSeparator(string $groupingSeparator)
Sets the grouping separator in the display language of this simulator
at line 668
string
getGroupingSize()
Returns the grouping size in the display language of this simulator
at line 680
void
setGroupingSize(string $groupingSize)
Sets the grouping size in the display language of this simulator
at line 694
string
getMoneySymbol()
Returns the currency symbol in the country of use of this simulator
at line 706
void
setMoneySymbol(string $moneySymbol)
Sets the currency symbol in the country of use of this simulator
at line 718
string
getSymbolPosition()
Returns the position of the currency symbol relative to the amount in the country of use of this simulator
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
at line 742
array
getDatas()
Returns the list of data used by this simulator.
at line 754
void
setDatas(array $datas)
Sets the list of data used by this simulator.
at line 766
void
addData(DatasetChild $data)
Adds a DatasetChild object in the list of data used by this simulator.
at line 778
void
removeData(int $index)
Removes a DatasetChild object from the list of data used by this simulator.
at line 790
Data|null
getDataById(int $id)
Retrieves a Data object by its ID
at line 811
Data|null
getDataByName(string $name)
Retrieves a Data object by its name
at line 835
DataGroup|null
getDataGroupById(int $id)
Retrieves a DataGroup object by its ID
at line 852
DataGroup|null
getDataGroupByName(string $name)
Retrieves a DataGroup object by its name
at line 868
Profiles
getProfiles()
Returns the profiles container used in this simulator
at line 880
void
setProfiles(Profiles $profiles)
Sets the profiles container used in this simulator
at line 891
array
getSteps()
Returns the list of simulation steps defined by this simulator.
at line 903
void
setSteps(array $steps)
Sets the list of simulation steps defined by this simulator.
at line 915
void
addStep(Step $step)
Adds a Step object in the list of steps defined by this simulator.
at line 927
void
removeStep(int $index)
Removes a Step object from the list of steps defined by this simulator.
at line 939
Step|null
getStepById(int $id)
Retrieves a Step object by its ID
at line 956
Step|null
getStepByName(string $name)
Retrieves a Step object by its name
at line 972
array
getSources()
Returns the list of used sources by this simulator.
at line 984
void
setSources(array $sources)
Sets the list of used sources by this simulator.
at line 996
void
addSource(Source $source)
Adds a Source object in the list of used sources by this simulator.
at line 1008
void
removeSource(int $index)
Removes a Source object from the list of used sources by this simulator.
at line 1019
array
getBusinessRules()
Returns the list of business rules implemented by this simulator
at line 1031
void
setBusinessRules(array $businessrules)
Sets the list of business rules implemented by this simulator
at line 1043
void
addBusinessRule(BusinessRule $businessrules)
Adds a BusinessRule object in the list of business rules implemented by this simulator
at line 1055
void
removeBusinessRule(int $index)
Removes a BusinessRule object from the list of business rules implemented by this simulator
at line 1067
BusinessRule|null
getBusinessRuleById(int $id)
Retrieves a BusinessRule object by its ID
at line 1083
RichText
getRelatedInformations()
Returns the informations related to this simulator.
at line 1095
void
setRelatedInformations(RichText $relatedInformations)
Sets the informations related to this simulator.
at line 1107
Site|null
getSiteById(int $id)
Retrieves a Site object by its ID
at line 1124
Database|null
getDatabaseById(int $id)
Retrieves a Database object by its ID
at line 1141
DataSource|null
getDatasourceById(int $id)
Retrieves a DataSource object by its ID
at line 1158
DataSource|null
getDatasourceByName(string $name)
Retrieves a DataSource object by its name
at line 1175
Source|null
getSourceById(int $id)
Retrieves a Source object by its ID
at line 1191
bool
isWarning()
Returns the warning attribute of this simulator
at line 1202
bool
getWarning()
Returns the warning attribute of this simulator
at line 1214
void
setWarning(bool $warning)
Determines whether an warning has been issued or not
at line 1225
array
getWarningMessages()
Returns the list of warning messages
at line 1237
void
setWarningMessages(array $warningMessages)
Sets the list list of warning messages
at line 1249
void
addWarningMessage(string $warningMessage)
Adds a warning message to the list of warning messages
at line 1263
void
removeWarningMessage(int $index)
Removes a warning message from the list of warning messages
at line 1274
bool
isError()
Returns the error attribute of this simulator
at line 1285
bool
getError()
Returns the error attribute of this simulator
at line 1297
void
setError(bool $error)
Determines whether an error has been detected or not
at line 1308
array
getErrorMessages()
Returns the list of error messages
at line 1320
void
setErrorMessages(array $errorMessages)
Sets the list of error messages
at line 1332
void
addErrorMessage(string $errorMessage)
Adds an error message to the list of error messages
at line 1346
void
removeErrorMessage(int $index)
Removes an error message from the list of error messages.
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.
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.
at line 1395
private string
replaceByDfnTag(array $matches)
Returns a HTML dfn tag with the elements of the given array.
at line 1410
RichText|string
replaceByFootnoteTag(RichText|string $target)
Replaces, into the given text, the footnote reference pattern string by the HTML dfn tag.
at line 1433
string
replaceBySpecialTags(string $target)
Replaces all special patterns by the corresponding html tag (data or dfn)
at line 1447
protected Data
loadData(SimpleXMLElement $data)
Loads into a Data object, the data item extracted from the XML file of this simulator
at line 1515
void
load(string $url)
Loads the XML definition file of the simulator into this Simulator object.
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.
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
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
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
at line 1898
protected void
loadDatabases(SimpleXMLElement $databases)
Loads into Database objects, all the databases declaration extracted from DataSources.xml
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
at line 1948
void
loadForSource(string $url)
Loads Data, DataSource, Source objects in response of the Ajax request using route path : /{simu}/Default/source
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
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
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
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 ')'.
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
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.
at line 2114
RichText|string
paragraphs(RichText|string $string)
Converts the lines of the given text into HTML paragraphs
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
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
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
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.
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.
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
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.
at line 3580
private string
makeRuleActionAttributes(RuleAction $action)
Converts the properties of a RuleAction object into an 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
at line 3680
private string
loadFileFromCache(string $url)
Loads an XML file from the APC cache
at line 3703
void
loadEmptySimulator()
Loads a simulator XML definition skeleton into this Simulator object.
Used to create a new simulator.