Description:
This box is designed to display on its own page, it will show all the people that rated a certain comment and what they rated it.
Box Code:
my $content = qq{
<table width="100%" border=0 cellpadding=2 cellspacing=0>};
my $cid = $S->{CGI}->param('cid');
my $sid = $S->{CGI}->param('sid');
my $f_cid = $S->{DBH}->quote($cid);
my $f_sid = $S->{DBH}->quote($sid);
#Check for hidden
my ($rv, $sth) = $S->db_select({
WHAT => 'points',
FROM => 'comments',
WHERE => qq{sid = $f_sid AND cid = $f_cid}});
my $points = $sth->fetchrow();
$sth->finish();
if (($points < $S->{UI}->{VARS}->{rating_min}) && ($S->{TRUSTLEV} != 2)) {
return '';
}
my ($rv, $sth) = $S->db_select({
WHAT => 'uid, rating',
FROM => 'commentratings',
WHERE => qq{sid = $f_sid AND cid = $f_cid}});
my $zeros = 0;
while (my $rating = $sth->fetchrow_hashref()) {
my $user = $S->user_data($rating->{uid});
if (($rating->{'rating'} < $S->{UI}->{VARS}->{rating_min}) && ($S->{TRUSTLEV} != 2)) {
$zeros++;
} else {
$content .= qq{
<tr>
<td>%%norm_font%%<A HREF="%%rootdir%%/user/uid:$rating->{uid}">$user->{nickname}</A>%%norm_font_end%%</td>
<td>%%norm_font%%$rating->{rating}%%norm_font_end%%</td>
</tr>};
}
}
$sth->finish();
if ($zeros) {
my $word = ($zeros == 1) ? "Rating" : "Ratings";
$content .= qq{
<tr>
<td colspan=2>%%norm_font%%Zero $word: $zeros%%norm_font_end%%</td>
</tr>};
}
$content .= qq{
</table>};
return {'content' => $content};
|