3 * sf_tracker_export.php
5 * SourceForge Exports: Export tracker contents in XML
8 * SourceForge: Breaking Down the Barriers to Open Source Development
9 * Copyright 1999-2001 (c) VA Linux Systems
10 * http://sourceforge.net
12 * @author Darrell Brogdon <dbrogdon@valinux.com>
19 require_once('pre.php');
20 require_once('common/tracker/Artifact.class');
21 require_once('common/tracker/Artifacts.class');
22 require_once('common/tracker/ArtifactFile.class');
23 require_once('common/tracker/ArtifactType.class');
24 require_once('common/tracker/ArtifactGroup.class');
25 require_once('common/tracker/ArtifactCategory.class');
26 require_once('common/tracker/ArtifactCanned.class');
27 require_once('common/tracker/ArtifactResolution.class');
29 header("Content-Type: text/plain");
31 <tracker version="1.0" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://<?php echo $sys_default_domain; ?>/export/sf_tracker_export.xsd">
33 if ($group_id && $atid) {
35 // get the Group object
37 $group =& group_get_object($group_id);
38 if (!$group || !is_object($group) || $group->isError()) {
39 echo(" <error>Could not get the Group object</error>\n");
44 // Create the ArtifactType object
46 $ath = new ArtifactType($group,$atid);
47 if (!$ath || !is_object($ath)) {
48 echo(" <error>ArtifactType could not be created</error>\n");
51 if ($ath->isError()) {
52 echo(' <error>' . $ath->getErrorMessage() . "</error>\n");
57 // Create the Artifacts object
59 $artifacts = new Artifacts($ath);
60 if (!$artifacts || !is_object($ath)) {
61 echo(" <error>Artifacts could not be created</error>\n");
64 if ($artifacts->isError()) {
65 echo(' <error>' . $artifacts->getErrorMessage() . "</error>\n");
70 // Loop through each artifact object and show the results
72 if (!$alist =& $artifacts->getArtifacts($offset)) {
73 echo(' <error>' . $artifacts->getErrorMessage() . "</error>\n");
82 for ($i=0; $i<count($alist); $i++) {
84 <artifact id="<?php echo $alist[$i]->getID(); ?>">
85 <submitted_by><?php echo $alist[$i]->getSubmittedUnixName(); ?></submitted_by>
86 <submitted_date><?php echo date( $sys_datefmt, $alist[$i]->getOpenDate() ); ?></submitted_date>
87 <artifact_type id="<?php echo $ath->getID(); ?>"><?php echo $ath->getID(); ?></artifact_type>
88 <category id="<?php echo $alist[$i]->getCategoryID(); ?>"><?php echo $alist[$i]->getCategoryName(); ?></category>
89 <artifact_group id="<?php echo $alist[$i]->getArtifactGroupID(); ?>"><?php echo $alist[$i]->getArtifactGroupID; ?></artifact_group>
90 <assigned_to><?php echo $alist[$i]->getAssignedRealName(); ?></assigned_to>
91 <priority id="<?php echo $alist[$i]->getPriority(); ?>"><?php echo $alist[$i]->getPriority(); ?></priority>
92 <status><?php echo $alist[$i]->getStatusName(); ?></status>
93 <resolution><?php echo $alist[$i]->getResolutionName(); ?></resolution>
94 <summary><?php echo $alist[$i]->getSummary(); ?></summary>
95 <detail><?php echo $alist[$i]->getDetails(); ?></detail>
97 $result = $alist[$i]->getMessages();
98 $rows = db_numrows($result);
103 for ($x=0; $x<$rows; $x++) {
106 <date><?php echo db_result($result, $x, 'adddate'); ?></date>
107 <sender><?php echo db_result($result, $x, 'user_name'); ?></sender>
108 <text><?php echo db_result($result, $x, 'body'); ?></text>
117 $file_list =& $alist[$i]->getFiles();
118 $count=count($file_list);
123 for ($x=0; $x<$count; $x++) {
126 <id><?php echo $file_list[$x]->getID(); ?></id>
127 <name><?php echo $file_list[$x]->getName(); ?></name>
128 <description><?php echo $file_list[$x]->getDescription(); ?></description>
129 <filesize><?php echo $file_list[$x]->getSize(); ?></filesize>
130 <filetype><?php echo $file_list[$x]->getType(); ?></filetype>
131 <adddate><?php echo $file_list[$x]->getDate(); ?></adddate>
132 <submitted_by><?php echo $file_list[$x]->getSubmittedBy(); ?></submitted_by>
141 $result = $alist[$i]->getHistory();
142 $rows = db_numrows($result);
148 for ($x=0; $x<$rows; $x++) {
151 <field><?php echo db_result($result, $x, 'field_name'); ?></field>
152 <old_value><?php echo db_result($result, $x, 'old_value'); ?></old_value>
153 <date><?php echo db_result($result, $x, 'entrydate'); ?></date>
154 <by><?php echo db_result($result, $x, 'user_name'); ?></by>
167 print(" <error>Group ID Not Set</error>\n");