2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
if(!check_perms('admin_donor_log')) { error(403); }
|
|
|
|
|
|
|
|
include(SERVER_ROOT.'/sections/donate/config.php');
|
|
|
|
|
|
|
|
define('DONATIONS_PER_PAGE', 50);
|
2012-10-11 08:00:15 +00:00
|
|
|
list($Page,$Limit) = Format::page_limit(DONATIONS_PER_PAGE);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
|
2013-02-22 08:00:24 +00:00
|
|
|
$sql = "SELECT
|
2011-03-28 14:21:28 +00:00
|
|
|
SQL_CALC_FOUND_ROWS
|
2013-02-22 08:00:24 +00:00
|
|
|
d.UserID,
|
|
|
|
d.Amount,
|
|
|
|
d.Currency,
|
|
|
|
d.Email,
|
|
|
|
d.Time
|
2012-03-28 08:00:20 +00:00
|
|
|
FROM donations AS d ";
|
2011-03-28 14:21:28 +00:00
|
|
|
if(!empty($_GET['search'])) {
|
|
|
|
$sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' ";
|
|
|
|
}
|
|
|
|
$sql .= "ORDER BY d.Time DESC LIMIT $Limit";
|
|
|
|
$DB->query($sql);
|
|
|
|
$Donations = $DB->to_array(false,MYSQLI_NUM);
|
|
|
|
|
|
|
|
$DB->query("SELECT FOUND_ROWS()");
|
|
|
|
list($Results) = $DB->next_record();
|
|
|
|
|
|
|
|
if (empty($_GET['search']) && !isset($_GET['page']) && !$DonationTimeline = $Cache->get_value('donation_timeline')) {
|
|
|
|
include(SERVER_ROOT.'/classes/class_charts.php');
|
|
|
|
$DB->query("SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, SUM(Amount) FROM donations GROUP BY Month ORDER BY Time DESC LIMIT 1, 18");
|
|
|
|
$Timeline = array_reverse($DB->to_array());
|
|
|
|
$Area = new AREA_GRAPH(880,160,array('Break'=>1));
|
|
|
|
foreach($Timeline as $Entry) {
|
|
|
|
list($Label,$Amount) = $Entry;
|
|
|
|
$Area->add($Label,$Amount);
|
|
|
|
}
|
|
|
|
$Area->transparent();
|
|
|
|
$Area->grid_lines();
|
|
|
|
$Area->color('3d7930');
|
|
|
|
$Area->lines(2);
|
|
|
|
$Area->generate();
|
|
|
|
$DonationTimeline = $Area->url();
|
|
|
|
$Cache->cache_value('donation_timeline',$DonationTimeline,mktime(0,0,0,date('n')+1,2));
|
|
|
|
}
|
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Donation log');
|
2011-03-28 14:21:28 +00:00
|
|
|
if (empty($_GET['search']) && !isset($_GET['page'])) {
|
|
|
|
?>
|
|
|
|
<div class="box pad">
|
2012-09-23 08:00:25 +00:00
|
|
|
<img src="<?=$DonationTimeline?>" alt="Donation timeline. The "y" axis is donation amount." />
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
2012-09-23 08:00:25 +00:00
|
|
|
<br />
|
2011-03-28 14:21:28 +00:00
|
|
|
<? } ?>
|
|
|
|
<div>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="search_form" name="donation_log" action="" method="get">
|
2012-09-01 08:00:24 +00:00
|
|
|
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr>
|
|
|
|
<td class="label"><strong>Email:</strong></td>
|
|
|
|
<td>
|
|
|
|
<input type="hidden" name="action" value="donation_log" />
|
|
|
|
<input type="text" name="search" size="60" value="<? if (!empty($_GET['search'])) { echo display_str($_GET['search']); } ?>" />
|
|
|
|
|
2012-09-23 08:00:25 +00:00
|
|
|
<input type="submit" value="Search donation log" />
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2013-02-22 08:00:24 +00:00
|
|
|
</table>
|
2011-03-28 14:21:28 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2012-09-23 08:00:25 +00:00
|
|
|
<br />
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="linkbox">
|
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
$Pages=Format::get_pages($Page,$Results,DONATIONS_PER_PAGE,11) ;
|
2011-03-28 14:21:28 +00:00
|
|
|
echo $Pages;
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<table width="100%">
|
|
|
|
<tr class="colhead">
|
|
|
|
<td>User</td>
|
|
|
|
<td>Amount</td>
|
|
|
|
<td>Email</td>
|
|
|
|
<td>Time</td>
|
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
foreach($Donations as $Donation) {
|
2012-03-28 08:00:20 +00:00
|
|
|
list($UserID, $Amount, $Currency, $Email, $DonationTime) = $Donation;
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<tr>
|
2012-10-11 08:00:15 +00:00
|
|
|
<td><?=Users::format_username($UserID, true, true, true, true)?></td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td><?=display_str($Amount)?> <?=$Currency?></td>
|
|
|
|
<td><?=display_str($Email)?></td>
|
|
|
|
<td><?=time_diff($DonationTime)?></td>
|
|
|
|
</tr>
|
|
|
|
<? } ?>
|
|
|
|
</table>
|
|
|
|
<div class="linkbox">
|
|
|
|
<?=$Pages?>
|
|
|
|
</div>
|
2012-10-11 08:00:15 +00:00
|
|
|
<? View::show_footer(); ?>
|