Files
HotLunches/event_calendar.form.php
T
2026-10-19 15:22:52 -07:00

138 lines
5.2 KiB
PHP

<?php
require_once("include/globals.php");
// writeLog("event_calendar.form.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator','Administration Team','Staff');
if (checkPermission($AllowedUserTypes) != 1) {
echo("<br>\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Setup default values on insert
if ($naction == 'add') {
$initTableName = $CurrentTable;
$tarray = initializeTableArray($initTableName);
extract($tarray, EXTR_OVERWRITE);
$event_type = 'School Event';
$today = date("Y-m-d",time());
$start_date = $today;
$end_date = $today;
$posted_date = $today;
$status = 'Approved';
$display = 'Active';
$posted_by = $_SESSION['UserInfo']['record_num'];
}
$PageTitle = getLanguageText('TEXT-EVENT-ADMINISTRATION');
$ButtonText = getLanguageText('TEXT-INSERT-RECORD');
?>
<br>
<form method='post' action='/'>
<?php
$message_width = $default_form_width;
include "form.messages.php";
?>
<table width='<?php echo($default_form_width) ?>' class='content-table'>
<tr>
<td colspan='2' align='center' class='heading'><?php echo($PageTitle) ?></td>
</tr>
<tr>
<td colspan='2' align='center'>
<br>
<?php
$text_data = trim(db_getVal("SELECT text_data FROM text_data WHERE school_num = $school_num AND text_id = 'Events Message'"));
if (strlen($text_data)) echo("<span class='message'>" . nl2br($text_data) . "</span><br>\n<br>\n");
?>
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-EVENT-TYPE'); ?>: </td>
<td align='left' valign='top'>
<select name='event_type' id='event_type'>
<?php BuildDBList("event_types","event_type_title","event_type_title","sequence",$event_type,"ASC","AND school_num = $school_num") ?>
</select>
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-START-DATE'); ?>: </td>
<td align='left' valign='top'>
<input type='text' name='start_date' id='start_date' value="<?php echo($start_date) ?>" size='15' class='date-field'> (<?php displayLanguageText('TEXT-REQUIRED'); ?>)
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-END-DATE'); ?>: </td>
<td align='left' valign='top'>
<input type='text' name='end_date' id='end_date' value="<?php echo($end_date) ?>" size='15' class='date-field'> (<?php displayLanguageText('TEXT-REQUIRED'); ?>)
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-SELECTED-DAYS-OF-WEEK'); ?>: </td>
<td align='left' valign='top'>
<?php BuildFileCheckbox("daysoftheweek.txt","dow",explode(',',$dow),"&nbsp;") ?>
</td>
</tr>
<tr>
<td colspan='2' align='center'>&nbsp;</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-EVENT-TITLE'); ?>: </td>
<td align='left' valign='top'>
<input type='text' name='title' id='title' value="<?php echo(str_replace('"',"&quot;",$title)) ?>" size='50'> (<?php displayLanguageText('TEXT-REQUIRED'); ?>)
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-EVENT-DATE-TIME'); ?>: </td>
<td align='left' valign='top'><input type='text' name='date_and_time' id='date_and_time' value="<?php echo(str_replace('"',"&quot;",$date_and_time)) ?>" size='50'></td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-EVENT-LOCATION'); ?>: </td>
<td align='left' valign='top'><input type='text' name='location' id='location' value="<?php echo(str_replace('"',"&quot;",$location)) ?>" size='50'></td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DESCRIPTION'); ?>: </td>
<td align='left' valign='top'><textarea name='description' id='description' rows='6' cols='50'><?php echo($description) ?></textarea></td>
</tr>
<tr>
<td colspan='2'>&nbsp;</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DISPLAY'); ?>: </td>
<td align='left' valign='top'><?php BuildFileRadio("event_display_mode.txt","display",$display) ?></td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-STATUS'); ?>: </td>
<td align='left' valign='top'>
<select name='status' id='status'>
<?php BuildFileList("event_status.txt",$status) ?>
</select>
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<br>
<input type='submit' name='button' class='btn btn--primary' value="<?php echo($ButtonText) ?>">
<input type='hidden' name='action' value='<?php echo($action) ?>'>
<input type='hidden' name='naction' value='<?php echo($next_naction) ?>'>
<input type='hidden' name='record_num' value='<?php echo($record_num) ?>'>
<input type='hidden' name='posted_by' value="<?php echo($posted_by) ?>">
<input type='hidden' name='posted_date' value="<?php echo($posted_date) ?>" size='15'>
<br>
<br>
</td>
</tr>
</table>
</form>