forked from science-ation/science-ation
Implement working prospect list, and ability to remove indidivuals from the list or empty the entire list
This commit is contained in:
parent
663420b078
commit
c9062e127b
@ -211,8 +211,98 @@ switch($_GET['action']){
|
|||||||
|
|
||||||
|
|
||||||
case "manage_tab_prospects":
|
case "manage_tab_prospects":
|
||||||
|
$donationhistorylist=array("never"=>"Never donated/sponsored", "past"=>"Donated/sponsored in the past", "lastyear"=>"Donated/sponsored last year", "thisyear"=>"Donated/sponosred 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']);
|
$campaign_id=intval($_GET['id']);
|
||||||
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'");
|
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'");
|
||||||
|
$campaign=mysql_fetch_object($q);
|
||||||
|
if($campaign->filterparameters) {
|
||||||
|
echo "<h4>".i18n("User List")."</h4>\n";
|
||||||
|
$params=unserialize($campaign->filterparameters);
|
||||||
|
echo "<table class=\"tableedit\">";
|
||||||
|
echo "<tr><td>".i18n("Donor Type")."</td><td>".i18n(ucfirst($params['donortype']))."</td></tr>\n";
|
||||||
|
if(is_array($params['donationhistory'])) {
|
||||||
|
echo "<tr><td>".i18n("Donation History")."</td><td>";
|
||||||
|
foreach($params['donationhistory'] AS $d) {
|
||||||
|
echo i18n($donationhistorylist[$d])."<br />\n";
|
||||||
|
}
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
}
|
||||||
|
// echo "<tr><td>".i18n("Donation Level")."</td><td>";
|
||||||
|
// echo "</td></tr>\n";
|
||||||
|
if(is_array($params['emailaddress'])) {
|
||||||
|
echo "<tr><td>".i18n("Email Address")."</td><td>";
|
||||||
|
foreach($params['emailaddress'] AS $e) {
|
||||||
|
echo i18n($emailaddresslist[$e])."<br />\n";
|
||||||
|
}
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
}
|
||||||
|
if($params['donortype']=="individual" && is_array($params['individual_type'])) {
|
||||||
|
echo "<tr><td>".i18n("Role")."</td><td>";
|
||||||
|
foreach($params['individual_type'] AS $e) {
|
||||||
|
echo i18n($rolelist[$e])."<br />\n";
|
||||||
|
}
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
} else if( is_array($params['contacttype'])) {
|
||||||
|
echo "<tr><td>".i18n("Role")."</td><td>";
|
||||||
|
foreach($params['contacttype'] AS $e) {
|
||||||
|
echo i18n(ucfirst($e))."<br />";
|
||||||
|
}
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</table>\n";
|
||||||
|
//params: individual/org
|
||||||
|
// donation history
|
||||||
|
// donation level
|
||||||
|
// email address
|
||||||
|
// role ind
|
||||||
|
// role org
|
||||||
|
|
||||||
|
echo "<br />";
|
||||||
|
echo "<form id=\"prospectremoveform\" onsubmit=\"return removeselectedprospects()\">\n";
|
||||||
|
echo "<input type=\"hidden\" name=\"fundraising_campaigns_id\" value=\"$campaign_id\" />\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 "<label>";
|
||||||
|
echo "<input type=\"checkbox\" name=\"prospectremovefromlist[]\" value=\"{$u['uid']}\" />";
|
||||||
|
if($u['sponsor']['donortype']=="organization") {
|
||||||
|
echo $u['sponsor']['organization']." - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $u['firstname']." " .$u['lastname'];
|
||||||
|
if($u['email']) echo " <{$u['email']}>";
|
||||||
|
echo "</label>\n";
|
||||||
|
echo "<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<br />";
|
||||||
|
echo "<br />";
|
||||||
|
|
||||||
|
echo "<table><tr><td>";
|
||||||
|
echo "<input onclick=\"return prospect_removeselected()\" type=\"button\" value=\"".i18n("Remove selected prospects from list")."\">\n";
|
||||||
|
echo "</td><td>";
|
||||||
|
echo "<input onclick=\"return prospect_removeall()\" type=\"button\" value=\"".i18n("Remove all prospects from list")."\">\n";
|
||||||
|
// echo "</td><td>";
|
||||||
|
// echo "<input type=\"button\" value=\"".i18n("Finalize prospect list")."\">\n";
|
||||||
|
echo "</td></tr></table>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
?>
|
?>
|
||||||
<h4><?=i18n("Choose Prospects")?></h4>
|
<h4><?=i18n("Choose Prospects")?></h4>
|
||||||
<form id="prospectform" onsubmit="return prospect_generatelist()">
|
<form id="prospectform" onsubmit="return prospect_generatelist()">
|
||||||
@ -227,10 +317,11 @@ switch($_GET['action']){
|
|||||||
<hr />
|
<hr />
|
||||||
<table>
|
<table>
|
||||||
<tr><td style="width: 130px;"><?=i18n("Donation History")?>:</td><td>
|
<tr><td style="width: 130px;"><?=i18n("Donation History")?>:</td><td>
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="donationhistory[]" value="never"><?=i18n("Never donated/sponsored")?></label><br />
|
<?
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="donationhistory[]" value="past"><?=i18n("Donated/sponsored in the past")?></label><br />
|
foreach($donationhistorylist AS $k=>$v) {
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="donationhistory[]" value="lastyear"><?=i18n("Donated/sponsored last year")?></label><br />
|
echo "<label><input onchange=\"return prospect_search()\" type=\"checkbox\" name=\"donationhistory[]\" value=\"$k\">".i18n($v)."</label><br />\n";
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="donationhistory[]" value="thisyear"><?=i18n("Donated/sponsored this year")?></label><br />
|
}
|
||||||
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td><?=i18n("Donation Level")?>:</td><td>
|
<tr><td><?=i18n("Donation Level")?>:</td><td>
|
||||||
<?
|
<?
|
||||||
@ -242,8 +333,11 @@ switch($_GET['action']){
|
|||||||
?>
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td><?=i18n("Email Address")?>:</td><td>
|
<tr><td><?=i18n("Email Address")?>:</td><td>
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="emailaddress[]" value="available"><?=i18n("Available")?></label><br />
|
<?
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="emailaddress[]" value="notavailable"><?=i18n("Not Available")?></label><br />
|
foreach($emailaddresslist AS $k=>$v) {
|
||||||
|
echo "<label><input onchange=\"return prospect_search()\" type=\"checkbox\" name=\"emailaddress[]\" value=\"$k\">".i18n($v)."</label><br />\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -251,15 +345,12 @@ switch($_GET['action']){
|
|||||||
<div id="prospect_individual" style="display: none;">
|
<div id="prospect_individual" style="display: none;">
|
||||||
<table>
|
<table>
|
||||||
<tr><td style="width: 130px;"><?=i18n("Role")?>:</td><td>
|
<tr><td style="width: 130px;"><?=i18n("Role")?>:</td><td>
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="judge"><?=i18n("Judge")?></label><br />
|
<?
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="teacher"><?=i18n("Teacher")?></label><br />
|
foreach($rolelist AS $k=>$v) {
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="sciencehead"><?=i18n("School Science Head")?></label><br />
|
echo "<label><input onchange=\"return prospect_search()\" type=\"checkbox\" name=\"individual_type[]\" value=\"$k\">".i18n($v)."</label><br />\n";
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="principal"><?=i18n("School Principal")?></label><br />
|
}
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="parent"><?=i18n("Parent/Guardian")?></label><br />
|
?>
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="committee"><?=i18n("Committee")?></label><br />
|
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="volunteer"><?=i18n("Volunteer")?></label><br />
|
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="alumni"><?=i18n("Alumni")?>(not implemented)</label><br />
|
|
||||||
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="mentor"><?=i18n("Mentor")?>(not implemented)</label><br />
|
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -276,6 +367,7 @@ switch($_GET['action']){
|
|||||||
<div id="prospectsearchresults"></div>
|
<div id="prospectsearchresults"></div>
|
||||||
</form>
|
</form>
|
||||||
<?
|
<?
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -290,6 +382,33 @@ switch($_GET['action']){
|
|||||||
exit;
|
exit;
|
||||||
break;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +561,23 @@ function prospect_search() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function prospect_generatelist() {
|
function prospect_generatelist() {
|
||||||
$("#prospectsearchresults").load("fundraising_campaigns_prospecting.php?generatelist=true",$("#prospectform").serializeArray());
|
$("#prospectsearchresults").load("fundraising_campaigns_prospecting.php?generatelist=true",$("#prospectform").serializeArray(), function() {
|
||||||
|
update_tab_prospects();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function prospect_removeselected() {
|
||||||
|
$("#debug").load("fundraising_campaigns.php?action=prospect_removeselected",$("#prospectremoveform").serializeArray(),function() {
|
||||||
|
update_tab_prospects();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function prospect_removeall() {
|
||||||
|
$("#debug").load("fundraising_campaigns.php?action=prospect_removeall",$("#prospectremoveform").serializeArray(),function() {
|
||||||
|
update_tab_prospects();
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ if($_POST['donortype']=="organization") {
|
|||||||
|
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
while($cr=mysql_fetch_object($cq)) {
|
while($cr=mysql_fetch_object($cq)) {
|
||||||
if(!$userslist[$cr->users_id])
|
if(!$userslist[$cr->uid])
|
||||||
$userslist[$cr->users_id]=user_load($cr->users_id);
|
$userslist[$cr->uid]=user_load($cr->users_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ div.notice_area div.happy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
width: 80px;
|
width: 100px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +125,15 @@ function user_load_volunteer(&$u)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_load_sponsor($u)
|
function user_load_sponsor(&$u)
|
||||||
{
|
{
|
||||||
$u['sponsors_id'] = intval($u['sponsors_id']);
|
$u['sponsors_id'] = intval($u['sponsors_id']);
|
||||||
$u['sponsor_complete'] = ($u['sponsor_complete'] == 'yes') ? 'yes' : 'no';
|
$u['sponsor_complete'] = ($u['sponsor_complete'] == 'yes') ? 'yes' : 'no';
|
||||||
$u['sponsor_active'] = ($u['sponsor_active'] == 'yes') ? 'yes' : 'no';
|
$u['sponsor_active'] = ($u['sponsor_active'] == 'yes') ? 'yes' : 'no';
|
||||||
|
if($u['sponsors_id']) {
|
||||||
|
$q=mysql_query("SELECT * FROM sponsors WHERE id='{$u['sponsors_id']}'");
|
||||||
|
$u['sponsor']=mysql_fetch_assoc($q);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user