FormManager = &$FormManager; $this->TypeDefinitionList = array ( 'Enumeration' => array('Name' => 'Enumeration', 'Class' => 'Enumeration', 'ParentType' => '', 'Parameters' => array()), 'Boolean' => array('Name' => 'Boolean', 'Class' => 'Boolean', 'ParentType' => '', 'Parameters' => array()), 'Integer' => array('Name' => 'Integer', 'Class' => 'Integer', 'ParentType' => '', 'Parameters' => array()), 'String' => array('Name' => 'String', 'Class' => 'String', 'ParentType' => '', 'Parameters' => array()), 'Text' => array('Name' => 'Text', 'Class' => 'Text', 'ParentType' => '', 'Parameters' => array()), 'Date' => array('Name' => 'Date', 'Class' => 'Date', 'ParentType' => '', 'Parameters' => array()), 'Time' => array('Name' => 'Time', 'Class' => 'Time', 'ParentType' => '', 'Parameters' => array()), 'DateTime' => array('Name' => 'DateTime', 'Class' => 'DateTime', 'ParentType' => '', 'Parameters' => array()), 'Password' => array('Name' => 'Password', 'Class' => 'Password', 'ParentType' => '', 'Parameters' => array()), 'Float' => array('Name' => 'Float', 'Class' => 'Float', 'ParentType' => '', 'Parameters' => array()), 'Hyperlink' => array('Name' => 'Hyperlink', 'Class' => 'Hyperlink', 'ParentType' => '', 'Parameters' => array()), 'Hidden' => array('Name' => 'Hidden', 'Class' => 'Hidden', 'ParentType' => '', 'Parameters' => array()), 'File' => array('Name' => 'File', 'Class' => 'File', 'ParentType' => '', 'Parameters' => array()), 'GPS' => array('Name' => 'GPS', 'Class' => 'GPS', 'ParentType' => '', 'Parameters' => array()), 'IPv4Address' => array('Name' => 'IPv4Address', 'Class' => 'IPv4Address', 'ParentType' => '', 'Parameters' => array()), 'OneToOne' => array('Name' => 'OneToOne', 'Class' => 'OneToOne', 'ParentType' => '', 'Parameters' => array()), 'OneToMany' => array('Name' => 'OneToMany', 'Class' => 'OneToMany', 'ParentType' => '', 'Parameters' => array()), 'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()), 'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()), 'MacAddress' => array('Name' => 'MacAddress', 'Class' => 'MacAddress', 'ParentType' => '', 'Parameters' => array()), 'IPv6Address' => array('Name' => 'IPv6Address', 'Class' => 'IPv6Address', 'ParentType' => '', 'Parameters' => array()), 'Image' => array('Name' => 'Image', 'Class' => 'Image', 'ParentType' => '', 'Parameters' => array()), 'TimeDiff' => array('Name' => 'TimeDiff', 'Class' => 'TimeDiff', 'ParentType' => 'Integer', 'Parameters' => array()), ); } function ExecuteTypeEvent($TypeName, $Event, $Parameters = array()) { if(array_key_exists($TypeName, $this->TypeDefinitionList)) { $Type = $this->TypeDefinitionList[$TypeName]; $TypeClass = 'Type'.$Type['Class']; $TypeObject = new $TypeClass($this->FormManager); if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); } else return($TypeName); } function IsHidden($TypeName) { if(array_key_exists($TypeName, $this->TypeDefinitionList)) { $Type = $this->TypeDefinitionList[$TypeName]; $TypeClass = 'Type'.$Type['Class']; $TypeObject = new $TypeClass($this->FormManager); return($TypeObject->Hidden); } else return(false); } function RegisterType($Name, $ParentType, $Parameters) { if($ParentType != '') { $Type = $this->TypeDefinitionList[$ParentType]; } else $Type = array(); $Type['Name'] = $Name; $Type['Class'] = $Name; if(array_key_exists('Parameters', $Type)) $Type['Parameters'] = array_merge($Type['Parameters'], $Parameters); else $Type['Parameters'] = $Parameters; $this->TypeDefinitionList[$Name] = $Type; } function UnregisterType($Name) { unset($this->TypeDefinitionList[$Name]); // TODO: remove dependent types } function GetTypeDefinition($TypeName) { return($this->TypeDefinitionList[$TypeName]); } }