Projet

Général

Profil

Révision 3461d8cb

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/fivestar/includes/fivestar.theme.inc
30 30
    '#stars' => 5,
31 31
    '#auto_submit' => FALSE,
32 32
    '#allow_clear' => TRUE,
33
    '#allow_revote' => TRUE,
34
    '#allow_ownvote' => TRUE,
33 35
    '#widget' => array(
34 36
      'name' => isset($variables['name']) ? $variables['name'] : 'default',
35 37
      'css' => isset($variables['css']) && $variables['css'] != 'default' ? $variables['css'] : FALSE,
......
67 69
  $settings = array(
68 70
    'stars' => $stars,
69 71
    'allow_clear' => $unvote,
72
    'allow_revote' => $revote,
73
    'allow_ownvote' => $ownvote,
70 74
    'style' => $style,
71 75
    'text' => $text,
72 76
    'title' => $title,
......
247 251
  $output = '';
248 252
  $div_class = '';
249 253
  $average_rating_microdata = '';
254
  $rating_count_microdata = '';
250 255
  if (isset($user_rating)) {
251 256
    $div_class = isset($votes) ? 'user-count' : 'user';
252 257
    $user_stars = round(($user_rating * $stars) / 100, 1);
......
256 261
    $output .= ' ';
257 262
  }
258 263
  if (isset($average_rating)) {
259
    $div_class = isset($votes) ? 'average-count' : 'average';
264
    if (isset($user_rating)) {
265
      $div_class = 'combo';
266
    }
267
    else {
268
      $div_class = isset($votes) ? 'average-count' : 'average';
269
    }
270

  
260 271
    $average_stars = round(($average_rating * $stars) / 100, 1);
261 272
    if (!empty($microdata['average_rating']['#attributes'])) {
262 273
      $average_rating_microdata = drupal_attributes($microdata['average_rating']['#attributes']);
......
264 275
    $output .= '<span class="average-rating">' . t('Average: !stars',
265 276
      array('!stars' => "<span $average_rating_microdata>$average_stars</span>")) . '</span>';
266 277
  }
267
  if (isset($user_rating) && isset($average_rating)) {
268
    $div_class = 'combo';
269
  }
270 278

  
271
  if (isset($votes) && !(isset($user_rating) || isset($average_rating))) {
272
    $output .= ' <span class="total-votes">' . format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') . '</span>';
273
    $div_class = 'count';
274
  }
275
  elseif (isset($votes)) {
276
    $output .= ' <span class="total-votes">(' . format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') . ')</span>';
279
  if (isset($votes)) {
280
    if (!isset($user_rating) && !isset($average_rating)) {
281
      $div_class = 'count';
282
    }
283
    if ($votes === 0) {
284
      $output = '<span class="empty">'. t('No votes yet') .'</span>';
285
    }
286
    else {
287
      if (!empty($microdata['rating_count']['#attributes'])) {
288
        $rating_count_microdata = drupal_attributes($microdata['rating_count']['#attributes']);
289
      }
290
      // We don't directly substitute $votes (i.e. use '@count') in format_plural,
291
      // because it has a span around it which is not translatable.
292
      $votes_str = format_plural($votes, '!cnt vote', '!cnt votes', array(
293
        '!cnt' => '<span ' . $rating_count_microdata . '>' . intval($votes) . '</span>'));
294
      if (isset($user_rating) || isset($average_rating)) {
295
        $output .= ' <span class="total-votes">(' . $votes_str . ')</span>';
296
      }
297
      else {
298
        $output .= ' <span class="total-votes">' . $votes_str . '</span>';
299
      }
300
    }
277 301
  }
278 302

  
279
  if ($votes === 0) {
280
    $output = '<span class="empty">' . t('No votes yet') . '</span>';
281
  }
282 303

  
283 304
  $output = '<div class="fivestar-summary fivestar-summary-' . $div_class . '">' . $output . '</div>';
284 305
  return $output;

Formats disponibles : Unified diff