blob: f158518b3369d706342874e3a971dbdfa3c074cc [file] [log] [blame]
<?php
/**
* Copyright (c) 2015, 2018 Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Nathan Gervais (Eclipse Foundation) - Initial implementation
* Eric Poirier (Eclipse Foundation)
*
* SPDX-License-Identifier: EPL-2.0
*/
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");
function sideDonorList($_numrows, $_amount = TRUE) {
$where = "WHERE F.is_benefit = 1 AND FC.date_expired > '2011-05-01 00:00:00' AND FC.date_expired < '2011-08-01 00:00:00'";
$friendsContributionsList = new FriendsContributionsList();
$friendsContributionsList->selectFriendsContributionsList(0, $_numrows, $where);
$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 = ucfirst(strtolower($friend->getFirstName())) . " " . ucfirst(strtolower($friend->getLastName()));
$name = htmlentities($name);
}
else
$name = "Anonymous";
$benefit = $friend->getIsBenefit();
if ($benefit)
$style = "";
else
$style = "";
if ($_amount) {
$amount = $contribution->getAmount();
echo "<li $style>$name - $" . $amount . "</li>";
}
else {
if ($i % 2 == 0) {
echo "<b>" . $name . " </b>";
}
else {
echo "$name ";
}
}
}
}
}
function getWantedCount() {
$where = "WHERE F.is_benefit = 1 AND FC.date_expired > '2011-05-01 00:00:00' AND FC.date_expired < '2011-08-01 00:00:00'";
$friendsContributionsList = new FriendsContributionsList();
$friendsContributionsList->selectFriendsContributionsList(0, 500, $where);
return $friendsContributionsList->getCount();
}