/** * Retrieve all the OJS publication objects containing the * data required to generate the given O4DOI schema. * * @param $object Issue|PublishedArticle|ArticleGalley The object to export. * * @return array An array with the required OJS objects. */ function &retrievePublicationObjects(&$object) { // Initialize local variables. $nullVar = null; $journal =& $this->getJournal(); $cache =& $this->getCache(); // Retrieve basic OJS objects. $publicationObjects = parent::retrievePublicationObjects($object); // Retrieve additional related objects. // For articles and galleys: Retrieve all galleys of the article: if (is_a($object, 'PublishedArticle') || is_a($object, 'ArticleGalley')) { assert(isset($publicationObjects['article'])); $publicationObjects['galleysByArticle'] =& $this->retrieveGalleysByArticle($publicationObjects['article']); } // For issues: Retrieve all articles and galleys of the issue: if (is_a($object, 'Issue')) { // Articles by issue. assert(isset($publicationObjects['issue'])); $issue =& $publicationObjects['issue']; $publicationObjects['articlesByIssue'] =& $this->retrieveArticlesByIssue($issue); // Galleys by issue. $issueId = $issue->getId(); if (!$cache->isCached('galleysByIssue', $issueId)) { foreach ($publicationObjects['articlesByIssue'] as $article) { $this->retrieveGalleysByArticle($article); unset($article); } $cache->markComplete('galleysByIssue', $issueId); } $publicationObjects['galleysByIssue'] =& $cache->get('galleysByIssue', $issueId); } return $publicationObjects; }
/** * @see DOIExportDom::getObjectLocalePrecedence() * @param $suppFile SuppFile */ function getObjectLocalePrecedence(&$article, &$galley, &$suppFile) { $locales = array(); if (is_a($suppFile, 'SuppFile')) { // Try to map the supp-file language to a PKP locale. $suppFileLocale = $this->translateLanguageToLocale($suppFile->getLanguage()); if (!is_null($suppFileLocale)) { $locales[] = $suppFileLocale; } } // Retrieve further locales from the other objects. $locales = array_merge($locales, parent::getObjectLocalePrecedence($article, $galley)); return $locales; }
/** * @see DOIExportDom::getObjectLocalePrecedence() * @param $article Article * @param $galley Galley */ function getObjectLocalePrecedence(&$article, &$galley) { // Retrieve further locales from the other objects. return array_merge($locales, parent::getObjectLocalePrecedence($article, $galley)); }
/** * @see DOIExportDom::retrievePublicationObjects() */ function &retrievePublicationObjects(&$object) { // Initialize local variables. $nullVar = null; $journal =& $this->getJournal(); $cache =& $this->getCache(); // Retrieve basic OJS objects. $publicationObjects = parent::retrievePublicationObjects($object); // Retrieve additional related objects. // For articles: no additional objects needed for CrossRef: // galleys are not considered and // supp files will be retrieved when crating the XML // Note: article issue is already retrieved by the parent method if (is_a($object, 'PublishedArticle')) { $article =& $publicationObjects['article']; } // For issues: Retrieve all articles of the issue: if (is_a($object, 'Issue')) { // Articles by issue. assert(isset($publicationObjects['issue'])); $issue =& $publicationObjects['issue']; $publicationObjects['articlesByIssue'] =& $this->retrieveArticlesByIssue($issue); } return $publicationObjects; }
/** * @see DOIExportDom::getPrimaryObjectLocale() * @param $suppFile SuppFile */ function getPrimaryObjectLocale(&$article, &$galley, &$suppFile) { $primaryObjectLocale = null; if (is_a($suppFile, 'SuppFile')) { // Try to map the supp-file language to a PKP locale. $suppFileLanguage = $suppFile->getLanguage(); if (strlen($suppFileLanguage) == 2) { $suppFileLanguage = AppLocale::get3LetterFrom2LetterIsoLanguage($suppFileLanguage); } if (strlen($suppFileLanguage) == 3) { $primaryObjectLocale = AppLocale::getLocaleFrom3LetterIso($suppFileLanguage); } } // If mapping didn't work or we do not have a supp file then // retrieve the locale from the other objects. if (!AppLocale::isLocaleValid($primaryObjectLocale)) { $primaryObjectLocale = parent::getPrimaryObjectLocale($article, $galley); } return $primaryObjectLocale; }