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

124 lines
4.1 KiB
PHP

<?php
require_once("include/globals.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');
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);
$user_num = intval($_SESSION['UserInfo']['record_num']);
$uploaded_by = $user_num;
$today = date("Y-m-d",time());
$uploaded_date = $today;
$document_date = $today;
}
?>
<script>
$(document).ready(function() {
$("#document_date").datepicker({ dateFormat: 'yy-mm-dd' });
});
</script>
<br>
<form method='post' enctype='multipart/form-data' action='/'>
<?php
$message_width = $default_form_width;
include "form.messages.php";
if (!is_dir($uploaddir)) echo("$uploaddir: not found");
?>
<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'>&nbsp;</td>
</tr>
<tr>
<td width='30%' align='right' valign='top'><?php displayLanguageText('TEXT-DOCUMENT-TO-UPLOAD'); ?>: </td>
<?php if ($naction == 'add') { ?>
<td width='70%' align='left' valign='top'><input type='file' name='filename' id='filename' size='40'></td>
<?php } else { ?>
<td width='70%' align='left' valign='top'><input type='text' name='file_name' id='file_name' value="<?php echo($file_name) ?>" size='40'></td>
<?php } ?>
</tr>
<?php if ($naction == 'add') { ?>
<tr>
<td valign='top'>&nbsp;</td>
<td align='left' valign='top'>
<select name='selected_filename'>
<option value=''><?php displayLanguageText('TEXT-SELECT-FILE'); ?></option>
<?php BuildDirList($uploaddir); ?>
</select>
</td>
<?php } ?>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DOCUMENT-TITLE'); ?>: </td>
<td align='left' valign='top'><input type='text' name='title' id='title' value="<?php echo($title) ?>" size='40'></td>
</tr>
<tr>
<td colspan='2' align='center'>&nbsp;</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DOCUMENT-CATEGORY'); ?>: </td>
<td align='left' valign='top'>
<select name='category_num'>
<?php BuildDBList("document_categories","record_num","category","sequence",$category_num,"ASC","and school_num = $base_school_num ") ?>
</select>
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DOCUMENT-DATE'); ?>: </td>
<td align='left' valign='top'><input type='text' name='document_date' id='document_date' value="<?php echo($document_date) ?>" size='15' class='date-field'></td>
</tr>
<tr>
<td colspan='2' align='center'>&nbsp;</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-STATUS'); ?>: </td>
<td align='left' valign='top'>
<select name='status'>
<?php BuildFileList("document_status.txt",$status) ?>
</select>
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DESCRIPTION'); ?>: </td>
<td align='left' valign='top'><textarea name='description' rows='4' cols='60'><?php echo($description) ?></textarea></td>
</tr>
<tr>
<td colspan='2' align='center'>
<br>
<input type='submit' 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='uploaded_by' value="<?php echo($uploaded_by) ?>">
<input type='hidden' name='uploaded_date' value='<?php echo($uploaded_date) ?>'>
<input type='hidden' name='record_num' value='<?php echo($record_num) ?>'>
<br>
<br>
</td>
</tr>
</table>
</form>