/[drupal]/contributions/modules/fivestar/fivestar.module
ViewVC logotype

Diff of /contributions/modules/fivestar/fivestar.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.22, Wed Jul 1 00:01:17 2009 UTC revision 1.23, Wed Jul 1 02:18:13 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar.module,v 1.21 2009/06/30 23:48:03 quicksketch Exp $  // $Id: fivestar.module,v 1.22 2009/07/01 00:01:17 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1283  function fivestar_views_widget_handler($ Line 1283  function fivestar_views_widget_handler($
1283      $content_id = $columns->nid;      $content_id = $columns->nid;
1284      $node_type = isset($columns->node_type) ? $columns->node_type : db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $columns->nid));      $node_type = isset($columns->node_type) ? $columns->node_type : db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $columns->nid));
1285    
     $votes = fivestar_get_votes($content_type, $content_id, $tag);  
   
1286      $values = array(      $values = array(
1287        'user' => isset($votes['user']['value']) ? $votes['user']['value'] : 0,        'user' => 0,
1288        'average' => isset($votes['average']['value']) ? $votes['average']['value'] : 0,        'average' => 0,
1289        'count' => isset($votes['count']['value']) ? $votes['count']['value'] : 0,        'count' => 0,
1290      );      );
1291    
1292        if ($field->table == 'votingapi_vote') {
1293          $values['user'] = $value;
1294        }
1295    
1296        if ($field->table == 'votingapi_cache') {
1297          $values['average'] = $value;
1298        }
1299    
1300        // Only pull in all the votes if we need to display the summary text.
1301        if ($summary) {
1302          $votes = fivestar_get_votes($content_type, $content_id, $tag);
1303          if ($field->table != 'votingapi_vote') {
1304            $values['user'] = isset($votes['user']['value']) ? $votes['user']['value'] : 0;
1305          }
1306          if ($field->table != 'votingapi_cache') {
1307            $values['average'] = isset($votes['average']['value']) ? $votes['average']['value'] : 0;
1308          }
1309          $values['count'] = isset($votes['count']['value']) ? $votes['count']['value'] : 0;
1310        }
1311    
1312      $settings = array(      $settings = array(
1313        'stars' => variable_get('fivestar_stars_'. $node_type, 5),        'stars' => variable_get('fivestar_stars_'. $node_type, 5),
1314        'allow_clear' => variable_get('fivestar_unvote_'. $node_type, FALSE),        'allow_clear' => variable_get('fivestar_unvote_'. $node_type, FALSE),
1315        // If the user has setup this content type to use smart stars, display        'style' => $field->table == 'votingapi_vote' ? 'user' : 'average',
       // the smart version instead of just the average.  
       'style' => variable_get('fivestar_style_'. $node_type, 'average') != 'smart' ? 'average' : 'smart',  
1316        'text' => $summary ? variable_get('fivestar_text_'. $node_type, 'dual') : 'none',        'text' => $summary ? variable_get('fivestar_text_'. $node_type, 'dual') : 'none',
1317        'content_type' => $content_type,        'content_type' => $content_type,
1318        'content_id' => $content_id,        'content_id' => $content_id,

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.2