2008-10-23 21:32:31 +00:00
< ?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website : http :// www . sfiab . ca
Copyright ( C ) 2008 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 " );
require_once ( " ../user.inc.php " );
user_auth_required ( 'committee' , 'admin' );
if ( $_GET [ 'id' ]) {
2008-10-25 04:28:41 +00:00
$id = intval ( $_GET [ 'id' ]);
2008-10-28 21:19:21 +00:00
$q = mysql_query ( " SELECT sponsorships.*, sponsors.organization FROM sponsorships,sponsors WHERE sponsorships.id=' $id ' AND sponsorships.sponsors_id=sponsors.id " );
2008-10-23 21:32:31 +00:00
echo " <h2>Edit Sponsorship</h2> " ;
$sponsorship = mysql_fetch_object ( $q );
$formaction = " sponsorshipedit " ;
}
else
{
echo " <h2>Create New Sponsorship</h2> " ;
$formaction = " sponsorshipadd " ;
$fundraising_type = $_GET [ 'fundraising_type' ];
}
echo " <input type= \" hidden \" name= \" action \" value= \" $formaction\ " > " ;
echo " <input type= \" hidden \" name= \" sponsorships_id \" value= \" $id\ " > " ;
2008-10-24 22:29:14 +00:00
echo " <table cellspacing=0 cellpadding=0 class= \" SFIABDialogTable \" > " ;
echo " <tr><th> " . i18n ( " Sponsor " ) . " </th> " ;
2008-10-23 21:32:31 +00:00
echo " <td> " ;
2008-10-28 21:19:21 +00:00
if ( $formaction == " sponsorshipadd " ) {
2008-10-23 21:32:31 +00:00
$q = mysql_query ( " SELECT * FROM sponsors ORDER BY organization " );
echo mysql_error ();
echo " <select name= \" sponsors_id \" > " ;
echo " <option value= \" \" > " . i18n ( " Choose " ) . " </option> \n " ;
while ( $r = mysql_fetch_object ( $q )) {
if ( $r -> id == $sponsorship -> sponsors_id ) $sel = " selected= \" selected \" " ; else $sel = " " ;
echo " <option $sel value= \" $r->id\ " > $r -> organization </ option > \n " ;
}
2008-10-25 04:25:38 +00:00
echo " </select> <a href= \" sponsors.php?action=add \" > " . i18n ( " Add " ) . " </a> \n " ;
2008-10-28 21:19:21 +00:00
}
else {
echo $sponsorship -> organization ;
}
2008-10-23 21:32:31 +00:00
echo " </td></tr> \n " ;
2008-10-24 22:29:14 +00:00
echo " <tr><th> " . i18n ( " Type " ) . " </th> " ;
2008-10-23 21:32:31 +00:00
echo " <td> " ;
$q = mysql_query ( " SELECT * FROM fundraising WHERE year=' { $config [ 'FAIRYEAR' ] } ' ORDER BY name " );
echo mysql_error ();
echo " <select name= \" fundraising_type \" > " ;
echo " <option value= \" \" > " . i18n ( " Choose " ) . " </option> \n " ;
while ( $r = mysql_fetch_object ( $q )) {
if ( $r -> type == $sponsorship -> fundraising_type || $r -> type == $fundraising_type ) $sel = " selected= \" selected \" " ; else $sel = " " ;
echo " <option $sel value= \" $r->type\ " > $r -> name </ option > \n " ;
}
echo " </select> \n " ;
echo " </td></tr> \n " ;
2008-10-24 22:29:14 +00:00
echo " <tr><th> " . i18n ( " Amount " ) . " </th><td><input type= \" text \" name= \" value \" value= \" $sponsorship->value\ " ></ td ></ tr > \n " ;
2008-10-23 21:32:31 +00:00
2008-10-24 22:29:14 +00:00
echo " <tr><th> " . i18n ( " Status " ) . " </th> " ;
2008-10-23 21:32:31 +00:00
echo " <td> " ;
echo " <select name= \" status \" > " ;
echo " <option value= \" \" > " . i18n ( " Choose " ) . " </option> \n " ;
$statuses = array ( " pending " , " confirmed " , " received " );
foreach ( $statuses AS $status ) {
if ( $sponsorship -> status == $status ) $sel = " selected= \" selected \" " ; else $sel = " " ;
echo " <option $sel value= \" $status\ " > " .i18n(ucfirst( $status )). " </ option > \n " ;
}
echo " </select> \n " ;
echo " </td></tr> \n " ;
2008-10-24 22:29:14 +00:00
echo " <tr><th> " . i18n ( " Probability " ) . " </th> " ;
2008-10-23 21:32:31 +00:00
echo " <td> " ;
echo " <select name= \" probability \" > " ;
echo " <option value= \" \" > " . i18n ( " Choose " ) . " </option> \n " ;
$probs = array ( " 25 " , " 50 " , " 75 " , " 90 " , " 95 " , " 99 " , " 100 " );
foreach ( $probs AS $prob ) {
if ( $sponsorship -> probability == $prob ) $sel = " selected= \" selected \" " ; else $sel = " " ;
echo " <option $sel value= \" $prob\ " > $prob %</ option > \n " ;
}
echo " </select> \n " ;
echo " </td></tr> \n " ;
echo " </table> \n " ;
?>