class DonationsView {
public static function render_mod_donations($UserID) { ?>
}
public static function render_donor_stats($UserID) {
$OwnProfile = G::$LoggedUser['ID'] == $UserID;
if (check_perms("users_mod") || $OwnProfile || Donations::is_visible($UserID)) { ?>
Donor Statistics
if (Donations::is_donor($UserID)) {
if (check_perms('users_mod') || $OwnProfile) { ?>
-
Total donor points: =Donations::get_total_rank($UserID)?>
} ?>
-
Current donor rank: =self::render_rank(Donations::get_rank($UserID), Donations::get_special_rank($UserID), true)?>
-
Leaderboard position: =Donations::get_leaderboard_position($UserID)?>
-
Last donated: =time_diff(Donations::get_donation_time($UserID))?>
-
Rank expires: =(Donations::get_rank_expiration($UserID))?>
} else { ?>
-
This user hasn't donated.
} ?>
}
}
public static function render_profile_rewards($EnabledRewards, $ProfileRewards) {
$Text = new Text;
for ($i = 1; $i <= 4; $i++) {
if (isset($EnabledRewards['HasProfileInfo' . $i]) && $ProfileRewards['ProfileInfo' . $i]) { ?>
=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?>
Hide
echo $Text->full_format($ProfileRewards['ProfileInfo' . $i]); ?>
}
}
}
public static function render_donation_history($DonationHistory) {
if (empty($DonationHistory)) {
return;
}
?>
$Row = 'b'; ?>
Source
|
Date
|
Amount (EUR)
|
Added Points
|
Total Points
|
Email
|
Reason
|
foreach ($DonationHistory as $Donation) { ?>
=$Donation['Source']?> (=Users::format_username($Donation['AddedBy'])?>)
|
=$Donation['Time']?>
|
=$Donation['Amount']?>
|
=$Donation['Rank']?>
|
=$Donation['TotalRank']?>
|
=$Donation['Email']?>
|
=$Donation['Reason']?>
|
$Row = $Row == 'b' ? 'a' : 'b';
} ?>
}
public static function render_rank($Rank, $SpecialRank, $ShowOverflow = false) {
if ($SpecialRank == 3) {
$Display = '∞ [Diamond]';
} else {
$CurrentRank = $Rank >= MAX_RANK ? MAX_RANK : $Rank;
$Overflow = $Rank - $CurrentRank;
$Display = $CurrentRank;
if ($Display == 5 || $Display == 6) {
$Display--;
}
if ($ShowOverflow && $Overflow) {
$Display .= " (+$Overflow)";
}
if ($Rank >= 6) {
$Display .= ' [Gold]';
} elseif ($Rank >= 4) {
$Display .= ' [Silver]';
} elseif ($Rank >= 3) {
$Display .= ' [Bronze]';
} elseif ($Rank >= 2) {
$Display .= ' [Copper]';
} elseif ($Rank >= 1) {
$Display .= ' [Red]';
}
}
echo $Display;
}
}