Fix special award nominations to work with "-1" special award (i dont want to nomiiated for special awradsa)

This commit is contained in:
james 2011-03-04 19:21:30 +00:00
parent afd81015eb
commit af47f30aeb
4 changed files with 22 additions and 15 deletions

View File

@ -44,6 +44,7 @@ fwrite($fout, " --- request at " . date("Y-m-d H:i:s") . " ---\n");
fwrite($fout, "\$_GET = \n" . print_r($_GET, true) . "\n"); fwrite($fout, "\$_GET = \n" . print_r($_GET, true) . "\n");
fwrite($fout, "\$_POST = \n" . print_r($_POST, true) . "\n"); fwrite($fout, "\$_POST = \n" . print_r($_POST, true) . "\n");
fwrite($fout, "\$_SESSION = \n" . print_r($_SESSION, true) . "\n"); fwrite($fout, "\$_SESSION = \n" . print_r($_SESSION, true) . "\n");
ob_start();
switch($request[0]) { switch($request[0]) {
case 'config': case 'config':
@ -1278,6 +1279,9 @@ switch($request[0]) {
} }
fwrite($fout, "result = \n" . print_r($ret, true) . "\n"); fwrite($fout, "result = \n" . print_r($ret, true) . "\n");
$output=ob_get_contents();
fwrite($fout, "outputbuffer = $output\n");
fclose($fout); fclose($fout);
ob_end_clean();
echo json_encode($ret); echo json_encode($ret);
?> ?>

View File

@ -1 +1 @@
234 235

1
db/db.update.235.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE `project_specialawards_link` CHANGE `award_awards_id` `award_awards_id` INT( 11 ) NULL DEFAULT NULL;

View File

@ -177,17 +177,17 @@ function getNominatedForNoSpecialAwardsForProject($projectid)
{ {
global $conference; global $conference;
$awardsq=mysql_query("SELECT $awardsq=mysql_query("SELECT
projects.id AS projects_id projects_id
FROM FROM
project_specialawards_link, project_specialawards_link
projects
WHERE WHERE
project_specialawards_link.projects_id='$projectid' projects_id='$projectid'
AND projects.conferences_id='".$conference['id']."' AND conferences_id='{$conference['id']}'
AND projects.id='$projectid' AND award_awards_id=-1
AND project_specialawards_link.award_awards_id IS NULL
"); ");
if(mysql_num_rows($awardsq) == 1) return true; if(mysql_num_rows($awardsq) == 1)
return true;
else
return false; return false;
} }
@ -320,22 +320,24 @@ function getProjectId($registrations_id){
function getAwardListing($project_id){ function getAwardListing($project_id){
$returnval = array(); $returnval = array();
$eligibleAwards = getSpecialAwardsEligibleForProject($project_id); $eligibleAwards = getSpecialAwardsEligibleForProject($project_id);
$nominatedawards = getSpecialAwardsNominatedForProject($project_id); $nominatedAwards = getSpecialAwardsNominatedForProject($project_id);
$eligibleawards = array_merge(array(array( 'id'=> -1, $eligibleAwards = array_merge(array(array( 'id'=> -1,
'name' => "I do not wish to self-nominate for any special awards", 'name' => "I do not wish to self-nominate for any special awards",
'criteria' => "Select this option if you do not wish to self-nominate you project for any special awards.<hr>", 'criteria' => "Select this option if you do not wish to self-nominate you project for any special awards.<hr>",
'self_nominate' => 'yes')), 'self_nominate' => 'yes')),
$eligibleawards); $eligibleAwards);
/* See if they have the -1 award selected */ /* See if they have the -1 award selected */
$noawards = getNominatedForNoSpecialAwardsForProject($project_id); $noawards = getNominatedForNoSpecialAwardsForProject($project_id);
// echo "noawards=$noawards";
if($noawards == true) { if($noawards == true) {
$nominatedawards = array_merge(array(array('id' => '-1')), $nominatedawards); // echo "marging -1 award";
$nominatedAwards = array_merge(array(array('id' => '-1')), $nominatedAwards);
} }
$nominatedawards_list=array(); $nominatedawards_list=array();
foreach($nominatedawards AS $naward){ foreach($nominatedAwards AS $naward){
$nominatedawards_list[] = $naward['id']; $nominatedawards_list[] = $naward['id'];
} }
foreach($eligibleAwards AS $eaward){ foreach($eligibleAwards AS $eaward){