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

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