Gazelle/sections/user/lastfm.php

33 lines
1.4 KiB
PHP
Raw Normal View History

2013-01-02 08:00:26 +00:00
<?
2013-01-11 08:00:38 +00:00
//Include Last.fm in the user sidebar only if a Last.fm username is specified.
2013-01-02 08:00:26 +00:00
$DB->query("SELECT username FROM lastfm_users WHERE ID = '$UserID'");
if ($DB->record_count()) {
2013-02-07 08:00:47 +00:00
list($LastFMUsername) = $DB->next_record();
$LastFMInfo = LastFM::get_user_info($LastFMUsername);
2013-02-09 08:01:01 +00:00
//Hand everything else over to JS (gets data via the username in an id-d div) to allow faster page loading.
2013-02-07 08:00:47 +00:00
?>
<div class="box box_info box_lastfm">
<div class="head colhead_dark">Last.fm</div>
<ul class="stats nobullet">
<li>
2013-05-16 16:15:57 +00:00
Username: <a id="lastfm_username" href="<?=($LastFMInfo['user']['url'])?>" target="_blank" title="<?=($LastFMInfo['user']['name'])?> on Last.fm: <?=(number_format($LastFMInfo['user']['playcount']))?> plays, <?=(number_format($LastFMInfo['user']['playlists']))?> playlists."><?=($LastFMInfo['user']['name'])?></a>
2013-02-07 08:00:47 +00:00
</li>
2013-05-16 16:15:57 +00:00
<div id="lastfm_stats"<? if ($OwnProfile == true): ?> data-uid="<?=($OwnProfile)?>"<? endif; ?>>
2013-02-07 08:00:47 +00:00
</div>
<li>
2013-02-09 08:01:01 +00:00
<a href="#" id="lastfm_expand" onclick="return false" class="brackets">Show more info</a>
2013-04-17 08:00:58 +00:00
<?
2013-02-07 08:00:47 +00:00
//Append the reload stats button only if allowed on the current user page.
$Response = $Cache->get_value('lastfm_clear_cache_' . $LoggedUser . '_' . $_GET['id']);
if (empty($Response)) :
?>
<span id="lastfm_reload_container">
2013-02-09 08:01:01 +00:00
<a href="#" id="lastfm_reload" onclick="return false" class="brackets">Reload stats</a>
2013-02-07 08:00:47 +00:00
</span>
2013-04-17 08:00:58 +00:00
<? endif; ?>
2013-02-07 08:00:47 +00:00
</li>
</ul>
</div>
2013-04-17 08:00:58 +00:00
<?
} ?>