| <?php |
| 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(); |
| } |