2009-10-26 21:55:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Bookmark voting badge.
|
|
|
|
* Shows the number of votes and buttons to vote for or
|
|
|
|
* against a bookmark.
|
|
|
|
* Expects a $row variable with bookmark data
|
|
|
|
*/
|
2009-11-02 09:38:02 +00:00
|
|
|
if (!$GLOBALS['enableVoting'] || $GLOBALS['votingMode'] != 1) {
|
2009-10-26 21:55:43 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-10-27 20:36:43 +00:00
|
|
|
if (isset($row['hasVoted']) && !$row['hasVoted']) {
|
2009-10-27 20:30:33 +00:00
|
|
|
$classes = 'vote-badge vote-badge-inactive';
|
2009-10-28 22:19:50 +00:00
|
|
|
} else if (isset($row['vote'])) {
|
|
|
|
$classes = 'vote-badge '
|
|
|
|
. ($row['vote'] == 1
|
|
|
|
? 'vote-badge-for'
|
|
|
|
: 'vote-badge-against'
|
|
|
|
);
|
2009-10-27 20:30:33 +00:00
|
|
|
} else {
|
|
|
|
$classes = 'vote-badge';
|
|
|
|
}
|
2009-10-28 08:02:17 +00:00
|
|
|
echo '<span class="' . $classes . '" id="bmv-' . $row['bId'] . '">';
|
2009-10-27 20:36:43 +00:00
|
|
|
|
2009-11-02 09:39:07 +00:00
|
|
|
if (isset($row['hasVoted']) && $row['vote'] != 1) {
|
2009-10-27 20:40:12 +00:00
|
|
|
echo '<a class="vote-for" rel="nofollow" href="'
|
2009-10-28 08:02:17 +00:00
|
|
|
. createVoteURL(true, $row['bId']) . '"'
|
|
|
|
. ' onclick="javascript:vote(' . $row['bId'] . ',1); return false;"'
|
|
|
|
. '>+</a>';
|
2009-10-26 21:55:43 +00:00
|
|
|
} else {
|
2009-11-02 09:39:07 +00:00
|
|
|
echo '<span class="vote-for vote-for-inactive">+</span>';
|
2009-10-26 21:55:43 +00:00
|
|
|
}
|
2009-10-27 20:36:43 +00:00
|
|
|
|
2009-10-26 21:55:43 +00:00
|
|
|
echo '<span class="voting">' . $row['bVoting'] . '</span>';
|
2009-10-27 20:36:43 +00:00
|
|
|
|
2009-11-02 09:39:07 +00:00
|
|
|
if (isset($row['hasVoted']) && $row['vote'] != -1) {
|
2009-10-27 20:40:12 +00:00
|
|
|
echo '<a class="vote-against" rel="nofollow" href="'
|
2009-10-28 08:02:17 +00:00
|
|
|
. createVoteURL(false, $row['bId']) . '"'
|
|
|
|
. ' onclick="vote(' . $row['bId'] . ',-1); return false;"'
|
|
|
|
. '>-</a>';
|
2009-10-26 21:55:43 +00:00
|
|
|
} else {
|
2009-11-02 09:39:07 +00:00
|
|
|
echo '<span class="vote-against vote-against-inactive">-</span>';
|
2009-10-26 21:55:43 +00:00
|
|
|
}
|
|
|
|
echo '</span>';
|
|
|
|
?>
|