/**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'xMetaDiss:xMetaDiss');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'xmlns:xMetaDiss', 'http://www.d-nb.de/standards/xmetadissplus/');
     XMLCustomWriter::setAttribute($root, 'xmlns:cc', 'http://www.d-nb.de/standards/cc/');
     XMLCustomWriter::setAttribute($root, 'xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     XMLCustomWriter::setAttribute($root, 'xmlns:dcmitype', 'http://purl.org/dc/dcmitype');
     XMLCustomWriter::setAttribute($root, 'xmlns:dcterms', 'http://purl.org/dc/terms/');
     XMLCustomWriter::setAttribute($root, 'xmlns:ddb', 'http://www.d-nb.de/standards/ddb/');
     XMLCustomWriter::setAttribute($root, 'xmlns:doi', 'http://www.d-nb.de/standards/doi/');
     XMLCustomWriter::setAttribute($root, 'xmlns:hdl', 'http://www.d-nb.de/standards/hdl/');
     XMLCustomWriter::setAttribute($root, 'xmlns:pc', 'http://www.d-nb.de/standards/pc/');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.d-nb.de/standards/subject/');
     XMLCustomWriter::setAttribute($root, 'xmlns:thesis', 'http://www.ndltd.org/standards/metadata/etdms/1.0/');
     XMLCustomWriter::setAttribute($root, 'xmlns:urn', 'http://www.d-nb.de/standards/urn/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.d-nb.de/standards/xmetadissplus/ http://www.d-nb.de/standards/xmetadissplus/xmetadissplus.xsd');
     // Prepare the XMDP document hierarchy from the XMDP MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
Example #2
0
 /**
  * Construct the sitemap
  * @return XMLNode
  */
 function createJournalSitemap()
 {
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'urlset');
     XMLCustomWriter::setAttribute($root, 'xmlns', SITEMAP_XSD_URL);
     // Journal home
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'index', 'index')));
     // About page
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'editorialTeam')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'editorialPolicies')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'submissions')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'siteMap')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'aboutThisPublishingSystem')));
     // Search
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search', 'authors')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search', 'titles')));
     // Issues
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'current')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'archive')));
     $publishedIssues =& $issueDao->getPublishedIssues($journalId);
     while ($issue =& $publishedIssues->next()) {
         XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'view', $issue->getId())));
         // Articles for issue
         $articles = $publishedArticleDao->getPublishedArticles($issue->getId());
         foreach ($articles as $article) {
             // Abstract
             XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'article', 'view', array($article->getId()))));
             // Galley files
             $galleys = $galleyDao->getGalleysByArticle($article->getId());
             foreach ($galleys as $galley) {
                 XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'article', 'view', array($article->getId(), $galley->getId()))));
             }
         }
         unset($issue);
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
 /**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'mods');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'version', '3.4');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'http://www.loc.gov/mods/v3');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd');
     // Prepare the MODS document hierarchy from the MODS MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
 /**
  * @copydoc Filter::process()
  * @param $input MetadataDescription
  */
 function &process(&$input)
 {
     // Start the XML document.
     $doc =& XMLCustomWriter::createDocument();
     // Create the root element.
     $root =& XMLCustomWriter::createElement($doc, 'epicur');
     // Add the XML namespace and schema.
     XMLCustomWriter::setAttribute($root, 'xmlns:epicur', 'urn:nbn:de:1111-2004033116');
     XMLCustomWriter::setAttribute($root, 'xmlns', 'urn:nbn:de:1111-2004033116');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'urn:nbn:de:1111-2004033116 http://www.persistent-identifier.de/xepicur/version1.0/xepicur.xsd');
     // Prepare the XMDP document hierarchy from the XMDP MetadataDescription instance.
     $documentHierarchy =& $this->_buildDocumentHierarchy($doc, $root, $input);
     // Recursively join the document hierarchy into a single document.
     $root =& $this->_joinNodes($documentHierarchy);
     XMLCustomWriter::appendChild($doc, $root);
     // Retrieve the XML from the DOM.
     $output = XMLCustomWriter::getXml($doc);
     return $output;
 }
 function exportArticle(&$journal, &$issue, &$article, &$galley, $outputFile = null)
 {
     $this->import('EruditExportDom');
     $doc =& XMLCustomWriter::createDocument('article', '-//ERUDIT//Erudit Article DTD 3.0.0//EN', 'http://www.erudit.org/dtd/article/3.0.0/en/eruditarticle.dtd');
     $articleNode =& EruditExportDom::generateArticleDom($doc, $journal, $issue, $article, $galley);
     XMLCustomWriter::appendChild($doc, $articleNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === 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=\"erudit.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
Example #6
0
 /**
  * Export a journal's content
  * @param $journal object
  * @param $outputFile string
  */
 function exportJournal(&$journal, $outputFile = null)
 {
     $this->import('DOAJExportDom');
     $doc =& XMLCustomWriter::createDocument();
     $journalNode =& DOAJExportDom::generateJournalDom($doc, $journal);
     $journalNode->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $journalNode->setAttribute('xsi:noNamespaceSchemaLocation', DOAJ_XSD_URL);
     XMLCustomWriter::appendChild($doc, $journalNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === 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=\"journal-" . $journal->getId() . ".xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
Example #7
0
 /**
  * Retrieve the XML for a batch of articles to be updated.
  *
  * @param $articles DBResultFactory The articles to be included
  *  in the list.
  * @param $totalCount integer The overall number of changed articles
  *  (not only the current batch).
  * @param $numDeleted integer An output parameter that returns
  *  the number of documents that will be deleted.
  *
  * @return string The XML ready to be consumed by the Solr data
  *  import service.
  */
 function _getArticleListXml(&$articles, $totalCount, &$numDeleted)
 {
     // Create the DOM document.
     $articleDoc =& XMLCustomWriter::createDocument();
     assert(is_a($articleDoc, 'DOMDocument'));
     // Create the root node.
     $articleList =& XMLCustomWriter::createElement($articleDoc, 'articleList');
     XMLCustomWriter::appendChild($articleDoc, $articleList);
     // Run through all articles in the batch and generate an
     // XML list for them.
     $numDeleted = 0;
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     /* @var $publishedArticleDao PublishedArticleDAO */
     foreach ($articles as $article) {
         if (!is_a($article, 'PublishedArticle')) {
             // Try to upgrade the article to a published article.
             $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($article->getId());
             if (is_a($publishedArticle, 'PublishedArticle')) {
                 unset($article);
                 $article =& $publishedArticle;
                 unset($publishedArticle);
             }
         }
         $journal = $this->_getJournal($article->getJournalId());
         // Check the publication state and subscription state of the article.
         if ($this->_isArticleAccessAuthorized($article)) {
             // Mark the article for update.
             $this->_addArticleXml($articleDoc, $article, $journal);
         } else {
             // Mark the article for deletion.
             $numDeleted++;
             $this->_addArticleXml($articleDoc, $article, $journal, true);
         }
         unset($journal, $article);
     }
     // Add the "has more" attribute so that the server knows
     // whether more batches may have to be pulled (useful for
     // pull indexing only).
     $hasMore = count($articles) < $totalCount ? 'yes' : 'no';
     $articleDoc->documentElement->setAttribute('hasMore', $hasMore);
     // Return XML.
     return XMLCustomWriter::getXml($articleDoc);
 }
 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;
 }
Example #9
0
 /**
  * Construct a sitemap for a scheduled conference
  * @return XMLNode
  */
 function createSchedConfSitemap()
 {
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $conference =& Request::getConference();
     $conferenceId = $conference->getId();
     $schedConf = Request::getSchedConf();
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'urlset');
     XMLCustomWriter::setAttribute($root, 'xmlns', SITEMAP_XSD_URL);
     // Sched. Conf. home
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath())));
     // About page
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'submissions')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'siteMap')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'aboutThisPublishingSystem')));
     // Search
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'authors')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'titles')));
     // Conference Information
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'overview')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'trackPolicies')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'presentations')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'accommodation')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'location')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'organizingTeam')));
     // Individual Papers
     $publishedPapers =& $publishedPaperDao->getPublishedPapers($schedConf->getId());
     while ($paper =& $publishedPapers->next()) {
         // Abstract
         XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', $paper->getId())));
         // Galley files
         $galleys = $galleyDao->getGalleysByPaper($paper->getId());
         foreach ($galleys as $galley) {
             XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getId(), $galley->getId()))));
         }
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
 /**
  * Export the selected email templates as XML
  * @param $args array
  * @@param $request PKPRequest
  */
 function exportEmails($args, $request)
 {
     $this->validate();
     import('lib.pkp.classes.xml.XMLCustomWriter');
     $selectedEmailKeys = (array) $request->getUserVar('tplId');
     if (empty($selectedEmailKeys)) {
         $request->redirect(null, null, 'emails');
     }
     $journal = Request::getJournal();
     $doc = XMLCustomWriter::createDocument();
     $emailTexts = XMLCustomWriter::createElement($doc, 'email_texts');
     $emailTexts->setAttribute('locale', AppLocale::getLocale());
     $emailTexts->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $emailTemplateDao = DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplates = $emailTemplateDao->getEmailTemplates(AppLocale::getLocale(), $journal->getId());
     foreach ($emailTemplates as $emailTemplate) {
         $emailKey = $emailTemplate->getData('emailKey');
         if (!in_array($emailKey, $selectedEmailKeys)) {
             continue;
         }
         $subject = $emailTemplate->getData('subject');
         $body = $emailTemplate->getData('body');
         $emailTextNode = XMLCustomWriter::createElement($doc, 'email_text');
         XMLCustomWriter::setAttribute($emailTextNode, 'key', $emailKey);
         //append subject node
         $subjectNode = XMLCustomWriter::createChildWithText($doc, $emailTextNode, 'subject', $subject, false);
         XMLCustomWriter::appendChild($emailTextNode, $subjectNode);
         //append body node
         $bodyNode = XMLCustomWriter::createChildWithText($doc, $emailTextNode, 'body', $body, false);
         XMLCustomWriter::appendChild($emailTextNode, $bodyNode);
         //append email_text node
         XMLCustomWriter::appendChild($emailTexts, $emailTextNode);
     }
     XMLCustomWriter::appendChild($doc, $emailTexts);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"email-templates-" . date('Y-m-d-H-i-s') . ".xml\"");
     XMLCustomWriter::printXML($doc);
 }
