5 * Copyright 2004, GForge, LLC
6 * Copyright 2009, Roland Mas
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfcommon.'include/Error.class.php';
26 class ArtifactHistory extends Error {
29 * The artifact object.
31 * @var object $Artifact.
33 var $Artifact; //object
36 * Array of artifact data.
38 * @var array $data_array.
43 * ArtifactHistory - constructor.
45 * @param Artifact $Artifact Artifact object.
46 * @param array|bool $data (all fields from artifact_history_user_vw) OR id from database.
48 function __construct(&$Artifact, $data=false) {
52 if (!$Artifact || !is_object($Artifact)) {
53 $this->setError('ArtifactHistory: No Valid Artifact');
56 //did Artifact have an error?
57 if ($Artifact->isError()) {
58 $this->setError('ArtifactHistory: '.$Artifact->getErrorMessage());
61 $this->Artifact =& $Artifact;
64 if (is_array($data)) {
65 $this->data_array =& $data;
67 $this->fetchData($data);
73 * fetchData - re-fetch the data for this ArtifactHistory from the database.
75 * @param int $id ID of the category.
76 * @return boolean success.
78 function fetchData($id) {
79 $res = db_query_params ('SELECT * FROM artifact_category WHERE id=$1',
81 if (!$res || db_numrows($res) < 1) {
82 $this->setError('ArtifactHistory: Invalid ArtifactHistory ID');
85 $this->data_array = db_fetch_array($res);
91 * getArtifact - get the Artifact Object this ArtifactHistory is associated with.
93 * @return object Artifact.
95 function &getArtifact() {
96 return $this->Artifact;
100 * getID - get this ArtifactHistory's ID.
102 * @return int The id #.
105 return $this->data_array['id'];
109 * getName - get the name.
111 * @return string The name.
114 return $this->data_array['category_name'];
118 * getAssignee - get the user_id of the person to assign this category to.
120 * @return int user_id.
122 function getAssignee() {
123 return $this->data_array['auto_assign_to'];
129 // c-file-style: "bsd"