From af47f30aeb7ff240b388da656096f0dd56b1681b Mon Sep 17 00:00:00 2001 From: james Date: Fri, 4 Mar 2011 19:21:30 +0000 Subject: [PATCH] Fix special award nominations to work with "-1" special award (i dont want to nomiiated for special awradsa) --- api.php | 4 ++++ db/db.code.version.txt | 2 +- db/db.update.235.sql | 1 + projects.inc.php | 30 ++++++++++++++++-------------- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 db/db.update.235.sql diff --git a/api.php b/api.php index 54f555d..2e21d4f 100644 --- a/api.php +++ b/api.php @@ -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, "\$_POST = \n" . print_r($_POST, true) . "\n"); fwrite($fout, "\$_SESSION = \n" . print_r($_SESSION, true) . "\n"); +ob_start(); switch($request[0]) { case 'config': @@ -1278,6 +1279,9 @@ switch($request[0]) { } fwrite($fout, "result = \n" . print_r($ret, true) . "\n"); +$output=ob_get_contents(); +fwrite($fout, "outputbuffer = $output\n"); fclose($fout); +ob_end_clean(); echo json_encode($ret); ?> diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 7b5813c..f8c9d43 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -234 +235 diff --git a/db/db.update.235.sql b/db/db.update.235.sql new file mode 100644 index 0000000..d4b3dc4 --- /dev/null +++ b/db/db.update.235.sql @@ -0,0 +1 @@ +ALTER TABLE `project_specialawards_link` CHANGE `award_awards_id` `award_awards_id` INT( 11 ) NULL DEFAULT NULL; diff --git a/projects.inc.php b/projects.inc.php index 22ac75c..c6d2b61 100644 --- a/projects.inc.php +++ b/projects.inc.php @@ -177,18 +177,18 @@ function getNominatedForNoSpecialAwardsForProject($projectid) { global $conference; $awardsq=mysql_query("SELECT - projects.id AS projects_id + projects_id FROM - project_specialawards_link, - projects + project_specialawards_link WHERE - project_specialawards_link.projects_id='$projectid' - AND projects.conferences_id='".$conference['id']."' - AND projects.id='$projectid' - AND project_specialawards_link.award_awards_id IS NULL + projects_id='$projectid' + AND conferences_id='{$conference['id']}' + AND award_awards_id=-1 "); - if(mysql_num_rows($awardsq) == 1) return true; - return false; + if(mysql_num_rows($awardsq) == 1) + return true; + else + return false; } function getProjectsNominatedForSpecialAward($award_id) @@ -320,22 +320,24 @@ function getProjectId($registrations_id){ function getAwardListing($project_id){ $returnval = array(); $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", 'criteria' => "Select this option if you do not wish to self-nominate you project for any special awards.
", 'self_nominate' => 'yes')), - $eligibleawards); + $eligibleAwards); /* See if they have the -1 award selected */ $noawards = getNominatedForNoSpecialAwardsForProject($project_id); +// echo "noawards=$noawards"; 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(); - foreach($nominatedawards AS $naward){ + foreach($nominatedAwards AS $naward){ $nominatedawards_list[] = $naward['id']; } foreach($eligibleAwards AS $eaward){