4 * functions to create a event for calendar.
6 * @copyright © 2002-2009 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @subpackage calendar
13 * Include the SquirrelMail initialization file.
15 require('../../include/init.php');
18 include_once(SM_PATH
. 'functions/date.php');
20 /* Calendar plugin required files. */
21 include_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
22 include_once(SM_PATH
. 'plugins/calendar/functions.php');
25 if (! sqGetGlobalVar('year',$year,SQ_FORM
) ||
! is_numeric($year)) {
28 if (! sqGetGlobalVar('month',$month,SQ_FORM
) ||
! is_numeric($month)) {
31 if (! sqGetGlobalVar('day',$day,SQ_FORM
) ||
! is_numeric($day)) {
34 if (! sqGetGlobalVar('hour',$hour,SQ_FORM
) ||
! is_numeric($hour)) {
37 if (! sqGetGlobalVar('event_hour',$event_hour,SQ_POST
) ||
! is_numeric($event_hour)) {
40 if (! sqGetGlobalVar('event_minute',$event_minute,SQ_POST
) ||
! is_numeric($event_minute)) {
43 if (! sqGetGlobalVar('event_length',$event_length,SQ_POST
) ||
! is_numeric($event_length)) {
46 if (! sqGetGlobalVar('event_priority',$event_priority,SQ_POST
) ||
! is_numeric($event_priority)) {
47 unset($event_priority);
50 sqGetGlobalVar('event_title',$event_title,SQ_POST
);
51 sqGetGlobalVar('event_text',$event_text,SQ_POST
);
52 sqGetGlobalVar('send',$send,SQ_POST
);
56 //main form to gather event info
57 function show_event_form() {
58 global $color, $editor_size, $year, $day, $month, $hour;
60 echo "\n<form name=\"eventscreate\" action=\"event_create.php\" method=\"post\">\n".
61 " <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
62 " <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
63 " <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
65 html_tag( 'td', _("Start time:"), 'right', $color[4] ) . "\n" .
66 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
67 " <select name=\"event_hour\">\n";
68 select_option_hour($hour);
71 " <select name=\"event_minute\">\n";
72 select_option_minute("00");
76 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
77 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
78 " <select name=\"event_length\">\n";
79 select_option_length("0");
83 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
84 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
85 " <select name=\"event_priority\">\n";
86 select_option_priority("0");
90 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
91 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
92 " <input type=\"text\" name=\"event_title\" value=\"\" size=\"30\" maxlength=\"50\" /><br />\n".
96 "<textarea name=\"event_text\" rows=\"5\" cols=\"$editor_size\"></textarea>" ,
97 'left', $color[4], 'colspan="2"' )
101 '<input type="submit" name="send" value="' .
102 _("Set Event") . '" />' ,
103 'left', $color[4], 'colspan="2"' )
109 if ( !isset($month) ||
$month <= 0){
110 $month = date( 'm' );
112 if ( !isset($year) ||
$year <= 0){
115 if (!isset($day) ||
$day <= 0){
118 if (!isset($hour) ||
$hour <= 0){
122 $calself=basename($PHP_SELF);
125 displayPageHeader($color);
129 echo html_tag( 'tr', '', '', $color[0] ) .
130 html_tag( 'td', '', 'left' ) .
131 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
133 html_tag( 'td', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"' )
135 //if form has not been filled in
136 if(!isset($event_text)){
140 $calendardata["$month$day$year"]["$event_hour$event_minute"] =
141 array( 'length' => $event_length,
142 'priority' => $event_priority,
143 'title' => $event_title,
144 'message' => $event_text,
148 echo html_tag( 'table',
150 html_tag( 'th', _("Event Has been added!") . "<br />\n", '', $color[4], 'colspan="2"' )
153 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
154 html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$month,$day,$year)), 'left', $color[4] ) . "\n"
157 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
158 html_tag( 'td', date_intl(_("H:i"),mktime($event_hour,$event_minute,0,$month,$day,$year)), 'left', $color[4] ) . "\n"
161 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
162 html_tag( 'td', htmlspecialchars($event_title,ENT_NOQUOTES
), 'left', $color[4] ) . "\n"
165 html_tag( 'td', _("Message:"), 'right', $color[4] ) . "\n" .
166 html_tag( 'td', nl2br(htmlspecialchars($event_text,ENT_NOQUOTES
)), 'left', $color[4] ) . "\n"
170 "<a href=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</a>\n" ,
171 'left', $color[4], 'colspan="2"' ) . "\n"
173 '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n";
177 </table
></td
></tr
></table
>