| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include(dirname(__FILE__).'/Base.php');
|
|---|
| 4 | include(dirname(__FILE__).'/Enumeration.php');
|
|---|
| 5 | include(dirname(__FILE__).'/Boolean.php');
|
|---|
| 6 | include(dirname(__FILE__).'/Integer.php');
|
|---|
| 7 | include(dirname(__FILE__).'/String.php');
|
|---|
| 8 | include(dirname(__FILE__).'/Text.php');
|
|---|
| 9 | include(dirname(__FILE__).'/PointerOneToMany.php');
|
|---|
| 10 | include(dirname(__FILE__).'/PointerOneToOne.php');
|
|---|
| 11 | include(dirname(__FILE__).'/Date.php');
|
|---|
| 12 | include(dirname(__FILE__).'/Time.php');
|
|---|
| 13 | include(dirname(__FILE__).'/DateTime.php');
|
|---|
| 14 | include(dirname(__FILE__).'/Password.php');
|
|---|
| 15 | include(dirname(__FILE__).'/Float.php');
|
|---|
| 16 | include(dirname(__FILE__).'/Hyperlink.php');
|
|---|
| 17 | include(dirname(__FILE__).'/Hidden.php');
|
|---|
| 18 | include(dirname(__FILE__).'/File/File.php');
|
|---|
| 19 | include(dirname(__FILE__).'/GPS.php');
|
|---|
| 20 | include(dirname(__FILE__).'/IPv4Address.php');
|
|---|
| 21 |
|
|---|
| 22 | $TypeDefinitionList = array(
|
|---|
| 23 | 'Enumeration' => array('Name' => 'Enumeration', 'Class' => 'Enumeration', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 24 | 'Boolean' => array('Name' => 'Boolean', 'Class' => 'Boolean', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 25 | 'Integer' => array('Name' => 'Integer', 'Class' => 'Integer', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 26 | 'String' => array('Name' => 'String', 'Class' => 'String', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 27 | 'Text' => array('Name' => 'Text', 'Class' => 'Text', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 28 | 'Date' => array('Name' => 'Date', 'Class' => 'Date', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 29 | 'Time' => array('Name' => 'Time', 'Class' => 'Time', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 30 | 'DateTime' => array('Name' => 'DateTime', 'Class' => 'DateTime', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 31 | 'Password' => array('Name' => 'Password', 'Class' => 'Password', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 32 | 'Float' => array('Name' => 'Float', 'Class' => 'Float', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 33 | 'Hyperlink' => array('Name' => 'Hyperlink', 'Class' => 'Hyperlink', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 34 | 'Hidden' => array('Name' => 'Hidden', 'Class' => 'Hidden', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 35 | 'File' => array('Name' => 'File', 'Class' => 'File', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 36 | 'GPS' => array('Name' => 'GPS', 'Class' => 'GPS', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 37 | 'IPv4Address' => array('Name' => 'IPv4Address', 'Class' => 'IPv4Address', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 38 | 'PointerOneToOne' => array('Name' => 'PointerOneToOne', 'Class' => 'PointerOneToOne', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 39 | 'PointerOneToMany' => array('Name' => 'PointerOneToMany', 'Class' => 'PointerOneToMany', 'ParentType' => '', 'Parameters' => array()),
|
|---|
| 40 | );
|
|---|
| 41 |
|
|---|
| 42 | function ExecuteTypeEvent($System, $TypeName, $Event, $Parameters = array())
|
|---|
| 43 | {
|
|---|
| 44 | global $TypeDefinitionList;
|
|---|
| 45 |
|
|---|
| 46 | if(array_key_exists($TypeName, $TypeDefinitionList))
|
|---|
| 47 | {
|
|---|
| 48 | $Type = $TypeDefinitionList[$TypeName];
|
|---|
| 49 | $TypeClass = 'Type'.$Type['Class'];
|
|---|
| 50 | $TypeObject = new $TypeClass($System);
|
|---|
| 51 | if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters));
|
|---|
| 52 | else return($TypeName.'->'.$Event.'('.serialize($Parameters).')');
|
|---|
| 53 | } else return($TypeName);
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | function RegisterType($Name, $ParentType, $Parameters)
|
|---|
| 57 | {
|
|---|
| 58 | global $TypeDefinitionList;
|
|---|
| 59 |
|
|---|
| 60 | if($ParentType != '')
|
|---|
| 61 | {
|
|---|
| 62 | $Type = $TypeDefinitionList[$ParentType];
|
|---|
| 63 | } else $Type = array();
|
|---|
| 64 |
|
|---|
| 65 | $Type['Name'] = $Name;
|
|---|
| 66 | $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters);
|
|---|
| 67 | $TypeDefinitionList[$Name] = $Type;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | function GetTypeDefinition($TypeName)
|
|---|
| 71 | {
|
|---|
| 72 | global $TypeDefinitionList;
|
|---|
| 73 |
|
|---|
| 74 | return($TypeDefinitionList[$TypeName]);
|
|---|
| 75 | }
|
|---|