summaryrefslogtreecommitdiffstats
path: root/templates/show_object_rating.inc.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-18 08:12:28 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-18 08:12:28 +0000
commit5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5 (patch)
treec31fecc94908b9b3804f12b13effd0b3a852b934 /templates/show_object_rating.inc.php
parent5d66022a37df7e568aa9e60750465236e35fc212 (diff)
downloadampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.tar.gz
ampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.tar.bz2
ampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.zip
fixed javascript on ratings images... kinda there is still a bug but it is just visual
Diffstat (limited to 'templates/show_object_rating.inc.php')
-rw-r--r--templates/show_object_rating.inc.php62
1 files changed, 30 insertions, 32 deletions
diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php
index 831b6b40..a440d919 100644
--- a/templates/show_object_rating.inc.php
+++ b/templates/show_object_rating.inc.php
@@ -19,42 +19,40 @@
*/
if ($type != 'song') {
- echo "<strong>" . _("Rating") . ":</strong>";
+ echo _('Rating') . ":";
}
/* Create some variables we are going to need */
$web_path = conf('web_path');
$base_url = $web_path . '/ratings.php?action=set_rating&amp;mode=' . conf('flash') . '&amp;rating_type=' . $rating->type . '&amp;object_id=' . $rating->id . '&amp;username=' . $GLOBALS['user']->username;
-$score = '0';
-
-/* count up to 6 */
-while ($score < 6) {
- /* Handle the "Not rated" possibility */
- if ($score == '0' AND $rating->rating == '-1') {
- echo "<img src=\"" . $web_path . "/images/ratings/x.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif ($score == '0' AND $rating->rating == '0') {
- echo "<img src=\"" . $web_path . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif ($score == '0') {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t";
- echo "<img src=\"" . $web_path . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- echo "</a>";
- }
- elseif ($score == $rating->rating) {
- echo "<img src=\"" . $web_path . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif (!$found_on) {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t<img src=\"" . $web_path . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n</a>\n";
- }
- else {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t<img src=\"" . $web_path . "/images/ratings/star_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n</a>\n";
- }
- /* Next! */
- $score++;
-} // end while
+
+//set the background to no stars
+echo "<ul class=\"star-rating\">\n";
+
+/* Handle the "Not rated" possibility */
+if ($rating->rating == '-1') {
+ echo "<li><a href=\"" . $base_url . "&amp;rating=-1\" title=\"don't play\" class=\"zero-stars\">-1</a></li>\n";
+}
+else {
+ echo "<li><a href=\"" . $base_url . "&amp;rating=-1\" title=\"remove rating\" class=\"zero-stars\">-1</a></li>\n";
+}
+// decide width of rating. image is 16 px wide
+$width = $rating->rating*16;
+if ($width < 0) $width = 0;
+
+//set the current rating background
+echo "<li class=\"current-rating\" style=\"width:${width}px\" >Current rating: ";
+if ($rating->rating <= 0) {
+ echo "not rated yet </li>\n";
+}
+else echo "$rating->rating of 5</li>\n";
+
+//it did not like my "1-star", "2-star" ... css styles, and I changed it to this after I realized star1... would have worked :\
+echo "<li> <a href=\"" . $base_url . "&amp;rating=1\" class=\"one-stars\" title=\"1 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=2\" class=\"two-stars\" title=\"2 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=3\" class=\"three-stars\" title=\"3 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=4\" class=\"four-stars\" title=\"4 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=5\" class=\"five-stars\" title=\"5 out of 5\">$score</a></li>\n";
+echo "</ul>";
?>