source: types/Date.php@ 5

Last change on this file since 5 was 5, checked in by george, 17 years ago
  • Upraveno: Definice typů přesunuty do databáze tabulky SystemType. Funkční pro každý typ je řešena jako samostatný soubor v podsložce types se stejným jménem jako je jméno typu.
File size: 1.3 KB
Line 
1<?php
2
3$MonthList = array('0', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec');
4
5function TypeDateViewHtml($Type, $Parameter, $Table, $Id)
6{
7 global $MonthList;
8
9 $Parts = explode('-', $Parameter);
10
11 $Output = ($Parts[2] * 1).'.'.$MonthList[$Parts[1] * 1].'.'.$Parts[0];
12 return($Output);
13}
14
15function TypeDateEditHtml($Type, $Parameter, $Table, $Id)
16{
17 global $MonthList;
18
19 $Parts = explode('-', $Parameter);
20
21 // Day
22 $Output = '<select name="%name%-day">';
23 for($I = 1; $I <= 31; $I++)
24 {
25 if($Parts[2] == $I) $Selected = ' selected="1"'; else $Selected = '';
26 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
27 }
28 $Output .= '</select>';
29 // Month
30 $Output .= '<select name="%name%-month">';
31 for($I = 1; $I <= 12; $I++)
32 {
33 if($Parts[1] == $I) $Selected = ' selected="1"'; else $Selected = '';
34 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthList[$I].'</option>';
35 }
36 $Output .= '</select>';
37 // Year
38 $Output .= '<select name="%name%-month">';
39 for($I = 1900; $I < 2100; $I++)
40 {
41 if($Parts[0] == $I) $Selected = ' selected="1"'; else $Selected = '';
42 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
43 }
44 $Output .= '</select>';
45 return($Output);
46}
47
48?>
Note: See TracBrowser for help on using the repository browser.