Changeset 67 for trunk/admin.php
- Timestamp:
- Jan 3, 2016, 11:52:37 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r64 r67 5 5 $Application->Start(); 6 6 7 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = ''; 8 switch($Operation) 7 class AdminPage 9 8 { 10 case 'Add': 11 $Output = ShowAdd(); 12 break; 13 case 'Delete': 14 $Output = ShowDelete(); 15 break; 16 case 'Edit': 17 $Output = ShowEdit(); 18 break; 19 case 'RebuildCache': 20 $Output = ShowRebuildCache(); 21 break; 22 default: 23 $Output = ShowNone(); 9 function __construct($Database) 10 { 11 $this->Database = &$Database; 12 } 13 14 function Show() 15 { 16 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = ''; 17 switch($Operation) 18 { 19 case 'Add': 20 $Output = $this->ShowAdd(); 21 break; 22 case 'Delete': 23 $Output = $this->ShowDelete(); 24 break; 25 case 'Edit': 26 $Output = $this->ShowEdit(); 27 break; 28 case 'RebuildCache': 29 $Output = $this->ShowRebuildCache(); 30 break; 31 default: 32 $Output = $this->ShowNone(); 33 } 34 ShowPage($Output); 35 } 36 37 function ShowNone() 38 { 39 $Table = array( 40 'Header' => array('Název veličiny', 'Operace'), 41 'Rows' => array(), 42 ); 43 44 $Result = $this->Database->select('measure', '*', '1 ORDER BY Description'); 45 while($Measure = $Result->fetch_array()) 46 { 47 array_push($Table['Rows'], array($Measure['Description'], MakeLink('?Operation=Edit&MeasureId='.$Measure['Id'], 'Editovat').' '.MakeLink('?Operation=Delete&MeasureId='.$Measure['Id'], 'Odstranit').' '.MakeLink('?Operation=RebuildCache&MeasureId='.$Measure['Id'], 'Přestavět cache'))); 48 } 49 $Output = '<h3>Seznam měření</h3>'.Table($Table).MakeLink('?Operation=Add', 'Přidat'); 50 return($Output); 51 } 52 53 function ShowEdit() 54 { 55 $DbResult = $this->Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId'])); 56 $Values = array(); 57 $Values = $DbResult->fetch_array(); 58 return($this->ShowEditTable('Measure', $Values)); 59 } 60 61 function ShowAdd() 62 { 63 $Values = array(); 64 return($this->ShowEditTable('Measure', $Values)); 65 } 66 67 function ShowRebuildCache() 68 { 69 echo("Vytvařím novou cache...<br>"); 70 $DbResult = $this->Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId'])); 71 $Measure = $DbResult->fetch_array(); 72 73 $Measure->RebuildMeasureCache(); 74 echo('Dokončeno<br>'); 75 } 24 76 } 25 ShowPage($Output);26 27 function ShowNone()28 {29 global $Database;30 $Table = array(31 'Header' => array('Název veličiny', 'Operace'),32 'Rows' => array(),33 );34 35 $Result = $Database->select('measure', '*', '1 ORDER BY Description');36 while($Measure = $Result->fetch_array())37 {38 array_push($Table['Rows'], array($Measure['Description'], MakeLink('?Operation=Edit&MeasureId='.$Measure['Id'], 'Editovat').' '.MakeLink('?Operation=Delete&MeasureId='.$Measure['Id'], 'Odstranit').' '.MakeLink('?Operation=RebuildCache&MeasureId='.$Measure['Id'], 'Přestavět cache')));39 }40 $Output = '<h3>Seznam měření</h3>'.Table($Table).MakeLink('?Operation=Add', 'Přidat');41 return($Output);42 }43 44 function ShowEdit()45 {46 global $Database;47 $DbResult = $Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId']));48 $Values = array();49 $Values = $DbResult->fetch_array();50 return(ShowEditTable('Measure', $Values));51 }52 53 function ShowAdd()54 {55 global $Database;56 $Values = array();57 return(ShowEditTable('Measure', $Values));58 }59 60 function ShowRebuildCache()61 {62 global $Database;63 echo("Vytvařím novou cache...<br>");64 $DbResult = $Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId']));65 $Measure = $DbResult->fetch_array();66 67 RebuildMeasureCache($Measure);68 echo('Dokončeno<br>');69 }
Note:
See TracChangeset
for help on using the changeset viewer.