Exemplo n.º 1
0
 private function getVoters($pageId)
 {
     $result = array();
     $dbr = wfGetDB(DB_SLAVE);
     $table = "image_votes";
     $vars = array("iv_userid", "iv_vote");
     $where = array("iv_pageid" => $pageId);
     $res = $dbr->select($table, $vars, $where);
     foreach ($res as $row) {
         // special case for anons that have voted..we stored their 'id' as negative
         if ($row->iv_userid < 0) {
             $voter = User::newFromId(0);
         } else {
             $voter = User::newFromId($row->iv_userid);
         }
         $admin = UCIPatrol::userInUCIAdminGroup($voter);
         $avatar = UCIPatrol::getUserAvatar($voter, $row->iv_userid);
         $result[] = array("name" => $avatar['name'], "vote" => $row->iv_vote, "image" => $avatar['image'], "admin_vote" => $admin);
     }
     return $result;
 }