From 125437dd55388479c612c5e3d5dff8e28d6fa480 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 24 Jan 2008 07:46:12 +0000 Subject: [PATCH] - More GVRSF stuff that I missed. Add two fields to the award_awards: 'self_nominate', and 'schedule_judges'. - self_nominate defaults to 'yes' for all new and existing awards. If turned off, the award will not appear in the student self-nomination pages. - schedule_judges specifies whether an award should have judges or not, we have some special awards that students can nominate for but do not require judges to find the winner. Similarly we have some awards students cannot nominate for but do require judges to determine a winner. This allows both cases to be handled. --- admin/award_awards.php | 21 +++++++++++++++++++++ db/db.code.version.txt | 2 +- db/db.update.101.sql | 6 ++++++ projects.inc.php | 6 ++++-- register_participants_spawards.php | 4 +++- 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 db/db.update.101.sql diff --git a/admin/award_awards.php b/admin/award_awards.php index 1bb254c4..0f00c1e3 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -74,6 +74,8 @@ else $id=$_POST['id']; + $self_nominate = ($_POST['self_nominate'] == 'yes') ? 'yes' : 'no'; + $schedule_judges = ($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no'; $exec="UPDATE award_awards SET ". "name='".mysql_escape_string(stripslashes($_POST['name']))."', ". "`order`='".mysql_escape_string(stripslashes($_POST['order']))."', ". @@ -82,6 +84,8 @@ "presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."', ". "excludefromac='".mysql_escape_string(stripslashes($_POST['excludefromac']))."', ". "cwsfaward='".mysql_escape_string(stripslashes($_POST['cwsfaward']))."', ". + "self_nominate='$self_nominate', ". + "schedule_judges='$schedule_judges', ". "criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."', ". "description='".mysql_escape_string(stripslashes($_POST['description']))."' ". "WHERE id='$id'"; @@ -157,6 +161,8 @@ award_awards.presenter, award_awards.excludefromac, award_awards.cwsfaward, + award_awards.self_nominate, + award_awards.schedule_judges, award_types.id AS award_types_id, award_types.type, award_sponsors.id AS award_sponsors_id, @@ -188,6 +194,9 @@ echo mysql_error(); $award_awards_presenter=$r->presenter; $award_awards_excludefromac=$r->excludefromac; $award_awards_cwsfaward=$r->cwsfaward; + $award_awards_self_nominate=$r->self_nominate; + $award_awards_schedule_judges=$r->schedule_judges; + //select the current categories that this award is linked to $ccq=mysql_query("SELECT * FROM award_awards_projectcategories WHERE award_awards_id='$r->id'"); @@ -207,6 +216,10 @@ echo mysql_error(); $buttontext="Add Award"; $firstsponsor="\n"; $firsttype="\n"; + /* We want these two on by default for new + * awards */ + $award_awards_self_nominate = 'yes'; + $award_awards_schedule_judges = 'yes'; } $buttontext=i18n($buttontext); @@ -223,6 +236,8 @@ echo mysql_error(); if($_POST['presenter']) $award_awards_presenter=$_POST['presenter']; if($_POST['excludefromac']) $award_awards_excludefromac=$_POST['excludefromac']; if($_POST['cwsfaward']) $award_awards_cwsfaward=$_POST['cwsfaward']; + if($_POST['self_nominate']) $award_awards_self_nominate=$_POST['self_nominate']; + if($_POST['schedule_judges']) $award_awards_schedule_judges=$_POST['schedule_judges']; echo "
\n"; @@ -315,6 +330,12 @@ echo mysql_error(); echo ""; if($award_awards_cwsfaward==1) $ch="checked=\"checked\""; else $ch=""; echo "".i18n("This award identifies the students that will be attending the Canada-Wide Science Fair").""; + echo ""; + $ch = ($award_awards_self_nominate=='yes') ? "checked=\"checked\"" : ''; + echo "".i18n("Students can self-nominate for this award (this is usually checked for special awards)").""; + echo ""; + $ch = ($award_awards_schedule_judges=='yes') ? "checked=\"checked\"" : ''; + echo "".i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)").""; echo "\n"; diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 29d6383b..398050c6 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -100 +101 diff --git a/db/db.update.101.sql b/db/db.update.101.sql new file mode 100644 index 00000000..60d088dc --- /dev/null +++ b/db/db.update.101.sql @@ -0,0 +1,6 @@ +ALTER TABLE `award_awards` ADD `self_nominate` ENUM('yes', 'no') NOT NULL DEFAULT 'yes' AFTER `cwsfaward` ; +ALTER TABLE `award_awards` ADD `schedule_judges` ENUM('yes', 'no') NOT NULL DEFAULT 'yes' AFTER `self_nominate` ; + +UPDATE award_awards SET self_nominate='yes' WHERE 1; +UPDATE award_awards SET schedule_judges='yes' WHERE 1; + diff --git a/projects.inc.php b/projects.inc.php index 15546dd5..9649a8e4 100644 --- a/projects.inc.php +++ b/projects.inc.php @@ -98,7 +98,8 @@ function getSpecialAwardsEligibleForProject($projectid) award_awards.criteria, award_awards_projectcategories.projectcategories_id, award_awards_projectdivisions.projectdivisions_id, - projects.id AS projects_id + projects.id AS projects_id, + award_awards.self_nominate FROM award_awards, award_awards_projectcategories, @@ -127,7 +128,8 @@ function getSpecialAwardsEligibleForProject($projectid) $awards[$r->id]=array( "id"=>$r->id, "criteria"=>$r->criteria, - "name"=>$r->name + "name"=>$r->name, + "self_nominate"=>$r->self_nominate ); } return $awards; diff --git a/register_participants_spawards.php b/register_participants_spawards.php index 24252539..166a8f91 100644 --- a/register_participants_spawards.php +++ b/register_participants_spawards.php @@ -172,7 +172,8 @@ else if($newstatus=="complete") $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.
")), + 'criteria' => "Select this option if you do not wish to self-nominate you project for any special awards.
", + 'self_nominate' => 'yes')), $eligibleawards); /* See if they have the -1 award selected */ $noawards = getNominatedForNoSpecialAwardsForProject($project->id); @@ -196,6 +197,7 @@ else if($newstatus=="complete") echo ""; foreach($eligibleawards AS $eaward) { + if($eaward['self_nominate'] == 'no') continue; echo "
"; if(in_array($eaward['id'],$nominatedawards_list)) $ch="checked=\"checked\""; else $ch=""; echo "";