Make the date in day-view internationalizable.
[squirrelmail.git] / plugins / calendar / event_create.php
CommitLineData
d61a01d4 1<?php
2/*
3 * event_create.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 * functions to create a event for calendar.
9 *
2c85de8f 10 * $Id$
d61a01d4 11 */
12
13require_once('calendar_data.php');
14require_once('functions.php');
15chdir('..');
16require_once('../src/validate.php');
17require_once('../functions/strings.php');
18require_once('../functions/date.php');
19require_once('../config/config.php');
20require_once('../functions/page_header.php');
21require_once('../src/load_prefs.php');
b01b21d0 22require_once('../functions/html.php');
d61a01d4 23
24//main form to gather event info
25function show_event_form() {
26 global $color, $editor_size, $year, $day, $month, $hour;
27
28 echo "\n<FORM name=eventscreate action=\"event_create.php\" METHOD=POST >\n".
29 " <INPUT TYPE=hidden NAME=\"year\" VALUE=\"$year\">\n".
30 " <INPUT TYPE=hidden NAME=\"month\" VALUE=\"$month\">\n".
31 " <INPUT TYPE=hidden NAME=\"day\" VALUE=\"$day\">\n".
b01b21d0 32 html_tag( 'tr' ) .
33 html_tag( 'td', _("Start time:"), 'right', $color[4] ) . "\n" .
34 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
d61a01d4 35 " <SELECT NAME=\"event_hour\">\n";
36 select_option_hour($hour);
37 echo " </SELECT>\n" .
38 " &nbsp;:&nbsp;\n" .
39 " <SELECT NAME=\"event_minute\">\n";
40 select_option_minute("00");
41 echo " </SELECT>\n".
b01b21d0 42 " </td></tr>\n".
43 html_tag( 'tr' ) .
44 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
45 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
d61a01d4 46 " <SELECT NAME=\"event_length\">\n";
47 select_option_length("0");
48 echo " </SELECT>\n".
b01b21d0 49 " </td></tr>\n".
50 html_tag( 'tr' ) .
51 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
52 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
d61a01d4 53 " <SELECT NAME=\"event_priority\">\n";
54 select_option_priority("0");
55 echo " </SELECT>\n".
b01b21d0 56 " </td></tr>\n".
57 html_tag( 'tr' ) .
58 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
59 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
d61a01d4 60 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"\" SIZE=30 MAXLENGTH=50><BR>\n".
b01b21d0 61 " </td></tr>\n".
62 html_tag( 'tr',
63 html_tag( 'td',
64 "<TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD></TEXTAREA>" ,
65 'left', $color[4], 'colspan="2"' )
66 ) ."\n" .
67 html_tag( 'tr',
68 html_tag( 'td',
69 "<INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
70 _("Set Event") . "\">" ,
71 'left', $color[4], 'colspan="2"' )
72 ) ."\n";
d61a01d4 73 echo "</FORM>\n";
74}
75
76
88cb1b4d 77if ( !isset($month) || $month <= 0){
d61a01d4 78 $month = date( 'm' );
79}
88cb1b4d 80if ( !isset($year) || $year <= 0){
d61a01d4 81 $year = date( 'Y' );
82}
88cb1b4d 83if (!isset($day) || $day <= 0){
d61a01d4 84 $day = date( 'd' );
85}
88cb1b4d 86if (!isset($hour) || $hour <= 0){
d61a01d4 87 $hour = '08';
88}
89
90$calself=basename($PHP_SELF);
91
92
93displayPageHeader($color, 'None');
94//load calendar menu
95calendar_header();
96
b01b21d0 97echo html_tag( 'tr', '', '', $color[0] ) .
98 html_tag( 'td', '', 'left' ) .
99 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
100 html_tag( 'tr',
f3409980 101 html_tag( 'td', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"' )
b01b21d0 102 );
d61a01d4 103//if form has not been filled in
104if(!isset($event_text)){
105 show_event_form();
106} else {
107 readcalendardata();
108 //make sure that event text is fittting in one line
109 $event_text=nl2br($event_text);
110 $event_text=ereg_replace ("\n", "", $event_text);
111 $event_text=ereg_replace ("\r", "", $event_text);
88cb1b4d 112 $calendardata["$month$day$year"]["$event_hour$event_minute"] =
113 array( 'length' => $event_length,
114 'priority' => $event_priority,
115 'title' => $event_title,
116 'message' => $event_text,
117 'reminder' => '' );
d61a01d4 118 //save
119 writecalendardata();
b01b21d0 120 echo html_tag( 'table',
121 html_tag( 'tr',
122 html_tag( 'th', _("Event Has been added!") . "<br>\n", '', $color[4], 'colspan="2"' )
123 ) .
124 html_tag( 'tr',
125 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
126 html_tag( 'td', $month .'/'.$day.'/'.$year, 'left', $color[4] ) . "\n"
127 ) .
128 html_tag( 'tr',
129 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
130 html_tag( 'td', $event_hour.':'.$event_minute, 'left', $color[4] ) . "\n"
131 ) .
132 html_tag( 'tr',
133 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
134 html_tag( 'td', $event_title, 'left', $color[4] ) . "\n"
135 ) .
136 html_tag( 'tr',
137 html_tag( 'td', _("Message:"), 'right', $color[4] ) . "\n" .
138 html_tag( 'td', $event_text, 'left', $color[4] ) . "\n"
139 ) .
140 html_tag( 'tr',
141 html_tag( 'td',
142 "<a href=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</a>\n" ,
143 'left', $color[4], 'colspan="2"' ) . "\n"
144 ) ,
145 '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n";
d61a01d4 146}
147
148?>
149</table></td></tr></table>
f3409980 150</body></html>