summaryrefslogtreecommitdiffstats
path: root/templates/show_object_rating.inc.php
diff options
context:
space:
mode:
authorspocky <spocky@ampache>2007-08-17 01:33:53 +0000
committerspocky <spocky@ampache>2007-08-17 01:33:53 +0000
commit9a3f9011f7f31dcb25c4643a625e5cba77bf9101 (patch)
tree4edaa87fcf982cc84a1f7e89cb84f7328a880f5c /templates/show_object_rating.inc.php
parentce094e4d95762791de7fa32b0a83ab0da7254d70 (diff)
downloadampache-9a3f9011f7f31dcb25c4643a625e5cba77bf9101.tar.gz
ampache-9a3f9011f7f31dcb25c4643a625e5cba77bf9101.tar.bz2
ampache-9a3f9011f7f31dcb25c4643a625e5cba77bf9101.zip
- updated star-rating to integrate original author's improvments (better compatibility, php code no more dependent on the stars image size which means themers can now use any image size they like)
- updated random albums css so that it does not break lines when cover is not downloaded quickly enough
Diffstat (limited to 'templates/show_object_rating.inc.php')
-rw-r--r--templates/show_object_rating.inc.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php
index 6e5bf185..d2908b5f 100644
--- a/templates/show_object_rating.inc.php
+++ b/templates/show_object_rating.inc.php
@@ -22,18 +22,15 @@
$web_path = Config::get('web_path');
$base_url = '?action=set_rating&rating_type=' . $rating->type . '&object_id=' . $rating->id;
+echo "<div class=\"star-rating dynamic-star-rating\">\n";
+echo "<ul>\n";
-//set the background to no stars
-echo "<ul class=\"star-rating\">\n";
-
-// Add in the 0 / Remove rating level
-echo "<li class=\"zero-stars\">" . Ajax::text($base_url . '&rating=-1','','rating0_' . $rating->id,'','zero-stars') . "</li>";
-
-// decide width of rating. image is 16 px wide
-$width = $rating->rating*16;
+// decide width of rating (5 stars -> 20% per star)
+$width = $rating->rating*20;
+if ($width < 0) $width = 0;
//set the current rating background
-echo "<li class=\"current-rating\" style=\"width:${width}px\" >Current rating: ";
+echo "<li class=\"current-rating\" style=\"width:${width}%\" >Current rating: ";
if ($rating->rating <= 0) {
echo "not rated yet </li>\n";
}
@@ -58,3 +55,8 @@ else echo "$rating->rating of 5</li>\n";
</li>
</ul>
+<?php
+ // Add in the 0 / Remove rating level
+ echo "<span class=\"zero-stars\">" . Ajax::text($base_url . '&rating=-1','','rating0_' . $rating->id,'','zero-stars') . "</span>\n";
+ echo "</div>\n";
+?>