forked from science-ation/science-ation
Overview tab implementation
This commit is contained in:
parent
7d42f697e7
commit
cdc93de3bd
@ -117,12 +117,13 @@ switch($_GET['action']){
|
|||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
<br />
|
<br />
|
||||||
<?
|
<?
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "manage":
|
case "manage":
|
||||||
if(!$_GET['id']) {
|
if(!$_GET['id']) {
|
||||||
error_("Missing campaign to manage");
|
error_("Missing campaign to manage");
|
||||||
@ -157,6 +158,44 @@ switch($_GET['action']){
|
|||||||
|
|
||||||
exit;
|
exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "manage_tab_overview":
|
||||||
|
$campaign_id=intval($_GET['id']);
|
||||||
|
|
||||||
|
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'");
|
||||||
|
|
||||||
|
if($r=mysql_fetch_object($q)) {
|
||||||
|
|
||||||
|
$goalq=mysql_query("SELECT * FROM fundraising_goals WHERE goal='{$r->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->budget)
|
||||||
|
$percent=round($received/$r->target*100,1);
|
||||||
|
else
|
||||||
|
$percent=0;
|
||||||
|
$col=colour_to_percent($percent);
|
||||||
|
echo "<table cellspacing=\"3\" cellpadding=\"3\">";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo " <td>Type</td><td>$r->type</td></tr>\n";
|
||||||
|
echo " <td>Start Date</td><td>".format_date($r->startdate)."</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo " <td>Follow-Up Date</td><td>".format_date($r->enddate)."</td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo " <td>Default Goal</td><td>$goalr->name</td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo " <td>Target</td><td>".format_money($r->target,false)."</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo " <td>Received</td><td>".format_money($received,false)."</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo " <td>% to Budget</td><td style=\"color: $col;\">{$percent}%</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_campaign_info(){
|
function save_campaign_info(){
|
||||||
@ -211,9 +250,12 @@ function managecampaigns() {
|
|||||||
$("#campaigndiv").load("<?$_SERVER['PHP_SELF']?>?action=managelist", null, function() {managecampaignsfinish();});
|
$("#campaigndiv").load("<?$_SERVER['PHP_SELF']?>?action=managelist", null, function() {managecampaignsfinish();});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentcampaignid;
|
||||||
|
|
||||||
function managecampaign(id) {
|
function managecampaign(id) {
|
||||||
$("#campaigndiv").show();
|
$("#campaigndiv").show();
|
||||||
$("#campaigndiv").load("<?$_SERVER['PHP_SELF']?>?action=manage&id="+id, null, function() {managecampaignfinish();});
|
$("#campaigndiv").load("<?$_SERVER['PHP_SELF']?>?action=manage&id="+id, null, function() {managecampaignfinish();});
|
||||||
|
currentcampaignid=id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,7 +276,7 @@ function managecampaignfinish() {
|
|||||||
show: function(event, ui) {
|
show: function(event, ui) {
|
||||||
switch(ui.panel.id) {
|
switch(ui.panel.id) {
|
||||||
case 'campaign_tab_overview':
|
case 'campaign_tab_overview':
|
||||||
// update_organizationinfo();
|
update_tab_overview();
|
||||||
break;
|
break;
|
||||||
case 'campaign_tab_donations':
|
case 'campaign_tab_donations':
|
||||||
// update_sponsorshipinfo();
|
// update_sponsorshipinfo();
|
||||||
@ -262,6 +304,9 @@ function campaigninfo_save(id) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_tab_overview() {
|
||||||
|
$("#campaign_tab_overview").load("<?$_SERVER['PHP_SELF']?>?action=manage_tab_overview&id="+currentcampaignid);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user