Skip to content

Commit

Permalink
Tooltips for listening user icons
Browse files Browse the repository at this point in the history
  • Loading branch information
amsoell committed Apr 8, 2011
1 parent df03445 commit 8a6cb32
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 17 deletions.
30 changes: 30 additions & 0 deletions classes/User.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ function ping() {

$db->query("UPDATE user SET lastseen=UNIX_TIMESTAMP(NOW()) WHERE `key`='".$this->key."' LIMIT 1");
}

function getTopArtists($count=10) {
$db = new Db();
$rdio = new Rdio(RDIO_CONSKEY, RDIO_CONSSEC);

$rs = $db->query("SELECT artistKey, count(id) AS requestCount FROM queue WHERE userKey='".$this->key."' GROUP BY artistKey ORDER BY requestCount DESC LIMIT $count");
$a = array();
while ($rec = mysql_fetch_array($rs)) {
$key = $rec['artistKey'];
$tmp = $rdio->get(array("keys"=>$rec['artistKey']));
$a[] = $tmp->result->$key;
}

return $a;
}

function getTopTracks($count=10) {
$db = new Db();
$rdio = new Rdio(RDIO_CONSKEY, RDIO_CONSSEC);

$rs = $db->query("SELECT trackKey, count(id) AS requestCount FROM queue WHERE userKey='".$this->key."' GROUP BY trackKey ORDER BY requestCount DESC LIMIT $count");
$a = array();
while ($rec = mysql_fetch_array($rs)) {
$key = $rec['trackKey'];
$tmp = $rdio->get(array("keys"=>$rec['trackKey']));
$a[] = $tmp->result->$key;
}

return $a;
}

}
?>
1 change: 1 addition & 0 deletions css/jquery.qtip.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 3 additions & 15 deletions include/header.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
<?php
session_start();

include("configuration.php");
include("classes/Db.class.php");
include("classes/Rdio.class.php");
include("classes/User.class.php");
include("classes/Track.class.php");
include("classes/Queue.class.php");
include("classes/Collection.class.php");
include("include/functions.php");

$c = new Config();
$db = new Db();
$rdio = new Rdio(RDIO_CONSKEY, RDIO_CONSSEC);
authenticate();
include("libs.php");
$token = $rdio->getPlaybackToken(array("domain"=>$c->app_domain));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
Expand All @@ -34,9 +20,11 @@
<script src="js/controller.js"></script>
<script src="/theme/<?php print $c->theme; ?>/js/controller.js"></script>
<script src="/js/jquery.fancybox-1.3.4.pack.js"></script>
<script src="/js/jquery.qtip.pack.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/reset/reset-min.css">
<link type="text/css" rel="stylesheet" href="/theme/<?php print $c->theme; ?>/css/style.css" />
<link type="text/css" rel="stylesheet" href="/css/jquery.fancybox-1.3.4.css" />
<link type="text/css" rel="stylesheet" href="/css/jquery.qtip.min.css" />
<link id="page_favicon" href="/favicon.ico" rel="icon" type="image/x-icon" />
</head>
<body onload="$('.autoclick').trigger('click')">
Expand Down
17 changes: 17 additions & 0 deletions include/libs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
session_start();

include("configuration.php");
include("classes/Db.class.php");
include("classes/Rdio.class.php");
include("classes/User.class.php");
include("classes/Track.class.php");
include("classes/Queue.class.php");
include("classes/Collection.class.php");
include("include/functions.php");

$c = new Config();
$db = new Db();
$rdio = new Rdio(RDIO_CONSKEY, RDIO_CONSSEC);
authenticate();
?>
19 changes: 19 additions & 0 deletions js/jquery.qtip.pack.js

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions profile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
include("include/libs.php");

if (isset($_REQUEST['key'])) {
$u = new User($_REQUEST['key']);
?>
<div class="profile">
<img src="<?php print $u->icon; ?>" width="64" height="64" align="left"/>
<h1><?php print $u->firstName." ".$u->lastName; ?>
<h2>aka: <?php print $u->username; ?></h2>
<br style="clear: both;" />
<br />
<h3>Top Artists</h3>
<ol>
<?php
foreach ($u->getTopArtists() as $artist) {
print "<li>".$artist->name."</li>\n";
}
?>
</ol>
<br /><br />
<h3>Top Songs</h3>
<ol>
<?php
foreach ($u->getTopTracks() as $track) {
print "<li>".$track->name." - ".$track->artist."</li>\n";
}
?>
</ol>
</div>
<?php
}
?>
28 changes: 26 additions & 2 deletions theme/cramppbo/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,30 @@ dd {
font-size: 12px;
}

.profile img {
padding: 1px;
border: 1px solid #CCC;
margin: 0 5px 5px 0;
}

.profile h1 {
font-size: 14px;
font-weight: bold;
padding-bottom: 0;
}

.profile h2 {
font-size: 10px;
padding-top: 3px;
font-weight: normal;
}

.profile h3 {
font-size:: 12px;
font-weight: bold;
}


#toolbar {
padding: 5px 0;
width: 100%;
Expand Down Expand Up @@ -293,12 +317,12 @@ dd {
height: 120px;
}

#collection #browser #album .album ol {
#collection #browser #album .album ol, .profile ol {
list-style: decimal;
padding-left: 28px;
}

#collection #browser #album ol li {
#collection #browser #album ol li, .profile ol li {
cursor: pointer;
list-style: decimal;
}
Expand Down
Binary file modified theme/cramppbo/js/controller.js
Binary file not shown.

0 comments on commit 8a6cb32

Please sign in to comment.