Changeset 887 for trunk/Common/Form/Form.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Form.php
r874 r887 22 22 class Form 23 23 { 24 var $FormManager;25 var $Definition;26 var $Values;27 var $ValuesValidate;28 var $ValuesFilter;29 var $OnSubmit;30 var $Database;31 32 function __construct( $FormManager)24 public FormManager $FormManager; 25 public Database $Database; 26 public array $Definition; 27 public array $Values; 28 public array $ValuesValidate; 29 public array $ValuesFilter; 30 public string $OnSubmit; 31 32 function __construct(FormManager $FormManager) 33 33 { 34 34 $this->FormManager = &$FormManager; … … 41 41 } 42 42 43 function LoadDefaults() 43 function LoadDefaults(): void 44 44 { 45 45 foreach ($this->Definition['Items'] as $Index => $Item) … … 58 58 } 59 59 60 function SetClass( $Name)60 function SetClass(string $Name): void 61 61 { 62 62 $this->Definition = &$this->FormManager->Classes[$Name]; … … 64 64 } 65 65 66 function GetValue( $Index, $Event = 'OnView')66 function GetValue(string $Index, string $Event = 'OnView'): string 67 67 { 68 68 $Item = $this->Definition['Items'][$Index]; … … 82 82 } 83 83 84 function ShowViewForm() 84 function ShowViewForm(): string 85 85 { 86 86 $Table = array( … … 116 116 } 117 117 118 function ShowEditForm() 118 function ShowEditForm(): string 119 119 { 120 120 if (!array_key_exists('SubmitText', $this->Definition)) $this->Definition['SubmitText'] = 'Uložit'; … … 125 125 } 126 126 127 function ShowEditBlock( $Context = '')127 function ShowEditBlock(string $Context = ''): string 128 128 { 129 129 $Hidden = ''; … … 182 182 } 183 183 184 function LoadValuesFromDatabase( $Id)184 function LoadValuesFromDatabase(string $Id): void 185 185 { 186 186 foreach ($this->Definition['Items'] as $Index => $Item) … … 232 232 } 233 233 234 function SaveValuesToDatabase( $Id)234 function SaveValuesToDatabase(string $Id) 235 235 { 236 236 $Values = array(); … … 269 269 } 270 270 271 function LoadValuesFromForm() 271 function LoadValuesFromForm(): void 272 272 { 273 273 $this->Values = $this->LoadValuesFromFormBlock(); 274 274 } 275 275 276 function LoadValuesFromFormBlock( $Context = '')276 function LoadValuesFromFormBlock(string $Context = ''): array 277 277 { 278 278 if ($Context != '') $Context = $Context.'-'; … … 319 319 } 320 320 321 function Validate() 321 function Validate(): bool 322 322 { 323 323 $Valid = true; … … 358 358 359 359 360 function MakeLink( $Target, $Title)360 function MakeLink(string $Target, string $Title): string 361 361 { 362 362 return '<a href="'.$Target.'">'.$Title.'</a>'; 363 363 } 364 364 365 function Table( $Table)365 function Table(array $Table): string 366 366 { 367 367 $Result = '<table class="BasicTable">'; … … 389 389 class FormManager 390 390 { 391 var$Classes;392 var$FormTypes;393 var$Database;394 var$Type;395 var$RootURL;396 var$ShowRelation;397 398 function __construct( $Database)391 public array $Classes; 392 public array $FormTypes; 393 public Database $Database; 394 public Type $Type; 395 public string $RootURL; 396 public bool $ShowRelation; 397 398 function __construct(Database $Database) 399 399 { 400 400 $this->Database = &$Database; … … 405 405 } 406 406 407 function RegisterClass( $Name, $Class)407 function RegisterClass(string $Name, array $Class): void 408 408 { 409 409 $this->Classes[$Name] = $Class; 410 410 } 411 411 412 function UnregisterClass( $Name)412 function UnregisterClass(string $Name): void 413 413 { 414 414 unset($this->Classes[$Name]); 415 415 } 416 416 417 function RegisterFormType( $Name, $Class)417 function RegisterFormType(string $Name, array $Class): void 418 418 { 419 419 $this->FormTypes[$Name] = $Class; 420 420 } 421 421 422 function UnregisterFormType( $Name)422 function UnregisterFormType(string $Name): void 423 423 { 424 424 unset($this->FormTypes[$Name]); 425 425 } 426 426 427 function UpdateSQLMeta() 427 function UpdateSQLMeta(): void 428 428 { 429 429 $this->Database->query('DELETE FROM ModelField');
Note:
See TracChangeset
for help on using the changeset viewer.