Skip to content

Commit

Permalink
ojs 3.3.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrause committed Nov 30, 2021
1 parent 706b120 commit f5c520b
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 172 deletions.
27 changes: 20 additions & 7 deletions RSCIExportPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ function manage($args, $request) {
return parent::manage($args, $request);
}

private $_context;

/**
* Get the zip with XML for an issue.
* @param $issueId int
* @param $context Context
* @return string XML contents representing the supplied issue IDs.
*/
function exportIssue($issueId)
function exportIssue($issueId, $context)
{
$issueDao = DAORegistry::getDAO('IssueDAO');
$issue = $issueDao->getById($issueId);
Expand Down Expand Up @@ -152,18 +155,28 @@ protected function _uploadZip($issueId, $xml)
$coverName = end($coverUrlParts);
$fileManager->copyFile($coverUrl, $this->getExportPath() . $coverName);

$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$articles = $publishedArticleDao->getPublishedArticles($issue->getId());
$request = Registry::get('request', false);
$context = $request->getContext();
$submissionsIterator = Services::get('submission')->getMany([
'contextId' => $context->getId(),
'issueId' => $issue->getId()
]);
/** @var Submission[] $publiations */
$submissions = iterator_to_array($submissionsIterator);
// $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
// $articles = $publishedArticleDao->getPublishedArticles($issue->getId());
$articleGalleyDAO = DAORegistry::getDAO('ArticleGalleyDAO');

foreach ($articles as $article)
foreach ($submissions as $submission)
{
/** @var Publication $publication */
$publication = $submission->getCurrentPublication();
/** @var ArticleGalley $galley */
$galley = $articleGalleyDAO->getBySubmissionId($article->getId())->next();
$articleFilePath = $galley->getFile()->getFilePath();
$galley = $articleGalleyDAO->getByPublicationId($publication->getId())->next();
$articleFilePath = $galley->getFile()->getData('path');
$fileParts = explode('.', $articleFilePath);
$fileExtension = end($fileParts);
$pages = $article->getPages();
$pages = $publication->getData('pages');
$fileManager->copyFile($articleFilePath, $this->getExportPath() . $pages . '.' . $fileExtension);
}

Expand Down
Loading

0 comments on commit f5c520b

Please sign in to comment.