5 * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * functions to create a event for calendar.
13 require_once('calendar_data.php');
14 require_once('functions.php');
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');
23 //main form to gather event info
24 function show_event_form() {
25 global $color, $editor_size, $year, $day, $month, $hour;
27 echo "\n<FORM name=eventscreate action=\"event_create.php\" METHOD=POST >\n".
28 " <INPUT TYPE=hidden NAME=\"year\" VALUE=\"$year\">\n".
29 " <INPUT TYPE=hidden NAME=\"month\" VALUE=\"$month\">\n".
30 " <INPUT TYPE=hidden NAME=\"day\" VALUE=\"$day\">\n".
31 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Start time:") . "</TD>\n".
32 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
33 " <SELECT NAME=\"event_hour\">\n";
34 select_option_hour($hour);
37 " <SELECT NAME=\"event_minute\">\n";
38 select_option_minute("00");
41 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Length:") . "</TD>\n".
42 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
43 " <SELECT NAME=\"event_length\">\n";
44 select_option_length("0");
47 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Priority:") . "</TD>\n".
48 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
49 " <SELECT NAME=\"event_priority\">\n";
50 select_option_priority("0");
53 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Title:") . "</TD>\n".
54 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
55 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"\" SIZE=30 MAXLENGTH=50><BR>\n".
57 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT COLSPAN=2>\n".
58 " <TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD></TEXTAREA>\n".
60 " <TR><TD ALIGN=LEFT BGCOLOR=\"$color[4]\" COLSPAN=2><INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
61 _("Set Event") . "\"></TD></TR>\n";
66 if ( !isset($month) ||
$month <= 0){
69 if ( !isset($year) ||
$year <= 0){
72 if (!isset($day) ||
$day <= 0){
75 if (!isset($hour) ||
$hour <= 0){
79 $calself=basename($PHP_SELF);
82 displayPageHeader($color, 'None');
87 echo "<TR BGCOLOR=\"$color[0]\"><TD>" .
88 "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">" .
89 '<tr><td COLSPAN=2>' .
90 date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) .
92 //if form has not been filled in
93 if(!isset($event_text)){
97 //make sure that event text is fittting in one line
98 $event_text=nl2br($event_text);
99 $event_text=ereg_replace ("\n", "", $event_text);
100 $event_text=ereg_replace ("\r", "", $event_text);
101 $calendardata["$month$day$year"]["$event_hour$event_minute"] =
102 array( 'length' => $event_length,
103 'priority' => $event_priority,
104 'title' => $event_title,
105 'message' => $event_text,
109 echo " <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
110 " <TR><TH COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
111 _("Event Has been added!") . "<br>\n".
112 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Date:") . "</TD>\n".
113 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$month/$day/$year</TD></TR>\n".
114 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Time:") . "</TD>\n".
115 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_hour:$event_minute</TD></TR>\n".
116 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Title:") . "</TD>\n".
117 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_title</TD></TR>\n".
118 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Message:") . "</TD>\n".
119 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_text</TD></TR>\n".
120 " <TR><TD COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
121 "<A HREF=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</A>\n".
127 </table
></td
></tr
></table
>