Last change
on this file was 93, checked in by chronos, 11 years ago |
- Fixed: System variable as parameter to constructors of descendents of Module class.
- Removed: End PHP mark "?>" from all files.
|
File size:
1.6 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | class TypeDate extends TypeBase
|
---|
4 | {
|
---|
5 | var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
|
---|
6 |
|
---|
7 | function OnView($Item)
|
---|
8 | {
|
---|
9 | global $MonthNames;
|
---|
10 |
|
---|
11 | $Parts = explode('-', $Item['Value']);
|
---|
12 |
|
---|
13 | $Output = ($Parts[2] * 1).'.'.$MonthNames[$Parts[1] * 1].' '.$Parts[0];
|
---|
14 | return($Output);
|
---|
15 | }
|
---|
16 |
|
---|
17 | function OnEdit($Item)
|
---|
18 | {
|
---|
19 | global $MonthNames;
|
---|
20 |
|
---|
21 | $Parts = explode('-', $Item['Value']);
|
---|
22 |
|
---|
23 | // Day
|
---|
24 | $Output = '<select name="'.$Item['Name'].'-day">';
|
---|
25 | for($I = 1; $I <= 31; $I++)
|
---|
26 | {
|
---|
27 | if($Parts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';
|
---|
28 | $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
|
---|
29 | }
|
---|
30 | $Output .= '</select>';
|
---|
31 | // Month
|
---|
32 | $Output .= '<select name="'.$Item['Name'].'-month">';
|
---|
33 | for($I = 1; $I <= 12; $I++)
|
---|
34 | {
|
---|
35 | if($Parts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';
|
---|
36 | $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>';
|
---|
37 | }
|
---|
38 | $Output .= '</select>';
|
---|
39 | // Year
|
---|
40 | $Output .= '<select name="'.$Item['Name'].'-year">';
|
---|
41 | for($I = 1900; $I < 2100; $I++)
|
---|
42 | {
|
---|
43 | if($Parts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';
|
---|
44 | $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
|
---|
45 | }
|
---|
46 | $Output .= '</select>';
|
---|
47 | return($Output);
|
---|
48 | }
|
---|
49 |
|
---|
50 | function OnLoad($Item)
|
---|
51 | {
|
---|
52 | return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day']);
|
---|
53 | }
|
---|
54 |
|
---|
55 | function DatabaseEscape($Value)
|
---|
56 | {
|
---|
57 | return('"'.addslashes($Value).'"');
|
---|
58 | }
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.