Example #11
0
 /**
  * Constructor
  * @param $request Request
  * @param $plugin DOIExportPlugin
  * @param $journal Journal
  * @param $objectCache PubObjectCache
  */
 function DOIExportDom($request, $plugin, $journal, $objectCache)
 {
     // Configure the DOM.
     $this->_doc = XMLCustomWriter::createDocument();
     $this->_request = $request;
     $this->_plugin = $plugin;
     $this->_journal = $journal;
     $this->_cache = $objectCache;
 }
 function exportIssues(&$journal, &$issues)
 {
     $this->import('MetsExportDom');
     $doc =& XMLCustomWriter::createDocument('', null);
     $root =& XMLCustomWriter::createElement($doc, 'METS:mets');
     XMLCustomWriter::setAttribute($root, 'xmlns:METS', 'http://www.loc.gov/METS/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xlink', 'http://www.w3.org/TR/xlink');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'PROFILE', 'Australian METS Profile 1.0');
     XMLCustomWriter::setAttribute($root, 'TYPE', 'journal');
     XMLCustomWriter::setAttribute($root, 'OBJID', 'J-' . $journal->getJournalId());
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/METS/ http://www.loc.gov/mets/mets.xsd');
     $HeaderNode =& MetsExportDom::createmetsHdr($doc);
     XMLCustomWriter::appendChild($root, $HeaderNode);
     MetsExportDom::generateJournalDmdSecDom($doc, $root, $journal);
     $fileSec =& XMLCustomWriter::createElement($doc, 'METS:fileSec');
     $fileGrpOriginal =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrpOriginal, 'USE', 'original');
     $fileGrpDerivative =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrpDerivative, 'USE', 'derivative');
     foreach ($issues as $issue) {
         MetsExportDom::generateIssueDmdSecDom($doc, $root, $issue, $journal);
         MetsExportDom::generateIssueFileSecDom($doc, $fileGrpOriginal, $issue);
         MetsExportDom::generateIssueHtmlGalleyFileSecDom($doc, $fileGrpDerivative, $issue);
     }
     $amdSec =& MetsExportDom::createmetsamdSec($doc, $root, $journal);
     XMLCustomWriter::appendChild($root, $amdSec);
     XMLCustomWriter::appendChild($fileSec, $fileGrpOriginal);
     XMLCustomWriter::appendChild($fileSec, $fileGrpDerivative);
     XMLCustomWriter::appendChild($root, $fileSec);
     MetsExportDom::generateStructMap($doc, $root, $journal, $issues);
     XMLCustomWriter::appendChild($doc, $root);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"" . $journal->getPath() . "-mets.xml\"");
     XMLCustomWriter::printXML($doc);
     return true;
 }
