By default, turn ON all eligibility in divs/cats for downloaded awards.. so

fairs don't wonder why they can't assign any winners to these awards.  In other
words, make it "just work".  :p
This commit is contained in:
james 2010-02-22 20:26:23 +00:00
parent de761c8b3e
commit f4d2d636d8
2 changed files with 28 additions and 0 deletions

View File

@ -27,6 +27,7 @@
require_once('curl.inc.php');
switch($_GET['action']) {
case 'check':
$fairs_id = intval($_GET['fairs_id']);
@ -88,6 +89,9 @@ case 'check':
return;
}
$divs = projectdivisions_load();
$cats = projectcategories_load();
foreach($awards as $award) {
$identifier=$award['identifier'];
$year=$award['year'];
@ -114,6 +118,11 @@ case 'check':
'".mysql_escape_string($identifier)."',
'$fairs_id')");
$award_id=mysql_insert_id();
/* By default make all divs/cats eligible */
foreach($divs as $id=>$d)
mysql_query("INSERT INTO award_awards_projectdivisions(award_awards_id,projectdivisions_id,year) VALUES ('$award_id','$id','{$config['FAIRYEAR']}')");
foreach($cats as $id=>$c)
mysql_query("INSERT INTO award_awards_projectcategories(award_awards_id,projectcategories_id,year) VALUES ('$award_id','$id','{$config['FAIRYEAR']}')");
} else {
echo i18n("Award already exists, updating info")."<br />";
$awardrecord=mysql_fetch_object($tq);

View File

@ -1325,5 +1325,24 @@ function getUserForSponsor($sponsor_id) {
return user_load_by_uid($r->uid);
}
function projectdivisions_load($year = false)
{
global $config;
if($year == false) $year = $config['FAIRYEAR'];
$divs = array();
$q = mysql_query("SELECT * FROM projectdivisions WHERE year='$year'");
while(($d = mysql_fetch_assoc($q))) $divs[$d['id']] = $d;
return $divs;
}
function projectcategories_load($year = false)
{
global $config;
if($year == false) $year = $config['FAIRYEAR'];
$cats = array();
$q = mysql_query("SELECT * FROM projectcategories WHERE year='$year'");
while(($c = mysql_fetch_assoc($q))) $cats[$c['id']] = $d;
return $cats;
}
?>