|
Last change
on this file was 887, checked in by chronos, 5 years ago |
- Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
- Fixed: Various found code issues.
|
|
File size:
897 bytes
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/Base.php');
|
|---|
| 4 |
|
|---|
| 5 | class TypeInteger extends TypeBase
|
|---|
| 6 | {
|
|---|
| 7 | function __construct(FormManager $FormManager)
|
|---|
| 8 | {
|
|---|
| 9 | parent::__construct($FormManager);
|
|---|
| 10 | $this->DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | function OnView(array $Item): ?string
|
|---|
| 14 | {
|
|---|
| 15 | $Output = $Item['Value'];
|
|---|
| 16 | return $Output;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | function OnEdit(array $Item): string
|
|---|
| 20 | {
|
|---|
| 21 | $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
|
|---|
| 22 | return $Output;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | function OnLoad(array $Item): ?string
|
|---|
| 26 | {
|
|---|
| 27 | return $_POST[$Item['Name']];
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | function Validate(array $Item): bool
|
|---|
| 31 | {
|
|---|
| 32 | if ($Item['Null'] and ($Item['Value'] == '')) return true;
|
|---|
| 33 | return preg_match('/^\-*[0-9\.]+$/', $Item['Value']);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | function GetValidationFormat(): string
|
|---|
| 37 | {
|
|---|
| 38 | return 'číselná hodnota';
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.