function getYesNoVotes($qc_id, $req_y, $req_n, $qc_key) { $t = QCRule::getTitleFromQCID($qc_id); $link = "<a href='{$t->getFullURL()}' target='new'>" . wfMsg('howto', $t->getText()) . "</a>"; $yes = array(); $no = array(); $status = ''; $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select('qc_vote', array('qcv_user', 'qcv_vote'), array('qcv_qcid' => $qc_id), 'QG::getVoteBlock', array('ORDER BY' => 'qcv_vote DESC')); while ($row = $dbr->fetchObject($res)) { if ($row->qcv_vote == '1') { array_push($yes, $row->qcv_user); } else { array_push($no, $row->qcv_user); } } $html .= "<div id='qc_vote_1'><div class='qc_vote_head'>Yes Votes</div>"; //get yes boxes for ($i = 0; $i < $req_y; $i++) { $html .= self::getAvatar($yes[$i]); } $html .= "</div><div id='qc_vote_2'>"; //get left arrow if ($req_y == count($yes)) { $html .= "<div class='qc_arrow qc_left_win'></div>"; $status = 'approved'; } else { $html .= "<div class='qc_arrow qc_left'></div>"; } //get right arrow if ($req_n == count($no)) { $html .= "<div class='qc_arrow qc_right_win'></div>"; $status = 'removed'; } else { $html .= "<div class='qc_arrow qc_right'></div>"; } $html .= "</div><div id='qc_vote_3'><div class='qc_vote_head qc_head_no'>No Votes</div>"; //get no boxes for ($i = 0; $i < $req_n; $i++) { $html .= self::getAvatar($no[$i]); } $html .= '</div>'; if ($status == '' && count($yes) == count($no)) { $status = 'tie'; } //grab main image $img = "<div class='qc_vote_img qc_img_{$status}'></div>"; //grab upper text if ($status == 'approved' || $status == 'removed') { $text = wfMsg('qcrule_' . $qc_key) . ' ' . wfMsg('qcvote_' . $status); } else { $text = wfMsg('qcvote_' . $status); } //format the top part $top = "<div id='qc_vote_text'>{$img}<p class='first'>{$text} {$link}</p></div>"; //add it all up $html = "{$top}<div id='qc_votes'>{$html}</div>"; return $html; }