librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1042] try encoding relative track play percentage in


From: Clint Adams
Subject: [Librefm-commits] [1042] try encoding relative track play percentage in the html for later css manipulation
Date: Thu, 30 Apr 2009 04:20:31 +0000

Revision: 1042
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1042
Author:   clint
Date:     2009-04-30 04:20:30 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
try encoding relative track play percentage in the html for later css 
manipulation

Modified Paths:
--------------
    trunk/nixtape/data/User.php
    trunk/nixtape/themes/librefm/templates/profile.tpl

Modified: trunk/nixtape/data/User.php
===================================================================
--- trunk/nixtape/data/User.php 2009-04-30 04:12:03 UTC (rev 1041)
+++ trunk/nixtape/data/User.php 2009-04-30 04:20:30 UTC (rev 1042)
@@ -193,14 +193,25 @@
                    return $res;
                }
 
+               $maxcount = 0;
+
                $data = $res->fetchAll(MDB2_FETCHMODE_ASSOC);
                foreach($data as $i) {
                    $row = sanitize($i);
                    $row["artisturl"] = Server::getArtistURL($row["artist"]);
                    $row["trackurl"] = 
Server::getTrackURL($row["artist"],$row["album"],$row["track"]);
+                   if ((int)$row["c"] > $maxcount) {
+                       $maxcount = (int)$row["c"];
+                   }
                    $result[] = $row;
                }
 
+               if ($maxcount > 0) {
+                       foreach($data as $i) {
+                       $row["width"]=(int)(100 * ($row["c"]/$maxcount));
+                       }
+               }
+
                return $result;
        }
 

Modified: trunk/nixtape/themes/librefm/templates/profile.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/profile.tpl  2009-04-30 04:12:03 UTC 
(rev 1041)
+++ trunk/nixtape/themes/librefm/templates/profile.tpl  2009-04-30 04:20:30 UTC 
(rev 1042)
@@ -61,7 +61,7 @@
 <h3>{$user}'s Top Tracks</h3>
 <ul>
 {section name=i loop=$toptracks}
-<li class="toptrack"><a 
href="{$toptracks[i].artisturl}">{$toptracks[i].artist}</a> - <a 
href="{$toptracks[i].trackurl}">{$toptracks[i].track}<a></li>
+<li style="width:{$toptracks[i].width}" class="toptrack"><a 
href="{$toptracks[i].artisturl}">{$toptracks[i].artist}</a> - <a 
href="{$toptracks[i].trackurl}">{$toptracks[i].track}<a></li>
 {/section}
 </ul>
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]