Last change
on this file was 8, checked in by chronos, 18 months ago |
- Modified: Updated Common package.
- Modified: Form types made as separate FormManager package.
- Fixed: PHP 8.1 support.
|
File size:
1.0 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | include_once(dirname(__FILE__).'/Base.php');
|
---|
4 |
|
---|
5 | class TypeMacAddress extends TypeString
|
---|
6 | {
|
---|
7 | function __construct(FormManager $FormManager)
|
---|
8 | {
|
---|
9 | parent::__construct($FormManager);
|
---|
10 | $this->DatabaseCompareOperators = array('Jako' => 'LIKE', 'Rovno' => '=', 'Nerovno' => '!=');
|
---|
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'].'" id="'.$Item['Name'].'" value="'.$Item['Value'].'"/>';
|
---|
22 | return $Output;
|
---|
23 | }
|
---|
24 |
|
---|
25 | function OnLoad(array $Item): ?string
|
---|
26 | {
|
---|
27 | return strtoupper($_POST[$Item['Name']]);
|
---|
28 | }
|
---|
29 |
|
---|
30 | function DatabaseEscape(string $Value): string
|
---|
31 | {
|
---|
32 | return '"'.addslashes($Value).'"';
|
---|
33 | }
|
---|
34 |
|
---|
35 | function Validate(array $Item): bool
|
---|
36 | {
|
---|
37 | if ($Item['Null'] and ($Item['Value'] == '')) return true;
|
---|
38 | return preg_match('/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/', $Item['Value']);
|
---|
39 | }
|
---|
40 |
|
---|
41 | function GetValidationFormat(): string
|
---|
42 | {
|
---|
43 | return 'XX:XX:XX:XX:XX:XX kde X je hexa hodnota 0..F';
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.