Update the rest of the awards system to pull from sponsors instead of award_sponsors

This commit is contained in:
james 2008-11-03 05:05:09 +00:00
parent 8df97afb4f
commit 4b573c7224
3 changed files with 37 additions and 34 deletions

View File

@ -32,8 +32,8 @@
'Awards Main' => 'admin/awards.php')
);
if($_GET['award_sponsors_id']) $award_sponsors_id=$_GET['award_sponsors_id'];
else if($_POST['award_sponsors_id']) $award_sponsors_id=$_POST['award_sponsors_id'];
if($_GET['sponsors_id']) $sponsors_id=$_GET['sponsors_id'];
else if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id'];
if($_GET['award_types_id']) $award_types_id=$_GET['award_types_id'];
else if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
@ -77,7 +77,7 @@
}
if($_GET['action']=="create" && $_GET['award_sponsors_id'])
if($_GET['action']=="create" && $_GET['sponsors_id'])
{
$q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
$prizes=array();
@ -106,8 +106,8 @@
$c_category=$cat[$c_id];
echo i18n("Creating %1 - %2",array($c_category,$d_division))."<br />";
mysql_query("INSERT INTO award_awards (award_sponsors_id,award_types_id,name,criteria,`order`,year) VALUES (
'{$_GET['award_sponsors_id']}',
mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,name,criteria,`order`,year) VALUES (
'{$_GET['sponsors_id']}',
'1',
'$c_category - $d_division',
'".i18n("Best %1 projects in the %2 division",array($c_category,$d_division))."',
@ -157,13 +157,13 @@
echo "<table>";
echo "<tr><td>".i18n("Sponsor").":</td><td>";
$sq=mysql_query("SELECT id,organization FROM award_sponsors ORDER BY organization");
echo "<select name=\"award_sponsors_id\">";
$sq=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
echo "<select name=\"sponsors_id\">";
//only show the "choose a sponsor" option if we are adding,if we are editing, then they must have already chosen one.
echo $firstsponsor;
while($sr=mysql_fetch_object($sq))
{
if($sr->id == $award_sponsors_id)
if($sr->id == $sponsors_id)
$sel="selected=\"selected\"";
else
$sel="";

View File

@ -39,8 +39,8 @@
'Awards Main' => 'admin/awards.php') );
}
if($_GET['award_sponsors_id'] && $_GET['award_sponsors_id']!="all")
$_SESSION['award_sponsors_id']=$_GET['award_sponsors_id'];
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
$_SESSION['sponsors_id']=$_GET['sponsors_id'];
if($_GET['award_types_id'] && $_GET['award_types_id']!="all")
$_SESSION['award_types_id']=$_GET['award_types_id'];
@ -48,15 +48,15 @@
if($_GET['award_sponsors_confirmed'] && $_GET['award_sponsors_confirmed']!="all")
$_SESSION['award_sponsors_confirmed']=$_GET['award_sponsors_confirmed'];
if($_GET['award_sponsors_id']=="all")
unset($_SESSION['award_sponsors_id']);
if($_GET['sponsors_id']=="all")
unset($_SESSION['sponsors_id']);
if($_GET['award_types_id']=="all")
unset($_SESSION['award_types_id']);
if($_GET['award_sponsors_confirmed']=="all")
unset($_SESSION['award_sponsors_confirmed']);
$award_types_id=$_SESSION['award_types_id'];
$award_sponsors_id=$_SESSION['award_sponsors_id'];
$sponsors_id=$_SESSION['sponsors_id'];
$award_sponsors_confirmed=$_SESSION['award_sponsors_confirmed'];
if($_POST['save']=="edit" || $_POST['save']=="add")
@ -65,7 +65,7 @@
echo error(i18n("Award Type is required"));
$_GET['action']=$_POST['save'];
}
else if(!$_POST['award_sponsors_id']) {
else if(!$_POST['sponsors_id']) {
echo error(i18n("Award Sponsor is required"));
$_GET['action']=$_POST['save'];
}
@ -74,7 +74,7 @@
if($_POST['save']=="add")
{
$q=mysql_query("INSERT INTO award_awards (award_sponsors_id,award_types_id,year) VALUES ('".$_POST['award_sponsors_id']."','".$_POST['award_types_id']."','".$config['FAIRYEAR']."')");
$q=mysql_query("INSERT INTO award_awards (sponsors_id,award_types_id,year) VALUES ('".$_POST['sponsors_id']."','".$_POST['award_types_id']."','".$config['FAIRYEAR']."')");
$id=mysql_insert_id();
}
else
@ -85,7 +85,7 @@
$exec="UPDATE award_awards SET ".
"name='".mysql_escape_string(stripslashes($_POST['name']))."', ".
"`order`='".mysql_escape_string(stripslashes($_POST['order']))."', ".
"award_sponsors_id='".mysql_escape_string(stripslashes($_POST['award_sponsors_id']))."', ".
"sponsors_id='".mysql_escape_string(stripslashes($_POST['sponsors_id']))."', ".
"award_types_id='".mysql_escape_string(stripslashes($_POST['award_types_id']))."', ".
"presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."', ".
"excludefromac='".mysql_escape_string(stripslashes($_POST['excludefromac']))."', ".
@ -171,17 +171,17 @@
award_awards.schedule_judges,
award_types.id AS award_types_id,
award_types.type,
award_sponsors.id AS award_sponsors_id,
award_sponsors.organization
sponsors.id AS sponsors_id,
sponsors.organization
FROM
award_awards,
award_types,
award_sponsors
sponsors
WHERE
award_awards.year='".$config['FAIRYEAR']."'
AND award_awards.id='".$_GET['edit']."'
AND award_awards.award_sponsors_id=award_sponsors.id
AND award_awards.sponsors_id=sponsors.id
AND award_awards.award_types_id=award_types.id
");
@ -195,7 +195,7 @@ echo mysql_error();
$award_awards_description=$r->description;
$award_types_id=$r->award_types_id;
$award_type=$r->type;
$award_sponsors_id=$r->award_sponsors_id;
$sponsors_id=$r->sponsors_id;
$award_sponsor=$r->organization;
$award_awards_presenter=$r->presenter;
$award_awards_excludefromac=$r->excludefromac;
@ -236,7 +236,7 @@ echo mysql_error();
if($_POST['criteria']) $award_awards_criteria=$_POST['criteria'];
if($_POST['description']) $award_awards_criteria=$_POST['description'];
if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id'];
if($_POST['award_sponsors_id']) $award_sponsors_id=$_POST['award_sponsors_id'];
if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id'];
if($_POST['eligiblecategories']) $currentcategories=$_POST['eligiblecategories'];
if($_POST['eligibledivisions']) $currentdivisions=$_POST['eligibledivisions'];
if($_POST['presenter']) $award_awards_presenter=$_POST['presenter'];
@ -257,12 +257,12 @@ echo mysql_error();
echo "<tr><td>".i18n("Order")."</td><td><input type=\"text\" name=\"order\" value=\"".htmlspecialchars($award_awards_order)."\" size=\"5\" maxlength=\"5\" />(".i18n("presentation order").")</td></tr>\n";
echo "<tr><td>".i18n("Sponsor")."</td><td>";
$sq=mysql_query("SELECT id,organization FROM award_sponsors ORDER BY organization");
echo "<select name=\"award_sponsors_id\">";
echo "<select name=\"sponsors_id\">";
//only show the "choose a sponsor" option if we are adding,if we are editing, then they must have already chosen one.
echo $firstsponsor;
while($sr=mysql_fetch_object($sq))
{
if($sr->id == $award_sponsors_id)
if($sr->id == $sponsors_id)
$sel="selected=\"selected\"";
else
$sel="";
@ -362,12 +362,12 @@ echo mysql_error();
echo "<form method=\"get\" action=\"award_awards.php\" name=\"filterchange\">";
echo "<table><tr><td colspan=\"2\">";
$q=mysql_query("SELECT id,organization FROM award_sponsors ORDER BY organization");
echo "<select name=\"award_sponsors_id\" onchange=\"document.forms.filterchange.submit()\">";
$q=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization");
echo "<select name=\"sponsors_id\" onchange=\"document.forms.filterchange.submit()\">";
echo "<option value=\"all\">".i18n("All Sponsors")."</option>";
while($r=mysql_fetch_object($q))
{
if($r->id == $award_sponsors_id)
if($r->id == $sponsors_id)
{
$sel="selected=\"selected\"";
$award_sponsors_organization=$r->organization;
@ -397,6 +397,9 @@ echo mysql_error();
echo "</select>";
echo "</td><td>";
/*
//FIXME: 'confirmed' no longer exists, we need to lookup their sponsorship record and check the status there, either pending, confirmed or received, dunno if it makes sense to put that here or not..
echo "<select name=\"award_sponsors_confirmed\" onchange=\"document.forms.filterchange.submit()\">";
if($award_sponsors_confirmed=="all") $sel="selected=\"selected\""; else $sel="";
echo "<option value=\"all\">".i18n("Any Status")."</option>";
@ -405,6 +408,7 @@ echo mysql_error();
if($award_sponsors_confirmed=="no") $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"no\">".i18n("Unconfirmed Only")."</option>";
echo "</select>";
*/
echo "</form>";
echo "</td></tr>";
echo "</table>";
@ -412,10 +416,10 @@ echo mysql_error();
echo "<br />";
echo "<a href=\"award_awards.php?award_sponsors_id=$award_sponsors_id&award_types_id=$award_types_id&action=add\">".i18n("Add New Award")."</a>\n";
echo "<a href=\"award_awards.php?sponsors_id=$sponsors_id&award_types_id=$award_types_id&action=add\">".i18n("Add New Award")."</a>\n";
echo "<br />";
if($award_sponsors_id) $where_asi="AND award_sponsors_id='$award_sponsors_id'";
if($sponsors_id) $where_asi="AND sponsors_id='$sponsors_id'";
if($award_types_id) $where_ati="AND award_types_id='$award_types_id'";
if($award_sponsors_confirmed) $where_asc="AND award_sponsors.confirmed='$award_sponsors_confirmed'";
@ -427,19 +431,18 @@ echo mysql_error();
award_awards.order,
award_awards.award_sources_id,
award_types.type,
award_sponsors.organization,
award_sponsors.confirmed
sponsors.organization
FROM
award_awards,
award_types,
award_sponsors
sponsors
WHERE
award_awards.year='".$config['FAIRYEAR']."'
$where_asi
$where_ati
$where_asc
AND award_awards.award_sponsors_id=award_sponsors.id
AND award_awards.sponsors_id=sponsors.id
AND award_awards.award_types_id=award_types.id
AND award_types.year='".$config['FAIRYEAR']."'
ORDER BY `$orderby`");

View File

@ -170,7 +170,7 @@
$numr=mysql_fetch_object($numq);
$numsponsorships=$numr->num;
$numq=mysql_query("SELECT COUNT(users_id) AS num FROM users_sponsor WHERE sponsors_id='$r->id'");
$numq=mysql_query("SELECT COUNT(users_id) AS num FROM users_sponsor, users WHERE sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.year='".$config['FAIRYEAR']."'");
$numr=mysql_fetch_object($numq);
$numcontacts=$numr->num;