blob: a85395b7509ebd0ba82d10b23ac89f5027b73246 [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2014 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Edouard Poitras (Eclipse Foundation) - Some modifications
*******************************************************************************/
function sideDonorList($_numrows) {
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/smartconnection.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/friends/friendsContributionsList.class.php");
$friendsContributionsList = new FriendsContributionsList();
$friendsContributionsList->selectFriendsContributionsList(0, $_numrows);
$friend = new Friend();
$contribution = new Contribution();
$fcObject = new FriendsContributions();
$count = $friendsContributionsList->getCount();
for ($i=0; $i < $count; $i++) {
$fcObject = $friendsContributionsList->getItemAt($i);
$friend = $fcObject->getFriendObject();
$contribution = $fcObject->getContributionObject();
$date = $contribution->getDateExpired();
$date = strtotime($date);
$date = strtotime("-1 year", $date);
$now = strtotime("now");
if ($date <= $now) {
$anonymous = $friend->getIsAnonymous();
if ($anonymous != 1) {
$name = $friend->getFirstName() . " " . $friend->getLastName();
$name = htmlentities($name);
}
else
$name = "Anonymous";
$benefit = $friend->getIsBenefit();
$star = '<i class="fa fa-li fa-angle-double-right"></i> ';
if ($benefit) {
$star = '<i class="fa fa-li fa-star"></i> ';
}
$amount = $contribution->getAmount();
echo "<li>" . $star . $name . "-" . "$" . $amount . "</li>";
}
}
echo "<div class=\"more\"><a href=\"donorlist.php\">Donor List</a></div>";
}
function donorListTable($_numrows, $chevron=TRUE, $striped=TRUE) {
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/smartconnection.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/friends/friendsContributionsList.class.php");
$return_html = "";
if ($striped) $return_html .= "<table class='table table-striped'>";
else $return_html .= "<table class='table'>";
$chevron_html = '<i class="fa fa-li fa-chevron-circle-right orange" style="position: relative; left: 0px; width: 0px;"></i> ';
$friendsContributionsList = new FriendsContributionsList();
$friendsContributionsList->selectFriendsContributionsList(0, $_numrows);
$friend = new Friend();
$contribution = new Contribution();
$fcObject = new FriendsContributions();
$count = $friendsContributionsList->getCount();
for ($i=0; $i < $count; $i++) {
$fcObject = $friendsContributionsList->getItemAt($i);
$friend = $fcObject->getFriendObject();
$contribution = $fcObject->getContributionObject();
$anonymous = $friend->getIsAnonymous();
$date = $contribution->getDateExpired();
$date = strtotime($date);
$date = strtotime("-1 year", $date);
$now = strtotime("now");
if ($date <= $now) {
if ($anonymous != 1 && ($friend->getFirstName() != '' || $friend->getLastName() != '')) {
$name = $friend->getFirstName() . " " . $friend->getLastName();
$name = htmlentities($name);
} else {
$name = "Anonymous";
}
$amount = $contribution->getAmount();
if ($chevron) $return_html .= "<tr><td>$chevron_html</td><td>$name-\$$amount</td></tr>";
else $return_html .= "<tr><td>$name-\$$amount</td></tr>";
}
}
$return_html .= "</table>";
return $return_html;
}
function displayPager($_start, $_pageValue, $_pageCount, $_showAll = NULL) {
$showAll = "";
if ($_showAll == 0) $showAll = "&showAll=0";
ob_start();
?>
<table class="pager">
<tr>
<td style="text-align:left">
<?php
if ($_start >= $_pageValue) {
?><a href="<?=$_SERVER['PHP_SELF'];?>?start=<?=$_start-$_pageValue;?><?=$showAll;?>"><< Previous Page</a><?php
}
?>&nbsp;</td>
<td style="text-align:right">
<?php
if (($_start + $_pageValue) < $_pageCount) {
?><a href="<?=$_SERVER['PHP_SELF'];?>?start=<?=$_start+$_pageValue;?><?=$showAll;?>">Next Page >></a><?php
}
?>
</td>
</tr>
</table>
<?php
return ob_get_clean();
}
?>