Add 'emailcontact' field to registrations table, that SCHOOLINVITE teachers can put their own email address into to receive emails that would normally go to the students. If the students email is valid the student will still get the emails as well.

This commit is contained in:
james 2007-11-15 21:17:20 +00:00
parent 90b40724b5
commit 8ad304441f
4 changed files with 23 additions and 10 deletions

View File

@ -922,9 +922,13 @@ function getEmailRecipientsForRegistration($reg_id)
$q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'");
$registration=mysql_fetch_object($q); $registration=mysql_fetch_object($q);
//FIXME: right now it only emails the kids! add fields to registrations table to store who it should email if($registration->emailcontact) && isEmailAddress($registration->emailcontact)) {
//and write a way for that info to be updated, especially on the teacher invitation screen to have emails $ret[]=array("to"=>$registration->emailcontact,
//go to the teacher. "firstname"=>"",
"lastname"=>"",
"email"=>$registration->emailcontact,
);
}
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'"); $sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
$ret=array(); $ret=array();
@ -936,6 +940,9 @@ function getEmailRecipientsForRegistration($reg_id)
$to=$sr->firstname." <".$sr->email.">"; $to=$sr->firstname." <".$sr->email.">";
else if($sr->lastname) else if($sr->lastname)
$to=$sr->lastname." <".$sr->email.">"; $to=$sr->lastname." <".$sr->email.">";
else
$to=$sr->email;
$ret[]=array("to"=>$to, $ret[]=array("to"=>$to,
"firstname"=>$sr->firstname, "firstname"=>$sr->firstname,
"lastname"=>$sr->lastname, "lastname"=>$sr->lastname,

View File

@ -1 +1 @@
59 60

1
db/db.update.60.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE `registrations` ADD `emailcontact` VARCHAR( 64 ) DEFAULT NULL AFTER `email` ;

View File

@ -38,9 +38,10 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
}while(mysql_num_rows($q)>0); }while(mysql_num_rows($q)>0);
//actually insert it //actually insert it
mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (". mysql_query("INSERT INTO registrations (num,email,emailcontact,start,status,year) VALUES (".
"'$regnum',". "'$regnum',".
"'".$_POST['email']."',". "'".$_POST['email']."',".
"'".$_POST['emailcontact']."',".
"NOW(),". "NOW(),".
"'open',". "'open',".
$config['FAIRYEAR']. $config['FAIRYEAR'].
@ -197,10 +198,11 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<input type=hidden name=action value=\"invite\">"; echo "<input type=hidden name=action value=\"invite\">";
echo "<table>"; echo "<table>";
echo "<tr><td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email\" /></td></tr>"; echo "<tr><td><nobr>".i18n("Student Email Address")."</nobr></td><td><input type=\"text\" name=\"email\" /></td><td>".i18n("Or unique username for student")."</td></tr>";
echo "<tr><td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" /></td></tr>"; echo "<tr><td><nobr>".i18n("Contact Email Address")."</nobr></td><td><input type=\"text\" name=\"emailcontact\" /></td><td>".i18n("Any emails that would normally go to the student, will also be sent to this address")."</td></tr>";
echo "<tr><td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" /></td></tr>"; echo "<tr><td><nobr>".i18n("Student First Name")."</nobr></td><td colspan=\"2\"><input type=\"text\" name=\"firstname\" /></td></tr>";
echo "<tr><td>".i18n("Grade")."</td><td>"; echo "<tr><td><nobr>".i18n("Student Last Name")."</nobr></td><td colspan=\"2\"><input type=\"text\" name=\"lastname\" /></td></tr>";
echo "<tr><td><nobr>".i18n("Grade")."</nobr></td><td colspan=\"2\">";
echo "<select name=\"grade\">\n"; echo "<select name=\"grade\">\n";
echo "<option value=\"\">".i18n("Select Grade")."</option>\n"; echo "<option value=\"\">".i18n("Select Grade")."</option>\n";
@ -236,7 +238,10 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
echo "<tr><td>$r->lastname</td><td>$r->firstname</td>"; echo "<tr><td>$r->lastname</td><td>$r->firstname</td>";
echo "<td>$r->email</td>"; echo "<td>$r->email";
if($r->emailcontact)
echo " / $r->emailcontact";
echo "</td>";
echo "<td align=\"center\">$r->grade</td>"; echo "<td align=\"center\">$r->grade</td>";
echo "<td align=\"center\">$r->num</td>"; echo "<td align=\"center\">$r->num</td>";
echo "<td align=\"center\">"; echo "<td align=\"center\">";