function ArtifactFromID($id, $data = false)
 {
     if ($data) {
         $art_arr =& $data;
     } else {
         $res = db_query("SELECT * FROM artifact_vw WHERE artifact_id='{$id}'");
         if (!$res || db_numrows($res) < 1) {
             $this->setError("Invalid Artifact ID");
             return false;
         } else {
             $art_arr =& db_fetch_array($res);
         }
     }
     $at = artifactType_get_object($art_arr['group_artifact_id']);
     if (!$at || !is_object($at)) {
         $this->setError("Could Not Create ArtifactType");
         return false;
     } elseif ($at->isError()) {
         $this->setError($at->getErrorMessage());
         return false;
     }
     $this->ArtifactType =& $at;
     $a = artifact_get_object($id, $art_arr);
     if (!$a || !is_object($a)) {
         $this->setError("Could Not Create Artifact");
         return false;
     } elseif ($a->isError()) {
         $this->setError($a->getErrorMessage());
         return false;
     }
     $this->Artifact =& $a;
     return true;
 }
/**
*       Factory method which creates an ArtifactFile from an artifactFile ID
*
*       @param int      The artifactFile ID
*       @param array    The result array, if it's passed in
*       @return object  Artifact object
*/
function &artifactfile_get_object($artifact_file_id, $data = false)
{
    global $ARTIFACTFILE_OBJ;
    if (!isset($ARTIFACTFILE_OBJ["_" . $artifact_file_id . "_"])) {
        if ($data) {
            //the db result handle was passed in
        } else {
            $res = db_query("SELECT * FROM artifact_file_user_vw WHERE id='{$artifact_file_id}'");
            if (db_numrows($res) < 1) {
                $ARTIFACTFILE_OBJ["_" . $artifact_file_id . "_"] = false;
                return false;
            }
            $data =& db_fetch_array($res);
        }
        $Artifact =& artifact_get_object($data["artifact_id"]);
        $ARTIFACTFILE_OBJ["_" . $artifact_file_id . "_"] = new ArtifactFile($Artifact, $data);
    }
    return $ARTIFACTFILE_OBJ["_" . $artifact_file_id . "_"];
}
Example #3
0
require_once $gfwww . 'tracker/include/ArtifactFileHtml.class.php';
require_once $gfcommon . 'tracker/ArtifactType.class.php';
require_once $gfwww . 'tracker/include/ArtifactTypeHtml.class.php';
require_once $gfwww . 'tracker/include/ArtifactHtml.class.php';
require_once $gfcommon . 'tracker/ArtifactCanned.class.php';
require_once $gfcommon . 'tracker/ArtifactTypeFactory.class.php';
if (!$sys_use_tracker) {
    exit_disabled();
}
$aid = getIntFromRequest('aid');
$group_id = getIntFromRequest('group_id');
$atid = getIntFromRequest('atid');
//if the ATID and GID are not provided, but
//the artifact_id is, then fetch the other vars
if ($aid && (!$group_id || !$atid)) {
    $a =& artifact_get_object($aid);
    if (!$a || !is_object($a) || $a->isError()) {
        exit_error('Error', 'Could Not Get Artifact Object');
    } else {
        $group_id = $a->ArtifactType->Group->getID();
        $atid = $a->ArtifactType->getID();
        $func = 'detail';
    }
}
if ($group_id && $atid) {
    include $gfwww . 'tracker/tracker.php';
} elseif ($group_id) {
    include $gfwww . 'tracker/ind.php';
} else {
    exit_no_group();
}
 /**
  * Get an instance of artifacte
  * 
  * @param    integer    artifact identifier (primary key)
  *
  * @return   object
  */
 function getTask($task_id)
 {
     return artifact_get_object($task_id);
 }
Example #5
0
function artifactDelete($session_ser, $group_id, $group_artifact_id, $artifact_id)
{
    continue_session($session_ser);
    $a =& artifact_get_object($artifact_id);
    if (!$a || !is_object($a)) {
        return new soap_fault('', 'artifactDelete', 'Could Not Get Artifact', 'Could Not Get Artifact');
    } elseif ($a->isError()) {
        return new soap_fault('', 'artifactDelete', '$a->getErrorMessage()', $a->getErrorMessage());
    }
    if (!$a->delete(1)) {
        return new soap_fault('', 'artifactDelete', '$a->getErrorMessage()', $a->getErrorMessage());
    } else {
        return true;
    }
}
Example #6
0
 function &getArtifact()
 {
     global $argv;
     // $Group not needed, but let the code here to support
     // tracker additions in the Future
     $Group =& group_get_object_by_name($argv[1]);
     if (!$Group || !is_object($Group)) {
         $this->setError('Could Not Get Group Object');
         return false;
     } elseif ($Group->isError()) {
         $this->setError('Getting Group Object: ' . $Group->getErrorMessage());
         return false;
     }
     // DBG("Artifact_get_object(".$this->ArtifactId.");");
     $this->Artifact =& artifact_get_object($this->ArtifactId);
     return $this->Artifact;
 }