Example #13
0
 /**
  * Constructor
  * @param $request Request
  * @param $plugin DOIExportPlugin
  * @param $journal Journal
  * @param $objectCache PubObjectCache
  */
 function DOIExportDom(&$request, &$plugin, &$journal, &$objectCache)
 {
     // Configure the DOM.
     $this->_doc =& XMLCustomWriter::createDocument();
     $this->_request =& $request;
     $this->_plugin =& $plugin;
     $this->_journal =& $journal;
     $this->_cache =& $objectCache;
 }
Example #14
0
 function &getMetadataPage($pageNum, &$errors)
 {
     import('xml.XMLCustomWriter');
     import('db.DBResultRange');
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $falseVar = false;
     if ($pageNum < 1) {
         return $falseVar;
     }
     $rangeInfo =& new DBResultRange(GOOGLE_SCHOLAR_ITEMS_PER_PAGE, $pageNum);
     $document =& XMLCustomWriter::createDocument('articles', 'articles.dtd');
     $articlesNode =& XMLCustomWriter::createElement($document, 'articles');
     XMLCustomWriter::appendChild($document, $articlesNode);
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticles =& $publishedArticleDao->getPublishedArticlesByJournalId($journalId, $rangeInfo);
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueCache = array();
     while ($publishedArticle =& $publishedArticles->next()) {
         $articleNode =& XMLCustomWriter::createElement($document, 'article');
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
         $frontNode =& XMLCustomWriter::createElement($document, 'front');
         XMLCustomWriter::appendChild($articleNode, $frontNode);
         $journalMetaNode =& XMLCustomWriter::createElement($document, 'journal-meta');
         XMLCustomWriter::appendChild($frontNode, $journalMetaNode);
         // Journal Metadata
         $journal =& Request::getJournal();
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'journal-title', $journal->getJournalTitle(), true);
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'abbrev-journal-title', $journal->getLocalizedSetting('initials'), false);
         $issn = $journal->getSetting('onlineIssn');
         if (empty($issn)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noIssn'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'issn', $issn, false);
         $publisherNode =& XMLCustomWriter::createElement($document, 'publisher');
         $publisherName = $this->getSetting($journalId, 'publisher-name');
         if (empty($publisherName)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noPublisherName'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $publisherNode, 'publisher-name', $publisherName, true);
         XMLCustomWriter::appendChild($journalMetaNode, $publisherNode);
         $articleMetaNode =& XMLCustomWriter::createElement($document, 'article-meta');
         XMLCustomWriter::appendChild($frontNode, $articleMetaNode);
         // Article Metadata
         $titleGroupNode =& XMLCustomWriter::createElement($document, 'title-group');
         XMLCustomWriter::appendChild($articleMetaNode, $titleGroupNode);
         $titles = $publishedArticle->getTitle(null);
         $primaryLocale = $journal->getPrimaryLocale();
         XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'article-title', $titles[$primaryLocale], true);
         unset($titles[$primaryLocale]);
         foreach ($titles as $locale => $title) {
             XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'trans-title', $title, false);
         }
         $contribGroupNode =& XMLCustomWriter::createElement($document, 'contrib-group');
         XMLCustomWriter::appendChild($articleMetaNode, $contribGroupNode);
         foreach ($publishedArticle->getAuthors() as $author) {
             $contribNode =& XMLCustomWriter::createElement($document, 'contrib');
             XMLCustomWriter::appendChild($contribGroupNode, $contribNode);
             XMLCustomWriter::setAttribute($contribNode, 'contrib-type', 'author');
             $nameNode =& XMLCustomWriter::createElement($document, 'name');
             XMLCustomWriter::appendChild($contribNode, $nameNode);
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'surname', $author->getAuthorLastName(), true);
             // Given names in the form: FirstName MiddleName, where MiddleName is optional
             $name = $author->getAuthorFirstName();
             // Opatan Inc. : gets Localized author firstName
             if (($middleName = $author->getAuthorMiddleName()) != '') {
                 $name .= " {$middleName}";
             }
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'given-names', $name, true);
         }
         $dateParts = getdate(strtotime($publishedArticle->getDatePublished()));
         $pubDateNode =& XMLCustomWriter::createElement($document, 'pub-date');
         XMLCustomWriter::appendChild($articleMetaNode, $pubDateNode);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'day', $dateParts['mday']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'month', $dateParts['mon']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'year', $dateParts['year']);
         $issueId = $publishedArticle->getIssueId();
         if (!isset($issueCache[$issueId])) {
             $issueCache[$issueId] =& $issueDao->getIssueById($issueId);
         }
         $issue =& $issueCache[$issueId];
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'volume', $issue->getVolume());
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'issue', $issue->getNumber());
         $canonicalUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
         XMLCustomWriter::setAttribute($canonicalUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId())));
         XMLCustomWriter::appendChild($articleMetaNode, $canonicalUriNode);
         foreach ($publishedArticle->getGalleys() as $galley) {
             $galleyUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
             if ($galley->isHTMLGalley()) {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             } else {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewFile', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             }
             XMLCustomWriter::appendChild($articleMetaNode, $galleyUriNode);
         }
         unset($issue);
     }
     return $document;
 }
 /**
  * Build article XML using DOM elements
  * @param $args Parameters to the plugin
  *
  * The DOM for this XML was developed according to the NLM
  * Standard Publisher Data Format:
  * http://www.ncbi.nlm.nih.gov/entrez/query/static/spec.html
  */
 function &generatePubMedDom()
 {
     // create the output XML document in DOM with a root node
     $doc =& XMLCustomWriter::createDocument('ArticleSet', PUBMED_DTD_ID, PUBMED_DTD_URL);
     return $doc;
 }
