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');
22 require_once('../functions/html.php');
24 //main form to gather event info
25 function show_event_form() {
26 global $color, $editor_size, $year, $day, $month, $hour;
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".
33 html_tag( 'td', _("Start time:"), 'right', $color[4] ) . "\n" .
34 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
35 " <SELECT NAME=\"event_hour\">\n";
36 select_option_hour($hour);
39 " <SELECT NAME=\"event_minute\">\n";
40 select_option_minute("00");
44 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
45 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
46 " <SELECT NAME=\"event_length\">\n";
47 select_option_length("0");
51 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
52 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
53 " <SELECT NAME=\"event_priority\">\n";
54 select_option_priority("0");
58 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
59 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
60 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"\" SIZE=30 MAXLENGTH=50><BR>\n".
64 "<TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD></TEXTAREA>" ,
65 'left', $color[4], 'colspan="2"' )
69 "<INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
70 _("Set Event") . "\">" ,
71 'left', $color[4], 'colspan="2"' )
77 if ( !isset($month) ||
$month <= 0){
80 if ( !isset($year) ||
$year <= 0){
83 if (!isset($day) ||
$day <= 0){
86 if (!isset($hour) ||
$hour <= 0){
90 $calself=basename($PHP_SELF);
93 displayPageHeader($color, 'None');
97 echo html_tag( 'tr', '', '', $color[0] ) .
98 html_tag( 'td', '', 'left' ) .
99 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
101 html_tag( 'td', date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"' )
103 //if form has not been filled in
104 if(!isset($event_text)){
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);
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,
120 echo html_tag( 'table',
122 html_tag( 'th', _("Event Has been added!") . "<br>\n", '', $color[4], 'colspan="2"' )
125 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
126 html_tag( 'td', $month .'/'.$day.'/'.$year, 'left', $color[4] ) . "\n"
129 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
130 html_tag( 'td', $event_hour.':'.$event_minute, 'left', $color[4] ) . "\n"
133 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
134 html_tag( 'td', $event_title, 'left', $color[4] ) . "\n"
137 html_tag( 'td', _("Message:"), 'right', $color[4] ) . "\n" .
138 html_tag( 'td', $event_text, 'left', $color[4] ) . "\n"
142 "<a href=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</a>\n" ,
143 'left', $color[4], 'colspan="2"' ) . "\n"
145 '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n";
149 </table
></td
></tr
></table
>