First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$templatePageTitle = "";
|
||||
$noTitle = true;
|
||||
$headerArgs = "";
|
||||
|
||||
|
||||
if (strlen($school_record['support_email']) == 0) {
|
||||
$error_message = getLanguageText('ERRORMSG-MISSING-SUPPORT-EMAIL-ADDRESS');
|
||||
header("Location: /?error_message=".urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$uidPrompt = getLanguageText('TEXT-NAME');
|
||||
$session_active = 0;
|
||||
if (SessionActive() == 1 && UserLoggedIn()) {
|
||||
if (!isset($userid)) $userid = $_SESSION['UserInfo']['userid'];
|
||||
if (!isset($email)) $email = $_SESSION['UserInfo']['email'];
|
||||
if (!isset($user_num)) $user_num = $_SESSION['UserInfo']['user_num'];
|
||||
$uidPrompt = getLanguageText('TEXT-USER-ID');
|
||||
$session_active = 1;
|
||||
}
|
||||
|
||||
|
||||
// Send email if all data is provided
|
||||
if (isset($action) && $action == 'substitution-submit') {
|
||||
extract($_POST);
|
||||
$error_message = "";
|
||||
|
||||
// Check for missing data in form
|
||||
if (!isset($request) || strlen($request) == 0 || !isset($userid) || strlen($userid) == 0 || !isset($email) || strlen($email) == 0 || strlen($date) == 0) {
|
||||
$error_message = getLanguageText('MSG-MISSING-DATA');
|
||||
}
|
||||
|
||||
// Validate the email address
|
||||
if (strlen($error_message) == 0) {
|
||||
if (!strpos($email,"@")) {
|
||||
$error_message = getLanguageText('MSG-INVALID-EMAIL');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send the email
|
||||
if (strlen($error_message) == 0) {
|
||||
|
||||
// Format the email
|
||||
include "include/queuemail.php";
|
||||
|
||||
$school_name = $school_record['school_name'];
|
||||
|
||||
$people_num = intval($people_num);
|
||||
$query = "SELECT first_name,last_name,record_num AS people_num FROM people WHERE school_num = $base_school_num AND user_num = $user_num AND record_num = $people_num";
|
||||
$people = db_query($query);
|
||||
$r = db_fetch_assoc($people);
|
||||
extract($r);
|
||||
$name = "$first_name $last_name";
|
||||
|
||||
$emailRecipient = getLanguageText('TEXT-SUBSTITUTION-REQUEST');
|
||||
$emailReply = $userid;
|
||||
$emailFrom = $email;
|
||||
$emailSubject = getLanguageText('TEXT-SUBSTITUTION-REQUEST');
|
||||
$emailMessage = sprintf("%-20s %s\n",getLanguageText('EMAIL-FROM') . ":",$userid) .
|
||||
sprintf("%-20s %s\n",getLanguageText('TEXT-EMAIL') . ":",$email) .
|
||||
sprintf("%-20s %s\n",getLanguageText('TEXT-NAME') . ":",$name) .
|
||||
sprintf("%-20s %s\n",getLanguageText('TEXT-DATE') . ":",$date) .
|
||||
"\n" .
|
||||
"$request\n\n" .
|
||||
"-------------------------------------------\n" .
|
||||
date("Y-m-d H:i:s",time()) . "\n" .
|
||||
"$school_name\n\n";
|
||||
|
||||
//
|
||||
// Log the request
|
||||
//
|
||||
$logTo = db_escape_string($emailTo);
|
||||
$logReply = db_escape_string($emailReply);
|
||||
$logFrom = db_escape_string($emailFrom);
|
||||
$logMessage = db_escape_string($emailMessage);
|
||||
$query = "insert into substitution_requests (school_num,people_num,sub_date,emailto,emailreply,emailfrom,emailmessage,submitted,status) " .
|
||||
"values ($school_num,$people_num,'$date','$logTo','$logReply','$logFrom','$logMessage',now(),'Open')";
|
||||
db_query($query);
|
||||
|
||||
|
||||
// Process send request
|
||||
$supportEmail = $school_record['support_email'];
|
||||
if (strstr($supportEmail,",")) $emailRecipients = explode(",",$supportEmail);
|
||||
else $emailRecipients = array($supportEmail);
|
||||
|
||||
// Send support email to all recipients
|
||||
for ($i = 0; $i < count($emailRecipients); $i++) {
|
||||
$emailTo = trim($emailRecipients[$i]);
|
||||
QueueEmail($emailTo, $emailFrom, $emailSubject, $emailMessage, $emailReply, $emailRecipient);
|
||||
}
|
||||
|
||||
|
||||
$form_message = getLanguageText('THANK-YOU');
|
||||
$success = 1;
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set the action for the form
|
||||
$action = "substitution-submit";
|
||||
|
||||
if (!isset($date)) $date = date("Y-m-d",time() + 60 * 60 * 24);
|
||||
if (!isset($request)) $request = '';
|
||||
|
||||
$text = db_getVal("SELECT text_data FROM text_data WHERE school_num = $school_num AND text_id = 'Substitutions Message'");
|
||||
if (strlen($text)) {
|
||||
?>
|
||||
<table width='80%' cellpadding='10' bgcolor='#C12F0B'>
|
||||
<tr>
|
||||
<td>
|
||||
<p style='color: #ffffff'><b><?php echo(nl2br($text)) ?></b></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<br>
|
||||
<form method='post' action='/'>
|
||||
<?php
|
||||
$message_width = $default_form_width;
|
||||
include "form.messages.php";
|
||||
?>
|
||||
<table width='400' max-width='400' class='content-table'>
|
||||
<tr>
|
||||
<td align='left'><h2><?php echo(getLanguageText('TEXT-SUBSTITUTION-REQUEST')) ?></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'><?php echo($uidPrompt) ?>: <br>
|
||||
<input type='text' name='userid' value='<?php echo(str_replace("'","'",$userid)) ?>' size='30'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'><?php echo(getLanguageText('SUPPORT-EMAIL')) ?>: <br>
|
||||
<input type='text' name='email' value='<?php echo($email) ?>' size='30'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'><?php echo(getLanguageText('TEXT-NAME')) ?>: <br>
|
||||
<select name='people_num'>
|
||||
<?php
|
||||
$query = "SELECT first_name,last_name,record_num AS people_num FROM people WHERE school_num = $base_school_num AND user_num = $user_num";
|
||||
$people = db_query($query);
|
||||
while ($row = db_fetch_assoc($people)) {
|
||||
extract($row);
|
||||
$name = "$first_name $last_name";
|
||||
echo(" <option value='$people_num'>$name</option>\n");
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='left'><?php echo(getLanguageText('TEXT-DATE')) ?>: <br>
|
||||
<input type='date' name='date' value='<?php echo($date) ?>' size='15' class='date-field'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='left'><br>
|
||||
<?php echo(getLanguageText('TEXT-SUBSTITUTION-REQUEST')) ?>:<br>
|
||||
<textarea name='request' rows='7' cols='60'><?php echo($request) ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='center'>
|
||||
<br>
|
||||
<input type='submit' class='btn btn--primary' value='<?php echo(getLanguageText('BUTTON-SUPPORT')) ?>'>
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type='hidden' name='action' value='<?php echo($action) ?>'>
|
||||
</form>
|
||||
<br>
|
||||
<?php
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user