Changeset 71 for trunk/www/Base
- Timestamp:
- Aug 23, 2009, 6:14:01 PM (15 years ago)
- Location:
- trunk/www/Base
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/Base/Form.php
r69 r71 1 1 <?php 2 2 3 class Form 3 class Form extends Module 4 4 { 5 5 var $Definition = array(); … … 7 7 var $OnSubmit = ''; 8 8 9 function __construct($ FormClass)9 function __construct($System, $FormClass) 10 10 { 11 11 $this->Definition = $FormClass; … … 14 14 $this->Values[$Index] = ''; 15 15 } 16 $this->System = $System; 17 $this->Database = $System->Database; 18 $this->Config = $System->Config; 16 19 } 17 20 … … 24 27 function ShowTableBlock($Context = '') 25 28 { 26 global $ Database, $FormTypes;29 global $FormTypes; 27 30 28 31 $Table = array( … … 41 44 } 42 45 } 43 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.Table($Table, 'WideTable'); 46 $Html = new Html(); 47 $Output = '<div style="text-align: center">'.$this->Definition['Title'].'</div>'.$Html->Table($Table, 'WideTable'); 44 48 return($Output); 45 49 } … … 54 58 function ShowEditBlock($Context = '') 55 59 { 56 global $ Database, $FormTypes;60 global $FormTypes; 57 61 58 62 $Table = array( … … 70 74 } 71 75 } 72 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table, 'BasicTable'). 76 $Html = new Html(); 77 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.$Html->Table($Table, 'BasicTable'). 73 78 '</fieldset>'; 74 79 foreach($this->Definition['Items'] as $Index => $Item) … … 79 84 function LoadValuesFromDatabase($Id) 80 85 { 81 global $Database; 82 83 $DbResult = $Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 86 $DbResult = $this->Database->query('SELECT T.* FROM '.$this->Definition['Table'].' AS T WHERE T.Id='.$Id); 84 87 if($DbResult->num_rows > 0) $DbRow = $DbResult->fetch_assoc(); 85 88 foreach($this->Definition['Items'] as $Index => $Item) … … 94 97 function SaveValuesToDatabase($Id) 95 98 { 96 global $Database;97 98 99 if($Id == 0) 99 100 { 100 101 $this->Values['Id'] = $Id; 101 $DbResult = $ Database->replace($this->Definition['Table'], $this->Values);102 $DbResult = $this->Database->replace($this->Definition['Table'], $this->Values); 102 103 } else 103 $DbResult = $ Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values);104 $DbResult = $this->Database->update($this->Definition['Table'], 'Id='.$Id, $this->Values); 104 105 } 105 106 -
trunk/www/Base/Html.php
r69 r71 1 1 <?php 2 2 3 class HTML extends Module3 class HTML 4 4 { 5 5 function ShowArray($Value) -
trunk/www/Base/Table.php
r69 r71 57 57 'Rows' => $this->Values, 58 58 ); 59 $Output = Table($Table, 'WideTable'); 60 $Output .= '<div class="Pager">'.PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>'; 59 $Html = new Html(); 60 $Output = $Html->Table($Table, 'WideTable'); 61 $Output .= '<div class="Pager">'.$Html->PageList('Page', $this->Page, $this->TotalRowCount, $Config['Web']['TableRowPerPage']).'</div>'; 61 62 return($Output); 62 63 } -
trunk/www/Base/Types/Base.php
r69 r71 1 1 <?php 2 2 3 class TypeBase 3 class TypeBase extends Module 4 4 { 5 5 var $DatabaseCompareOperators = array(); -
trunk/www/Base/Types/Include.php
r69 r71 42 42 function ExecuteTypeEvent($TypeName, $Event, $Parameters = array()) 43 43 { 44 global $TypeDefinitionList ;44 global $TypeDefinitionList, $System; 45 45 46 46 if(array_key_exists($TypeName, $TypeDefinitionList)) … … 48 48 $Type = $TypeDefinitionList[$TypeName]; 49 49 $TypeClass = 'Type'.$Type['Class']; 50 $TypeObject = new $TypeClass ;50 $TypeObject = new $TypeClass($System); 51 51 if(is_callable(array($TypeObject, $Event))) return($TypeObject->$Event($Parameters)); 52 52 else return($TypeName.'->'.$Event.'('.serialize($Parameters).')'); -
trunk/www/Base/Types/PointerOneToOne.php
r69 r71 5 5 function OnView($Item) 6 6 { 7 global $ Database, $TypeDefinitionList;7 global $TypeDefinitionList; 8 8 9 9 $Type = $TypeDefinitionList[$Item['Type']]; 10 $DbResult = $ Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);10 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']); 11 11 $DbRow = $DbResult->fetch_assoc(); 12 12 $Output = $DbRow['Name']; … … 24 24 function OnEdit($Item) 25 25 { 26 global $ Database, $TypeDefinitionList;26 global $TypeDefinitionList; 27 27 28 28 $Output = '<select name="'.$Item['Name'].'">'; … … 30 30 if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition']; 31 31 else $Where = ''; 32 $DbResult = $ Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');32 $DbResult = $this->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC'); 33 33 while($DbRow = $DbResult->fetch_assoc()) 34 34 {
Note:
See TracChangeset
for help on using the changeset viewer.