show the awsards on the registration summary main page

This commit is contained in:
james 2005-05-11 21:39:39 +00:00
parent ed663e77eb
commit d9d82ce1f5
4 changed files with 56 additions and 19 deletions

View File

@ -123,7 +123,6 @@ function getSpecialAwardsNominatedForProject($projectid)
{
global $config;
//FIXME: this query isnt done yet, its still a copy from above
$awardsq=mysql_query("SELECT
award_awards.id,
award_awards.name,

View File

@ -187,28 +187,34 @@ function safetyStatus($reg_id="")
function spawardStatus($reg_id="")
{
global $config;
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
return false;
//grab all of their answers
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='$rid'");
while($r=mysql_fetch_object($q))
{
$safetyanswers[$r->safetyquestions_id]=$r->answer;
}
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid'");
$project=mysql_fetch_object($q);
//now grab all the questions
$q=mysql_query("SELECT * FROM safetyquestions ORDER BY ord");
while($r=mysql_fetch_object($q))
{
if($r->required=="yes" && !$safetyanswers[$r->id])
{
return "incomplete";
}
}
$awardsq=mysql_query("SELECT
award_awards.id,
award_awards.name,
award_awards.criteria,
projects.id AS projects_id
FROM
award_awards,
project_specialawards_link,
projects
WHERE
project_specialawards_link.projects_id='".$project->id."'
AND project_specialawards_link.award_awards_id=award_awards.id
AND projects.year='".$config['FAIRYEAR']."'
ORDER BY
award_awards.name
");
if(mysql_num_rows($awardsq))
return "complete";
else
return "incomplete";
}

View File

@ -24,6 +24,7 @@
<?
require("common.inc.php");
include "register_participants.inc.php";
include "projects.inc.php";
//authenticate based on email address and registration number from the SESSION
if(!$_SESSION['email'])
@ -182,7 +183,36 @@ echo "<table><tr><td>";
if(registrationFormsReceived())
{
echo "<tr><td><a href=\"register_participants_spawards.php\">".i18n("Self-nominate for special awards")."</a></td></tr>";
// $awards=getSpecialAwardsNominatedByRegistrationID($_SESSION['registration_id']);
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."'");
$project=mysql_fetch_object($q);
$nominatedawards=getSpecialAwardsNominatedForProject($project->id);
$num=count($nominatedawards);
if($num)
{
echo "<tr><td>";
echo happy(i18n("You are nominated for %1 awards",array($num)),"inline");
echo "</td></tr>";
echo "<tr><td>";
$c=1;
foreach($nominatedawards AS $na)
{
echo $c.". ".$na['name']."<br />";
$c++;
}
echo "</td>";
echo "</tr>";
}
else
{
echo "<tr><td>";
echo error(i18n("You are nominated for 0 awards"),"inline");
echo "</td></tr>";
}
echo "</td></tr>";
}
else
{

View File

@ -116,10 +116,12 @@ else if($newstatus=="complete")
$eligibleawards=getSpecialAwardsEligibleForProject($project->id);
$nominatedawards=getSpecialAwardsNominatedForProject($project->id);
/*
echo "eligible awards <br>";
echo nl2br(print_r($eligibleawards,true));
echo "nominated awards <br>";
echo nl2br(print_r($nominatedawards,true));
*/
$nominatedawards_list=array();
foreach($nominatedawards AS $naward)