d61a01d4 |
1 | <?php |
7c67a5e8 |
2 | |
3 | /** |
1c7143ad |
4 | * Other calendar plugin functions. |
7c67a5e8 |
5 | * |
1c7143ad |
6 | * @copyright © 2002-2006 The SquirrelMail Project Team |
4b4abf93 |
7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
8 | * @version $Id$ |
ea5f4b8e |
9 | * @package plugins |
10 | * @subpackage calendar |
d61a01d4 |
11 | */ |
12 | |
ea5f4b8e |
13 | /** |
1c7143ad |
14 | * Adds second layer of calendar links to upper menu |
ea5f4b8e |
15 | * @return void |
16 | */ |
d61a01d4 |
17 | function calendar_header() { |
d61a01d4 |
18 | global $color,$year,$day,$month; |
19 | |
b01b21d0 |
20 | echo html_tag( 'table', '', '', $color[0], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) . |
21 | html_tag( 'tr' ) . |
22 | html_tag( 'td', '', 'left', '', 'width="100%"' ); |
d61a01d4 |
23 | |
c435f076 |
24 | displayInternalLink("plugins/calendar/calendar.php?year=$year&month=$month",_("Month View"),"right"); |
1ba8cd6b |
25 | echo " \n"; |
c435f076 |
26 | displayInternalLink("plugins/calendar/day.php?year=$year&month=$month&day=$day",_("Day View"),"right"); |
1ba8cd6b |
27 | echo " \n"; |
c435f076 |
28 | // displayInternalLink("plugins/calendar/event_create.php?year=$year&month=$month&day=$day",_("Add Event"),"right"); |
1ba8cd6b |
29 | // echo " \n"; |
b01b21d0 |
30 | echo '</td></tr>'; |
d61a01d4 |
31 | |
32 | } |
33 | |
1c7143ad |
34 | /** |
35 | * Generates html option tags with length values |
36 | * |
37 | * Hardcoded values from 0 minutes to 6 hours |
38 | * @param integer $selected selected option length |
39 | * @return void |
40 | */ |
d61a01d4 |
41 | function select_option_length($selected) { |
d61a01d4 |
42 | $eventlength = array( |
1ba8cd6b |
43 | '0' => _("0 min."), |
44 | '15' => _("15 min."), |
6fe63d4e |
45 | '30' => _("30 min."), |
1ba8cd6b |
46 | '45' => _("45 min."), |
47 | '60' => _("1 hr."), |
48 | '90' => _("1.5 hr."), |
49 | '120' => _("2 hr."), |
50 | '150' => _("2.5 hr."), |
51 | '180' => _("3 hr."), |
52 | '210' => _("3.5 hr."), |
53 | '240' => _("4 hr."), |
54 | '300' => _("5 hr."), |
55 | '360' => _("6 hr.") |
d61a01d4 |
56 | ); |
57 | |
58 | while( $bar = each($eventlength)) { |
1c7143ad |
59 | if($bar['key']==$selected){ |
60 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
d61a01d4 |
61 | } else { |
1c7143ad |
62 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
d61a01d4 |
63 | } |
64 | } |
65 | } |
66 | |
1c7143ad |
67 | /** |
68 | * Generates html option tags with minute values |
69 | * |
70 | * Hardcoded values in 5 minute intervals |
71 | * @param integer $selected selected value |
72 | * @return void |
73 | */ |
d61a01d4 |
74 | function select_option_minute($selected) { |
75 | $eventminute = array( |
1c7143ad |
76 | '00'=>'00', |
77 | '05'=>'05', |
78 | '10'=>'10', |
79 | '15'=>'15', |
80 | '20'=>'20', |
81 | '25'=>'25', |
82 | '30'=>'30', |
83 | '35'=>'35', |
84 | '40'=>'40', |
85 | '45'=>'45', |
86 | '50'=>'50', |
87 | '55'=>'55' |
d61a01d4 |
88 | ); |
89 | |
90 | while ( $bar = each($eventminute)) { |
1c7143ad |
91 | if ($bar['key']==$selected){ |
92 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
d61a01d4 |
93 | } else { |
1c7143ad |
94 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
d61a01d4 |
95 | } |
96 | } |
97 | } |
98 | |
1c7143ad |
99 | /** |
100 | * Generates html option tags with hour values |
101 | * @param integer $selected selected value |
102 | * @return void |
103 | * @todo 12/24 hour format |
104 | */ |
d61a01d4 |
105 | function select_option_hour($selected) { |
106 | |
107 | for ($i=0;$i<24;$i++){ |
108 | ($i<10)? $ih = "0" . $i : $ih = $i; |
109 | if ($ih==$selected){ |
6fd95361 |
110 | echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n"; |
d61a01d4 |
111 | } else { |
6fd95361 |
112 | echo ' <option value="'.$ih.'">'.$i."</option>\n"; |
d61a01d4 |
113 | } |
114 | } |
115 | } |
116 | |
1c7143ad |
117 | /** |
118 | * Generates html option tags with priority values |
119 | * @param integer $selected selected value |
120 | * @return void |
121 | */ |
d61a01d4 |
122 | function select_option_priority($selected) { |
123 | $eventpriority = array( |
1ba8cd6b |
124 | '0' => _("Normal"), |
125 | '1' => _("High"), |
d61a01d4 |
126 | ); |
127 | |
128 | while( $bar = each($eventpriority)) { |
1c7143ad |
129 | if($bar['key']==$selected){ |
130 | echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n"; |
d61a01d4 |
131 | } else { |
1c7143ad |
132 | echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n"; |
d61a01d4 |
133 | } |
134 | } |
135 | } |
136 | |
1c7143ad |
137 | /** |
138 | * Generates html option tags with year values |
139 | * |
140 | * Hardcoded values from 1902 to 2037 |
141 | * @param integer $selected selected value |
142 | * @return void |
143 | */ |
d61a01d4 |
144 | function select_option_year($selected) { |
145 | |
98a792df |
146 | for ($i=1902;$i<2038;$i++){ |
d61a01d4 |
147 | if ($i==$selected){ |
6fd95361 |
148 | echo ' <option value="'.$i.'" selected="selected">'.$i."</option>\n"; |
d61a01d4 |
149 | } else { |
6fd95361 |
150 | echo ' <option value="'.$i.'">'.$i."</option>\n"; |
d61a01d4 |
151 | } |
152 | } |
153 | } |
154 | |
1c7143ad |
155 | /** |
156 | * Generates html option tags with month values |
157 | * @param integer $selected selected value |
158 | * @return void |
159 | */ |
d61a01d4 |
160 | function select_option_month($selected) { |
161 | |
162 | for ($i=1;$i<13;$i++){ |
163 | $im=date('m',mktime(0,0,0,$i,1,1)); |
e1baa507 |
164 | $is = getMonthAbrv( date('m',mktime(0,0,0,$i,1,1)) ); |
d61a01d4 |
165 | if ($im==$selected){ |
6fd95361 |
166 | echo ' <option value="'.$im.'" selected="selected">'.$is."</option>\n"; |
d61a01d4 |
167 | } else { |
6fd95361 |
168 | echo ' <option value="'.$im.'">'.$is."</option>\n"; |
d61a01d4 |
169 | } |
170 | } |
171 | } |
172 | |
1c7143ad |
173 | /** |
174 | * Generates html option tags with day of month values |
175 | * |
176 | * Hardcoded values from 1 to 31 |
177 | * @param integer $selected selected value |
178 | * @return void |
179 | */ |
d61a01d4 |
180 | function select_option_day($selected) { |
181 | |
182 | for ($i=1;$i<32;$i++){ |
183 | ($i<10)? $ih="0".$i : $ih=$i; |
184 | if ($i==$selected){ |
6fd95361 |
185 | echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n"; |
d61a01d4 |
186 | } else { |
6fd95361 |
187 | echo ' <option value="'.$ih.'">'.$i."</option>\n"; |
d61a01d4 |
188 | } |
189 | } |
190 | } |
191 | |
6fd95361 |
192 | ?> |