Changeset 436
- Timestamp:
- Oct 12, 2012, 11:37:49 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/form_classes.php
r435 r436 2 2 3 3 $FormClasses = array( 4 'Product' => array( 5 'Title' => 'Zboží', 6 'Table' => 'Product', 7 'DefaultSortColumn' => 'Name', 8 'Items' => array( 9 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 10 'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0'), 11 'Count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => ''), 12 'Date' => array('Type' => 'Date', 'Caption' => 'Datum', 'Default' => ''), 13 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek', 'Default' => ''), 14 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '0'), 15 'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''), 16 'User' => array('Type' => 'TMember', 'Caption' => 'Uživatel', 'Default' => ''), 17 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => ''), 18 'DeviceId' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), 19 'DeprecatedPrice' => array('Type' => 'Float', 'Caption' => 'Odpisová cena', 'Default' => ''), 20 'StockCard' => array('Type' => 'TStockCard', 'Caption' => 'Zboží', 'Default' => ''), 21 ), 22 ), 23 'Stock' => array( 24 'Title' => 'Sklady', 25 'Table' => 'Stock', 26 'DefaultSortColumn' => 'Name', 27 'Items' => array( 28 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 29 ), 30 ), 4 31 'FinanceBillingPeriod' => array( 5 32 'Title' => 'Platební období', … … 504 531 'Filter' => '1', 505 532 ), 533 'TStockCard' => array( 534 'Type' => 'Reference', 535 'Table' => 'StockCard', 536 'Id' => 'Id', 537 'Name' => 'Name', 538 'Filter' => '1', 539 ), 506 540 ); 507 541 -
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.