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); } }