Michal Szczotka <michal@tuxy.org> Calendar plugin.
[squirrelmail.git] / plugins / calendar / functions.php
CommitLineData
d61a01d4 1<?php
2/*
3 * functions.php
4 *
5 * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * miscelenous functions.
9 *
10 * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org.
11 */
12
13
14function calendar_header() {
15 //Add Second layer ofCalendar links to upper menu
16 global $color,$year,$day,$month;
17
18 echo "<TABLE BGCOLOR=\"$color[0]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>".
19 "<TR><TD ALIGN=left WIDTH=\"100%\">";
20
21 displayInternalLink("plugins/calendar/calendar.php?year=$year&month=$month",_("Month View"),"right");
22 echo "&nbsp;&nbsp\n";
23 displayInternalLink("plugins/calendar/day.php?year=$year&month=$month&day=$day",_("Day View"),"right");
24 echo "&nbsp;&nbsp\n";
25 // displayInternalLink("plugins/calendar/event_create.php?year=$year&month=$month&day=$day",_("Add Event"),"right");
26 // echo "&nbsp;&nbsp\n";
27 echo '</TD></TR>';
28
29}
30
31function select_option_length($selected) {
32
33 $eventlength = array(
34 "0" => _("0 min."),
35 "15" => _("15 min."),
36 "30" => _("35 min."),
37 "45" => _("45 min."),
38 "60" => _("1 hr."),
39 "90" => _("1.5 hr."),
40 "120" => _("2 hr."),
41 "150" => _("2.5 hr."),
42 "180" => _("3 hr."),
43 "210" => _("3.5 hr."),
44 "240" => _("4 hr."),
45 "300" => _("5 hr."),
46 "360" => _("6 hr.")
47 );
48
49 while( $bar = each($eventlength)) {
50 if($selected==$bar[key]){
51 echo " <OPTION VALUE=\"".$bar[key]."\" SELECTED>".$bar[value]."</OPTION>\n";
52 } else {
53 echo " <OPTION VALUE=\"".$bar[key]."\">".$bar[value]."</OPTION>\n";
54 }
55 }
56}
57
58function select_option_minute($selected) {
59 $eventminute = array(
60 "00"=>"00",
61 "05"=>"05",
62 "10"=>"10",
63 "15"=>"15",
64 "20"=>"20",
65 "25"=>"25",
66 "30"=>"30",
67 "35"=>"35",
68 "40"=>"40",
69 "45"=>"45",
70 "50"=>"50",
71 "55"=>"55"
72 );
73
74 while ( $bar = each($eventminute)) {
75 if ($selected==$bar[key]){
76 echo " <OPTION VALUE=\"".$bar[key]."\" SELECTED>".$bar[value]."</OPTION>\n";
77 } else {
78 echo " <OPTION VALUE=\"".$bar[key]."\">".$bar[value]."</OPTION>\n";
79 }
80 }
81}
82
83function select_option_hour($selected) {
84
85 for ($i=0;$i<24;$i++){
86 ($i<10)? $ih = "0" . $i : $ih = $i;
87 if ($ih==$selected){
88 echo " <OPTION VALUE=\"$ih\" SELECTED>$i</OPTION>\n";
89 } else {
90 echo " <OPTION VALUE=\"$ih\">$i</OPTION>\n";
91 }
92 }
93}
94
95function select_option_priority($selected) {
96 $eventpriority = array(
97 "0" => _("Normal"),
98 "1" => _("High"),
99 );
100
101 while( $bar = each($eventpriority)) {
102 if($selected==$bar[key]){
103 echo " <OPTION VALUE=\"".$bar[key]."\" SELECTED>".$bar[value]."</OPTION>\n";
104 } else {
105 echo " <OPTION VALUE=\"".$bar[key]."\">".$bar[value]."</OPTION>\n";
106 }
107 }
108}
109
110function select_option_year($selected) {
111
112 for ($i=1900;$i<2100;$i++){
113 if ($i==$selected){
114 echo " <OPTION VALUE=\"$i\" SELECTED>$i</OPTION>\n";
115 } else {
116 echo " <OPTION VALUE=\"$i\">$i</OPTION>\n";
117 }
118 }
119}
120
121function select_option_month($selected) {
122
123 for ($i=1;$i<13;$i++){
124 $im=date('m',mktime(0,0,0,$i,1,1));
125 $is = substr( _( date('F',mktime(0,0,0,$i,1,1)) ), 0, 3 );
126 if ($im==$selected){
127 echo " <OPTION VALUE=\"$im\" SELECTED>$is</OPTION>\n";
128 } else {
129 echo " <OPTION VALUE=\"$im\">$is</OPTION>\n";
130 }
131 }
132}
133
134function select_option_day($selected) {
135
136 for ($i=1;$i<32;$i++){
137 ($i<10)? $ih="0".$i : $ih=$i;
138 if ($i==$selected){
139 echo " <OPTION VALUE=\"$ih\" SELECTED>$i</OPTION>\n";
140 } else {
141 echo " <OPTION VALUE=\"$ih\">$i</OPTION>\n";
142 }
143 }
144}
145
146?>