Changeset 436 for trunk/is/index.php
- Timestamp:
- Oct 12, 2012, 11:37:49 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/is/index.php
r435 r436 34 34 35 35 if($_SESSION['Action'] == 'list') $Output .= $this->ShowList($_SESSION['Table']); 36 else if($_SESSION['Action'] == 'edit') $Output .= $this->ShowEdit( );37 else if($_SESSION['Action'] == 'add') $Output .= $this->ShowAdd( );38 else if($_SESSION['Action'] == 'view') $Output .= $this->ShowView( );39 else if($_SESSION['Action'] == 'delete') $Output .= $this->ShowDelete( );36 else if($_SESSION['Action'] == 'edit') $Output .= $this->ShowEdit($_SESSION['Table'], $_SESSION['Id']); 37 else if($_SESSION['Action'] == 'add') $Output .= $this->ShowAdd($_SESSION['Table']); 38 else if($_SESSION['Action'] == 'view') $Output .= $this->ShowView($_SESSION['Table'], $_SESSION['Id']); 39 else if($_SESSION['Action'] == 'delete') $Output .= $this->ShowDelete($_SESSION['Table'], $_SESSION['Id']); 40 40 $Output .= '</td></tr></table>'; 41 41 … … 43 43 } 44 44 45 function ShowEdit( )45 function ShowEdit($Table, $Id) 46 46 { 47 47 $Output = ''; … … 50 50 if($_GET['o'] == 'save') 51 51 { 52 $Form = new Form($ _SESSION['Table']);52 $Form = new Form($Table); 53 53 $Form->LoadValuesFromForm(); 54 $Form->SaveValuesToDatabase($ _SESSION['Id']);54 $Form->SaveValuesToDatabase($Id); 55 55 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 56 56 $_SESSION['Action'] = 'view'; 57 $Output .= $this->ShowView( );57 $Output .= $this->ShowView($Table, $Id); 58 58 } 59 59 } else 60 60 { 61 $Form = new Form($ _SESSION['Table']);62 $Form->LoadValuesFromDatabase($ _SESSION['Id']);61 $Form = new Form($Table); 62 $Form->LoadValuesFromDatabase($Id); 63 63 $Form->OnSubmit = '?a=edit&o=save'; 64 64 $Output .= $Form->ShowEditForm(); … … 75 75 } 76 76 77 function ShowDelete( )77 function ShowDelete($Table, $Id) 78 78 { 79 79 $Output = ''; 80 $this->Database->delete($ _SESSION['Table'], 'Id='.$_SESSION['Id']);80 $this->Database->delete($Table, 'Id='.$Id); 81 81 $Output .= $this->SystemMessage('Odstranění položky', 'Položka odstraněna'); 82 82 $_SESSION['Action'] = 'list'; 83 $Output .= $this->ShowList( );84 return($Output); 85 } 86 87 function ShowAdd( )83 $Output .= $this->ShowList($Table); 84 return($Output); 85 } 86 87 function ShowAdd($Table) 88 88 { 89 89 $Output = ''; … … 92 92 if($_GET['o'] == 'save') 93 93 { 94 $Form = new Form($ _SESSION['Table']);94 $Form = new Form($Table); 95 95 $Form->LoadValuesFromForm(); 96 96 $Form->SaveValuesToDatabase(0); 97 97 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 98 98 $_SESSION['Action'] = 'view'; 99 $_SESSION['Id'] = $this->Database->insert_id; 100 $Output .= $this->ShowView(); 99 $Id = $this->Database->insert_id; 100 $_SESSION['Id'] = $Id; 101 $this->Database->update($Table, 'Id='.$Id, 102 array('UserCreate' => $this->System->Modules['User']->User['Id'], 103 'TimeCreate' => 'NOW()')); 104 $Output .= $this->ShowView($Table, $Id); 101 105 } 102 106 } else 103 107 { 104 $Form = new Form($ _SESSION['Table']);108 $Form = new Form($Table); 105 109 $Form->OnSubmit = '?a=add&o=save'; 106 110 $Output .= $Form->ShowEditForm(); … … 113 117 } 114 118 115 function ShowView( )119 function ShowView($Table, $Id) 116 120 { 117 121 global $FormTypes; 118 122 119 $Form = new Form($ _SESSION['Table']);120 $Form->LoadValuesFromDatabase($ _SESSION['Id']);123 $Form = new Form($Table); 124 $Form->LoadValuesFromDatabase($Id); 121 125 $Form->OnSubmit = '?a=view'; 122 126 $Output = $Form->ShowViewForm(); … … 135 139 { 136 140 $Output .= '<div style="text-align: center;">'.$Form->Definition['Title'].'</div>'; 137 $Output .= $this->ShowList($FormTypes[$Item['Type']]['Table'], '`'.$FormTypes[$Item['Type']]['Ref'].'`='.$ _SESSION['Id']).'<br/>';141 $Output .= $this->ShowList($FormTypes[$Item['Type']]['Table'], '`'.$FormTypes[$Item['Type']]['Ref'].'`='.$Id).'<br/>'; 138 142 } 139 143 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.