/[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.64, Wed Jul 1 02:43:31 2009 UTC revision 1.13.2.65, Wed Jul 1 03:02:11 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: fivestar.module,v 1.13.2.63 2009/07/01 02:17:46 quicksketch Exp $  // $Id: fivestar.module,v 1.13.2.64 2009/07/01 02:43:31 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 780  function _fivestar_cast_vote($type, $cid Line 780  function _fivestar_cast_vote($type, $cid
780    
781  function fivestar_get_votes($type, $cid, $tag = 'vote', $uid = NULL) {  function fivestar_get_votes($type, $cid, $tag = 'vote', $uid = NULL) {
782    global $user;    global $user;
783    if (empty($uid)) {  
784      if (!isset($uid)) {
785      $uid = $user->uid;      $uid = $user->uid;
786    }    }
787    
# Line 1045  function fivestar_form(&$form_state, $co Line 1046  function fivestar_form(&$form_state, $co
1046      }      }
1047    }    }
1048    
1049      $star_display = variable_get('fivestar_style_'. $node->type, 'average');
1050      $text_display = variable_get('fivestar_text_'. $node->type, 'dual');
1051    
1052    $votes = fivestar_get_votes($content_type, $content_id);    if ($star_display == 'average' && ($text_display == 'average' || $text_display == 'none')) {
1053        // Save a query and don't retrieve the user vote unnecessarily.
1054        $votes = fivestar_get_votes($content_type, $content_id, 'vote', 0);
1055      }
1056      else {
1057        $votes = fivestar_get_votes($content_type, $content_id);
1058      }
1059    
1060    $values = array(    $values = array(
1061      'user' => isset($votes['user']['value']) ? $votes['user']['value'] : 0,      'user' => isset($votes['user']['value']) ? $votes['user']['value'] : 0,
# Line 1057  function fivestar_form(&$form_state, $co Line 1066  function fivestar_form(&$form_state, $co
1066    $settings = array(    $settings = array(
1067      'stars' => variable_get('fivestar_stars_'. $node->type, 5),      'stars' => variable_get('fivestar_stars_'. $node->type, 5),
1068      'allow_clear' => variable_get('fivestar_unvote_'. $node->type, FALSE),      'allow_clear' => variable_get('fivestar_unvote_'. $node->type, FALSE),
1069      'style' => variable_get('fivestar_style_'. $node->type, 'average'),      'style' => $star_display,
1070      'text' => variable_get('fivestar_text_'. $node->type, 'dual'),      'text' => $text_display,
1071      'content_type' => $content_type,      'content_type' => $content_type,
1072      'content_id' => $content_id,      'content_id' => $content_id,
1073      'tag' => 'vote',      'tag' => 'vote',

Legend:
Removed from v.1.13.2.64  
changed lines
  Added in v.1.13.2.65

  ViewVC Help
Powered by ViewVC 1.1.2