Changeset 11 for trunk/www/table.php
- Timestamp:
- Jun 11, 2009, 8:28:50 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/table.php
r10 r11 5 5 var $Id; 6 6 var $Definition; 7 var $Values; 8 var $Header; 9 var $OnRow; 10 11 function __construct($ClassName) 12 { 13 global $FormClasses; 14 15 $this->Definition = &$FormClasses[$ClassName]; 16 } 7 17 8 18 function Show() 9 19 { 20 $Table = array( 21 'Header' => $this->Header, 22 'Rows' => $this->Values, 23 ); 24 $Output = Table($Table, 'WideTable'); 25 return($Output); 10 26 } 27 28 function LoadValuesFromDatabase($Database) 29 { 30 $this->Header = array(); 31 foreach($this->Definition['Items'] as $Index => $Item) 32 { 33 $this->Header[] = $Item['Caption']; 34 35 } 36 $this->Values = array(); 37 $DbResult = $Database->query('SELECT * FROM '.$this->Definition['Table']); 38 while($DbRow = $DbResult->fetch_assoc()) 39 { 40 if(method_exists($this->OnRow[0], $this->OnRow[1])) 41 { 42 $Object = $this->OnRow[0]; 43 $Method = $this->OnRow[1]; 44 $DbRow = $Object->$Method($DbRow); 45 } 46 $Row = array(); 47 foreach($this->Definition['Items'] as $Index => $Item) 48 { 49 $Row[] = $DbRow[$Index]; 50 } 51 $this->Values[] = $Row; 52 } 53 } 11 54 } 12 55
Note:
See TracChangeset
for help on using the changeset viewer.