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