2013-09-09 08:00:52 +00:00
< ?
class Top10View {
public static function render_linkbox ( $Selected ) { ?>
< div class = " linkbox " >
< a href = " top10.php?type=torrents " class = " brackets " >< ? = self :: get_selected_link ( " Torrents " , $Selected == " torrents " ) ?> </a>
2013-10-09 08:01:03 +00:00
< a href = " top10.php?type=lastfm " class = " brackets " >< ? = self :: get_selected_link ( " Last.fm " , $Selected == " lastfm " ) ?> </a>
2013-09-09 08:00:52 +00:00
< 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>
< a href = " top10.php?type=votes " class = " brackets " >< ? = self :: get_selected_link ( " Favorites " , $Selected == " votes " ) ?> </a>
< a href = " top10.php?type=donors " class = " brackets " >< ? = self :: get_selected_link ( " Donors " , $Selected == " donors " ) ?> </a>
</ div >
< ? }
public static function render_artist_links ( $Selected , $View ) { ?>
< div class = " center " >
2013-10-09 08:01:03 +00:00
< a href = " top10.php?type=lastfm&category=weekly&view=<?= $View ?> " class = " brackets tooltip " title = " These are the artists with the most Last.fm listeners this week " >< ? = self :: get_selected_link ( " Weekly Artists " , $Selected == " weekly " ) ?> </a>
< a href = " top10.php?type=lastfm&category=hyped&view=<?= $View ?> " class = " brackets tooltip " title = " These are the the fastest rising artists on Last.fm this week " >< ? = self :: get_selected_link ( " Hyped Artists " , $Selected == " hyped " ) ?> </a>
2013-09-13 08:00:53 +00:00
2013-09-09 08:00:52 +00:00
</ div >
< ? }
public static function render_artist_controls ( $Selected , $View ) { ?>
< div class = " center " >
2013-10-09 08:01:03 +00:00
< a href = " top10.php?type=lastfm&category=<?= $Selected ?>&view=tiles " class = " brackets " >< ? = self :: get_selected_link ( " Tiles " , $View == " tiles " ) ?> </a>
< a href = " top10.php?type=lastfm&category=<?= $Selected ?>&view=list " class = " brackets " >< ? = self :: get_selected_link ( " List " , $View == " list " ) ?> </a>
2013-09-09 08:00:52 +00:00
</ div >
< ? }
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 ) {
switch ( $Category ) {
2013-09-13 08:00:53 +00:00
2013-09-09 08:00:52 +00:00
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 ) {
2013-10-10 08:01:46 +00:00
if ( ! empty ( $Image )) {
$Name = htmlspecialchars ( $Name );
?>
2013-09-09 08:00:52 +00:00
< li >
< a href = " <?= $Url ?><?= $Name ?> " >
2013-10-10 08:01:46 +00:00
< img class = " tooltip large_tile " alt = " <?= $Name ?> " title = " <?= $Name ?> " src = " <?=ImageTools::process( $Image )?> " />
2013-09-09 08:00:52 +00:00
</ a >
</ li >
< ? }
}
public static function render_artist_list ( $Artist , $Category ) {
switch ( $Category ) {
2013-09-13 08:00:53 +00:00
2013-09-09 08:00:52 +00:00
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 )) {
$UseTooltipster = ! isset ( G :: $LoggedUser [ 'Tooltipster' ]) || G :: $LoggedUser [ 'Tooltipster' ];
2013-09-14 08:00:52 +00:00
$Image = ImageTools :: process ( $Image );
2013-10-10 08:01:46 +00:00
$Title = " title= \" <img class="large_tile" src=" $Image " alt="" /> \" " ;
$Name = htmlspecialchars ( $Name );
2013-09-09 08:00:52 +00:00
?>
< li >
2013-10-10 08:01:46 +00:00
< a class = " tooltip_image " < ? = $Title ?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
2013-09-09 08:00:52 +00:00
</ li >
< ? }
}
}