5 * Copyright 2002, 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 ArtifactFromID extends Error {
32 function __construct($id, $data = false) {
36 $res = db_query_params ('SELECT * FROM artifact_vw WHERE artifact_id=$1',
38 if (!$res || db_numrows($res) < 1) {
39 $this->setError("Invalid Artifact ID");
42 $art_arr = db_fetch_array($res);
46 $at = artifactType_get_object($art_arr['group_artifact_id']);
47 if (!$at || !is_object($at)) {
48 $this->setError("Could Not Create ArtifactType");
50 } elseif ($at->isError()) {
51 $this->setError($at->getErrorMessage());
54 $this->ArtifactType =& $at;
56 $a = artifact_get_object($id,$art_arr);
57 if (!$a || !is_object($a)) {
58 $this->setError("Could Not Create Artifact");
60 } elseif ($a->isError()) {
61 $this->setError($a->getErrorMessage());
64 $this->Artifact =& $a;