Changeset 501 for trunk/Common/Form/Types
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- Location:
- trunk/Common/Form
- Files:
-
- 2 added
- 1 deleted
- 5 edited
- 2 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Types/Base.php
r484 r501 3 3 class TypeBase 4 4 { 5 var $System; 5 var $FormManager; 6 var $Database; 6 7 var $DatabaseCompareOperators = array(); 7 8 var $Hidden; 8 9 9 function __construct($ System)10 function __construct($FormManager) 10 11 { 11 $this->System = &$System; 12 $this->FormManager = &$FormManager; 13 $this->Database = &$FormManager->Database; 12 14 $this->Hidden = false; 13 15 } -
trunk/Common/Form/Types/Enumeration.php
r498 r501 7 7 function OnView($Item) 8 8 { 9 $Type = $this-> System->Type->GetTypeDefinition($Item['Type']);9 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 10 10 if(array_key_exists($Item['Value'], $Type['Parameters']['States'])) 11 11 $Output = $Type['Parameters']['States'][$Item['Value']]; … … 16 16 function OnEdit($Item) 17 17 { 18 $Type = $this-> System->Type->GetTypeDefinition($Item['Type']);18 $Type = $this->FormManager->Type->GetTypeDefinition($Item['Type']); 19 19 $Output = '<select name="'.$Item['Name'].'">'; 20 20 if(array_key_exists('Null', $Item) and $Item['Null']) -
trunk/Common/Form/Types/Hidden.php
r484 r501 5 5 class TypeHidden extends TypeBase 6 6 { 7 function __construct($ System)7 function __construct($FormManager) 8 8 { 9 parent::__construct($ System);9 parent::__construct($FormManager); 10 10 $this->Hidden = true; 11 11 } -
trunk/Common/Form/Types/OneToMany.php
r483 r501 25 25 { 26 26 $Output = '<select name="'.$Item['Name'].'">'; 27 $Type = $this-> System->Type->TypeDefinitionList[$Item['Type']];27 $Type = $this->FormManager->Type->TypeDefinitionList[$Item['Type']]; 28 28 if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 29 29 else $Where = ''; … … 35 35 if(array_key_exists('View', $Type['Parameters'])) $Table = $Type['Parameters']['View']; 36 36 else $Table = $Type['Parameters']['Table']; 37 $DbResult = $this-> System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`');37 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS `Name`,'.$Type['Parameters']['Id'].' AS `Id` FROM '.$Table.''.$Where.' ORDER BY `Name`'); 38 38 while($DbRow = $DbResult->fetch_assoc()) 39 39 { -
trunk/Common/Form/Types/RandomHash.php
r484 r501 5 5 class TypeRandomHash extends TypeBase 6 6 { 7 function __construct($ System)7 function __construct($FormManager) 8 8 { 9 parent::__construct($ System);9 parent::__construct($FormManager); 10 10 $this->Hidden = true; 11 11 } -
trunk/Common/Form/Types/Type.php
r500 r501 16 16 include(dirname(__FILE__).'/Hyperlink.php'); 17 17 include(dirname(__FILE__).'/Hidden.php'); 18 include(dirname(__FILE__).'/File/File.php'); 18 include(dirname(__FILE__).'/File.php'); 19 include(dirname(__FILE__).'/FileContent.php'); 19 20 include(dirname(__FILE__).'/GPS.php'); 20 21 include(dirname(__FILE__).'/IPv4Address.php'); … … 24 25 class Type 25 26 { 26 var $ System;27 var $FormManager; 27 28 var $TypeDefinitionList; 28 29 var $Values; 29 30 30 function __construct($ System)31 function __construct($FormManager) 31 32 { 32 $this-> System = $System;33 $this->FormManager = &$FormManager; 33 34 $this->TypeDefinitionList = array 34 35 ( … … 52 53 'Color' => array('Name' => 'Color', 'Class' => 'Color', 'ParentType' => '', 'Parameters' => array()), 53 54 'RandomHash' => array('Name' => 'RandomHash', 'Class' => 'RandomHash', 'ParentType' => '', 'Parameters' => array()), 55 'FileContent' => array('Name' => 'FileContent', 'Class' => 'FileContent', 'ParentType' => '', 'Parameters' => array()), 54 56 ); 55 57 } … … 61 63 $Type = $this->TypeDefinitionList[$TypeName]; 62 64 $TypeClass = 'Type'.$Type['Class']; 63 $TypeObject = new $TypeClass($this-> System);65 $TypeObject = new $TypeClass($this->FormManager); 64 66 if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); 65 67 else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); … … 73 75 $Type = $this->TypeDefinitionList[$TypeName]; 74 76 $TypeClass = 'Type'.$Type['Class']; 75 $TypeObject = new $TypeClass($this-> System);77 $TypeObject = new $TypeClass($this->FormManager); 76 78 return($TypeObject->Hidden); 77 79 } else return(false); … … 92 94 } 93 95 96 function UnregisterType($Name) 97 { 98 unset($this->TypeDefinitionList[$Name]); 99 // TODO: remove dependent types 100 } 101 94 102 function GetTypeDefinition($TypeName) 95 103 {
Note:
See TracChangeset
for help on using the changeset viewer.