You are here

function theme_vote_up_down_widget_alt in Vote Up/Down 5

File

./vote_up_down.module, line 530
vote_up_down is a module that adds a widget for +1/-1 votes on nodes. It depends upon Voting API. It's based upon "simplevote.module".

Code

function theme_vote_up_down_widget_alt($cid, $type) {
  global $user;
  if (user_access('view up-down vote')) {
    $output = '<div class="vote-up-down-widget-alt">';
    $output .= theme('vote_up_down_points_alt', $cid, $type);
    if (user_access('use up-down vote') && ($user->uid || variable_get('vote_up_down_anonymous_vote', 0))) {
      $user_vote = votingapi_get_user_votes($type, $cid, _vote_up_down_get_uid());
      if ($user_vote[0]->value > 0) {
        $class = 'vote-up-act';
      }
      else {
        $class = 'vote-up-inact';
      }
      $token = drupal_get_token("vote_up_down/{$type}/{$cid}/1");
      $output .= '<span id="vote_up_' . $cid . '" class="' . $class . '" title="' . url("vote_up_down/{$type}/{$cid}/1/1/1", array(
        'query' => 'token=' . $token,
      )) . '">' . l('', "vote_up_down/{$type}/{$cid}/1", array(
        'class' => $class,
        'title' => t('Vote'),
      ), drupal_get_destination() . '&token=' . $token, NULL, FALSE, TRUE) . '</span>';
    }
    else {
      $output .= '<span class="up-inact" title="' . t('You must login to vote.') . '"></span>';
    }
    $output .= '</div>';
    return $output;
  }
}