~ubuntu-branches/debian/sid/ampache/sid

« back to all changes in this revision

Viewing changes to templates/show_object_rating.inc.php

  • Committer: Package Import Robot
  • Author(s): Charlie Smotherman
  • Date: 2013-08-27 13:19:48 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130827131948-1czew0zxn6u70dtv
Tags: 3.6-rzb2752+dfsg-1
* New upsteam snapshot.  Contains important bug fixes to the installer.
* Correct typo in ampache-common.postrm.
* Remove courtousy copy of php-getid3, during repack.  Closes: #701526
* Update package to use dh_linktree to make the needed sym links to the
  needed system libs that were removed during repack.
* Update debian/rules to reflect upstreams removing/moving of modules.
* Update debian/ampache-common.install to reflect upstreams removal of files.
* Updated to use new apache2.4 API. Closes: #669756
* Updated /debian/po/de.po thx David Prévot for the patch.  Closes:  #691963
* M3U import is now ordered, fixed upstream.  Closes: #684984
* Text input area has been resized so IPv6 addresses will now fit, fixed
  upstream.  Closes:  #716230
* Added ampache-common.preinst to make sure that the courtousy copies of code
  dirs are empty so dh_linktree can do it's magic on upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
 
2
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
3
3
/**
4
 
 * Show Object Rating
5
 
 *
6
4
 *
7
5
 * LICENSE: GNU General Public License, version 2 (GPLv2)
8
 
 * Copyright (c) 2001 - 2011 Ampache.org All Rights Reserved
 
6
 * Copyright 2001 - 2013 Ampache.org
9
7
 *
10
8
 * This program is free software; you can redistribute it and/or
11
9
 * modify it under the terms of the GNU General Public License v2
20
18
 * along with this program; if not, write to the Free Software
21
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
20
 *
23
 
 * @package     Ampache
24
 
 * @copyright   2001 - 2011 Ampache.org
25
 
 * @license     http://opensource.org/licenses/gpl-2.0 GPLv2
26
 
 * @link        http://www.ampache.org/
27
21
 */
28
22
 
29
23
/* Create some variables we are going to need */
30
24
$web_path = Config::get('web_path');
31
25
$base_url = '?action=set_rating&rating_type=' . $rating->type . '&object_id=' . $rating->id;
 
26
$othering = false;
 
27
$rate = $rating->get_user_rating();
 
28
if (!$rate) {
 
29
    $rate = $rating->get_average_rating();
 
30
    $othering = true;
 
31
}
32
32
?>
33
33
 
34
 
<div class="star-rating dynamic-star-rating">
 
34
<div class="star-rating dynamic-star-rating<?php if ($othering) { echo ' global-star-rating'; } ?>">
35
35
  <ul>
36
36
    <?php
37
37
    // decide width of rating (5 stars -> 20% per star)
38
 
    $width = $rating->preciserating*20;
 
38
    $width = $rate * 20;
39
39
    if ($width < 0) $width = 0;
40
40
 
41
41
    //set the current rating background
42
 
    echo "<li class=\"current-rating\" style=\"width:${width}%\" >" . T_('Current rating: ');
43
 
    if ($rating->rating <= 0) {
44
 
        echo T_('not rated yet') . "</li>\n";
 
42
    echo '<li class="current-rating" style="width:' . $width . '%" >';
 
43
    echo T_('Current rating: ');
 
44
    if ($rate <= 0) {
 
45
        echo T_('not rated yet') . "</li>\n";
45
46
    }
46
 
    else printf(T_('%s of 5'), $rating->preciserating); echo "</li>\n";
 
47
    else printf(T_('%s of 5'), $rate); echo "</li>\n";
47
48
 
48
 
    for ($i=1; $i<6; $i++)
 
49
    for ($i = 1; $i < 6; $i++)
49
50
    {
50
51
    ?>
51
52
      <li>
52
 
        <?php echo Ajax::text($base_url . '&rating='.$i,'','rating'.$i.'_' . $rating->id,'','star'.$i); ?>
 
53
          <?php echo Ajax::text($base_url . '&rating=' . $i, '', 'rating' . $i . '_' . $rating->id, '', 'star' . $i); ?>
53
54
      </li>
54
55
    <?php
55
56
    }
56
57
    ?>
57
58
  </ul>
58
 
        <?php echo Ajax::text($base_url . '&rating=-1','','rating0_' . $rating->id,'','star0'); ?>
 
59
       <?php echo Ajax::text($base_url . '&rating=-1', '', 'rating0_' . $rating->id, '', 'star0'); ?>
59
60
</div>