From fb53a2cb2c0abd983255c01a7183ee4ea40c29cc Mon Sep 17 00:00:00 2001 From: james Date: Thu, 6 Nov 2008 21:06:40 +0000 Subject: [PATCH] Add sponsorship levels editor Add description to funrdaising types Add description/benefits to sponsorship levels --- admin/fundraising.php | 7 ++- admin/fundraising_types.php | 1 + admin/fundraising_types_handler.inc.php | 7 +-- admin/sponsor_contacts.php | 5 +- admin/sponsors.php | 2 +- admin/sponsorship_levels.php | 71 +++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 admin/sponsorship_levels.php diff --git a/admin/fundraising.php b/admin/fundraising.php index 93ebccf..d8af53c 100644 --- a/admin/fundraising.php +++ b/admin/fundraising.php @@ -43,7 +43,7 @@ require_once("../dialog.inc.php"); if(!mysql_num_rows($q)) { $q=mysql_query("SELECT * FROM fundraising WHERE year='-1'"); while($r=mysql_fetch_object($q)) { - mysql_query("INSERT INTO fundraising (`type`,`name`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','$r->system','$r->goal','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO fundraising (`type`,`name`,`description`,`system`,`goal`,`year`) VALUES ('$r->type','".mysql_real_escape_string($r->name)."','".mysql_real_escape_string($r->description)."','$r->system','$r->goal','".$config['FAIRYEAR']."')"); } } @@ -53,7 +53,7 @@ require_once("../dialog.inc.php"); while($r=mysql_fetch_object($q)) { echo ""; - echo "id',300,230)\" href=\"#\">"; + echo "id',400,250)\" href=\"#\">"; if($r->system=="no") { echo "id\">"; } @@ -129,7 +129,10 @@ require_once("../dialog.inc.php"); echo "\n"; echo "
\n"; echo "
\n"; + echo "Manage Sponsorship Levels\n"; + echo "
\n"; echo "Manage Sponsors\n"; + echo "
\n"; send_footer(); ?> diff --git a/admin/fundraising_types.php b/admin/fundraising_types.php index 302842a..dccbb36 100644 --- a/admin/fundraising_types.php +++ b/admin/fundraising_types.php @@ -52,6 +52,7 @@ echo "".i18n("Name")."name)."\">\n"; echo "".i18n("Key")."type)."\">\n"; } + echo "".i18n("Description")."\n"; echo "".i18n("Goal")."goal\">\n"; echo "\n"; diff --git a/admin/fundraising_types_handler.inc.php b/admin/fundraising_types_handler.inc.php index 9ed0ee3..2082b46 100644 --- a/admin/fundraising_types_handler.inc.php +++ b/admin/fundraising_types_handler.inc.php @@ -26,16 +26,17 @@ if($_POST['action']=="fundedit" || $_POST['action']=="fundadd") { } $name=mysql_real_escape_string($_POST['name']); $type=mysql_real_escape_string($_POST['type']); + $description=mysql_real_escape_string($_POST['description']); $goal=intval($_POST['goal']); } if($_POST['action']=="fundedit") { if( ($system=="yes" && $goal) || ($system=="no" && $goal && $type && $name) ) { if($system=="yes") { - mysql_query("UPDATE fundraising SET goal='$goal' WHERE id='$fundraising_id'"); + mysql_query("UPDATE fundraising SET goal='$goal', description='$description' WHERE id='$fundraising_id'"); } else { - mysql_query("UPDATE fundraising SET goal='$goal', type='$type', name='$name' WHERE id='$fundraising_id'"); + mysql_query("UPDATE fundraising SET goal='$goal', description='$description', type='$type', name='$name' WHERE id='$fundraising_id'"); } if(mysql_error()) message_push(error(mysql_error())); @@ -49,7 +50,7 @@ if($_POST['action']=="fundedit") { } if($_POST['action']=="fundadd") { if( $goal && $type && $name) { - mysql_query("INSERT INTO fundraising (type,name,system,goal,year) VALUES ('$type','$name','no','$goal','{$config['FAIRYEAR']}')"); + mysql_query("INSERT INTO fundraising (type,name,description,system,goal,year) VALUES ('$type','$name','$description','no','$goal','{$config['FAIRYEAR']}')"); message_push(happy(i18n("Added new fund"))); } else diff --git a/admin/sponsor_contacts.php b/admin/sponsor_contacts.php index cc05c38..d6b9a73 100644 --- a/admin/sponsor_contacts.php +++ b/admin/sponsor_contacts.php @@ -172,7 +172,10 @@ echo "
"; $q=mysql_query("SELECT * FROM users LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id - WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$sponsors_id' ORDER BY lastname,firstname"); + WHERE year='".$config['FAIRYEAR']."' + AND sponsors_id='$sponsors_id' + AND deleted='no' + ORDER BY lastname,firstname"); echo mysql_Error(); if(mysql_num_rows($q)) diff --git a/admin/sponsors.php b/admin/sponsors.php index 07c4b36..6b4ec3d 100644 --- a/admin/sponsors.php +++ b/admin/sponsors.php @@ -170,7 +170,7 @@ $numr=mysql_fetch_object($numq); $numsponsorships=$numr->num; - $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']."'"); + $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']."' and users.deleted='no'"); $numr=mysql_fetch_object($numq); $numcontacts=$numr->num; diff --git a/admin/sponsorship_levels.php b/admin/sponsorship_levels.php new file mode 100644 index 0000000..dc1e4d3 --- /dev/null +++ b/admin/sponsorship_levels.php @@ -0,0 +1,71 @@ + + + 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. +*/ +?> +level)."', + '".mysql_real_escape_string($r->min)."', + '".mysql_real_escape_string($r->max)."', + '".mysql_real_escape_string($r->description)."', + '".$config['FAIRYEAR']."')"); + } + } + + user_auth_required('committee', 'admin'); + send_header("Sponsorship Levels", + array('Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php', + 'Fundraising' => 'admin/fundraising.php'), + "internal_document_management" + ); + + $editor=new TableEditor("sponsorships_levels", + array("level"=>"Level Name", + "min"=>"Minimum Amount", + "max"=>"Maximum Amount", + ) + , + array("level"=>"Level Name", + "min"=>"Minimum Amount", + "max"=>"Maximum Amount", + "description"=>"Description / Benefits", + ) + ,array("year"=>$config['FAIRYEAR']) + ); + + $editor->setPrimaryKey("id"); + $editor->setDefaultSortField("max"); + $editor->setRecordType("Level"); + $editor->filterList('year',$config['FAIRYEAR']); + $editor->execute(); + + send_footer(); +?>