Example #16
0
 function &exportUsers(&$journal, &$users, $allowedRoles = null)
 {
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $doc =& XMLCustomWriter::createDocument('users', USERS_DTD_ID, USERS_DTD_URL);
     $root =& XMLCustomWriter::createElement($doc, 'users');
     foreach ($users as $user) {
         $userNode =& XMLCustomWriter::createElement($doc, 'user');
         XMLCustomWriter::createChildWithText($doc, $userNode, 'username', $user->getUserName(), false);
         $passwordNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'password', $user->getPassword());
         XMLCustomWriter::setAttribute($passwordNode, 'encrypted', Config::getVar('security', 'encryption'));
         XMLCustomWriter::createChildWithText($doc, $userNode, 'salutation', $user->getSalutation(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'first_name', $user->getFirstName());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'middle_name', $user->getMiddleName(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'last_name', $user->getLastName());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'initials', $user->getInitials(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'gender', $user->getGender(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'email', $user->getEmail());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'url', $user->getUrl(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'phone', $user->getPhone(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'fax', $user->getFax(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'mailing_address', $user->getMailingAddress(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'country', $user->getCountry(), false);
         if (is_array($user->getAffiliation(null))) {
             foreach ($user->getAffiliation(null) as $locale => $value) {
                 $affiliationNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'affiliation', $value, false);
                 if ($affiliationNode) {
                     XMLCustomWriter::setAttribute($affiliationNode, 'locale', $locale);
                 }
                 unset($affiliationNode);
             }
         }
         if (is_array($user->getSignature(null))) {
             foreach ($user->getSignature(null) as $locale => $value) {
                 $signatureNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'signature', $value, false);
                 if ($signatureNode) {
                     XMLCustomWriter::setAttribute($signatureNode, 'locale', $locale);
                 }
                 unset($signatureNode);
             }
         }
         $interestsNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'interests', $user->getInterests(), false);
         if ($interestsNode) {
             XMLCustomWriter::setAttribute($interestsNode, 'locale', $locale);
         }
         if (is_array($user->getGossip(null))) {
             foreach ($user->getGossip(null) as $locale => $value) {
                 $gossipNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'gossip', $value, false);
                 if ($gossipNode) {
                     XMLCustomWriter::setAttribute($gossipNode, 'locale', $locale);
                 }
                 unset($gossipNode);
             }
         }
         if (is_array($user->getBiography(null))) {
             foreach ($user->getBiography(null) as $locale => $value) {
                 $biographyNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'biography', $value, false);
                 if ($biographyNode) {
                     XMLCustomWriter::setAttribute($biographyNode, 'locale', $locale);
                 }
                 unset($biographyNode);
             }
         }
         XMLCustomWriter::createChildWithText($doc, $userNode, 'locales', join(':', $user->getLocales()), false);
         $roles =& $roleDao->getRolesByUserId($user->getId(), $journal->getId());
         foreach ($roles as $role) {
             $rolePath = $role->getRolePath();
             if ($allowedRoles !== null && !in_array($rolePath, $allowedRoles)) {
                 continue;
             }
             $roleNode =& XMLCustomWriter::createElement($doc, 'role');
             XMLCustomWriter::setAttribute($roleNode, 'type', $rolePath);
             XMLCustomWriter::appendChild($userNode, $roleNode);
             unset($roleNode);
         }
         XMLCustomWriter::appendChild($root, $userNode);
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
 /**
  * Index rebuild cleanup: mark select options as clean.
  */
 function callbackFinish($hookName, $args)
 {
     $searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
     $searchFormElements =& $searchFormElementDao->getSearchFormElements();
     while ($searchFormElement =& $searchFormElements->next()) {
         $searchFormElement->setIsClean(true);
         $searchFormElementDao->updateSearchFormElement($searchFormElement);
         unset($searchFormElement);
     }
     if ($this->isUsingSolr()) {
         import('lib.pkp.classes.xml.XMLCustomWriter');
         $doc =& XMLCustomWriter::createDocument('commit', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'commit');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
         $doc =& XMLCustomWriter::createDocument('optimize', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'optimize');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
     } else {
         $index =& $this->getIndex();
         $index->optimize();
     }
 }
 function exportArticles(&$results, $outputFile = null)
 {
     $this->import('NativeExportDom');
     $doc =& XMLCustomWriter::createDocument('articles', NATIVE_DTD_ID, NATIVE_DTD_URL);
     $articlesNode =& XMLCustomWriter::createElement($doc, 'articles');
     XMLCustomWriter::appendChild($doc, $articlesNode);
     foreach ($results as $result) {
         $article =& $result['publishedArticle'];
         $section =& $result['section'];
         $issue =& $result['issue'];
         $journal =& $result['journal'];
         $articleNode =& NativeExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
     }
     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=\"articles.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
 /**
  * Build article XML using DOM elements
  * @return XMLNode
  */
 function &generateCrossRefDom()
 {
     // create the output XML document in DOM with a root node
     $doc =& XMLCustomWriter::createDocument();
     return $doc;
 }
Example #20
0
 function exportSchedConfs(&$conference, &$schedConfIdArray)
 {
     $this->import('MetsExportDom');
     $schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'METS:mets');
     XMLCustomWriter::setAttribute($root, 'xmlns:METS', 'http://www.loc.gov/METS/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xlink', 'http://www.w3.org/TR/xlink');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'PROFILE', 'Australian METS Profile 1.0');
     XMLCustomWriter::setAttribute($root, 'TYPE', 'conference');
     XMLCustomWriter::setAttribute($root, 'OBJID', 'C-' . $conference->getId());
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/METS/ http://www.loc.gov/mets/mets.xsd');
     $headerNode =& MetsExportDom::createmetsHdr($doc);
     XMLCustomWriter::appendChild($root, $headerNode);
     MetsExportDom::generateConfDmdSecDom($doc, $root, $conference);
     $fileSec =& XMLCustomWriter::createElement($doc, 'METS:fileSec');
     $fileGrp =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrp, 'USE', 'original');
     $i = 0;
     while ($i < sizeof($schedConfIdArray)) {
         $schedConf =& $schedConfDAO->getSchedConf($schedConfIdArray[$i]);
         MetsExportDom::generateSchedConfDmdSecDom($doc, $root, $conference, $schedConf);
         MetsExportDom::generateSchedConfFileSecDom($doc, $fileGrp, $conference, $schedConf);
         $i++;
     }
     $amdSec =& MetsExportDom::createmetsamdSec($doc, $root, $conference);
     XMLCustomWriter::appendChild($root, $amdSec);
     XMLCustomWriter::appendChild($fileSec, $fileGrp);
     XMLCustomWriter::appendChild($root, $fileSec);
     MetsExportDom::generateConfstructMapWithSchedConfsIdArray($doc, $root, $conference, $schedConfIdArray);
     XMLCustomWriter::appendChild($doc, $root);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"" . $conference->getPath() . "-mets.xml\"");
     XMLCustomWriter::printXML($doc);
     return true;
 }
 /**
  * Export public identifiers of one or more issues.
  * @param $journal object
  * @param $issues array
  * @param $outputFile xml file containing the exported public identifiers
  */
 function exportPubIdsForIssues($journal, $issues, $outputFile = null)
 {
     $doc =& XMLCustomWriter::createDocument('pubIds', PID_DTD_URL, PID_DTD_URL);
     $pubIdsNode =& XMLCustomWriter::createElement($doc, 'pubIds');
     XMLCustomWriter::appendChild($doc, $pubIdsNode);
     foreach ($issues as $issue) {
         $this->generatePubId($doc, $pubIdsNode, $issue, $journal->getId());
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         foreach ($publishedArticleDao->getPublishedArticles($issue->getId()) as $publishedArticle) {
             $this->generatePubId($doc, $pubIdsNode, $publishedArticle, $journal->getId());
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $galleys = $articleGalleyDao->getBySubmissionId($publishedArticle->getId());
             while ($galley = $galleys->next()) {
                 $this->generatePubId($doc, $pubIdsNode, $galley, $journal->getId());
             }
         }
     }
     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=\"pubIds.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
Example #22
0
 /**
  * Build paper XML using DOM elements
  * @param $args Parameters to the plugin
  *
  * The DOM for this XML was developed according to the NLM 
  * Standard Publisher Data Format: 
  * http://www.ncbi.nlm.nih.gov/entrez/query/static/spec.html
  */
 function &generateNLMDom()
 {
     // create the output XML document in DOM with a root node
     $doc =& XMLCustomWriter::createDocument('InputMeetingAbstractSet', NLM_DTD_ID, NLM_DTD_URL);
     return $doc;
 }
Example #23
0
 /**
  * Export a journal's content
  * @param $journal object
  * @param $outputFile string
  */
 function exportJournal(&$journal, $outputFile = null)
 {
     $this->import('DOAJExportDom');
     $doc =& XMLCustomWriter::createDocument('journal', DOAJ_XSD_URL);
     $journalNode =& DOAJExportDom::generateJournalDom($doc, $journal);
     XMLCustomWriter::appendChild($doc, $journalNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === 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=\"journal-" . $journal->getJournalId() . ".xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }