Fix what seems to have been a copy/paste bug
[squirrelmail.git] / plugins / calendar / functions.php
1 <?php
2
3 /**
4 * Other calendar plugin functions.
5 *
6 * @copyright 2002-2011 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 * @version $Id$
9 * @package plugins
10 * @subpackage calendar
11 */
12
13 /**
14 * Add link to menu at top of content pane
15 *
16 * @return void
17 *
18 */
19 function calendar_do() {
20
21 global $oTemplate, $nbsp;
22 $output = makeInternalLink('plugins/calendar/calendar.php',_("Calendar"),'right')
23 . $nbsp . $nbsp;
24 return array('menuline' => $output);
25
26 }
27
28 /**
29 * Adds second layer of calendar links to upper menu
30 * @return void
31 */
32 function calendar_header() {
33 global $color,$year,$day,$month;
34
35 // FIXME: Don't echo HTML from core. This whole function should probably be moved into a template file
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%"' );
39
40 echo makeInternalLink("plugins/calendar/calendar.php?year=$year&amp;month=$month",_("Month View"),"right");
41 echo "&nbsp;&nbsp;\n";
42 echo makeInternalLink("plugins/calendar/day.php?year=$year&amp;month=$month&amp;day=$day",_("Day View"),"right");
43 echo "&nbsp;&nbsp;\n";
44 // echo makeInternalLink("plugins/calendar/event_create.php?year=$year&amp;month=$month&amp;day=$day",_("Add Event"),"right");
45 // echo "&nbsp;&nbsp;\n";
46 echo '</td></tr>';
47
48 }
49
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 */
57 function select_option_length($selected) {
58 $eventlength = array(
59 '0' => _("0 min."),
60 '15' => _("15 min."),
61 '30' => _("30 min."),
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.")
72 );
73
74 while( $bar = each($eventlength)) {
75 if($bar['key']==$selected){
76 echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
77 } else {
78 echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
79 }
80 }
81 }
82
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 */
90 function select_option_minute($selected) {
91 $eventminute = array(
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'
104 );
105
106 while ( $bar = each($eventminute)) {
107 if ($bar['key']==$selected){
108 echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
109 } else {
110 echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
111 }
112 }
113 }
114
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 */
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){
126 echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n";
127 } else {
128 echo ' <option value="'.$ih.'">'.$i."</option>\n";
129 }
130 }
131 }
132
133 /**
134 * Generates html option tags with priority values
135 * @param integer $selected selected value
136 * @return void
137 */
138 function select_option_priority($selected) {
139 $eventpriority = array(
140 '0' => _("Normal"),
141 '1' => _("High"),
142 );
143
144 while( $bar = each($eventpriority)) {
145 if($bar['key']==$selected){
146 echo ' <option value="'.$bar['key'].'" selected="selected">'.$bar['value']."</option>\n";
147 } else {
148 echo ' <option value="'.$bar['key'].'">'.$bar['value']."</option>\n";
149 }
150 }
151 }
152
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 */
160 function select_option_year($selected) {
161
162 for ($i=1902;$i<2038;$i++){
163 if ($i==$selected){
164 echo ' <option value="'.$i.'" selected="selected">'.$i."</option>\n";
165 } else {
166 echo ' <option value="'.$i.'">'.$i."</option>\n";
167 }
168 }
169 }
170
171 /**
172 * Generates html option tags with month values
173 * @param integer $selected selected value
174 * @return void
175 */
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));
180 $is = getMonthAbrv( date('m',mktime(0,0,0,$i,1,1)) );
181 if ($im==$selected){
182 echo ' <option value="'.$im.'" selected="selected">'.$is."</option>\n";
183 } else {
184 echo ' <option value="'.$im.'">'.$is."</option>\n";
185 }
186 }
187 }
188
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 */
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){
201 echo ' <option value="'.$ih.'" selected="selected">'.$i."</option>\n";
202 } else {
203 echo ' <option value="'.$ih.'">'.$i."</option>\n";
204 }
205 }
206 }
207