Changeset 431
- Timestamp:
- Oct 11, 2012, 9:15:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/form_classes.php
r430 r431 2 2 3 3 $FormClasses = array( 4 'NetworkDomainAlias' => array( 5 'Title' => 'Alias domény', 6 'Table' => 'NetworkDomainAlias', 7 'Items' => array( 8 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 9 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''), 10 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''), 11 ), 12 ), 4 13 'NetworkDevice' => array( 5 14 'Title' => 'Síťové zařízení', … … 82 91 'Quantity' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'), 83 92 'Tax' => array('Type' => 'Integer', 'Caption' => 'Daň [%]', 'Default' => '19'), 93 ), 94 ), 95 'FinanceOperation' => array( 96 'Title' => 'Finanční operace', 97 'Table' => 'FinanceOperation', 98 'DefaultSortColumn' => 'Time', 99 'Items' => array( 100 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas realizace', 'Default' => ''), 101 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Zákazník', 'Default' => ''), 102 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotově', 'Default' => ''), 103 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Zdanitelné', 'Default' => ''), 104 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Unit' => 'Kč'), 105 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), 106 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''), 107 'Network' => array('Type' => 'Boolean', 'Caption' => 'Týkající sítě', 'Default' => ''), 108 'BankAccount' => array('Type' => 'TFinanceBankAccount', 'Caption' => 'Účet', 'Default' => ''), 109 'Treasury' => array('Type' => 'TFinanceTreasury', 'Caption' => 'Pokladna', 'Default' => ''), 84 110 ), 85 111 ), … … 309 335 'Filter' => '1', 310 336 ), 337 'TSubject' => array( 338 'Type' => 'Reference', 339 'Table' => 'Subject', 340 'Id' => 'Id', 341 'Name' => 'Name', 342 'Filter' => '1', 343 ), 344 'TFinanceTreasury' => array( 345 'Type' => 'Reference', 346 'Table' => 'FinanceTreasury', 347 'Id' => 'Id', 348 'Name' => 'Name', 349 'Filter' => '1', 350 ), 351 'TFinanceBankAccount' => array( 352 'Type' => 'Reference', 353 'Table' => 'FinanceBankAccount', 354 'Id' => 'Id', 355 'Name' => 'Comment', 356 'Filter' => '1', 357 ), 311 358 ); 312 359 -
trunk/forms.php
r430 r431 10 10 var $OnSubmit = ''; 11 11 12 function Form($ClassName)12 function __construct($ClassName) 13 13 { 14 14 global $FormClasses; 15 15 16 16 $this->Definition = &$FormClasses[$ClassName]; 17 } 18 19 function ShowViewForm() 20 { 21 global $Database, $FormTypes, $System; 22 23 $Table = array( 24 //'Header' => array('Položka', 'Hodnota'), 25 'Rows' => array(), 26 ); 27 foreach($this->Definition['Items'] as $Index => $Item) 28 { 29 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 30 if(array_key_exists($Item['Type'], $FormTypes)) 31 { 32 if(!array_key_exists($Item['Type'], $System->Type->TypeDefinitionList)) 33 $System->Type->RegisterType($Item['Type'], '', 34 $FormTypes[$Item['Type']]); 35 $Edit = ''.$System->Type->ExecuteTypeEvent('OneToMany', 'OnView', 36 array('Value' => $this->Values[$Index], 'Name' => $Index, 37 'Type' => $Item['Type'])).''; 38 } else $Edit = ''.$System->Type->ExecuteTypeEvent($Item['Type'], 'OnView', 39 array('Value' => $this->Values[$Index], 'Name' => $Index)).''; 40 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 41 } 42 $Output = '<fieldset><legend>'.$this->Definition['Title'].'</legend>'.Table($Table). 43 '</fieldset>'; 44 return($Output); 17 45 } 18 46 -
trunk/is/index.php
r430 r431 34 34 { 35 35 if(array_key_exists('Table', $_SESSION)) 36 $Output .= $this->Show Table($FormClasses[$_SESSION['Table']]);36 $Output .= $this->ShowList($FormClasses[$_SESSION['Table']]); 37 37 } else 38 if($_SESSION['Action'] == 'edit') 39 { 40 $Form = new Form($_SESSION['Table']); 41 $Form->LoadValuesFromDatabase($_SESSION['Id']); 42 $Form->OnSubmit = '?a=view'; 43 $Output .= $Form->ShowEditForm(); 44 } else 45 if($_SESSION['Action'] == 'view') 46 { 47 48 } else 49 if($_SESSION['Action'] == 'delete') 50 { 51 52 } 38 if($_SESSION['Action'] == 'edit') $Output .= $this->ShowEdit(); 39 else if($_SESSION['Action'] == 'add') $Output .= $this->ShowAdd(); 40 else if($_SESSION['Action'] == 'view') $Output .= $this->ShowView(); 41 else if($_SESSION['Action'] == 'delete') $Output .= $this->ShowDelete(); 53 42 $Output .= '</td></tr></table>'; 54 43 … … 56 45 } 57 46 58 function ShowTable($FormClass) 47 function ShowEdit() 48 { 49 $Form = new Form($_SESSION['Table']); 50 $Form->LoadValuesFromDatabase($_SESSION['Id']); 51 $Form->OnSubmit = '?a=view'; 52 $Output = $Form->ShowEditForm(); 53 return($Output); 54 } 55 56 function ShowDelete() 57 { 58 $Output = ''; 59 return($Output); 60 } 61 62 function ShowAdd() 63 { 64 $Form = new Form($_SESSION['Table']); 65 $Form->OnSubmit = '?a=view'; 66 $Output = $Form->ShowEditForm(); 67 return($Output); 68 } 69 70 function ShowView() 71 { 72 $Form = new Form($_SESSION['Table']); 73 $Form->LoadValuesFromDatabase($_SESSION['Id']); 74 $Form->OnSubmit = '?a=view'; 75 $Output = $Form->ShowViewForm(); 76 $Output .= '<br/><div style="text-align: center;"><a href="?a=edit"><img alt="Upravit" title="Upravit" src="'. 77 $this->System->Link('/images/edit.png').'"/></a></div>'; 78 return($Output); 79 } 80 81 function ShowList($FormClass) 59 82 { 60 83 global $Type, $FormTypes; … … 70 93 $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']); 71 94 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 72 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 95 if(!array_key_exists('DefaultSortColumn', $FormClass)) 96 $FormClass['DefaultSortColumn'] = 'Id'; 97 $Order = GetOrderTableHeader($TableColumns, $FormClass['DefaultSortColumn'], 0); 73 98 $Output .= $Order['Output']; 74 99
Note:
See TracChangeset
for help on using the changeset viewer.