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