Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

donationsview.class.php 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?
  2. class DonationsView {
  3. public static function render_mod_donations($UserID) {
  4. ?>
  5. <table class="layout box" id="donation_box">
  6. <tr class="colhead">
  7. <td colspan="2">
  8. Donor System (add points)
  9. </td>
  10. </tr>
  11. <tr>
  12. <td class="label">Value:</td>
  13. <td>
  14. <input type="text" name="donation_value" onkeypress="return isNumberKey(event);" />
  15. <select name="donation_currency">
  16. <option value="EUR">EUR</option>
  17. <option value="USD">USD</option>
  18. <option value="BTC">BTC</option>
  19. </select>
  20. </td>
  21. </tr>
  22. <tr>
  23. <td class="label">Reason:</td>
  24. <td><input type="text" class="wide_input_text" name="donation_reason" /></td>
  25. </tr>
  26. <tr>
  27. <td align="right" colspan="2">
  28. <input type="submit" name="donor_points_submit" value="Add donor points" />
  29. </td>
  30. </tr>
  31. </table>
  32. <table class="layout box" id="donor_points_box">
  33. <tr class="colhead">
  34. <td colspan="3" class="tooltip" title='Use this tool only when manually correcting values. If crediting donations normally, use the "Donor System (add points)" tool'>
  35. Donor System (modify values)
  36. </td>
  37. </tr>
  38. <tr>
  39. <td class="label tooltip" title="Active points determine a user's Donor Rank and do expire.">Active points:</td>
  40. <td><input type="text" name="donor_rank" onkeypress="return isNumberKey(event);" value="<?=Donations::get_rank($UserID)?>" /></td>
  41. </tr>
  42. <tr>
  43. <td class="label tooltip" title="Total points represent a user's overall total and never expire. Total points determines a user's Special Rank and Donor Leaderboard placement.">Total points:</td>
  44. <td><input type="text" name="total_donor_rank" onkeypress="return isNumberKey(event);" value="<?=Donations::get_total_rank($UserID)?>" /></td>
  45. </tr>
  46. <tr>
  47. <td class="label">Reason:</td>
  48. <td><input type="text" class="wide_input_text" name="reason" /></td>
  49. </tr>
  50. <tr>
  51. <td align="right" colspan="2">
  52. <input type="submit" name="donor_values_submit" value="Change point values" />
  53. </td>
  54. </tr>
  55. </table>
  56. <?
  57. }
  58. public static function render_donor_stats($UserID) {
  59. $OwnProfile = G::$LoggedUser['ID'] == $UserID;
  60. if (check_perms("users_mod") || $OwnProfile || Donations::is_visible($UserID)) {
  61. ?>
  62. <div class="box box_info box_userinfo_donor_stats">
  63. <div class="head colhead_dark">Donor Statistics</div>
  64. <ul class="stats nobullet">
  65. <?
  66. if (Donations::is_donor($UserID)) {
  67. if (check_perms('users_mod') || $OwnProfile) {
  68. ?>
  69. <li>
  70. Total donor points: <?=Donations::get_total_rank($UserID)?>
  71. </li>
  72. <? } ?>
  73. <li>
  74. Current donor rank: <?=self::render_rank(Donations::get_rank($UserID), Donations::get_special_rank($UserID), true)?>
  75. </li>
  76. <li>
  77. Leaderboard position: <?=Donations::get_leaderboard_position($UserID)?>
  78. </li>
  79. <li>
  80. Last donated: <?=time_diff(Donations::get_donation_time($UserID))?>
  81. </li>
  82. <li>
  83. Rank expires: <?=(Donations::get_rank_expiration($UserID))?>
  84. </li>
  85. <? } else { ?>
  86. <li>
  87. This user hasn't donated.
  88. </li>
  89. <? } ?>
  90. </ul>
  91. </div>
  92. <?
  93. }
  94. }
  95. public static function render_profile_rewards($EnabledRewards, $ProfileRewards) {
  96. for ($i = 1; $i <= 4; $i++) {
  97. if ($EnabledRewards['HasProfileInfo' . $i] && $ProfileRewards['ProfileInfo' . $i]) {
  98. ?>
  99. <div class="box">
  100. <div class="head">
  101. <span><?=!empty($ProfileRewards['ProfileInfoTitle' . $i]) ? display_str($ProfileRewards['ProfileInfoTitle' . $i]) : "Extra Profile " . ($i + 1)?></span>
  102. <span style="float: right;"><a href="#" onclick="$('#profilediv_<?=$i?>').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">Hide</a></span>
  103. </div>
  104. <div class="pad profileinfo" id="profilediv_<?=$i?>">
  105. <? echo Text::full_format($ProfileRewards['ProfileInfo' . $i]); ?>
  106. </div>
  107. </div>
  108. <?
  109. }
  110. }
  111. }
  112. public static function render_donation_history($DonationHistory) {
  113. if (empty($DonationHistory)) {
  114. return;
  115. }
  116. ?>
  117. <div class="box box2" id="donation_history_box">
  118. <div class="head">
  119. Donation History <a href="#" onclick="$('#donation_history').gtoggle(); return false;" class="brackets" style="float: right;">Toggle</a>
  120. </div>
  121. <div class="hidden" id="donation_history">
  122. <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
  123. <tbody>
  124. <tr class="colhead_dark">
  125. <td>
  126. <strong>Source</strong>
  127. </td>
  128. <td>
  129. <strong>Date</strong>
  130. </td>
  131. <td>
  132. <strong>Amount (EUR)</strong>
  133. </td>
  134. <td>
  135. <strong>Added Points</strong>
  136. </td>
  137. <td>
  138. <strong>Total Points</strong>
  139. </td>
  140. <td>
  141. <strong>Email</strong>
  142. </td>
  143. <td style="width: 30%;">
  144. <strong>Reason</strong>
  145. </td>
  146. </tr>
  147. <? foreach ($DonationHistory as $Donation) { ?>
  148. <tr class="row">
  149. <td>
  150. <?=display_str($Donation['Source'])?> (<?=Users::format_username($Donation['AddedBy'])?>)
  151. </td>
  152. <td>
  153. <?=$Donation['Time']?>
  154. </td>
  155. <td>
  156. <?=$Donation['Amount']?>
  157. </td>
  158. <td>
  159. <?=$Donation['Rank']?>
  160. </td>
  161. <td>
  162. <?=$Donation['TotalRank']?>
  163. </td>
  164. <td>
  165. <?=display_str($Donation['Email'])?>
  166. </td>
  167. <td>
  168. <?=display_str($Donation['Reason'])?>
  169. </td>
  170. </tr>
  171. <?
  172. }
  173. ?>
  174. </tbody>
  175. </table>
  176. </div>
  177. </div>
  178. <?
  179. }
  180. public static function render_rank($Rank, $SpecialRank, $ShowOverflow = false) {
  181. if ($SpecialRank == 3) {
  182. $Display = '∞ [Diamond]';
  183. } else {
  184. $CurrentRank = $Rank >= MAX_RANK ? MAX_RANK : $Rank;
  185. $Overflow = $Rank - $CurrentRank;
  186. $Display = $CurrentRank;
  187. if ($Display == 5 || $Display == 6) {
  188. $Display--;
  189. }
  190. if ($ShowOverflow && $Overflow) {
  191. $Display .= " (+$Overflow)";
  192. }
  193. if ($Rank >= 6) {
  194. $Display .= ' [Gold]';
  195. } elseif ($Rank >= 4) {
  196. $Display .= ' [Silver]';
  197. } elseif ($Rank >= 3) {
  198. $Display .= ' [Bronze]';
  199. } elseif ($Rank >= 2) {
  200. $Display .= ' [Copper]';
  201. } elseif ($Rank >= 1) {
  202. $Display .= ' [Red]';
  203. }
  204. }
  205. echo $Display;
  206. }
  207. }