Gazelle/classes/top10view.class.php

105 lines
3.4 KiB
PHP
Raw Normal View History

2013-09-09 08:00:52 +00:00
<?
class Top10View {
2013-10-13 08:01:01 +00:00
public static function render_linkbox($Selected) {
?>
2013-09-09 08:00:52 +00:00
<div class="linkbox">
<a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected == "torrents")?></a>
2014-01-24 08:00:47 +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>
2013-10-13 08:01:01 +00:00
<?
}
2013-09-09 08:00:52 +00:00
2013-10-13 08:01:01 +00:00
public static function render_artist_links($Selected, $View) {
?>
2013-09-09 08:00:52 +00:00
<div class="center">
2014-01-24 08:00:47 +00:00
<a href="top10.php?type=lastfm&amp;category=weekly&amp;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&amp;category=hyped&amp;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-10-13 08:01:01 +00:00
2013-09-09 08:00:52 +00:00
</div>
2013-10-13 08:01:01 +00:00
<?
}
2013-09-09 08:00:52 +00:00
2013-10-13 08:01:01 +00:00
public static function render_artist_controls($Selected, $View) {
?>
2013-09-09 08:00:52 +00:00
<div class="center">
2013-10-09 08:01:03 +00:00
<a href="top10.php?type=lastfm&amp;category=<?=$Selected?>&amp;view=tiles" class="brackets"><?=self::get_selected_link("Tiles", $View == "tiles")?></a>
<a href="top10.php?type=lastfm&amp;category=<?=$Selected?>&amp;view=list" class="brackets"><?=self::get_selected_link("List", $View == "list")?></a>
2013-09-09 08:00:52 +00:00
</div>
2013-10-13 08:01:01 +00:00
<?
}
2013-09-09 08:00:52 +00:00
private static function get_selected_link($String, $Selected) {
if ($Selected) {
2013-10-24 08:01:05 +00:00
return "<strong>$String</strong>";
2013-09-09 08:00:52 +00:00
} else {
return $String;
}
}
public static function render_artist_tile($Artist, $Category) {
2013-10-20 08:00:53 +00:00
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;
}
2013-09-09 08:00:52 +00:00
}
}
private static function render_tile($Url, $Name, $Image) {
2013-10-10 08:01:46 +00:00
if (!empty($Image)) {
2013-10-13 08:01:01 +00:00
$Name = display_str($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>
2013-10-13 08:01:01 +00:00
<?
}
2013-09-09 08:00:52 +00:00
}
public static function render_artist_list($Artist, $Category) {
2013-10-20 08:00:53 +00:00
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;
}
2013-09-09 08:00:52 +00:00
}
}
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-24 08:01:05 +00:00
$Title = "title=\"&lt;img class=&quot;large_tile&quot; src=&quot;$Image&quot; alt=&quot;&quot; /&gt;\"";
2013-10-13 08:01:01 +00:00
$Name = display_str($Name);
?>
2013-09-09 08:00:52 +00:00
<li>
2013-10-24 08:01:05 +00:00
<a class="tooltip_image" data-title-plain="<?=$Name?>" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
2013-09-09 08:00:52 +00:00
</li>
2013-10-13 08:01:01 +00:00
<?
}
2013-09-09 08:00:52 +00:00
}
2013-10-20 08:00:53 +00:00
private static function is_valid_artist($Artist) {
return $Artist['name'] != '[unknown]';
}
2013-09-09 08:00:52 +00:00
}