From 3ab46da3d5b9f33d627af5cf7f2f92a8ffc0534d Mon Sep 17 00:00:00 2001 From: james Date: Thu, 6 Nov 2008 21:07:40 +0000 Subject: [PATCH] Add defaults and descriptions to fundraising types and sponsorship levels Start working on the sponsors main page for when a sponsor logs in --- db/db.update.119.sql | 11 ++++++++-- sponsor_main.php | 48 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/db/db.update.119.sql b/db/db.update.119.sql index bcbf2b3..6d0fa11 100644 --- a/db/db.update.119.sql +++ b/db/db.update.119.sql @@ -4,6 +4,7 @@ CREATE TABLE `fundraising` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `type` VARCHAR( 32 ) NOT NULL , `name` VARCHAR( 128 ) NOT NULL , + `description` TEXT NULL DEFAULT NULL , `system` ENUM( 'no', 'yes' ) DEFAULT 'no' NOT NULL , `goal` INT UNSIGNED NOT NULL , `year` INT NOT NULL , @@ -11,8 +12,8 @@ CREATE TABLE `fundraising` ( ) TYPE = MYISAM ; ALTER TABLE `fundraising` ADD UNIQUE (type,year); -INSERT INTO `fundraising` ( `id` , `type` , `name` , `system` , `goal` , `year` ) VALUES ( '', 'general', 'General Funds', 'yes', '0', '-1'); -INSERT INTO `fundraising` ( `id` , `type` , `name` , `system` , `goal` , `year` ) VALUES ( '', 'awards', 'Award Sponsorships', 'yes', '0', '-1'); +INSERT INTO `fundraising` ( `id` , `type` , `name` , `description`, `system` , `goal` , `year` ) VALUES ( '', 'general', 'General Funds', 'General funds donated to the fair may be allocated as the fair organizers see fit','yes', '0', '-1'); +INSERT INTO `fundraising` ( `id` , `type` , `name` , `description`, `system` , `goal` , `year` ) VALUES ( '', 'awards', 'Award Sponsorships', 'Award Sponsorships are provided to allow an organization to sponsor a specific award that is given out at the fair', 'yes', '0', '-1'); ALTER TABLE `award_sponsors` RENAME `sponsors` ; ALTER TABLE `sponsors` DROP `confirmed`; @@ -56,3 +57,9 @@ CREATE TABLE `sponsorships_levels` ( `year` INT NOT NULL , PRIMARY KEY ( `id` ) ) TYPE = MYISAM ; + +INSERT INTO sponsorships_levels (`level`,`min`,`max`,`year`) VALUES ('Bronze','100','499',-1); +INSERT INTO sponsorships_levels (`level`,`min`,`max`,`year`) VALUES ('Silver','500','999',-1); +INSERT INTO sponsorships_levels (`level`,`min`,`max`,`year`) VALUES ('Gold','1000','10000',-1); + + diff --git a/sponsor_main.php b/sponsor_main.php index ab1800a..c028d4e 100644 --- a/sponsor_main.php +++ b/sponsor_main.php @@ -29,9 +29,14 @@ user_auth_required('sponsor'); send_header("Sponsor Main", array()); + $u=user_load($_SESSION['users_id']); + //print_r($u); + $q=mysql_query("SELECT * FROM sponsors WHERE id='".$u['sponsors_id']."'"); + $sponsor=mysql_fetch_object($q); //only display the named greeting if we have their name echo i18n("Hello %1",array($_SESSION['name'])); + if($sponsor->organization) echo " ".i18n("from %1",array($sponsor->organization)); echo "
"; echo "
"; @@ -39,9 +44,50 @@ echo " \n"; echo " ".theme_icon("edit_profile")."
".i18n("Edit My Profile")."
"; echo " ".theme_icon("change_password")."
".i18n("Change My Password")."
"; - echo " ".theme_icon("")."
".i18n("Manage My Roles")."
"; +// echo " ".theme_icon("")."
".i18n("Manage My Roles")."
"; echo " \n"; echo "\n"; + echo "

Your sponsorships

\n"; + + $sq=mysql_query("SELECT sponsorships.id, + sponsors.organization, + sponsorships.value, + sponsorships.status, + sponsorships.probability, + fundraising.name + FROM sponsorships + JOIN sponsors ON sponsorships.sponsors_id=sponsors.id + JOIN fundraising ON sponsorships.fundraising_type=fundraising.type + AND sponsorships.year='{$config['FAIRYEAR']}' + AND fundraising.year='{$config['FAIRYEAR']}' + AND sponsors.id='".$u['sponsors_id']."' + ORDER BY status DESC, probability DESC, organization"); + echo mysql_error(); + + echo ""; + echo ""; + echo " \n"; + echo " \n"; + echo " \n"; + echo " "; + echo "\n"; + while($sr=mysql_fetch_object($sq)) { + echo "id\" class=\"fundraising{$sr->status}\">"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + } + echo "
".i18n("Sponsorship Category")."".i18n("Status")."".i18n("Amount")."".i18n("Action")."
$sr->name$sr->status".format_money($sr->value).""; + if($sr->status=="confirmed") { + echo "Pay Online\n"; + } + else if($sr->status=="pending") { + echo "id\">Confirm Funding\n"; + } + echo " "; + echo "
\n"; send_footer(); ?>