function &generateTrackDom(&$doc, &$schedConf, &$track) { $root =& XMLCustomWriter::createElement($doc, 'track'); if (is_array($track->getTitle(null))) { foreach ($track->getTitle(null) as $locale => $title) { $titleNode =& XMLCustomWriter::createChildWithText($doc, $root, 'title', $title, false); if ($titleNode) { XMLCustomWriter::setAttribute($titleNode, 'locale', $locale); } unset($titleNode); } } if (is_array($track->getAbbrev(null))) { foreach ($track->getAbbrev(null) as $locale => $abbrev) { $abbrevNode =& XMLCustomWriter::createChildWithText($doc, $root, 'abbrev', $abbrev, false); if ($abbrevNode) { XMLCustomWriter::setAttribute($abbrevNode, 'locale', $locale); } unset($abbrevNode); } } if (is_array($track->getIdentifyType(null))) { foreach ($track->getIdentifyType(null) as $locale => $identifyType) { $identifyTypeNode =& XMLCustomWriter::createChildWithText($doc, $root, 'identify_type', $identifyType, false); if ($identifyTypeNode) { XMLCustomWriter::setAttribute($identifyTypeNode, 'locale', $locale); } unset($identifyTypeNode); } } if (is_array($track->getPolicy(null))) { foreach ($track->getPolicy(null) as $locale => $policy) { $policyNode =& XMLCustomWriter::createChildWithText($doc, $root, 'policy', $policy, false); if ($policyNode) { XMLCustomWriter::setAttribute($policyNode, 'locale', $locale); } unset($policyNode); } } $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO'); foreach ($publishedPaperDao->getPublishedPapersByTrackId($track->getId(), $schedConf->getId()) as $paper) { $paperNode =& NativeExportDom::generatePaperDom($doc, $schedConf, $track, $paper); XMLCustomWriter::appendChild($root, $paperNode); unset($paperNode); } return $root; }
function exportPapers(&$results, $outputFile = null) { $this->import('NativeExportDom'); $doc =& XMLCustomWriter::createDocument('papers', NATIVE_DTD_ID, NATIVE_DTD_URL); $papersNode =& XMLCustomWriter::createElement($doc, 'papers'); XMLCustomWriter::appendChild($doc, $papersNode); foreach ($results as $result) { $paper =& $result['publishedPaper']; $track =& $result['track']; $conference =& $result['conference']; $schedConf =& $result['schedConf']; $paperNode =& NativeExportDom::generatePaperDom($doc, $schedConf, $track, $paper); XMLCustomWriter::appendChild($papersNode, $paperNode); } if (!empty($outputFile)) { if (($h = fopen($outputFile, 'w')) === false) { return false; } fwrite($h, XMLCustomWriter::getXML($doc)); fclose($h); } else { header("Content-Type: application/xml"); header("Cache-Control: private"); header("Content-Disposition: attachment; filename=\"papers.xml\""); XMLCustomWriter::printXML($doc); } return true; }