5 * Copyright 1999-2001, VA Linux Systems, Inc.
6 * Copyright 2002-2004, GForge, LLC
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; either version 2 of the License,
13 * or (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with FusionForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 require_once $gfcommon.'include/Error.class.php';
27 require_once $gfcommon.'tracker/Artifact.class.php';
29 class Artifacts extends Error {
32 * Status db resource ID.
34 * @var int $status_res.
39 * Artifact Type object.
41 * @var object $ArtifactType.
46 * Array of Artifact objects.
48 * @var array $artifacts_array.
53 * Artifacts - constructor.
55 * Use this constructor if you are modifying an existing artifact.
57 * @param object Artifact Type object.
58 * @param int (primary key from database).
59 * @return boolean success.
61 function Artifacts(&$ArtifactType) {
64 $this->ArtifactType =& $ArtifactType;
66 //was ArtifactType legit?
67 if (!$ArtifactType || !is_object($ArtifactType)) {
68 $this->setError('Artifact: No Valid ArtifactType');
71 //did ArtifactType have an error?
72 if ($ArtifactType->isError()) {
73 $this->setError('Artifact: '.$ArtifactType->getErrorMessage());
80 * getArtifacts - get an array of artifacts.
82 * Retrieves an array of artifact objects.
84 * @param boolean Database query offset.
85 * @return an array of artifact objects on success / false on failure.
87 function &getArtifacts($offset=false) {
97 group_artifact_id='". $this->ArtifactType->getID() ."'";
99 $res = db_query($sql,500,$offset);
102 $this->setError('Could not get artifacts: ' . db_error());
105 while ($rows = db_fetch_array($res)) {
106 $this->artifacts_array[] = new Artifact($this->ArtifactType, $rows);
109 return $this->artifacts_array;
114 * getArtifactType - get the artifact type.
116 * @return object The ArtifactType object.
118 function &getArtifactType() {
119 return $this->ArtifactType;
125 // c-file-style: "bsd"