forked from science-ation/science-ation
commit this file so i can mov eit
This commit is contained in:
parent
c7e1ec708c
commit
b1810d05a2
@ -75,3 +75,57 @@ function getProjectsEligibleForAwards($awards_ids_array)
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
function getAwardsEligibleForProject($projectnumber)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$prjq=mysql_query("SELECT
|
||||
award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards_projectcategories.projectcategories_id,
|
||||
award_awards_projectdivisions.projectdivisions_id,
|
||||
projects.id AS projects_id
|
||||
FROM
|
||||
award_awards,
|
||||
award_awards_projectcategories,
|
||||
award_awards_projectdivisions,
|
||||
projects
|
||||
WHERE
|
||||
award_awards.id='$award_id'
|
||||
AND award_awards.id=award_awards_projectcategories.award_awards_id
|
||||
AND award_awards.id=award_awards_projectdivisions.award_awards_id
|
||||
AND projects.projectcategories_id=award_awards_projectcategories.projectcategories_id
|
||||
AND projects.projectdivisions_id=award_awards_projectdivisions.projectdivisions_id
|
||||
AND projects.projectnumber is not null
|
||||
AND projects.year='".$config['FAIRYEAR']."'
|
||||
ORDER BY
|
||||
projectnumber
|
||||
");
|
||||
$projects=array();
|
||||
while($prjr=mysql_fetch_object($prjq))
|
||||
{
|
||||
$projects[$prjr->projectnumber]=array(
|
||||
"id"=>$prjr->projects_id,
|
||||
"projectnumber"=>$prjr->projectnumber,
|
||||
"title"=>$prjr->title
|
||||
);
|
||||
}
|
||||
return $projects;
|
||||
}
|
||||
|
||||
function getAwardsEligibleForProjects($awards_ids_array)
|
||||
{
|
||||
$projects=array();
|
||||
foreach($awards_ids_array AS $award_id)
|
||||
{
|
||||
$awardprojects=array();
|
||||
$awardprojects=getProjectsEligibleForAward($award_id);
|
||||
//this will just overwrite ones that already exist, but still keep things in order because the main key is the projectnumber (i hope)
|
||||
foreach($awardprojects AS $proj)
|
||||
$projects[$proj['projectnumber']]=$proj;
|
||||
}
|
||||
|
||||
return $projects;
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user