Révision 4853591f
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/fivestar/includes/fivestar.theme.inc | ||
---|---|---|
38 | 38 |
|
39 | 39 |
// Attach necessary JS settings |
40 | 40 |
$settings = array( |
41 |
'titleUser' => t('Your rating') .': ', |
|
42 |
'titleAverage' => t('Average') .': ', |
|
41 |
'titleUser' => t('Your rating') . ': ',
|
|
42 |
'titleAverage' => t('Average') . ': ',
|
|
43 | 43 |
'feedbackSavingVote' => t('Saving your vote...'), |
44 | 44 |
'feedbackVoteSaved' => t('Your vote has been saved.'), |
45 | 45 |
'feedbackDeletingVote' => t('Deleting your vote...'), |
... | ... | |
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
function theme_fivestar_preview_wrapper($variables) { |
88 |
return '<div class="fivestar-preview fivestar-preview-'. $variables['type'] .'">'. $variables['content'] .'</div>';
|
|
88 |
return '<div class="fivestar-preview fivestar-preview-' . $variables['type'] . '">' . $variables['content'] . '</div>';
|
|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
/** |
... | ... | |
184 | 184 |
$stars = $variables['stars']; |
185 | 185 |
$tag = $variables['tag']; |
186 | 186 |
$widget = $variables['widget']; |
187 |
if($widget['name'] != 'default') { |
|
187 |
if ($widget['name'] != 'default') { |
|
188 |
$path = drupal_get_path('module', 'fivestar'); |
|
189 |
drupal_add_css($path . '/css/fivestar.css'); |
|
188 | 190 |
drupal_add_css($widget['css']); |
189 | 191 |
} |
190 | 192 |
|
191 | 193 |
$output = '<div class="fivestar-' . $widget['name'] . '">'; |
192 |
$output .= '<div class="fivestar-widget-static fivestar-widget-static-'. $tag .' fivestar-widget-static-'. $stars . ' clearfix">';
|
|
194 |
$output .= '<div class="fivestar-widget-static fivestar-widget-static-' . $tag . ' fivestar-widget-static-' . $stars . ' clearfix">';
|
|
193 | 195 |
if (empty($stars)) { |
194 | 196 |
$stars = 5; |
195 | 197 |
} |
... | ... | |
200 | 202 |
$zebra = ($n % 2 == 0) ? 'even' : 'odd'; |
201 | 203 |
$first = $n == 1 ? ' star-first' : ''; |
202 | 204 |
$last = $n == $stars ? ' star-last' : ''; |
203 |
$output .= '<div class="star star-'. $n .' star-'. $zebra . $first . $last .'">';
|
|
205 |
$output .= '<div class="star star-' . $n . ' star-' . $zebra . $first . $last . '">';
|
|
204 | 206 |
if ($rating < $star_value && $rating > $prev_star_value) { |
205 | 207 |
$percent = (($rating - $prev_star_value) / ($star_value - $prev_star_value)) * 100; |
206 |
$output .= '<span class="on" style="width: '. $percent .'%">';
|
|
208 |
$output .= '<span class="on" style="width: ' . $percent . '%">';
|
|
207 | 209 |
} |
208 | 210 |
elseif ($rating >= $star_value) { |
209 | 211 |
$output .= '<span class="on">'; |
... | ... | |
248 | 250 |
if (isset($user_rating)) { |
249 | 251 |
$div_class = isset($votes) ? 'user-count' : 'user'; |
250 | 252 |
$user_stars = round(($user_rating * $stars) / 100, 1); |
251 |
$output .= '<span class="user-rating">'. t('Your rating: <span>!stars</span>', array('!stars' => $user_rating ? $user_stars : t('None'))) .'</span>';
|
|
253 |
$output .= '<span class="user-rating">' . t('Your rating: <span>!stars</span>', array('!stars' => $user_rating ? $user_stars : t('None'))) . '</span>';
|
|
252 | 254 |
} |
253 | 255 |
if (isset($user_rating) && isset($average_rating)) { |
254 | 256 |
$output .= ' '; |
... | ... | |
259 | 261 |
if (!empty($microdata['average_rating']['#attributes'])) { |
260 | 262 |
$average_rating_microdata = drupal_attributes($microdata['average_rating']['#attributes']); |
261 | 263 |
} |
262 |
$output .= '<span class="average-rating">'. t('Average: <span !microdata>!stars</span>', array('!stars' => $average_stars, '!microdata' => $average_rating_microdata)) .'</span>'; |
|
264 |
$output .= '<span class="average-rating">' . t('Average: !stars', |
|
265 |
array('!stars' => "<span $average_rating_microdata>$average_stars</span>")) . '</span>'; |
|
263 | 266 |
} |
264 | 267 |
if (isset($user_rating) && isset($average_rating)) { |
265 | 268 |
$div_class = 'combo'; |
266 | 269 |
} |
267 | 270 |
|
268 | 271 |
if (isset($votes) && !(isset($user_rating) || isset($average_rating))) { |
269 |
$output .= ' <span class="total-votes">'. format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') .'</span>';
|
|
272 |
$output .= ' <span class="total-votes">' . format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') . '</span>';
|
|
270 | 273 |
$div_class = 'count'; |
271 | 274 |
} |
272 | 275 |
elseif (isset($votes)) { |
273 |
$output .= ' <span class="total-votes">('. format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') .')</span>';
|
|
276 |
$output .= ' <span class="total-votes">(' . format_plural($votes, '<span>@count</span> vote', '<span>@count</span> votes') . ')</span>';
|
|
274 | 277 |
} |
275 | 278 |
|
276 | 279 |
if ($votes === 0) { |
277 |
$output = '<span class="empty">'. t('No votes yet') .'</span>';
|
|
280 |
$output = '<span class="empty">' . t('No votes yet') . '</span>';
|
|
278 | 281 |
} |
279 | 282 |
|
280 |
$output = '<div class="fivestar-summary fivestar-summary-'. $div_class . '">'. $output .'</div>';
|
|
283 |
$output = '<div class="fivestar-summary fivestar-summary-' . $div_class . '">' . $output . '</div>';
|
|
281 | 284 |
return $output; |
282 | 285 |
} |
283 | 286 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules