d40fcbb2e5365d39bf97a4e72006d53ced941262
4 * functions to create a event for calendar.
6 * @copyright © 2002-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @subpackage calendar
14 define('SM_PATH','../../');
16 /* SquirrelMail required files. */
17 include_once(SM_PATH
. 'include/validate.php');
19 include_once(SM_PATH
. 'functions/date.php');
21 /* Calendar plugin required files. */
22 include_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
23 include_once(SM_PATH
. 'plugins/calendar/functions.php');
26 if (! sqGetGlobalVar('year',$year,SQ_FORM
) ||
! is_numeric($year)) {
29 if (! sqGetGlobalVar('month',$month,SQ_FORM
) ||
! is_numeric($month)) {
32 if (! sqGetGlobalVar('day',$day,SQ_FORM
) ||
! is_numeric($day)) {
35 if (! sqGetGlobalVar('hour',$hour,SQ_FORM
) ||
! is_numeric($hour)) {
38 if (! sqGetGlobalVar('event_hour',$event_hour,SQ_POST
) ||
! is_numeric($event_hour)) {
41 if (! sqGetGlobalVar('event_minute',$event_minute,SQ_POST
) ||
! is_numeric($event_minute)) {
44 if (! sqGetGlobalVar('event_length',$event_length,SQ_POST
) ||
! is_numeric($event_length)) {
47 if (! sqGetGlobalVar('event_priority',$event_priority,SQ_POST
) ||
! is_numeric($event_priority)) {
48 unset($event_priority);
51 sqGetGlobalVar('event_title',$event_title,SQ_POST
);
52 sqGetGlobalVar('event_text',$event_text,SQ_POST
);
53 sqGetGlobalVar('send',$send,SQ_POST
);
57 //main form to gather event info
58 function show_event_form() {
59 global $color, $editor_size, $year, $day, $month, $hour;
61 echo "\n<form name=\"eventscreate\" action=\"event_create.php\" method=\"post\">\n".
62 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
63 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
64 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
66 html_tag( 'td', _("Start time:"), 'right', $color[4] ) . "\n" .
67 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
68 " <select name=\"event_hour\">\n";
69 select_option_hour($hour);
72 " <select name=\"event_minute\">\n";
73 select_option_minute("00");
77 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
78 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
79 " <select name=\"event_length\">\n";
80 select_option_length("0");
84 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
85 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
86 " <select name=\"event_priority\">\n";
87 select_option_priority("0");
91 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
92 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
93 " <input type=\"text\" name=\"event_title\" value=\"\" size=\"30\" maxlength=\"50\" /><br />\n".
97 "<textarea name=\"event_text\" rows=\"5\" cols=\"$editor_size\" wrap=\"hard\"></textarea>" ,
98 'left', $color[4], 'colspan="2"' )
102 '<input type="submit" name="send" value="' .
103 _("Set Event") . '" />' ,
104 'left', $color[4], 'colspan="2"' )
110 if ( !isset($month) ||
$month <= 0){
111 $month = date( 'm' );
113 if ( !isset($year) ||
$year <= 0){
116 if (!isset($day) ||
$day <= 0){
119 if (!isset($hour) ||
$hour <= 0){
123 $calself=basename($PHP_SELF);
126 displayPageHeader($color, 'None');
130 echo html_tag( 'tr', '', '', $color[0] ) .
131 html_tag( 'td', '', 'left' ) .
132 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
134 html_tag( 'td', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"' )
136 //if form has not been filled in
137 if(!isset($event_text)){
141 $calendardata["$month$day$year"]["$event_hour$event_minute"] =
142 array( 'length' => $event_length,
143 'priority' => $event_priority,
144 'title' => $event_title,
145 'message' => $event_text,
149 echo html_tag( 'table',
151 html_tag( 'th', _("Event Has been added!") . "<br />\n", '', $color[4], 'colspan="2"' )
154 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
155 html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$month,$day,$year)), 'left', $color[4] ) . "\n"
158 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
159 html_tag( 'td', date_intl(_("H:i"),mktime($event_hour,$event_minute,0,$month,$day,$year)), 'left', $color[4] ) . "\n"
162 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
163 html_tag( 'td', htmlspecialchars($event_title,ENT_NOQUOTES
), 'left', $color[4] ) . "\n"
166 html_tag( 'td', _("Message:"), 'right', $color[4] ) . "\n" .
167 html_tag( 'td', nl2br(htmlspecialchars($event_text,ENT_NOQUOTES
)), 'left', $color[4] ) . "\n"
171 "<a href=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</a>\n" ,
172 'left', $color[4], 'colspan="2"' ) . "\n"
174 '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n";
178 </table
></td
></tr
></table
>