Make the date in day-view internationalizable.
[squirrelmail.git] / plugins / calendar / event_delete.php
1 <?php
2 /*
3 * event_delete.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 delete a event.
9 *
10 * $Id$
11 */
12
13 require_once('calendar_data.php');
14 require_once('functions.php');
15 chdir('..');
16 require_once('../src/validate.php');
17 require_once('../functions/strings.php');
18 require_once('../functions/date.php');
19 require_once('../config/config.php');
20 require_once('../functions/page_header.php');
21 require_once('../src/load_prefs.php');
22 require_once('../functions/html.php');
23
24 function confirm_deletion()
25 {
26 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
27
28 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
29
30 echo html_tag( 'table',
31 html_tag( 'tr',
32 html_tag( 'th', _("Do you really want to delete this event?") . '<br>', '', $color[4], 'colspan="2"' )
33 ) .
34 html_tag( 'tr',
35 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
36 html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
37 ) .
38 html_tag( 'tr',
39 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
40 html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
41 ) .
42 html_tag( 'tr',
43 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
44 html_tag( 'td', $tmparray[title], 'left', $color[4] )
45 ) .
46 html_tag( 'tr',
47 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
48 html_tag( 'td', $tmparray[message], 'left', $color[4] )
49 ) .
50 html_tag( 'tr',
51 html_tag( 'td',
52 " <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
53 " <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
54 " <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
55 " <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
56 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
57 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
58 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
59 " <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
60 " <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
61 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
62 ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
63 " </FORM>\n" ,
64 'right', $color[4] ) .
65 html_tag( 'td',
66 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
67 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
68 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
69 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
70 ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
71 " </FORM>\n" ,
72 'left', $color[4] )
73 ) ,
74 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
75 }
76
77 if ($month <= 0){
78 $month = date( 'm' );
79 }
80 if ($year <= 0){
81 $year = date( 'Y' );
82 }
83 if ($day <= 0){
84 $day = date( 'd' );
85 }
86
87 $calself=basename($PHP_SELF);
88
89 displayPageHeader($color, 'None');
90 //load calendar menu
91 calendar_header();
92
93 echo html_tag( 'tr', '', '', $color[0] ) .
94 html_tag( 'td' ) .
95 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
96 html_tag( 'tr' ) .
97 html_tag( 'td', '', 'left' ) .
98 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
99 if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
100 if (isset($confirmed)){
101 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
102 echo '<br><br>' . _("Event deleted!") . "<br>\n";
103 echo "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
104 _("Day View") . "</a>\n";
105 } else {
106 readcalendardata();
107 confirm_deletion();
108 }
109 } else {
110 echo '<br>' . _("Nothing to delete!");
111 }
112
113 ?>
114 </table></td></tr></table>
115 </body></html>