/[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.13.2.62, Wed Jul 1 00:33:49 2009 UTC revision 1.13.2.63, Wed Jul 1 02:17:46 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar.module,v 1.13.2.61 2009/06/30 23:58:17 quicksketch Exp $  // $Id: fivestar.module,v 1.13.2.62 2009/07/01 00:33:49 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1694  function fivestar_views_widget_handler($ Line 1694  function fivestar_views_widget_handler($
1694      $content_id = $columns->nid;      $content_id = $columns->nid;
1695      $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));
1696    
     $votes = fivestar_get_votes($content_type, $content_id, $tag);  
   
1697      $values = array(      $values = array(
1698        'user' => isset($votes['user']['value']) ? $votes['user']['value'] : 0,        'user' => 0,
1699        'average' => isset($votes['average']['value']) ? $votes['average']['value'] : 0,        'average' => 0,
1700        'count' => isset($votes['count']['value']) ? $votes['count']['value'] : 0,        'count' => 0,
1701      );      );
1702    
1703        if ($field->table == 'votingapi_vote') {
1704          $values['user'] = $value;
1705        }
1706    
1707        if ($field->table == 'votingapi_cache') {
1708          $values['average'] = $value;
1709        }
1710    
1711        // Only pull in all the votes if we need to display the summary text.
1712        if ($summary) {
1713          $votes = fivestar_get_votes($content_type, $content_id, $tag);
1714          if ($field->table != 'votingapi_vote') {
1715            $values['user'] = isset($votes['user']['value']) ? $votes['user']['value'] : 0;
1716          }
1717          if ($field->table != 'votingapi_cache') {
1718            $values['average'] = isset($votes['average']['value']) ? $votes['average']['value'] : 0;
1719          }
1720          $values['count'] = isset($votes['count']['value']) ? $votes['count']['value'] : 0;
1721        }
1722    
1723      $settings = array(      $settings = array(
1724        'stars' => variable_get('fivestar_stars_'. $node_type, 5),        'stars' => variable_get('fivestar_stars_'. $node_type, 5),
1725        'allow_clear' => variable_get('fivestar_unvote_'. $node_type, FALSE),        'allow_clear' => variable_get('fivestar_unvote_'. $node_type, FALSE),
1726        // 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',  
1727        'text' => $summary ? variable_get('fivestar_text_'. $node_type, 'dual') : 'none',        'text' => $summary ? variable_get('fivestar_text_'. $node_type, 'dual') : 'none',
1728        'content_type' => $content_type,        'content_type' => $content_type,
1729        'content_id' => $content_id,        'content_id' => $content_id,

Legend:
Removed from v.1.13.2.62  
changed lines
  Added in v.1.13.2.63

  ViewVC Help
Powered by ViewVC 1.1.2