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. */ ?> \n"; $q=mysql_query("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name"); while($r=mysql_fetch_object($q)) { echo "

id}\">".htmlspecialchars($r->name)."

\n"; echo "
id}\">\n"; echo "\n"; echo "id}\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" onsubmit=\"return campaigninfo_save($r->id)\">\n"; echo "id}\" />\n"; display_campaign_form($r); ?>

">

id}\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\" onsubmit=\"return campaigninfo_remove($r->id)\">\n"; echo "id}\" />\n"; ?>
">


">
fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); $goalr=mysql_fetch_object($goalq); $recq=mysql_query("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); echo mysql_error(); $recr=mysql_fetch_object($recq); $received=$recr->received; if($r->target) $percent=round($received/$r->target*100,1); else $percent=0; $col=colour_to_percent($percent); echo "id)\">\n"; echo " \n"; echo " \n"; echo " \n"; echo " "; echo " \n"; echo " \n"; echo " \n"; echo " "; echo "\n"; } ?>
$r->name$r->type".format_date($r->startdate)."".format_date($r->enddate)."".format_money($r->target,false)."".format_money($received,false)."{$percent}%$goalr->name

$campaign->name\n"; ?>
overview tab
donations tab
prospects tab
communications tab
fundraising_goal); $recq=mysql_query("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); echo mysql_error(); $recr=mysql_fetch_object($recq); $received=$recr->received; if($r->target) $percent=round($received/$r->target*100,1); else $percent=0; $col=colour_to_percent($percent); echo ""; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo " "; echo "\n"; echo " "; echo "\n"; echo " "; echo "\n"; echo " \n"; echo "\n"; echo " \n"; echo "\n"; echo " \n"; echo "\n"; echo "
".i18n("Type")."$r->type
".i18n("Start Date")."".format_date($r->startdate)."
".i18n("Follow-Up Date")."".format_date($r->followupdate)."
".i18n("End Date")."".format_date($r->enddate)."
".i18n("Default Purpose")."$goalr->name
".i18n("Target")."".format_money($r->target,false)."
".i18n("Received")."".format_money($received,false)."
".i18n("% to Budget")."{$percent}%
\n"; } exit; break; case "manage_tab_donations": $campaign_id=intval($_GET['id']); $q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'"); if($campaign=mysql_fetch_object($q)) { echo ""; echo ""; echo ""; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo ""; echo "\n"; $q=mysql_query("SELECT * FROM fundraising_donations WHERE fundraising_campaigns_id='$campaign_id' AND status='received' ORDER BY datereceived DESC"); while($r=mysql_fetch_object($q)) { $goal=getGoal($r->fundraising_goal); $sq=mysql_query("SELECT * FROM sponsors WHERE id='{$r->sponsors_id}'"); $sponsor=mysql_fetch_object($sq); echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; } echo "
".i18n("Date")."".i18n("Donor/Sponsor")."".i18n("Purpose")."".i18n("Amount")."".i18n("Type of Support")."
".format_date($r->datereceived)."".$sponsor->organization."".$goal->name."".format_money($r->value)."".i18n($r->supporttype)."
\n"; } exit; break; case "manage_tab_prospects": $donationhistorylist=array("never"=>"Never donated/sponsored", "past"=>"Donated/sponsored in the past", "lastyear"=>"Donated/sponsored last year", "thisyear"=>"Donated/sponsored this year"); $emailaddresslist=array("available"=>"Available", "notavaialble"=>"Not Available"); $rolelist=array( "judge"=>"Judge", "teacher"=>"Teacher", "sciencehead"=>"School Science Head", "principal"=>"School Principal", "parent"=>"Parent", "committee"=>"Committee", "volunteer"=>"Volunteer", "alumni"=>"Alumni (not implemented)", "mentor"=>"Mentor (not implemented)", ); $campaign_id=intval($_GET['id']); $q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'"); $campaign=mysql_fetch_object($q); if($campaign->filterparameters) { echo "

".i18n("User List")."

\n"; $params=unserialize($campaign->filterparameters); echo ""; echo "\n"; if(is_array($params['donationhistory'])) { echo "\n"; } // echo "\n"; if(is_array($params['emailaddress'])) { echo "\n"; } if($params['donortype']=="individual" && is_array($params['individual_type'])) { echo "\n"; } else if( is_array($params['contacttype'])) { echo "\n"; } echo "
".i18n("Donor Type")."".i18n(ucfirst($params['donortype']))."
".i18n("Donation History").""; foreach($params['donationhistory'] AS $d) { echo i18n($donationhistorylist[$d])."
\n"; } echo "
".i18n("Donation Level").""; // echo "
".i18n("Email Address").""; foreach($params['emailaddress'] AS $e) { echo i18n($emailaddresslist[$e])."
\n"; } echo "
".i18n("Role").""; foreach($params['individual_type'] AS $e) { echo i18n($rolelist[$e])."
\n"; } echo "
".i18n("Role").""; foreach($params['contacttype'] AS $e) { echo i18n(ucfirst($e))."
"; } echo "
\n"; //params: individual/org // donation history // donation level // email address // role ind // role org echo "
"; echo "
\n"; echo "\n"; $q=mysql_query("SELECT * FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaign_id'"); while($r=mysql_fetch_object($q)) { $u=user_load_by_uid($r->users_uid); //hopefully this never returns false, but who knows.. if($u) { echo "\n"; echo "
"; } } echo "
"; echo "
"; echo "
"; echo "\n"; echo ""; echo "\n"; // echo ""; // echo "\n"; echo "
\n"; } else { ?>

:


"Initial Communication", "followup"=>"Follow-Up Communication"); foreach($communications as $key=>$name) { echo "

".i18n($name)."

\n"; //check if they have one in the emails database $q=mysql_query("SELECT * FROM emails WHERE fundraising_campaigns_id='$campaign_id' AND val='$key'"); if($email=mysql_fetch_object($q)) { echo "
"; echo "id,$campaign_id)\">"; echo "  "; echo "id);\" href=\"\">"; echo "
"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".i18n("Subject")."".htmlspecialchars($email->subject)."
".i18n("From")."".htmlspecialchars($email->from)."
".$email->bodyhtml."
"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
"; //we let them always send it again for now... might change this back later, but i think just notifying them of when it was last sent is enough and keeps teh form more consistent echo "id)\" value=\"".i18n("Send as email")."\" />"; echo "
\n"; if($email->lastsent) { list($date,$time)=explode(" ",$email->lastsent); echo i18n("Last Sent"); echo "
".format_date($date); echo "
".format_time($time); } echo "
\n"; echo "
\n"; } else { echo "\n"; } echo "
"; } exit; break; case "prospect_removeselected": $campaignid=intval($_POST['fundraising_campaigns_id']); print_r($_POST); if(is_array($_POST['prospectremovefromlist'])) { $uidlist=implode(",",$_POST['prospectremovefromlist']); $query="DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid' AND users_uid IN ($uidlist)"; mysql_query($query); echo mysql_error(); } //if theres nobody left in the list we need to reset the filter params as well $q=mysql_query("SELECT COUNT(*) AS num FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid'"); $r=mysql_fetch_object($q); if($r->num==0) { mysql_query("UPDATE fundraising_campaigns SET filterparameters=NULL WHERE id='$campaignid'"); } happy_("Selected users removed from list"); exit; break; case "prospect_removeall": $campaignid=intval($_POST['fundraising_campaigns_id']); mysql_query("DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid'"); mysql_query("UPDATE fundraising_campaigns SET filterparameters=NULL WHERE id='$campaignid'"); happy_("All users removed from list"); exit; break; case "communication_remove": $emails_id=$_POST['id']; //check if its been sent, if so, it cannot be deleted, sorry! $q=mysql_query("SELECT * FROM emails WHERE id='$emails_id'"); $e=mysql_fetch_object($q); if($e->lastsent) { error_("Cannot remove an email that has already been sent"); } else { mysql_query("DELETE FROM emails WHERE id='$emails_id'"); happy_("Communicaton removed"); } exit; break; case "campaign_remove": $campaign_id = $_POST['campaign_id']; if(is_numeric($campaign_id)) { mysql_query("DELETE FROM fundraising_campaigns WHERE (SELECT COUNT(*) FROM fundraising_donations WHERE fundraising_campaigns_id = $campaign_id) = 0 AND (SELECT count(*) FROM emails WHERE fundraising_campaigns_id = $campaign_id) = 0 AND id = $campaign_id"); if(mysql_affected_rows() == 0) { error_("Cannot delete campaign. It is in use."); } else { mysql_query("DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id = $campaign_id"); mysql_query("DELETE FROM fundraising_donations WHERE fundraising_campaigns_id = $campaign_id"); mysql_query("DELETE FROM fundraising_donor_logs WHERE fundraising_campaigns_id = $campaign_id"); mysql_query("DELETE FROM emailqueue WHERE fundraising_campaigns_id = $campaign_id"); mysql_query("DELETE FROM emails WHERE fundraising_campaigns_id = $campaign_id"); happy_("Campaign removed"); echo ""; } } else { error_("Invalid Campaign ID"); } exit; break; } function save_campaign_info(){ global $config; if(!$_POST['name']){ error_("Appeal Name is required"); return; } if(!$_POST['startdate']) $startdate=date("Y-m-d"); else $startdate=$_POST['startdate']; if(!$_GET['id']) { $query = "INSERT INTO fundraising_campaigns (name,fiscalyear) VALUES ( '".mysql_real_escape_string(stripslashes($_POST['name']))."','{$config['FISCALYEAR']}')"; mysql_query($query); $id = mysql_insert_id(); happy_("Appeal Created"); }else{ $id = $_GET["id"]; happy_("Appeal Saved"); } mysql_query("UPDATE fundraising_campaigns SET name='".mysql_real_escape_string(stripslashes($_POST['name']))."', `type`='".mysql_real_escape_string($_POST['type'])."', startdate='".mysql_real_escape_string($startdate)."', followupdate='".mysql_real_escape_string($_POST['followupdate'])."', enddate='".mysql_real_escape_string($_POST['enddate'])."', target='".mysql_real_escape_string($_POST['target'])."', fundraising_goal='".mysql_real_escape_string($_POST['fundraising_goal'])."' WHERE id='$id'"); } send_header("Appeal Management", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', 'Fundraising' => 'admin/fundraising.php'), "fundraising" ); ?> startdate) $sd=$r->startdate; else $sd=date("Y-m-d"); ?> $ "; echo "\n"; while($fgr=mysql_fetch_object($fgq)) { if($r->fundraising_goal==$fgr->goal) $sel="selected=\"selected\""; else $sel=""; echo "\n"; } echo "\n"; ?>
Create/Modify Appeals Appeal Management