BioTorrents.de’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.

top10view.class.php 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. class Top10View
  3. {
  4. public static function render_linkbox($Selected)
  5. {
  6. $ENV = ENV::go();
  7. ?>
  8. <div class="linkbox">
  9. <a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected === "torrents")?></a>
  10. <a href="top10.php?type=users" class="brackets"><?=self::get_selected_link("Users", $Selected === "users")?></a>
  11. <a href="top10.php?type=tags" class="brackets"><?=self::get_selected_link("Tags", $Selected === "tags")?></a>
  12. <?php if ($ENV->FEATURE_DONATE) { ?>
  13. <a href="top10.php?type=donors" class="brackets"><?=self::get_selected_link("Donors", $Selected === "donors")?></a>
  14. <?php } ?>
  15. </div>
  16. <?php
  17. }
  18. private static function get_selected_link($String, $Selected)
  19. {
  20. if ($Selected) {
  21. return "<strong>$String</strong>";
  22. } else {
  23. return $String;
  24. }
  25. }
  26. public static function render_artist_tile($Artist, $Category)
  27. {
  28. if (self::is_valid_artist($Artist)) {
  29. switch ($Category) {
  30. case 'weekly':
  31. case 'hyped':
  32. self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
  33. break;
  34. default:
  35. break;
  36. }
  37. }
  38. }
  39. private static function render_tile($Url, $Name, $Image)
  40. {
  41. if (!empty($Image)) {
  42. $Name = display_str($Name); ?>
  43. <li>
  44. <a
  45. href="<?=$Url?><?=$Name?>">
  46. <img class="tooltip large_tile" alt="<?=$Name?>"
  47. title="<?=$Name?>"
  48. src="<?=ImageTools::process($Image)?>" />
  49. </a>
  50. </li>
  51. <?php
  52. }
  53. }
  54. public static function render_artist_list($Artist, $Category)
  55. {
  56. if (self::is_valid_artist($Artist)) {
  57. switch ($Category) {
  58. case 'weekly':
  59. case 'hyped':
  60. self::render_list("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
  61. break;
  62. default:
  63. break;
  64. }
  65. }
  66. }
  67. private static function render_list($Url, $Name, $Image)
  68. {
  69. if (!empty($Image)) {
  70. $Image = ImageTools::process($Image);
  71. $Title = "title=\"&lt;img class=&quot;large_tile&quot; src=&quot;$Image&quot; alt=&quot;&quot; /&gt;\"";
  72. $Name = display_str($Name); ?>
  73. <li>
  74. <a class="tooltip_image" data-title-plain="<?=$Name?>" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
  75. </li>
  76. <?php
  77. }
  78. }
  79. private static function is_valid_artist($Artist)
  80. {
  81. return $Artist['name'] !== '[unknown]';
  82. }
  83. }