Bazaar Status body<=

[<< Back]

selectrow_hashref("SELECT * FROM bzrs WHERE open='1' ". "ORDER BY datestart LIMIT 1"); return "No bazaar session is currently active." unless $bz; } else { $bz = $dbh->selectrow_hashref("SELECT * FROM bzrs WHERE bzid=?", undef, $bzid); return "Invalid bazaar ID" unless $bz; } $bzid = $bz->{'bzid'}; my (@pot, $pot); $sth = $dbh->prepare("SELECT dateadd, amt, reason FROM bzrpot ". "WHERE bzid=? ORDER BY dateadd"); $sth->execute($bzid); while ($_ = $sth->fetchrow_hashref) { push @pot, $_; $pot += $_->{'amt'}; } my $is_voter; $sth = $dbh->prepare("SELECT u.user, u.name, v.weight FROM bzrvoter v, user u ". "WHERE u.userid=v.userid AND v.bzid=? ". "ORDER BY v.weight DESC"); $sth->execute($bzid); my @voters; while ($_ = $sth->fetchrow_hashref) { push @voters, $_; $_->{'_votelink'} = 1 if $bz->{'open'} && $remote && $remote->{'user'} eq $_->{'user'}; } $ret .= "\n"; $ret .= "\n"; $ret .= "\n"; my $state = $bz->{'open'} ? "In progress" : "Completed"; $ret .= "\n"; $ret .= "\n"; $ret .= "
Bazaar Session:\#$bzid: $bz->{'name'}
Start Time:$bz->{'datestart'}
State:$state
Pot:\$" . sprintf("%0.02f", $pot) . ""; if (@pot > 1) { $ret .= "

Details:"; foreach (@pot) { my $reason = $_->{'reason'}; if ($LJ::ZILLA_ROOT) { $reason =~ s/bug (\d+)/$&<\/a>/gi; } $ret .= sprintf("\n", substr($_->{'dateadd'}, 0, 10), $_->{'amt'}, $reason); } $ret .= "
%s\$%0.02f%s
"; } $ret .= "

\n"; $ret .= "the details to find out how the system works. p?>"; $ret .= "
"; $ret .= "\n"; foreach my $v (@voters) { my $name = LJ::eall($v->{'name'}); $ret .= ""; $ret .= "\n"; } $ret .= "
UserWeight
" . LJ::ljuser($v->{'user'}) . " - $name" . sprintf("%0.02f%%", $v->{'weight'}*100) . ""; if ($v->{'_votelink'}) { $ret .= "[Vote]"; } $ret .= "
"; $ret .= ""; $ret .= "
"; $sth = $dbh->prepare("SELECT DISTINCT u.user, c.coid, c.cat, c.des, c.url, c.dateadd ". "FROM contributed c, useridmap u, bzrvote v, bzrvoter vr ". "WHERE u.userid=c.userid AND v.bzid=? AND vr.bzid=v.bzid ". "AND vr.userid=v.userid AND v.coid=c.coid AND v.weight > 0 ". "ORDER BY c.dateadd"); $sth->execute($bzid); while (my $c = $sth->fetchrow_hashref) { my $des = LJ::eall($c->{'des'}); $des = "$des" if $c->{'url'}; $ret .= "

[$c->{'coid'}] "; $ret .= LJ::ljuser($c->{'user'}) . ": $des ($c->{'cat'}; $c->{'dateadd'})

\n"; } $ret .= "
"; return $ret; } _code?> <=body page?>