1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- #declare(strict_types=1);
-
- class Top10View
- {
- public static function render_linkbox($Selected)
- {
- $ENV = ENV::go();
- ?>
- <div class="linkbox">
- <a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected === "torrents")?></a>
- <a href="top10.php?type=users" class="brackets"><?=self::get_selected_link("Users", $Selected === "users")?></a>
- <a href="top10.php?type=tags" class="brackets"><?=self::get_selected_link("Tags", $Selected === "tags")?></a>
- <?php if ($ENV->FEATURE_DONATE) { ?>
- <a href="top10.php?type=donors" class="brackets"><?=self::get_selected_link("Donors", $Selected === "donors")?></a>
- <?php } ?>
- </div>
- <?php
- }
-
- private static function get_selected_link($String, $Selected)
- {
- if ($Selected) {
- return "<strong>$String</strong>";
- } else {
- return $String;
- }
- }
-
- public static function render_artist_tile($Artist, $Category)
- {
- if (self::is_valid_artist($Artist)) {
- switch ($Category) {
- case 'weekly':
- case 'hyped':
- self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
- break;
- default:
- break;
- }
- }
- }
-
- private static function render_tile($Url, $Name, $Image)
- {
- if (!empty($Image)) {
- $Name = display_str($Name); ?>
- <li>
- <a
- href="<?=$Url?><?=$Name?>">
- <img class="tooltip large_tile" alt="<?=$Name?>"
- title="<?=$Name?>"
- src="<?=ImageTools::process($Image)?>" />
- </a>
- </li>
- <?php
- }
- }
-
- public static function render_artist_list($Artist, $Category)
- {
- if (self::is_valid_artist($Artist)) {
- switch ($Category) {
- case 'weekly':
- case 'hyped':
- self::render_list("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
- break;
- default:
- break;
- }
- }
- }
-
- private static function render_list($Url, $Name, $Image)
- {
- if (!empty($Image)) {
- $Image = ImageTools::process($Image);
- $Title = "title=\"<img class="large_tile" src="$Image" alt="" />\"";
- $Name = display_str($Name); ?>
-
- <li>
- <a class="tooltip_image" data-title-plain="<?=$Name?>" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
- </li>
- <?php
- }
- }
-
- private static function is_valid_artist($Artist)
- {
- return $Artist['name'] !== '[unknown]';
- }
- }
|