66 lines
2.1 KiB
PHP
66 lines
2.1 KiB
PHP
<?php
|
|
include "db.php";
|
|
// include "table.php";
|
|
include "include/queuemail.php";
|
|
|
|
$results = db_query("SELECT people.*,school_name FROM people,schools " .
|
|
"WHERE school_num > 1 " .
|
|
"AND people_type = 'Student' " .
|
|
"AND (class_num IN (0,1,2) OR user_num = 0) " .
|
|
"AND people.school_num = schools.record_num " .
|
|
"AND reseller != 'esns' " .
|
|
"ORDER BY school_name");
|
|
|
|
$reply = "support@hotlunches.net";
|
|
$replyname = "Hot Lunches On-Line";
|
|
|
|
$pschool = "";
|
|
$count = 0;
|
|
$total = 0;
|
|
while ($row = db_fetch_assoc($results)) {
|
|
extract($row);
|
|
$school_name = $school_name;
|
|
|
|
if ($school_name != $pschool) {
|
|
if ($count > 0 && strlen($school_name)) {
|
|
$message .= " - Students: $count\n";
|
|
echo("$message\n");
|
|
|
|
//$r = db_query("SELECT * FROM school_contact_list WHERE school_num = $pschool_num ORDER BY sequence");
|
|
//while ($c = db_fetch_assoc($r)) {
|
|
//$recipient = $c['contact_email'];
|
|
//$name = $c['contact_name'];
|
|
//if (strlen($recipient) > 0) QueueEmail($recipient,$reply,$subject,$message,$replyname,$name);
|
|
//}
|
|
}
|
|
|
|
$subject = "CORRECTION - Students without a Class Assigned at $school_name";
|
|
$message = "Hello,\n\n" .
|
|
"Here is a CORRECT list of the students at your school who do not have a class assigned. " .
|
|
"It is important to address this as these students will not appear on any delivery reports until they are assigned to a class.\n\n" .
|
|
"$school_name:\n";
|
|
$pschool = $school_name;
|
|
$pschool_num = $school_num;
|
|
$count = 0;
|
|
}
|
|
|
|
$uname = "";
|
|
$email = "";
|
|
if ($user_num > 0) {
|
|
$r = db_query("SELECT * FROM users WHERE record_num = $user_num");
|
|
$u = db_fetch_assoc($r);
|
|
if (strlen($u['first_name'])) $uname = $u['first_name'] . " " . $u['last_name'];
|
|
else $uname = $u['last_name'];
|
|
$email = $u['email'];
|
|
}
|
|
|
|
$message .= sprintf(" - %-30s %-25s - %s\n","$first_name $last_name",$uname,$email);
|
|
$count++;
|
|
$total++;
|
|
}
|
|
|
|
echo($message);
|
|
echo("\n\n");
|
|
|
|
?>
|