| <?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'] . "/eclipse.org-common/system/app.class.php"); |
| |
| |
| |
| /** |
| * Models a Bug |
| * |
| * Models a Bug reported in the Eclipse Bugzilla bug tracking system. |
| * |
| * @license http://www.eclipse.org/legal/epl-v10.html Eclipse Public License - v 1.0 |
| * @author Eduardo A. Romero |
| */ |
| class Bug { |
| |
| |
| |
| var $bug_id = 0; |
| var $description = ""; |
| var $reporter = ""; |
| var $severity = ""; |
| var $assignee = ""; |
| var $url = ""; |
| var $status = ""; |
| var $resolution = ""; |
| var $priority = ""; |
| var $votes = 0; |
| var $product = ""; |
| var $classification = ""; |
| var $component = ""; |
| |
| /** |
| * @access public |
| * @return integer The bug id as in Bugzilla |
| */ |
| function getBugID() { |
| return $this->bug_id; |
| } |
| /** |
| * @access public |
| * @return string A paragraph describing the bug |
| */ |
| function getDescription() { |
| $ret = "Bug #" . $this->bug_id; |
| if(strlen( $this->description)>0) |
| $ret = $this->description; |
| return $ret; |
| } |
| /** |
| * @access public |
| * @return string The Name of the Person who reported the bug |
| */ |
| function getReporter() { |
| return $this->reporter; |
| } |
| /** |
| * @access public |
| * @return string The Name of the Person working on this bug |
| */ |
| function getAssignee() { |
| return $this->assignee; |
| } |
| /** |
| * @access public |
| * @return string The Severity of the bug, i.e. critical, blocker... |
| */ |
| function getSeverity() { |
| return $this->severity; |
| } |
| |
| /** |
| * @access public |
| * @return string URL The URL field of the bug |
| */ |
| function getUrl() { |
| return $this->url; |
| } |
| /** |
| * @access public |
| * @return string the Status of the bug. i.e. NEW, RESOLVED, OPEN... |
| */ |
| function getStatus() { |
| return $this->status; |
| } |
| |
| /** |
| * @access public |
| * @return string the Resolution of the bug. i.e. FIXED, DUPLICATED... |
| */ |
| function getResolution() { |
| return $this->resolution; |
| } |
| /** |
| * @access public |
| * @return string the Priority of the bug. i.e. P1, P3... |
| */ |
| function getPriority() { |
| return $this->priority; |
| } |
| /** |
| * @access public |
| * @return integer the number of Votes this bug has |
| */ |
| function getVotes() { |
| return $this->votes; |
| } |
| /** |
| * @access public |
| * @return string The product this bug belongs to |
| */ |
| function getProduct() { |
| return $this->product; |
| } |
| /** |
| * @access public |
| * @return string This bug's classification |
| */ |
| function getClassification() { |
| return $this->classification; |
| } |
| /** |
| * @access public |
| * @return string The component this bug belongs to |
| */ |
| function getComponent() { |
| return $this->component; |
| } |
| |
| /** |
| * Sets the ID of this bug |
| * |
| * @access private |
| * @param integer the bug id |
| */ |
| function setBugID($_bug_id) { |
| $this->bug_id = $_bug_id; |
| } |
| /** |
| * Sets the description of the bug |
| * |
| * @access private |
| * @param string the description of the bug |
| */ |
| function setDescription($_description) { |
| $this->description = $_description; |
| } |
| /** |
| * Sets the reporter of the bug |
| * |
| * @access private |
| * @param string The Name of the person who reported the bug |
| */ |
| function setReporter($_reporter) { |
| $this->reporter = $_reporter; |
| } |
| /** |
| * Sets the severity of the bug |
| * |
| * @access private |
| * @param string The Severity of the bug |
| */ |
| function setSeverity($_severity) { |
| $this->severity = $_severity; |
| } |
| /** |
| * Sets the asignee of the bug |
| * @access private |
| * @param string The Name of the person working on this bug |
| */ |
| function setAssignee($_assignee) { |
| $this->assignee = $_assignee; |
| } |
| |
| /** |
| * Sets the URL of the bug, i.e. a page with a more detailed description of the bug |
| * |
| * @access private |
| * @param string The URL |
| */ |
| function setUrl($_url) { |
| $this->url = $_url; |
| } |
| |
| /** |
| * Sets the Status of the bug |
| * |
| * @access private |
| * @param string The Status of the bug |
| */ |
| function setStatus($_status) { |
| $this->status = $_status; |
| } |
| |
| /** |
| * Sets the Resolution of the bug |
| * |
| * @access private |
| * @param string The Resolution of the bug |
| */ |
| function setResolution($_resolution) { |
| $this->resolution = $_resolution; |
| } |
| |
| /** |
| * Sets the Priority of the bug |
| * |
| * @access private |
| * @param string The Priority of the bug |
| */ |
| function setPriority($_priority){ |
| $this->priority = $_priority; |
| } |
| |
| /** |
| * Sets the number of Votes this bug has |
| * |
| * @access private |
| * @param integer The number of votes the bug has |
| */ |
| function setVotes($_votes){ |
| $this->votes = $_votes; |
| } |
| /** |
| * @access public |
| * @return string The product this bug belongs to |
| */ |
| function setProduct($_product) { |
| $this->product = $_product; |
| } |
| /** |
| * @access public |
| * @return string This bug's classification |
| */ |
| function setClassification($_classification) { |
| $this->classification = $_classification; |
| } |
| /** |
| * @access public |
| * @return string The component this bug belongs to |
| */ |
| function setComponent($_component) { |
| $this->component = $_component; |
| } |
| |
| |
| /** |
| * Constructs a new Bug object from the Eclipse Bugzilla bugtracking system given its bug_id. |
| * |
| * Constructs a new Bug object given its Bugzilla bug id. Unless specified, the bug wont include |
| * the number of votes it has. The constructor will populate the object with the information on |
| * the bugs database. |
| * |
| * @access public |
| * @param integer $_bug_id The bug id number, as in the Eclipse Bugzilla bugtracking system. |
| * @param boolean $_get_votes When set to <em>true</em> another query will be executed to calculate the |
| * number of votes this bug has, this is the default behavior. When set to <em>false</em> the votes |
| * information will be set to zero. |
| * |
| */ |
| function Bug($_bug_id, $_get_votes = false) { |
| |
| $App = new App(); |
| $WHERE = ""; |
| if($_bug_id != "" && $_bug_id > 0) |
| { |
| |
| $dbc = new DBConnectionBugs(); |
| $dbh = $dbc->connect(); |
| $local = 0; |
| |
| $_bug_id = $App->returnQuotedString($_bug_id); |
| $sql = "SELECT bugs.bug_id, bugs.short_desc, bugs.bug_file_loc, bugs.bug_severity, bugs.bug_status, bugs.resolution, bugs.priority, reporter.login_name AS reporter, asignee.login_name AS asignee, products.name AS product, classifications.name AS classification, components.name AS component |
| FROM bugs, profiles AS reporter, profiles AS asignee, products, classifications, components |
| WHERE bugs.bug_id = $_bug_id |
| AND reporter.userid = bugs.reporter |
| AND asignee.userid = bugs.assigned_to |
| AND products.id = bugs.product_id |
| AND classifications.id = products.classification_id |
| AND components.id = bugs.component_id |
| LIMIT 0 , 1"; |
| $result = mysql_query($sql, $dbh); |
| if($myrow = mysql_fetch_array($result)) { |
| |
| $this->setBugID ($myrow["bug_id"]); |
| $this->setDescription ($myrow["short_desc"]); |
| $this->setReporter ($myrow["reporter"]); |
| $this->setSeverity ($myrow["bug_severity"]); |
| $this->setAssignee ($myrow["asignee"]); |
| $this->setUrl ($myrow["bug_file_loc"]); |
| $this->setStatus ($myrow["bug_status"]); |
| $this->setPriority ($myrow["priority"]); |
| $this->setResolution ($myrow["resolution"]); |
| $this->setComponent ($myrow["component"]); |
| $this->setProduct ($myrow["product"]); |
| $this->setClassification($myrow["classification"]); |
| |
| } |
| |
| if($_get_votes) |
| { |
| $sql = "SELECT SELECT count(votes.vote_count) as total, votes.bug_id |
| FROM votes |
| WHERE votes.bug_id = $_bug_id |
| LIMIT 0 , 1"; |
| |
| $result = mysql_query($sql, $dbh); |
| |
| if($myrow = mysql_fetch_array($result)) { |
| $this->setVotes ($myrow["total"]); |
| } |
| } |
| |
| |
| |
| $dbh = null; |
| $dbc = null; |
| $result = null; |
| $myrow = null; |
| |
| } |
| } |
| |
| } |
| ?> |