| <?php |
| /** |
| * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (http://www.eclipse.org/legal/epl-v10.html). |
| * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. |
| * |
| */ |
| |
| /** |
| * |
| */ |
| |
| require_once("/home/data/httpd/eclipse-php-classes/system/dbconnection_bugs_ro.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/stats/hostname.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/buglist.class.php"); |
| |
| /** |
| * Provides the Top Ten voted bugs on the Eclipse Bugzilla bug tracking system |
| * |
| * This Class provides an easy way to create and enumerate the top ten bugs on bugs.eclipse.org |
| * |
| * @author Eduardo A. Romero Gomez |
| * @example examples/top_ten_bugs.php Example of <b>top_ten_voted.class.php</b> using the Eclpse Visual Style, CSS and Navigation |
| * @link /projects/common/doc/examples/top_ten_bugs.php The Results of the example |
| * @license http://www.eclipse.org/legal/epl-v10.html Eclipse Public License - v 1.0 |
| */ |
| |
| Class TopTen extends BugList { |
| |
| /** |
| * Returns the Top Ten most voted bugs on the Eclipse Bugzilla bug tracking system |
| * |
| * @param boolean $overall If set to <em>true</em> the top ten list will include NEW, RESOLVED and CLOSED bugs, otherwise it will return only the NEW bugs. |
| * @param int $type_of_bugs, set it to 1 to get BUGS, and to 2 to get ENHANCEMENTS |
| */ |
| function topten($type_of_bugs = 1, $overall = false) |
| { |
| $dbc = new DBConnectionBugs(); |
| $dbh = $dbc->connect(); |
| $local = 0; |
| |
| $_status = "AND NOT ( |
| bugs.bug_status = \"RESOLVED\" |
| OR bugs.bug_status = \"VERIFIED\" |
| OR bugs.bug_status = \"CLOSED\" |
| )"; |
| |
| |
| $ToB = " AND NOT (bug_severity = 'enchancement') "; |
| |
| if($type_of_bugs == 2) |
| { |
| $ToB = " AND (bug_severity = 'enchancement') "; |
| } elseif($type_of_bugs == 1) { |
| $ToB = " AND NOT (bug_severity = 'enchancement') "; |
| } |
| |
| if ($overall) |
| { |
| $sql = "SELECT votes.bug_id, count(vote_count) as total " . |
| "FROM `votes`,`bugs` " . |
| "WHERE 1 AND bugs.bug_id = votes.bug_id $ToB" . |
| "GROUP BY bug_id " . |
| "ORDER BY total DESC " . |
| "LIMIT 0, 10"; |
| } |
| else |
| { |
| $sql = "SELECT count(vote_count) as total, votes.bug_id, bugs.bug_status " . |
| "FROM votes, bugs WHERE 1 AND bugs.bug_id = votes.bug_id " . |
| $_status . $ToB . |
| "GROUP BY bug_id " . |
| "ORDER BY total " . |
| "DESC LIMIT 0,10"; |
| |
| } |
| $result = mysql_query($sql, $dbh); |
| |
| |
| while($myrow = mysql_fetch_array($result)) |
| { |
| $bug = new Bug($myrow["bug_id"]); |
| $bug->setVotes ($myrow["total"]); |
| $this->add($bug); |
| } |
| |
| $dbh = null; |
| $dbc = null; |
| $result = null; |
| $myrow = null; |
| } |
| } |
| ?> |