public function exportTrackerData($tracker_id)
 {
     $artifacts_node = $this->node_helper->createElement('artifacts');
     foreach ($this->dao->searchArtifacts($tracker_id) as $row) {
         $artifact_exporter = new ArtifactXMLExporterArtifact($this->dao, $this->attachment_exporter, $this->node_helper, $this->logger);
         $artifact_node = $artifact_exporter->exportArtifact($tracker_id, $row);
         $artifacts_node->appendChild($artifact_node);
     }
     $this->node_helper->appendChild($artifacts_node);
 }
 private function createCommentNode(array $row)
 {
     $comment_node = $this->node_helper->createElement('comment');
     $this->node_helper->appendSubmittedBy($comment_node, $row['submitted_by'], $row['is_anonymous']);
     $this->node_helper->appendSubmittedOn($comment_node, $row['date']);
     $comment = Encoding_SupportedXmlCharEncoding::getXMLCompatibleString($row['comment']);
     $body = $this->node_helper->getNodeWithValue('body', $comment);
     $body->setAttribute('format', $this->getFormat($row['format']));
     $comment_node->appendChild($body);
     return $comment_node;
 }
 private function getBareChangeset($submitted_by, $is_anonymous, $submitted_on)
 {
     $changeset_node = $this->node_helper->createElement('changeset');
     $this->node_helper->appendSubmittedBy($changeset_node, $submitted_by, $is_anonymous);
     $this->node_helper->appendSubmittedOn($changeset_node, $submitted_on);
     $this->comment_exporter->createRootNode($changeset_node);
     return $changeset_node;
 }
 public function appendNode(DOMElement $artifact_node, $artifact_id)
 {
     $list_of_changesets = $artifact_node->getElementsByTagName('changeset');
     if ($list_of_changesets->length == 0) {
         return;
     }
     $permissions = $this->dao->searchPermsForArtifact($artifact_id);
     if (!count($permissions)) {
         return;
     }
     $last_changeset_node = $list_of_changesets->item($list_of_changesets->length - 1);
     $field_node = $this->node_helper->createElement('field_change');
     $field_node->setAttribute('field_name', 'permissions_on_artifact');
     $field_node->setAttribute('type', 'permissions_on_artifact');
     $field_node->setAttribute('use_perm', '1');
     foreach ($permissions as $row) {
         $ugroup_node = $this->node_helper->createElement('ugroup');
         $ugroup_node->setAttribute('ugroup_id', $row['ugroup_id']);
         $field_node->appendChild($ugroup_node);
     }
     $last_changeset_node->appendChild($field_node);
 }
 public function addFilesToArtifact(DOMElement $artifact_node, $artifact_type_id, $artifact_id)
 {
     $dar = $this->dao->searchFilesForArtifact($artifact_id);
     foreach ($dar as $row) {
         $xml_file_id = ArtifactAttachmentFieldXMLExporter::XML_FILE_PREFIX . $row['id'];
         $file = $this->node_helper->createElement('file');
         $file->setAttribute('id', $xml_file_id);
         $file->appendChild($this->node_helper->getNodeWithValue('filename', $row['filename']));
         $file->appendChild($this->node_helper->getNodeWithValue('path', $this->getPathRelativeToTv3RootPath($artifact_type_id, $row['id'])));
         $file->appendChild($this->node_helper->getNodeWithValue('filesize', $row['filesize']));
         $file->appendChild($this->node_helper->getNodeWithValue('filetype', $row['filetype']));
         $file->appendChild($this->node_helper->getNodeWithValue('description', $row['description']));
         $artifact_node->appendChild($file);
     }
 }
 public function addFilesToArtifact(DOMElement $artifact_node, $artifact_type_id, $artifact_id)
 {
     $dar = $this->dao->searchFilesForArtifact($artifact_id);
     if (count($dar)) {
         $this->archive->addEmptyDir(ArtifactXMLExporter::ARCHIVE_DATA_DIR);
     }
     foreach ($dar as $row) {
         $xml_file_id = ArtifactAttachmentFieldXMLExporter::XML_FILE_PREFIX . $row['id'];
         $path_in_archive = $this->getFilePathInArchive($xml_file_id);
         if ($this->skip_files) {
             $this->archive->addFromString($path_in_archive, '');
         } else {
             $this->archive->addFile($this->getFilePathOnServer($artifact_type_id, $row['id']), $path_in_archive);
         }
         $file = $this->node_helper->createElement('file');
         $file->setAttribute('id', $xml_file_id);
         $file->appendChild($this->node_helper->getNodeWithValue('filename', $row['filename']));
         $file->appendChild($this->node_helper->getNodeWithValue('path', $this->getFilePathInArchive($xml_file_id)));
         $file->appendChild($this->node_helper->getNodeWithValue('filesize', $row['filesize']));
         $file->appendChild($this->node_helper->getNodeWithValue('filetype', $row['filetype']));
         $file->appendChild($this->node_helper->getNodeWithValue('description', $row['description']));
         $artifact_node->appendChild($file);
     }
 }