- 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.
This commit is contained in:
dave 2008-01-24 07:46:12 +00:00
parent 446b54f693
commit 125437dd55
5 changed files with 35 additions and 4 deletions

View File

@ -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="<option value=\"\">".i18n("Choose a sponsor")."</option>\n";
$firsttype="<option value=\"\">".i18n("Choose an award type")."</option>\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 "<form method=\"post\" action=\"award_awards.php\">\n";
@ -315,6 +330,12 @@ echo mysql_error();
echo "<tr><td align=\"right\">";
if($award_awards_cwsfaward==1) $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"checkbox\" name=\"cwsfaward\" value=\"1\"></td><td>".i18n("This award identifies the students that will be attending the Canada-Wide Science Fair")."</td></tr>";
echo "<tr><td align=\"right\">";
$ch = ($award_awards_self_nominate=='yes') ? "checked=\"checked\"" : '';
echo "<input $ch type=\"checkbox\" name=\"self_nominate\" value=\"yes\"></td><td>".i18n("Students can self-nominate for this award (this is usually checked for special awards)")."</td></tr>";
echo "<tr><td align=\"right\">";
$ch = ($award_awards_schedule_judges=='yes') ? "checked=\"checked\"" : '';
echo "<input $ch type=\"checkbox\" name=\"schedule_judges\" value=\"yes\"></td><td>".i18n("Allow the Automatic Judge Scheduler to assign judges to this award (usually checked)")."</td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";

View File

@ -1 +1 @@
100
101

6
db/db.update.101.sql Normal file
View File

@ -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;

View File

@ -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;

View File

@ -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.<hr>")),
'criteria' => "Select this option if you do not wish to self-nominate you project for any special awards.<hr>",
'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 "<table>";
foreach($eligibleawards AS $eaward)
{
if($eaward['self_nominate'] == 'no') continue;
echo "<tr><td rowspan=\"2\">";
if(in_array($eaward['id'],$nominatedawards_list)) $ch="checked=\"checked\""; else $ch="";
echo "<input onclick=\"checkboxclicked(this)\" $ch type=\"checkbox\" name=\"spaward[]\" value=\"".$eaward['id']."\" />";