forked from science-ation/science-ation
Rework the donors search/landing page so it shows top 10 donors if no search is performed yet
Fix a few typo's and make the fundingselection/proposalsubmissiondate save properly
This commit is contained in:
parent
7b4e7cd55f
commit
5d9824a5a6
@ -65,9 +65,11 @@ switch($_GET['action']) {
|
|||||||
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
||||||
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
|
"donationpolicyurl='".mysql_escape_string(stripslashes($_POST['donationpolicyurl']))."', ".
|
||||||
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
|
"fundingselectiondate='".mysql_escape_string(stripslashes($_POST['fundingselectiondate']))."', ".
|
||||||
|
"proposalsubmissiondate='".mysql_escape_string(stripslashes($_POST['proposalsubmissiondate']))."', ".
|
||||||
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."' ".
|
"waiveraccepted='".mysql_escape_string(stripslashes($_POST['waiveraccepted']))."' ".
|
||||||
"WHERE id='$id'";
|
"WHERE id='$id'";
|
||||||
mysql_query($exec);
|
mysql_query($exec);
|
||||||
|
echo mysql_error();
|
||||||
|
|
||||||
//FIXME accept the logo
|
//FIXME accept the logo
|
||||||
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
|
//"logo='".mysql_escape_string(stripslashes($_POST['logo']))."', ".
|
||||||
@ -132,7 +134,7 @@ switch($_GET['action']) {
|
|||||||
echo "<table class=\"tableview\">";
|
echo "<table class=\"tableview\">";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo " <th>".i18n("Date")."</th>\n";
|
echo " <th>".i18n("Date")."</th>\n";
|
||||||
echo " <th>".i18n("Goal")."</th>\n";
|
echo " <th>".i18n("Purpose")."</th>\n";
|
||||||
echo " <th>".i18n("Appeal")."</th>\n";
|
echo " <th>".i18n("Appeal")."</th>\n";
|
||||||
echo " <th>".i18n("Value")."</th>\n";
|
echo " <th>".i18n("Value")."</th>\n";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
@ -157,7 +159,7 @@ switch($_GET['action']) {
|
|||||||
echo "<table class=\"tableview\">";
|
echo "<table class=\"tableview\">";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo " <th>".i18n("Date")."</th>\n";
|
echo " <th>".i18n("Date")."</th>\n";
|
||||||
echo " <th>".i18n("Goal")."</th>\n";
|
echo " <th>".i18n("Purpose")."</th>\n";
|
||||||
echo " <th>".i18n("Appeal")."</th>\n";
|
echo " <th>".i18n("Appeal")."</th>\n";
|
||||||
echo " <th>".i18n("Value")."</th>\n";
|
echo " <th>".i18n("Value")."</th>\n";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
@ -841,9 +843,9 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#organizationinfo_fundingselectiondate").datepicker({ dateFormat: 'yy-mm-dd'});
|
$("#organizationinfo_fundingselectiondate").datepicker({ dateFormat: 'yy-mm-dd'});
|
||||||
|
$("#organizationinfo_proposalsubmissiondate").datepicker({ dateFormat: 'yy-mm-dd'});
|
||||||
//, showOn: 'button', buttonText: "<?=i18n("calendar")?>" });
|
//, showOn: 'button', buttonText: "<?=i18n("calendar")?>" });
|
||||||
open_search();
|
open_search();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -871,6 +873,7 @@ function open_editor(id) {
|
|||||||
$("#organizationinfo_website").val("");
|
$("#organizationinfo_website").val("");
|
||||||
$("#organizationinfo_donationpolicyurl").val("");
|
$("#organizationinfo_donationpolicyurl").val("");
|
||||||
$("#organizationinfo_fundingselectiondate").val("");
|
$("#organizationinfo_fundingselectiondate").val("");
|
||||||
|
$("#organizationinfo_proposalsubmissiondate").val("");
|
||||||
$("#organizationinfo_notes").val("");
|
$("#organizationinfo_notes").val("");
|
||||||
|
|
||||||
$("#organizationinfo_save_button").attr('disabled','disabled');
|
$("#organizationinfo_save_button").attr('disabled','disabled');
|
||||||
@ -889,8 +892,7 @@ function open_editor(id) {
|
|||||||
function open_search() {
|
function open_search() {
|
||||||
$("#donor_editor").hide();
|
$("#donor_editor").hide();
|
||||||
$("#searchbrowse").show();
|
$("#searchbrowse").show();
|
||||||
|
donorsearch(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
function update_organizationinfo()
|
function update_organizationinfo()
|
||||||
{
|
{
|
||||||
@ -919,6 +921,7 @@ function update_organizationinfo()
|
|||||||
$("#organizationinfo_website").val(json.website);
|
$("#organizationinfo_website").val(json.website);
|
||||||
$("#organizationinfo_donationpolicyurl").val(json.donationpolicyurl);
|
$("#organizationinfo_donationpolicyurl").val(json.donationpolicyurl);
|
||||||
$("#organizationinfo_fundingselectiondate").val(json.fundingselectiondate);
|
$("#organizationinfo_fundingselectiondate").val(json.fundingselectiondate);
|
||||||
|
$("#organizationinfo_proposalsubmissiondate").val(json.proposalsubmissiondate);
|
||||||
$("#organizationinfo_notes").val(json.notes);
|
$("#organizationinfo_notes").val(json.notes);
|
||||||
// For some reason, with checkboxes, these have to be arrays
|
// For some reason, with checkboxes, these have to be arrays
|
||||||
$("[name=waiveraccepted]").val([json.waiveraccepted]);
|
$("[name=waiveraccepted]").val([json.waiveraccepted]);
|
||||||
@ -1011,10 +1014,13 @@ function activityinfo_save() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function donorsearch() {
|
function donorsearch(realsearch) {
|
||||||
$("#searchresults").show();
|
$("#searchresults").show();
|
||||||
$("#searchresults").load("donors_search.php", $("#searchform").serializeArray());
|
if(realsearch)
|
||||||
return false;
|
$("#searchresults").load("donors_search.php", $("#searchform").serializeArray());
|
||||||
|
else
|
||||||
|
$("#searchresults").load("donors_search.php"); //, $("#searchform").serializeArray());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchtimer;
|
var searchtimer;
|
||||||
@ -1125,8 +1131,8 @@ echo "<hr />";
|
|||||||
</tr>
|
</tr>
|
||||||
<tr><td><?=i18n("Donation Policy")?></td><td colspan="5"><input id="organizationinfo_donationpolicyurl" type="file" name="donationpolicyurl" size="30" maxlength="128" /></td></tr>
|
<tr><td><?=i18n("Donation Policy")?></td><td colspan="5"><input id="organizationinfo_donationpolicyurl" type="file" name="donationpolicyurl" size="30" maxlength="128" /></td></tr>
|
||||||
<tr><td><?=i18n("Logo")?></td><td colspan="5"><input type="file" id="organizationinfo_logo" name="logo" size="30" /></td></tr>
|
<tr><td><?=i18n("Logo")?></td><td colspan="5"><input type="file" id="organizationinfo_logo" name="logo" size="30" /></td></tr>
|
||||||
<tr><td><?=i18n("Funding Selection Date")?></td><td><input id="organizationinfo_fundingselectiondate" type="text" name="fundingselectiondate" size="10" maxlength="10" /></td>
|
<tr><td><?=i18n("Funding Selection Date")?></td><td><input id="organizationinfo_fundingselectiondate" type="text" name="fundingselectiondate" class="date" size="12" maxlength="12" /></td>
|
||||||
<td><?=i18n("Proposal Submission Date")?></td><td colspan="3"><input id="organizationinfo_proposalsubmissiondate" type="text" name="proposalsubmissiondate" size="10" maxlength="10" /></td>
|
<td><?=i18n("Proposal Submission Date")?></td><td colspan="3"><input id="organizationinfo_proposalsubmissiondate" type="text" name="proposalsubmissiondate" class="date" size="12" maxlength="12" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?
|
<?
|
||||||
/*
|
/*
|
||||||
@ -1164,7 +1170,8 @@ echo "<hr />";
|
|||||||
|
|
||||||
|
|
||||||
<div id="searchbrowse" style="display: none;">
|
<div id="searchbrowse" style="display: none;">
|
||||||
<form id="searchform" method="post" action="donors.php" onsubmit="return donorsearch()">
|
<form id="searchform" method="post" action="donors.php" onsubmit="return donorsearch(true)">
|
||||||
|
<input type="hidden" name="limit" value="-1" />
|
||||||
<?=i18n("Search")?>: <input type="text" name="search" />
|
<?=i18n("Search")?>: <input type="text" name="search" />
|
||||||
<input id="search_donortype_individual" type="checkbox" name="donortype[]" value="individual" checked="checked" /><label for="search_donortype_individual"><?=i18n("Individual")?></label>
|
<input id="search_donortype_individual" type="checkbox" name="donortype[]" value="individual" checked="checked" /><label for="search_donortype_individual"><?=i18n("Individual")?></label>
|
||||||
<input id="search_donortype_organization" type="checkbox" name="donortype[]" value="organization" checked="checked"/><label for="search_donortype_organization"><?=i18n("Organization")?></label>
|
<input id="search_donortype_organization" type="checkbox" name="donortype[]" value="organization" checked="checked"/><label for="search_donortype_organization"><?=i18n("Organization")?></label>
|
||||||
|
@ -42,54 +42,78 @@
|
|||||||
// echo "query=$query";
|
// echo "query=$query";
|
||||||
$q=mysql_query($query);
|
$q=mysql_query($query);
|
||||||
|
|
||||||
|
$thisyear=$config['FISCALYEAR'];
|
||||||
echo "<table class=\"tableview\">";
|
$lastyear=$config['FISCALYEAR']-1;
|
||||||
echo "<tr>";
|
$rows=array();
|
||||||
echo " <th>Organization</th>";
|
|
||||||
// echo " <th># of Sponsorships</th>";
|
|
||||||
// echo " <th># of Awards</th>";
|
|
||||||
echo " <th># of Contacts</th>";
|
|
||||||
// echo " <th>Action</th>";
|
|
||||||
echo "</tr>\n";
|
|
||||||
|
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
|
$cq=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations WHERE sponsors_id='$r->id' AND status='received' AND fiscalyear='$thisyear'");
|
||||||
|
$cr=mysql_fetch_object($cq);
|
||||||
|
$thisyeartotal=$cr->total;
|
||||||
|
$cq=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations WHERE sponsors_id='$r->id' AND status='received' AND fiscalyear='$lastyear'");
|
||||||
|
$cr=mysql_fetch_object($cq);
|
||||||
|
$lastyeartotal=$cr->total;
|
||||||
|
if($lastyeartotal)
|
||||||
|
$change=round(($thisyeartotal-$lastyeartotal)/$lastyeartotal*100);
|
||||||
|
else
|
||||||
|
$change="N/A";
|
||||||
|
$rows[]=array("id"=>$r->id, "name"=>$r->organization, "thisyeartotal"=>$thisyeartotal, "lastyeartotal"=>$lastyeartotal, "change"=>$change);
|
||||||
|
}
|
||||||
|
$thisyearsort=array();
|
||||||
|
if(!$_POST['order']) {
|
||||||
|
//if order is not given, lets order by donation amount this year
|
||||||
|
foreach($rows AS $key=>$val) {
|
||||||
|
$thisyearsort[$key]=$val['thisyeartotal'];
|
||||||
|
}
|
||||||
|
array_multisort($thisyearsort,SORT_DESC,$rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_POST['limit']) {
|
||||||
|
$limit=$_POST['limit'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$limit=10;
|
||||||
|
echo "<h4>".i18n("Top 10 donors this year")."</h4>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<table class=\"tableview\">";
|
||||||
|
echo "<tr>";
|
||||||
|
echo " <th>Donor/Sponsor</th>";
|
||||||
|
echo " <th>Total $ this year</th>";
|
||||||
|
echo " <th>Total $ last year</th>";
|
||||||
|
echo " <th>% change</th>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
$x=0;
|
||||||
|
foreach($rows AS $r) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
$eh="style=\"cursor:pointer;\" onclick=\"open_editor({$r->id});\"";
|
$eh="style=\"cursor:pointer;\" onclick=\"open_editor({$r['id']});\"";
|
||||||
echo " <td $eh>$r->organization</td>\n";
|
echo " <td $eh>{$r['name']}</td>\n";
|
||||||
|
echo " <td style=\"text-align: right;\">";
|
||||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE year='".$config['FAIRYEAR']."' AND sponsors_id='$r->id'");
|
echo format_money($r['thisyeartotal']);
|
||||||
$numr=mysql_fetch_object($numq);
|
echo "</td>\n";
|
||||||
$numawards=$numr->num;
|
echo " <td style=\"text-align: right;\">";
|
||||||
|
echo format_money($r['lastyeartotal']);
|
||||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM fundraising_donations WHERE fiscalyear='".$config['FISCALYEAR']."' AND sponsors_id='$r->id'");
|
echo "</td>\n";
|
||||||
$numr=mysql_fetch_object($numq);
|
if(is_numeric($r['change'])) {
|
||||||
$numsponsorships=$numr->num;
|
$n=$r['change']/2+50;
|
||||||
|
if($n<0) $n=0;
|
||||||
$numq=mysql_query("SELECT uid,MAX(year),firstname,lastname,deleted FROM users,users_sponsor WHERE types LIKE '%sponsor%' AND sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.deleted='no' GROUP BY uid ORDER BY firstname");
|
if($n>100) $n=100;
|
||||||
// $numq=mysql_query("SELECT DISTINCT(uid) FROM users_sponsor, users WHERE sponsors_id='$r->id' AND users_sponsor.users_id=users.id AND users.deleted='no'");
|
$col="color: ".colour_to_percent($n);
|
||||||
$numcontacts=mysql_num_rows($numq);
|
$sign="%";
|
||||||
// $numr=mysql_fetch_object($numq);
|
}
|
||||||
// $numcontacts=$numr->num;
|
else{
|
||||||
|
$col=""; $sign=""; }
|
||||||
|
echo " <td style=\"text-align: center; $col\">";
|
||||||
/*
|
echo $r['change'].$sign;
|
||||||
echo " <td align=\"center\" valign=\"top\">";
|
echo "</td>\n";
|
||||||
echo "$numsponsorships ";
|
|
||||||
echo "<a href=\"fundraising.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
|
||||||
echo "</td>";
|
|
||||||
|
|
||||||
echo " <td align=\"center\" valign=\"top\">";
|
|
||||||
echo "$numawards ";
|
|
||||||
echo "<a href=\"award_awards.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
|
||||||
echo "</td>";
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo " <td align=\"center\" valign=\"top\">";
|
|
||||||
echo "$numcontacts ";
|
|
||||||
// echo "<a href=\"sponsor_contacts.php?sponsors_id=$r->id\"><img alt=\"view\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/viewmag.".$config['icon_extension']."\"></a>";
|
|
||||||
echo "</td>";
|
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
$x++;
|
||||||
|
if($x==$limit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user