5 * Copyright 2002, GForge, LLC
6 * Copyright 2009, Roland Mas
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';
28 class ArtifactFromID extends Error {
34 function ArtifactFromID($id, $data = false) {
38 $res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1',
40 if (!$res || db_numrows($res) < 1) {
41 $this->setError("Invalid Artifact ID");
44 $art_arr =& db_fetch_array($res);
48 $at = artifactType_get_object($art_arr['group_artifact_id']);
49 if (!$at || !is_object($at)) {
50 $this->setError("Could Not Create ArtifactType");
52 } elseif ($at->isError()) {
53 $this->setError($at->getErrorMessage());
56 $this->ArtifactType =& $at;
58 $a = artifact_get_object($id,$art_arr);
59 if (!$a || !is_object($a)) {
60 $this->setError("Could Not Create Artifact");
62 } elseif ($a->isError()) {
63 $this->setError($a->getErrorMessage());
66 $this->Artifact =& $a;