Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vote.php 2.7KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?
  2. $UserVotes = Votes::get_user_votes($LoggedUser['ID']);
  3. $GroupVotes = Votes::get_group_votes($GroupID);
  4. $TotalVotes = $GroupVotes['Total'];
  5. $UpVotes = $GroupVotes['Ups'];
  6. $DownVotes = $TotalVotes - $UpVotes;
  7. $Voted = isset($UserVotes[$GroupID]) ? $UserVotes[$GroupID]['Type'] : false;
  8. $Score = Votes::binomial_score($UpVotes, $TotalVotes);
  9. ?>
  10. <div class="box" id="votes">
  11. <div class="head"><strong>Group Votes</strong></div>
  12. <div class="album_votes body">
  13. <span class="favoritecount tooltip" title="<?=$UpVotes . ($UpVotes == 1 ? ' upvote' : ' upvotes')?>"><span id="upvotes"><?=number_format($UpVotes)?></span> <span class="vote_album_up">&and;</span></span>
  14. &nbsp; &nbsp;
  15. <span class="favoritecount tooltip" title="<?=$DownVotes . ($DownVotes == 1 ? ' downvote' : ' downvotes')?>"><span id="downvotes"><?=number_format($DownVotes)?></span> <span class="vote_album_down">&or;</span></span>
  16. &nbsp; &nbsp;
  17. <span class="favoritecount" id="totalvotes"><?=number_format($TotalVotes)?></span> Total
  18. <br /><br />
  19. <span class="tooltip_interactive" title="&lt;span style=&quot;font-weight: bold;&quot;&gt;Score: <?=number_format($Score * 100, 4)?>&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the lower bound of the binomial confidence interval &lt;a href=&quot;wiki.php?action=article&amp;id=1037&quot;&gt;described here&lt;/a&gt;, multiplied by 100." data-title-plain="Score: <?=number_format($Score * 100, 4)?>. This is the lower bound of the binomial confidence interval described in the Favorite Album Votes wiki article, multiplied by 100.">Score: <span class="favoritecount"><?=number_format($Score * 100, 1)?></span></span>
  20. &nbsp; | &nbsp;
  21. <span class="favoritecount"><?=number_format(($TotalVotes == 0) ? 0 : ($UpVotes / $TotalVotes) * 100, 1)?>%</span> positive
  22. <br /><br />
  23. <span id="upvoted"<?=(($Voted != 'Up') ? ' class="hidden"' : '')?>>You have upvoted.<br /><br /></span>
  24. <span id="downvoted"<?=(($Voted != 'Down') ? ' class="hidden"' : '')?>>You have downvoted.<br /><br /></span>
  25. <? if (check_perms('site_album_votes')) { ?>
  26. <span<?=($Voted ? ' class="hidden"' : '')?> id="vote_message"><a href="#" class="brackets upvote" onclick="UpVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Upvote</a> - <a href="#" class="brackets downvote" onclick="DownVoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;">Downvote</a></span>
  27. <? } ?>
  28. <span<?=($Voted ? '' : ' class="hidden"')?> id="unvote_message">
  29. Changed your mind?
  30. <br />
  31. <a href="#" onclick="UnvoteGroup(<?=$GroupID?>, '<?=$LoggedUser['AuthKey']?>'); return false;" class="brackets">Clear your vote</a>
  32. </span>
  33. </div>
  34. </div>