/** * Replace various variables in the code template with data * relevant to the assigned article. * @param PublishedArticle $publishedArticle */ function replaceCodeVars($publishedArticle = null) { $application = Application::getApplication(); $request = $application->getRequest(); $router = $request->getRouter(); $context = $request->getContext(); $code = $this->getCode(); $codeVariables = array('journalUrl' => $router->url($request, null, 'index'), 'journalName' => $context->getLocalizedName()); if (isset($publishedArticle)) { $codeVariables = array_merge($codeVariables, array('articleUrl' => $router->url($request, null, 'article', 'view', $publishedArticle->getId()), 'articleTitle' => $publishedArticle->getLocalizedTitle())); } // Replace variables in message with values foreach ($codeVariables as $key => $value) { if (!is_object($value)) { $code = str_replace('{$' . $key . '}', $value, $code); } } $this->setCode($code); }
/** * @covers PubObjectCache */ public function testAddSeveralGalleys() { $nullVar = null; $cache = new PubObjectCache(); $article = new PublishedArticle(); $article->setId('2'); $article->setIssueId('1'); $articleGalley1 = new ArticleGalley(); $articleGalley1->setId('3'); $articleGalley1->setArticleId($article->getId()); $articleGalley2 = new ArticleGalley(); $articleGalley2->setId('4'); $articleGalley2->setArticleId($article->getId()); // Add galleys in the wrong order. $cache->add($articleGalley2, $article); $cache->add($articleGalley1, $article); $cache->markComplete('galleysByArticle', $article->getId()); // Retrieve them in the right order. $retrievedGalleys = $cache->get('galleysByArticle', $article->getId()); $expectedGalleys = array(3 => $articleGalley1, 4 => $articleGalley2); self::assertEquals($expectedGalleys, $retrievedGalleys); // And they should still be cached. self::assertTrue($cache->isCached('galleysByArticle', $article->getId())); }
/** * Class-specific methods for published submissions. * @param PublishedArticle $submission * @param DOMElement $node * @return PublishedArticle */ function populatePublishedSubmission($submission, $node) { $deployment = $this->getDeployment(); $issue = $deployment->getIssue(); $submission->setSequence($node->getAttribute('seq')); $submission->setAccessStatus($node->getAttribute('access_status')); $submission->setIssueId($issue->getId()); return $submission; }
function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$article, &$publishedArticle, &$errors, &$user, $isCommandLine, &$dependentItems) { $errors = array(); $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames()); // => journal locales must be set up before $journalPrimaryLocale = $journal->getPrimaryLocale(); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article = new Article(); $article->setLocale($journalPrimaryLocale); // FIXME in bug #5543 $article->setJournalId($journal->getId()); $article->setUserId($user->getId()); $article->setSectionId($section->getId()); $article->setStatus(STATUS_PUBLISHED); $article->setSubmissionProgress(0); $article->setDateSubmitted(Core::getCurrentDate()); $article->stampStatusModified(); $titleExists = false; for ($index = 0; $node = $articleNode->getChildByName('title', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleTitleLocaleUnsupported', array('articleTitle' => $node->getValue(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setTitle($node->getValue(), $locale); $titleExists = true; } if (!$titleExists || $article->getTitle($journalPrimaryLocale) == "") { $errors[] = array('plugins.importexport.native.import.error.articleTitleMissing', array('issueTitle' => $issue->getIssueIdentification(), 'sectionTitle' => $section->getLocalizedTitle())); return false; } for ($index = 0; $node = $articleNode->getChildByName('abstract', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleAbstractLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setAbstract($node->getValue(), $locale); } if ($indexingNode = $articleNode->getChildByName('indexing')) { for ($index = 0; $node = $indexingNode->getChildByName('discipline', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleDisciplineLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setDiscipline($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('type', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleTypeLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setType($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleSubjectLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setSubject($node->getValue(), $locale); } for ($index = 0; $node = $indexingNode->getChildByName('subject_class', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleSubjectClassLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setSubjectClass($node->getValue(), $locale); } if ($coverageNode = $indexingNode->getChildByName('coverage')) { for ($index = 0; $node = $coverageNode->getChildByName('geographical', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleCoverageGeoLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setCoverageGeo($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('chronological', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleCoverageChronLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setCoverageChron($node->getValue(), $locale); } for ($index = 0; $node = $coverageNode->getChildByName('sample', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleCoverageSampleLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setCoverageSample($node->getValue(), $locale); } } } for ($index = 0; $node = $articleNode->getChildByName('sponsor', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $journalPrimaryLocale; } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleSponsorLocaleUnsupported', array('articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $article->setSponsor($node->getValue(), $locale); } if ($node = $articleNode->getChildByName('pages')) { $article->setPages($node->getValue()); } if ($language = $articleNode->getAttribute('language')) { $article->setLanguage($language); } /* --- Handle authors --- */ $hasErrors = false; for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) { if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors)) { $errors = array_merge($errors, $authorErrors); $hasErrors = true; } } if ($hasErrors) { return false; } /* --- Handle covers --- */ for ($index = 0; $node = $articleNode->getChildByName('cover', $index); $index++) { if (!NativeImportDom::handleArticleCoverNode($journal, $node, $article, $coverErrors, $isCommandLine)) { $errors = array_merge($errors, $coverErrors); $hasErrors = true; } } for ($index = 0; $node = $articleNode->getChildByName('id', $index); $index++) { switch ($node->getAttribute('type')) { case 'doi': $article->setStoredDOI($node->getValue()); break; } } $articleDao->insertArticle($article); $dependentItems[] = array('article', $article); // Create submission mangement records $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $initialCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); $initialCopyeditSignoff->setUserId(0); $signoffDao->updateObject($initialCopyeditSignoff); $authorCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $authorCopyeditSignoff->setUserId(0); $signoffDao->updateObject($authorCopyeditSignoff); $finalCopyeditSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); $finalCopyeditSignoff->setUserId(0); $signoffDao->updateObject($finalCopyeditSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $authorProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $authorProofSignoff->setUserId(0); $signoffDao->updateObject($authorProofSignoff); $proofreaderProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId()); $proofreaderProofSignoff->setUserId(0); $signoffDao->updateObject($proofreaderProofSignoff); $layoutProofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutProofSignoff->setUserId(0); $signoffDao->updateObject($layoutProofSignoff); // Log the import in the article event log. import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); ArticleLog::logEvent($article->getId(), ARTICLE_LOG_ARTICLE_IMPORT, ARTICLE_LOG_TYPE_DEFAULT, 0, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getId())); // Insert published article entry. $publishedArticle = new PublishedArticle(); $publishedArticle->setArticleId($article->getId()); $publishedArticle->setIssueId($issue->getId()); if ($node = $articleNode->getChildByName('date_published')) { $publishedDate = strtotime($node->getValue()); if ($publishedDate === -1) { $errors[] = array('plugins.importexport.native.import.error.invalidDate', array('value' => $node->getValue())); return false; } else { $publishedArticle->setDatePublished($publishedDate); } } $node = $articleNode->getChildByName('open_access'); $publishedArticle->setAccessStatus($node ? ARTICLE_ACCESS_OPEN : ARTICLE_ACCESS_ISSUE_DEFAULT); $publishedArticle->setSeq(REALLY_BIG_NUMBER); $publishedArticle->setViews(0); $publishedArticle->setPublicArticleId($articleNode->getAttribute('public_id')); $publishedArticle->setPubId($publishedArticleDao->insertPublishedArticle($publishedArticle)); $publishedArticleDao->resequencePublishedArticles($section->getId(), $issue->getId()); /* --- Galleys (html or otherwise handled simultaneously) --- */ import('classes.file.ArticleFileManager'); $articleFileManager = new ArticleFileManager($article->getId()); /* --- Handle galleys --- */ $hasErrors = false; $galleyCount = 0; for ($index = 0; $index < count($articleNode->children); $index++) { $node = $articleNode->children[$index]; if ($node->getName() == 'htmlgalley') { $isHtml = true; } elseif ($node->getName() == 'galley') { $isHtml = false; } else { continue; } if (!NativeImportDom::handleGalleyNode($journal, $node, $issue, $section, $article, $galleyErrors, $isCommandLine, $isHtml, $galleyCount, $articleFileManager)) { $errors = array_merge($errors, $galleyErrors); $hasErrors = true; } $galleyCount++; unset($node); } if ($hasErrors) { return false; } /* --- Handle supplemental files --- */ $hasErrors = false; for ($index = 0; $node = $articleNode->getChildByName('supplemental_file', $index); $index++) { if (!NativeImportDom::handleSuppFileNode($journal, $node, $issue, $section, $article, $suppFileErrors, $isCommandLine, $articleFileManager)) { $errors = array_merge($errors, $suppFileErrors); $hasErrors = true; } } if ($hasErrors) { return false; } // Index the inserted article. import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); return true; }
function importArticles() { assert($this->xml->name == 'articles'); $articleDAO =& DAORegistry::getDAO('ArticleDAO'); $articles = $articleDAO->getArticlesByJournalId($this->journal->getId()); $journalFileManager = new JournalFileManager($this->journal); $publicFileManager =& new PublicFileManager(); $this->nextElement(); while ($this->xml->name == 'article') { $articleXML = $this->getCurrentElementAsDom(); $article = new Article(); $article->setJournalId($this->journal->getId()); $article->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleXML->userId)); $article->setSectionId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_SECTION, (int) $articleXML->sectionId)); $article->setLocale((string) $articleXML->locale); $article->setLanguage((string) $articleXML->language); $article->setCommentsToEditor((string) $articleXML->commentsToEditor); $article->setCitations((string) $articleXML->citations); $article->setDateSubmitted((string) $articleXML->dateSubmitted); $article->setDateStatusModified((string) $articleXML->dateStatusModified); $article->setLastModified((string) $articleXML->lastModified); $article->setStatus((int) $articleXML->status); $article->setSubmissionProgress((int) $articleXML->submissionProgress); $article->setCurrentRound((int) $articleXML->currentRound); $article->setPages((string) $articleXML->pages); $article->setFastTracked((int) $articleXML->fastTracked); $article->setHideAuthor((int) $articleXML->hideAuthor); $article->setCommentsStatus((int) $articleXML->commentsStatus); $articleDAO->insertArticle($article); $oldArticleId = (int) $articleXML->oldId; $this->restoreDataObjectSettings($articleDAO, $articleXML->settings, 'article_settings', 'article_id', $article->getId()); $article =& $articleDAO->getArticle($article->getId()); // Reload article with restored settings $covers = $article->getFileName(null); if ($covers) { foreach ($covers as $locale => $oldCoverFileName) { $sourceFile = $this->publicFolderPath . '/' . $oldCoverFileName; $extension = $publicFileManager->getExtension($oldCoverFileName); $destFile = 'cover_issue_' . $article->getId() . "_{$locale}.{$extension}"; $publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile); unlink($sourceFile); $article->setFileName($destFile, $locale); $articleDAO->updateArticle($article); } } $articleFileManager = new ArticleFileManager($article->getId()); $authorDAO =& DAORegistry::getDAO('AuthorDAO'); foreach ($articleXML->author as $authorXML) { $author = new Author(); $author->setArticleId($article->getId()); $author->setFirstName((string) $authorXML->firstName); $author->setMiddleName((string) $authorXML->middleName); $author->setLastName((string) $authorXML->lastName); $author->setSuffix((string) $authorXML->suffix); $author->setCountry((string) $authorXML->country); $author->setEmail((string) $authorXML->email); $author->setUrl((string) $authorXML->url); $author->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $authorXML->userGroupId)); $author->setPrimaryContact((int) $authorXML->primaryContact); $author->setSequence((int) $authorXML->sequence); $authorDAO->insertAuthor($author); $this->restoreDataObjectSettings($authorDAO, $authorXML->settings, 'author_settings', 'author_id', $author->getId()); unset($author); } $articleEmailLogDAO =& DAORegistry::getDAO('ArticleEmailLogDAO'); $emailLogsXML = array(); foreach ($articleXML->emailLogs->emailLog as $emailLogXML) { array_unshift($emailLogsXML, $emailLogXML); } foreach ($emailLogsXML as $emailLogXML) { $emailLog = new ArticleEmailLogEntry(); $emailLog->setAssocType(ASSOC_TYPE_ARTICLE); $emailLog->setAssocId($article->getId()); $emailLog->setSenderId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $emailLogXML->senderId)); $emailLog->setDateSent((string) $emailLogXML->dateSent); $emailLog->setIPAddress((string) $emailLogXML->IPAddress); $emailLog->setEventType((int) $emailLogXML->eventType); $emailLog->setFrom((string) $emailLogXML->from); $emailLog->setRecipients((string) $emailLogXML->recipients); $emailLog->setCcs((string) $emailLogXML->ccs); $emailLog->setBccs((string) $emailLogXML->bccs); $emailLog->setSubject((string) $emailLogXML->subject); $emailLog->setBody((string) $emailLogXML->body); $articleEmailLogDAO->insertObject($emailLog); $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $emailLogXML->oldId, $emailLog->getId()); } $articleFileDAO =& DAORegistry::getDAO('ArticleFileDAO'); foreach ($articleXML->articleFile as $articleFileXML) { try { $articleFile = new ArticleFile(); $articleFile->setArticleId($article->getId()); $articleFile->setSourceFileId((int) $articleFileXML->sourceFileId); $articleFile->setSourceRevision((int) $articleFileXML->sourceRevision); $articleFile->setRevision((int) $articleFileXML->revision); $articleFile->setFileName((string) $articleFileXML->fileName); $articleFile->setFileType((string) $articleFileXML->fileType); $articleFile->setFileSize((string) $articleFileXML->fileSize); $articleFile->setOriginalFileName((string) $articleFileXML->originalFileName); $articleFile->setFileStage((int) $articleFileXML->fileStage); $articleFile->setAssocId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $articleFileXML->assocId)); $articleFile->setDateUploaded((string) $articleFileXML->dateUploaded); $articleFile->setDateModified((string) $articleFileXML->dateModified); $articleFile->setRound((int) $articleFileXML->round); $articleFile->setViewable((int) $articleFileXML->viewable); $articleFileDAO->insertArticleFile($articleFile); $oldArticleFileId = (int) $articleFileXML->oldId; $oldFileName = $articleFile->getFileName(); $stagePath = $articleFileManager->fileStageToPath($articleFile->getFileStage()); $fileInTransferPackage = $this->journalFolderPath . "/articles/{$oldArticleId}/{$stagePath}/{$oldFileName}"; $newFileName = $articleFileManager->generateFilename($articleFile, $articleFile->getFileStage(), $articleFile->getOriginalFileName()); $newFilePath = "/articles/" . $article->getId() . "/{$stagePath}/{$newFileName}"; $journalFileManager->copyFile($fileInTransferPackage, $journalFileManager->filesDir . $newFilePath); unlink($fileInTransferPackage); $articleFileDAO->updateArticleFile($articleFile); $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, $oldArticleFileId, $articleFile->getFileId()); } catch (Exception $e) { } } $articleFiles = $articleFileDAO->getArticleFilesByArticle($article->getId()); foreach ($articleFiles as $articleFile) { try { $articleFile->setSourceFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, $articleFile->getSourceFileId())); $articleFileDAO->updateArticleFile($articleFile); } catch (Exception $e) { } } $suppFileDAO =& DAORegistry::getDAO('SuppFileDAO'); foreach ($articleXML->suppFile as $suppFileXML) { $suppFile =& new SuppFile(); $suppFile->setArticleId($article->getId()); $suppFile->setRemoteURL((string) $suppFileXML->remoteURL); $suppFile->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $suppFileXML->fileId)); $suppFile->setType((string) $suppFileXML->type); $suppFile->setDateCreated((string) $suppFileXML->dateCreated); $suppFile->setLanguage((string) $suppFileXML->language); $suppFile->setShowReviewers((int) $suppFileXML->showReviewers); $suppFile->setDateSubmitted((string) $suppFileXML->dateSubmitted); $suppFile->setSequence((int) $suppFileXML->sequence); $suppFileDAO->insertSuppFile($suppFile); $this->restoreDataObjectSettings($suppFileDAO, $suppFileXML->settings, 'article_supp_file_settings', 'supp_id', $suppFile->getId()); } $articleCommentDAO =& DAORegistry::getDAO('ArticleCommentDAO'); foreach ($articleXML->articleComment as $articleCommentXML) { $articleComment = new ArticleComment(); $articleComment->setArticleId($article->getId()); $articleComment->setAssocId($article->getId()); $articleComment->setCommentType((int) $articleCommentXML->commentType); $articleComment->setRoleId((int) $articleCommentXML->roleId); $articleComment->setAuthorId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleCommentXML->authorId)); $articleComment->setCommentTitle((string) $articleCommentXML->commentTitle); $articleComment->setComments((string) $articleCommentXML->comments); $articleComment->setDatePosted((string) $articleCommentXML->datePosted); $articleComment->setDateModified((string) $articleCommentXML->dateModified); $articleComment->setViewable((int) $articleCommentXML->viewable); $articleCommentDAO->insertArticleComment($articleComment); } $articleGalleyDAO =& DAORegistry::getDAO('ArticleGalleyDAO'); foreach ($articleXML->articleGalley as $articleGalleyXML) { $articleGalley = null; if ($articleGalleyXML->htmlGalley == "1") { $articleGalley = new ArticleHTMLGalley(); } else { $articleGalley = new ArticleGalley(); } $articleGalley->setArticleId($article->getId()); $articleGalley->setLocale((string) $articleGalleyXML->locale); $articleGalley->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyXML->fileId)); $articleGalley->setLabel((string) $articleGalleyXML->label); $articleGalley->setSequence((int) $articleGalleyXML->sequence); $articleGalley->setRemoteURL((string) $articleGalleyXML->remoteURL); if ($articleGalley instanceof ArticleHTMLGalley) { $articleGalley->setStyleFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyXML->styleFileId)); } $articleGalleyDAO->insertGalley($articleGalley); if ($articleGalley instanceof ArticleHTMLGalley) { foreach ($articleGalleyXML->htmlGalleyImage as $articleGalleyImageXML) { $imageId = $this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyImageXML); $articleGalleyDAO->insertGalleyImage($articleGalley->getId(), $imageId); } } $this->restoreDataObjectSettings($articleGalleyDAO, $articleGalleyXML->settings, 'article_galley_settings', 'galley_id', $articleGalley->getId()); } $noteDAO =& DAORegistry::getDAO('NoteDAO'); foreach ($articleXML->articleNote as $articleNoteXML) { $articleNote = new Note(); $articleNote->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleNoteXML->userId)); $articleNote->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleNoteXML->fileId)); $articleNote->setAssocType(ASSOC_TYPE_ARTICLE); $articleNote->setAssocId($article->getId()); $articleNote->setDateCreated((string) $articleNoteXML->dateCreated); $articleNote->setDateModified((string) $articleNoteXML->dateModified); $articleNote->setContents((string) $articleNoteXML->contents); $articleNote->setTitle((string) $articleNoteXML->title); $noteDAO->insertObject($articleNote); } $editAssignmentDAO =& DAORegistry::getDAO('EditAssignmentDAO'); foreach ($articleXML->editAssignment as $editAssignmentXML) { $editAssignment = new EditAssignment(); $editAssignment->setArticleId($article->getId()); $editAssignment->setEditorId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $editAssignmentXML->editorId)); $editAssignment->setCanReview((int) $editAssignmentXML->canReview); $editAssignment->setCanEdit((int) $editAssignmentXML->canEdit); $editAssignment->setDateUnderway((string) $editAssignmentXML->dateUnderway); $editAssignment->setDateNotified((string) $editAssignmentXML->dateNotified); $editAssignmentDAO->insertEditAssignment($editAssignment); } $reviewAssignmentDAO =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewFormResponseDAO =& DAORegistry::getDAO('ReviewFormResponseDAO'); foreach ($articleXML->reviewAssignment as $reviewAssignmentXML) { $reviewAssignment = new ReviewAssignment(); $reviewAssignment->setSubmissionId($article->getId()); $reviewAssignment->setReviewerId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $reviewAssignmentXML->reviewerId)); try { $reviewAssignment->setReviewerFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $reviewAssignmentXML->reviewerFileId)); } catch (Exception $e) { $this->logger->log("Arquivo do artigo {$oldArticleId} não encontrado. ID: " . (int) $reviewAssignmentXML->reviewerFileId . "\n"); } $reviewAssignment->setReviewFormId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM, (int) $reviewAssignmentXML->reviewFormId)); $reviewAssignment->setReviewRoundId((int) $reviewAssignmentXML->reviewRoundId); $reviewAssignment->setStageId((int) $reviewAssignmentXML->stageId); $reviewAssignment->setReviewerFullName((string) $reviewAssignmentXML->reviewerFullName); $reviewAssignment->setCompetingInterests((string) $reviewAssignmentXML->competingInterests); $reviewAssignment->setRegretMessage((string) $reviewAssignmentXML->regretMessage); $reviewAssignment->setRecommendation((string) $reviewAssignmentXML->recommendation); $reviewAssignment->setDateAssigned((string) $reviewAssignmentXML->dateAssigned); $reviewAssignment->setDateNotified((string) $reviewAssignmentXML->dateNotified); $reviewAssignment->setDateConfirmed((string) $reviewAssignmentXML->dateConfirmed); $reviewAssignment->setDateCompleted((string) $reviewAssignmentXML->dateCompleted); $reviewAssignment->setDateAcknowledged((string) $reviewAssignmentXML->dateAcknowledged); $reviewAssignment->setDateDue((string) $reviewAssignmentXML->dateDue); $reviewAssignment->setDateResponseDue((string) $reviewAssignmentXML->dateResponseDue); $reviewAssignment->setLastModified((string) $reviewAssignmentXML->lastModified); $reviewAssignment->setDeclined((int) $reviewAssignmentXML->declined); $reviewAssignment->setReplaced((int) $reviewAssignmentXML->replaced); $reviewAssignment->setCancelled((int) $reviewAssignmentXML->cancelled); $reviewAssignment->setQuality((int) $reviewAssignmentXML->quality); $reviewAssignment->setDateRated((string) $reviewAssignmentXML->dateRated); $reviewAssignment->setDateReminded((string) $reviewAssignmentXML->dateReminded); $reviewAssignment->setReminderWasAutomatic((int) $reviewAssignmentXML->reminderWasAutomatic); $reviewAssignment->setRound((int) $reviewAssignmentXML->round); $reviewAssignment->setReviewRevision((int) $reviewAssignmentXML->reviewRevision); $reviewAssignment->setReviewMethod((int) $reviewAssignmentXML->reviewMethod); $reviewAssignment->setUnconsidered((int) $reviewAssignmentXML->unconsidered); $reviewAssignmentDAO->insertObject($reviewAssignment); foreach ($reviewAssignmentXML->formResponses->formResponse as $formResponseXML) { $reviewFormResponseDAO->update('INSERT INTO review_form_responses (review_form_element_id, review_id, response_type, response_value) VALUES (?, ?, ?, ?)', array($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM_ELEMENT, (int) $formResponseXML->reviewFormElementId), $reviewAssignment->getId(), (string) $formResponseXML->responseType, (string) $formResponseXML->responseValue)); } } $signoffDAO =& DAORegistry::getDAO('SignoffDAO'); foreach ($articleXML->signoff as $signoffXML) { $signoff = new Signoff(); $signoff->setAssocType(ASSOC_TYPE_ARTICLE); $signoff->setAssocId($article->getId()); $signoff->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $signoffXML->userId)); $signoff->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $signoffXML->fileId)); $signoff->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $signoffXML->userGroupId)); $signoff->setSymbolic((string) $signoffXML->symbolic); $signoff->setFileRevision((int) $signoffXML->fileRevision); $signoff->setDateUnderway((string) $signoffXML->dateUnderway); $signoff->setDateNotified((string) $signoffXML->dateNotified); $signoff->setDateCompleted((string) $signoffXML->dateCompleted); $signoff->setDateAcknowledged((string) $signoffXML->dateAcknowledged); $signoffDAO->insertObject($signoff); } $editorSubmissionDAO =& DAORegistry::getDAO('EditorSubmissionDAO'); foreach ($articleXML->editDecisions as $editDecisionXML) { $editDecisions =& $editorSubmissionDAO->update('INSERT INTO edit_decisions (article_id, round, editor_id, decision, date_decided) values (?, ?, ?, ?, ?)', array($article->getId(), (string) $editDecisionXML->round, $this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $editDecisionXML->editorId), (string) $editDecisionXML->decision, (string) $editDecisionXML->dateDecided)); } $publishedArticleDAO =& DAORegistry::getDAO('PublishedArticleDAO'); if (isset($articleXML->publishedArticle)) { $publishedArticleXML = $articleXML->publishedArticle; $publishedArticle = new PublishedArticle(); $publishedArticle->setId($article->getId()); $publishedArticle->setIssueId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ISSUE, (int) $publishedArticleXML->issueId)); $publishedArticle->setDatePublished((string) $publishedArticleXML->datePublished); $publishedArticle->setSeq((int) $publishedArticleXML->seq); $publishedArticle->setAccessStatus((int) $publishedArticleXML->accessStatus); $publishedArticleDAO->insertPublishedArticle($publishedArticle); } $articleEventLogDAO =& DAORegistry::getDAO('ArticleEventLogDAO'); $eventLogsXML =& iterator_to_array($articleXML->eventLogs->eventLog); $eventLogsXML = array(); foreach ($articleXML->eventLogs->eventLog as $eventLogXML) { array_unshift($eventLogsXML, $eventLogXML); } foreach ($eventLogsXML as $eventLogXML) { $eventLog = new ArticleEventLogEntry(); $eventLog->setAssocType(ASSOC_TYPE_ARTICLE); $eventLog->setAssocId($article->getId()); $eventLog->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $eventLogXML->userId)); $eventLog->setDateLogged((string) $eventLogXML->dateLogged); $eventLog->setIPAddress((string) $eventLogXML->IPAddress); $eventLog->setEventType((int) $eventLogXML->eventType); $eventLog->setMessage((string) $eventLogXML->message); $eventLog->setIsTranslated((int) $eventLogXML->isTranslated); $articleEventLogDAO->insertObject($eventLog); $this->restoreDataObjectSettings($articleEventLogDAO, $eventLogXML->settings, 'event_log_settings', 'log_id', $eventLog->getId()); } try { $article->setSubmissionFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->submissionFileId)); } catch (Exception $e) { } try { $article->setRevisedFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->revisedFileId)); } catch (Exception $e) { } try { $article->setReviewFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->reviewFileId)); } catch (Exception $e) { } try { $article->setEditorFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->editorFileId)); } catch (Exception $e) { } $articleDAO->updateArticle($article); $this->nextElement(); } }
/** * Schedule/unschedule an article for publication. * @param $args array * @param $request object */ function scheduleForPublication($args, $request) { $articleId = (int) array_shift($args); $issueId = (int) $request->getUserVar('issueId'); $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT); $journal =& $request->getJournal(); $submission =& $this->submission; $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueById($issueId, $journal->getId()); if ($issue) { // Schedule against an issue. if ($publishedArticle) { $publishedArticle->setIssueId($issueId); $publishedArticleDao->updatePublishedArticle($publishedArticle); } else { $publishedArticle = new PublishedArticle(); $publishedArticle->setId($submission->getId()); $publishedArticle->setIssueId($issueId); $publishedArticle->setDatePublished(Core::getCurrentDate()); $publishedArticle->setSeq(REALLY_BIG_NUMBER); $publishedArticle->setViews(0); $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT); $publishedArticleDao->insertPublishedArticle($publishedArticle); // Resequence the articles. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId); // If we're using custom section ordering, and if this is the first // article published in a section, make sure we enter a custom ordering // for it. (Default at the end of the list.) if ($sectionDao->customSectionOrderingExists($issueId)) { if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) { $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER); $sectionDao->resequenceCustomSectionOrders($issueId); } } } } else { if ($publishedArticle) { // This was published elsewhere; make sure we don't // mess up sequencing information. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $publishedArticle->getIssueId()); $publishedArticleDao->deletePublishedArticleByArticleId($articleId); } } $submission->stampStatusModified(); if ($issue && $issue->getPublished()) { $submission->setStatus(STATUS_PUBLISHED); } else { $submission->setStatus(STATUS_QUEUED); } $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission); $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling'); }
/** * creates and returns a published article object from a row, including all supp files etc. * @param $row array * @param $callHooks boolean Whether or not to call hooks * @return PublishedArticle object */ function &_returnPublishedArticleFromRow($row, $callHooks = true) { $publishedArticle = new PublishedArticle(); $publishedArticle->setPublishedArticleId($row['published_article_id']); $publishedArticle->setIssueId($row['issue_id']); $publishedArticle->setDatePublished($this->datetimeFromDB($row['date_published'])); $publishedArticle->setSeq($row['seq']); $publishedArticle->setAccessStatus($row['access_status']); $publishedArticle->setGalleys($this->galleyDao->getGalleysByArticle($row['article_id'])); // Article attributes $this->articleDao->_articleFromRow($publishedArticle, $row); $publishedArticle->setSuppFiles($this->suppFileDao->getSuppFilesByArticle($row['article_id'])); if ($callHooks) { HookRegistry::call('PublishedArticleDAO::_returnPublishedArticleFromRow', array(&$publishedArticle, &$row)); } return $publishedArticle; }
/** * Schedule/unschedule an article for publication. * @param $args array * @param $request object */ function scheduleForPublication($args, $request) { $articleId = (int) array_shift($args); $issueId = (int) $request->getUserVar('issueId'); $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT); $journal =& $request->getJournal(); $submission =& $this->submission; $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueById($issueId, $journal->getId()); if ($publishedArticle) { if (!$issue || !$issue->getPublished()) { $fromIssue =& $issueDao->getIssueById($publishedArticle->getIssueId(), $journal->getId()); if ($fromIssue->getPublished()) { // Insert article tombstone import('classes.article.ArticleTombstoneManager'); $articleTombstoneManager = new ArticleTombstoneManager(); $articleTombstoneManager->insertArticleTombstone($submission, $journal); } } } import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); if ($issue) { // Schedule against an issue. if ($publishedArticle) { $publishedArticle->setIssueId($issueId); $publishedArticle->setSeq(REALLY_BIG_NUMBER); $publishedArticleDao->updatePublishedArticle($publishedArticle); // Re-index the published article metadata. $articleSearchIndex->articleMetadataChanged($publishedArticle); } else { $publishedArticle = new PublishedArticle(); $publishedArticle->setId($submission->getId()); $publishedArticle->setIssueId($issueId); $publishedArticle->setDatePublished(Core::getCurrentDate()); $publishedArticle->setSeq(REALLY_BIG_NUMBER); $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT); $publishedArticleDao->insertPublishedArticle($publishedArticle); // If we're using custom section ordering, and if this is the first // article published in a section, make sure we enter a custom ordering // for it. (Default at the end of the list.) if ($sectionDao->customSectionOrderingExists($issueId)) { if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) { $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER); $sectionDao->resequenceCustomSectionOrders($issueId); } } // Index the published article metadata and files for the first time. $articleSearchIndex->articleMetadataChanged($publishedArticle); $articleSearchIndex->articleFilesChanged($publishedArticle); } } else { if ($publishedArticle) { // This was published elsewhere; make sure we don't // mess up sequencing information. $issueId = $publishedArticle->getIssueId(); $publishedArticleDao->deletePublishedArticleByArticleId($articleId); // Delete the article from the search index. $articleSearchIndex->articleFileDeleted($articleId); } } // Resequence the articles. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId); $submission->stampStatusModified(); if ($issue && $issue->getPublished()) { $submission->setStatus(STATUS_PUBLISHED); // delete article tombstone $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO'); $tombstoneDao->deleteByDataObjectId($submission->getId()); } else { $submission->setStatus(STATUS_QUEUED); } $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission); // Call initialize permissions again to check if copyright year needs to be initialized. $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article = $articleDao->getArticle($articleId); $article->initializePermissions(); $articleDao->updateLocaleFields($article); $articleSearchIndex->articleChangesFinished(); $request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling'); }
/** * Activate mock DAOs for authors, galleys and supp files * and return a test article. * * @return Article */ private function _getTestArticle() { // Activate the mock DAOs. $this->_registerMockAuthorDAO(); $this->_registerMockIssueDAO(); $this->_registerMockJournalDAO(); $this->_registerMockArticleGalleyDAO(); $this->_registerMockSuppFileDAO(); // Create a test article. $article = new PublishedArticle(); $article->setId(3); $article->setJournalId(2); $article->setIssueId(2); $article->setSectionId(1); $article->setStatus(STATUS_PUBLISHED); $article->setTitle('Deutscher Titel', 'de_DE'); $article->setTitle('English Title', 'en_US'); $article->setAbstract('Deutsche Zusammenfassung', 'de_DE'); $article->setAbstract('English Abstract', 'en_US'); $article->setDiscipline('Sozialwissenschaften', 'de_DE'); $article->setDiscipline('Social Sciences', 'en_US'); $article->setSubject('Thema', 'de_DE'); $article->setSubjectClass('Ein Themengebiet', 'de_DE'); $article->setSubject('subject', 'en_US'); $article->setSubjectClass('Uma classe de temas', 'pt_BR'); $article->setType('Typ', 'de_DE'); $article->setType('type', 'en_US'); $article->setCoverageGeo('Kaltes Kap', 'de_DE'); $article->setCoverageGeo('Cabo Frio', 'pt_BR'); $article->setCoverageChron('Sommer 2012', 'de_DE'); $article->setCoverageChron('Summer 2012', 'en_US'); $article->setCoverageSample('Alles', 'de_DE'); $article->setCoverageSample('everything', 'en_US'); $article->setDatePublished('2012-03-15 16:45:00'); $article->setLocale('de_DE'); return $article; }
/** * Class-specific methods for published submissions. * @param PublishedArticle $submission * @param DOMElement $node * @return PublishedArticle */ function populatePublishedSubmission($submission, $node) { $deployment = $this->getDeployment(); $issue = $deployment->getIssue(); if (empty($issue)) { $issueIdentificationNodes = $node->getElementsByTagName('issue_identification'); if ($issueIdentificationNodes->length != 1) { $titleNodes = $node->getElementsByTagName('title'); $deployment->addError(ASSOC_TYPE_SUBMISSION, $submission->getId(), __('plugins.importexport.native.import.error.issueIdentificationMissing', array('articleTitle' => $titleNodes->item(0)->textContent))); } else { $issueIdentificationNode = $issueIdentificationNodes->item(0); $issue = $this->parseIssueIdentification($issueIdentificationNode); } } $submission->setSequence($node->getAttribute('seq')); $submission->setAccessStatus($node->getAttribute('access_status')); if ($issue) { $submission->setIssueId($issue->getId()); } return $submission; }
/** * Schedule an article for publication in a given issue */ function scheduleForPublication($articleId, $issueId) { $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $issueDao =& DAORegistry::getDAO('IssueDAO'); $request =& $this->request; $journal =& $request->getJournal(); $submission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); $issue =& $issueDao->getIssueById($issueId, $journal->getId()); if ($issue) { // Schedule against an issue. if ($publishedArticle) { $publishedArticle->setIssueId($issueId); $publishedArticleDao->updatePublishedArticle($publishedArticle); } else { $publishedArticle = new PublishedArticle(); $publishedArticle->setId($submission->getId()); $publishedArticle->setIssueId($issueId); $publishedArticle->setDatePublished($this->getData('datePublished')); $publishedArticle->setSeq(REALLY_BIG_NUMBER); $publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT); $publishedArticleDao->insertPublishedArticle($publishedArticle); // Resequence the articles. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId); // If we're using custom section ordering, and if this is the first // article published in a section, make sure we enter a custom ordering // for it. (Default at the end of the list.) if ($sectionDao->customSectionOrderingExists($issueId)) { if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) { $sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER); $sectionDao->resequenceCustomSectionOrders($issueId); } } } } else { if ($publishedArticle) { // This was published elsewhere; make sure we don't // mess up sequencing information. $publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $publishedArticle->getIssueId()); $publishedArticleDao->deletePublishedArticleByArticleId($articleId); } } $submission->stampStatusModified(); if ($issue && $issue->getPublished()) { $submission->setStatus(STATUS_PUBLISHED); if ($publishedArticle && !$publishedArticle->getDatePublished()) { $publishedArticle->setDatePublished($issue->getDatePublished()); } } else { $submission->setStatus(STATUS_QUEUED); } $sectionEditorSubmissionDao->updateSectionEditorSubmission($submission); // Call initialize permissions again to check if copyright year needs to be initialized. $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article = $articleDao->getArticle($articleId); $article->initializePermissions(); $articleDao->updateLocaleFields($article); }
/** * Activate mock DAOs for authors, galleys and supp files * and return a test article. * * @return Article */ private function _getTestArticle() { // Activate the mock DAOs. $this->_registerMockAuthorDAO(); $this->_registerMockIssueDAO(); $this->_registerMockJournalDAO(); $this->_registerMockArticleGalleyDAO(); // Create a test article. $article = new PublishedArticle(); $article->setId(3); $article->setJournalId(2); $article->setIssueId(2); $article->setSectionId(1); $article->setStatus(STATUS_PUBLISHED); $article->setTitle('Deutscher Titel', 'de_DE'); $article->setTitle('English Title', 'en_US'); $article->setAbstract('Deutsche Zusammenfassung', 'de_DE'); $article->setAbstract('English Abstract', 'en_US'); $article->setDiscipline('Sozialwissenschaften', 'de_DE'); $article->setDiscipline('Social Sciences', 'en_US'); $article->setSubject('Thema', 'de_DE'); $article->setSubject('subject', 'en_US'); $article->setType('Typ', 'de_DE'); $article->setType('type', 'en_US'); $article->setDatePublished('2012-03-15 16:45:00'); $article->setLocale('de_DE'); return $article; }