Add awards subsystem

Add award sponsors
This commit is contained in:
james 2005-02-23 22:03:56 +00:00
parent 6d58c108c0
commit 537fdb2139
3 changed files with 225 additions and 0 deletions

185
admin/award_sponsors.php Normal file
View File

@ -0,0 +1,185 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
auth_required('admin');
send_header("Administration - Award Sponsors");
?>
<?
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>\n";
echo "<a href=\"awards.php\">&lt;&lt; ".i18n("Back to Awards")."</a>\n";
if($_POST['save']=="edit" || $_POST['save']=="add")
{
if($_POST['save']=="add")
{
$q=mysql_query("INSERT INTO award_sponsors (year) VALUES ('".$config['FAIRYEAR']."')");
$id=mysql_insert_id();
}
else
$id=$_POST['id'];
$exec="UPDATE award_sponsors SET ".
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
"city='".mysql_escape_string(stripslashes($_POST['city']))."', ".
"province_code='".mysql_escape_string(stripslashes($_POST['province_code']))."', ".
"postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ".
"phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ".
"fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ".
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."' ".
"WHERE id='$id'";
mysql_query($exec);
if($_POST['save']=="add")
echo happy("Sponsor successfully added");
else
echo happy("Successfully saved changes to sponsor");
}
if($_GET['action']=="delete" && $_GET['delete'])
{
mysql_query("DELETE FROM award_sponsors WHERE id='".$_GET['delete']."'");
echo happy("Sponsor successfully deleted");
}
if($_GET['action']=="confirm" && $_GET['confirm'])
{
mysql_query("UPDATE award_sponsors SET confirmed='yes' WHERE id='".$_GET['confirm']."'");
echo happy("Sponsor successfully confirmed");
}
if($_GET['action']=="unconfirm" && $_GET['unconfirm'])
{
mysql_query("UPDATE award_sponsors SET confirmed='no' WHERE id='".$_GET['unconfirm']."'");
echo happy("Sponsor successfully unconfirmed");
}
if($_GET['action']=="edit" || $action=="add")
{
echo "<a href=\"award_sponsors.php\">&lt;&lt; ".i18n("Back to Award Sponsors")."</a>\n";
if($_GET['action']=="edit")
{
echo "<h3>".i18n("Edit Award Sponsor")."</h3>\n";
$buttontext="Save Sponsor";
$q=mysql_query("SELECT * FROM award_sponsors WHERE id='".$_GET['edit']."'");
$r=mysql_fetch_object($q);
}
else if($action=="add")
{
echo "<h3>".i18n("Add New Award Sponsor")."</h3>\n";
$buttontext="Add Sponsor";
}
$buttontext=i18n($buttontext);
echo "<form method=\"post\" action=\"award_sponsors.php\">\n";
echo "<input type=\"hidden\" name=\"save\" value=\"".$_GET['action']."\">\n";
if($_GET['action']=="edit")
echo "<input type=\"hidden\" name=\"id\" value=\"".$_GET['edit']."\">\n";
echo "<table>\n";
echo "<tr><td>".i18n("Organization Name")."</td><td><input type=\"text\" name=\"organization\" value=\"".htmlspecialchars($r->organization)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Address")."</td><td><input type=\"text\" name=\"address\" value=\"".htmlspecialchars($r->address)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"".htmlspecialchars($r->city)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
echo "<tr><td>".i18n("Province")."</td><td>";
emit_province_selector("province_code",$r->province_code);
echo "</td></tr>\n";
echo "<tr><td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode\" value=\"$r->postalcode\" size=\"8\" maxlength=\"7\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"".htmlspecialchars($r->phone)."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
}
else
{
echo "<br />";
echo "<a href=\"award_sponsors.php?action=add\">Add New Sponsor</a>\n";
echo "<br />";
echo "<table class=\"summarytable\">";
echo "<tr>";
echo " <th>Confirmed?</th>";
echo " <th>Organization</th>";
echo " <th># of Awards</th>";
echo " <th>Action</th>";
echo "</tr>\n";
$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization");
while($r=mysql_fetch_object($q))
{
echo "<tr>\n";
echo "<td align=\"center\">\n";
if($r->confirmed=='yes')
{
echo "<a href=\"award_sponsors.php?action=unconfirm&unconfirm=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/ok.".$config['icon_extension']."\"></a>\n";
}
else
{
echo "<a href=\"award_sponsors.php?action=confirm&confirm=$r->id\">confirm</a>";
}
echo "</td>\n";
echo " <td>$r->organization</td>\n";
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE id='$r->id'");
$numr=mysql_fetch_object($numq);
$num=$numr->num;
$total=$numr->total;
echo " <td align=center valign=top>";
echo "$num &nbsp;";
echo "<a href=\"award_awards.php?award_sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
echo "</td>";
echo " <td>";
echo "<a href=\"award_sponsors.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
echo "&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you want to remove this sponsor?')\" href=\"award_sponsors.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo " </td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
send_footer();
?>

37
admin/awards.php Normal file
View File

@ -0,0 +1,37 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
auth_required('admin');
send_header("Administration - Awards");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>\n";
echo "<br />";
echo "<br />";
echo "<a href=\"award_sponsors.php\">Award Sponsors</a><br />";
send_footer();
?>

View File

@ -26,9 +26,12 @@
auth_required('admin');
send_header("Administration");
echo "<br />";
echo "<a href=\"registration.php\">Participant Registration</a> <br />";
echo "<a href=\"reports.php\">Print / Export Reports</a> <br />";
echo "<hr />";
echo "<a href=\"committees.php\">Committee Management</a> <br />";
echo "<a href=\"awards.php\">Awards Management</a> <br />";
send_footer();
?>