forked from science-ation/science-ation
Send a registration email for new regs for awards that are marked as
"this student should be registered in this fair" so the student knows how to login. For non-registration awards, set the status to complete so the project is included in awards.
This commit is contained in:
parent
b1033e2369
commit
6bd6f971ac
26
remote.php
26
remote.php
@ -192,9 +192,10 @@ function award_upload_school(&$student, &$school, $year, &$response)
|
|||||||
return award_upload_update_school($q, $school, $school_id);
|
return award_upload_update_school($q, $school, $school_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
function award_upload_assign(&$fair, &$award, &$prize, &$project, $year, &$response)
|
||||||
{
|
{
|
||||||
$reg_email_needs_update = false;
|
$reg_email_needs_update = false;
|
||||||
|
$new_reg = false;
|
||||||
/* Copied from admin/award_upload.php, this is the
|
/* Copied from admin/award_upload.php, this is the
|
||||||
* transport name => sql name mapping */
|
* transport name => sql name mapping */
|
||||||
$student_fields = array('firstname'=>'firstname',
|
$student_fields = array('firstname'=>'firstname',
|
||||||
@ -247,7 +248,11 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
|||||||
'$year', '{$fair['id']}');");
|
'$year', '{$fair['id']}');");
|
||||||
$pid = mysql_insert_id();
|
$pid = mysql_insert_id();
|
||||||
$reg_email_needs_update = true;
|
$reg_email_needs_update = true;
|
||||||
|
$new_reg = true;
|
||||||
}
|
}
|
||||||
|
$q = mysql_query("SELECT * FROM registrations WHERE id='$registrations_id'");
|
||||||
|
$registration = mysql_fetch_assoc($q);
|
||||||
|
|
||||||
/* Update the project in case anythign changed */
|
/* Update the project in case anythign changed */
|
||||||
mysql_query("UPDATE projects SET title='".mysql_real_escape_string($project['title'])."',
|
mysql_query("UPDATE projects SET title='".mysql_real_escape_string($project['title'])."',
|
||||||
summary='".mysql_real_escape_string($project['abstract'])."',
|
summary='".mysql_real_escape_string($project['abstract'])."',
|
||||||
@ -283,8 +288,23 @@ function award_upload_assign(&$fair, &$prize, &$project, $year, &$response)
|
|||||||
WHERE id='$registrations_id'");
|
WHERE id='$registrations_id'");
|
||||||
$reg_email_needs_update = false;
|
$reg_email_needs_update = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if($award['external_register_winners'] == 1 && $new_reg == true) {
|
||||||
|
/* This award is for students who are participating in this fair, we need
|
||||||
|
* to get their reg number to them if this is a new registration */
|
||||||
|
email_send("new_participant",$student['email'],array(),
|
||||||
|
array( "EMAIL"=>$student['email'],
|
||||||
|
"REGNUM"=>$registration['num'])
|
||||||
|
);
|
||||||
|
$response['notice'][] = " - Sent welcome registration email to: {$student['firstname']} {$student['lastname']} <{$student['email']}>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($award['external_register_winners'] == 0) {
|
||||||
|
/* It's not an external, so we don't need the student to login
|
||||||
|
* or antyhing, we probably want to include it in reports, so set
|
||||||
|
* it to complete */
|
||||||
|
mysql_query("UPDATE registrations SET status='complete' WHERE id='$registrations_id'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handle_award_upload(&$u, &$fair, &$data, &$response)
|
function handle_award_upload(&$u, &$fair, &$data, &$response)
|
||||||
@ -323,7 +343,7 @@ function handle_award_upload(&$u, &$fair, &$data, &$response)
|
|||||||
if(!is_array($ul_p['projects'])) continue;
|
if(!is_array($ul_p['projects'])) continue;
|
||||||
|
|
||||||
foreach($ul_p['projects'] as &$project) {
|
foreach($ul_p['projects'] as &$project) {
|
||||||
award_upload_assign($fair, $prize, $project, $year, $response);
|
award_upload_assign($fair, $award, $prize, $project, $year, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response['notice'][] = 'Award winners saved';
|
$response['notice'][] = 'Award winners saved';
|
||||||
|
Loading…
Reference in New Issue
Block a user