forked from science-ation/science-ation
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:
parent
90b40724b5
commit
8ad304441f
@ -922,9 +922,13 @@ function getEmailRecipientsForRegistration($reg_id)
|
||||
$q=mysql_query("SELECT * FROM registrations WHERE id='$reg_id' AND year='{$config['FAIRYEAR']}'");
|
||||
$registration=mysql_fetch_object($q);
|
||||
|
||||
//FIXME: right now it only emails the kids! add fields to registrations table to store who it should email
|
||||
//and write a way for that info to be updated, especially on the teacher invitation screen to have emails
|
||||
//go to the teacher.
|
||||
if($registration->emailcontact) && isEmailAddress($registration->emailcontact)) {
|
||||
$ret[]=array("to"=>$registration->emailcontact,
|
||||
"firstname"=>"",
|
||||
"lastname"=>"",
|
||||
"email"=>$registration->emailcontact,
|
||||
);
|
||||
}
|
||||
|
||||
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND year='{$config['FAIRYEAR']}'");
|
||||
$ret=array();
|
||||
@ -936,6 +940,9 @@ function getEmailRecipientsForRegistration($reg_id)
|
||||
$to=$sr->firstname." <".$sr->email.">";
|
||||
else if($sr->lastname)
|
||||
$to=$sr->lastname." <".$sr->email.">";
|
||||
else
|
||||
$to=$sr->email;
|
||||
|
||||
$ret[]=array("to"=>$to,
|
||||
"firstname"=>$sr->firstname,
|
||||
"lastname"=>$sr->lastname,
|
||||
|
@ -1 +1 @@
|
||||
59
|
||||
60
|
||||
|
1
db/db.update.60.sql
Normal file
1
db/db.update.60.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `registrations` ADD `emailcontact` VARCHAR( 64 ) DEFAULT NULL AFTER `email` ;
|
@ -38,9 +38,10 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
}while(mysql_num_rows($q)>0);
|
||||
|
||||
//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',".
|
||||
"'".$_POST['email']."',".
|
||||
"'".$_POST['emailcontact']."',".
|
||||
"NOW(),".
|
||||
"'open',".
|
||||
$config['FAIRYEAR'].
|
||||
@ -197,10 +198,11 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
echo "<input type=hidden name=action value=\"invite\">";
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email\" /></td></tr>";
|
||||
echo "<tr><td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" /></td></tr>";
|
||||
echo "<tr><td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" /></td></tr>";
|
||||
echo "<tr><td>".i18n("Grade")."</td><td>";
|
||||
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><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><nobr>".i18n("Student First Name")."</nobr></td><td colspan=\"2\"><input type=\"text\" name=\"firstname\" /></td></tr>";
|
||||
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 "<option value=\"\">".i18n("Select Grade")."</option>\n";
|
||||
@ -236,7 +238,10 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
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->num</td>";
|
||||
echo "<td align=\"center\">";
|
||||
|
Loading…
Reference in New Issue
Block a user