本文整理汇总了PHP中ArticleSearchIndex::articleChangesFinished方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::articleChangesFinished方法的具体用法?PHP ArticleSearchIndex::articleChangesFinished怎么用?PHP ArticleSearchIndex::articleChangesFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::articleChangesFinished方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
/**
* @see Filter::process()
* @param $document DOMDocument|string
* @return array Array of imported documents
*/
function &process(&$document)
{
$importedObjects =& parent::process($document);
// Index imported content
import('classes.search.ArticleSearchIndex');
foreach ($importedObjects as $submission) {
assert(is_a($submission, 'Submission'));
ArticleSearchIndex::articleMetadataChanged($submission);
ArticleSearchIndex::submissionFilesChanged($submission);
}
ArticleSearchIndex::articleChangesFinished();
return $importedObjects;
}
示例2: deleteSubmission
/**
* Delete a submission.
* @param $args array
* @param $request PKPRequest
*/
function deleteSubmission($args, $request)
{
$articleId = (int) array_shift($args);
$this->validate($request, $articleId);
$authorSubmission =& $this->submission;
$this->setupTemplate($request, true);
// If the submission is incomplete, allow the author to delete it.
if ($authorSubmission->getSubmissionProgress() != 0) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->deleteArticleById($articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
}
$request->redirect(null, null, 'index');
}
示例3: publishIssue
/**
* Publish issue
* @param $args array
* @param $request Request
*/
function publishIssue($args, $request)
{
$issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE);
$issueId = $issue->getId();
$journal = $request->getJournal();
$journalId = $journal->getId();
$articleSearchIndex = null;
if (!$issue->getPublished()) {
$confirmationText = __('editor.issues.confirmPublish');
import('controllers.grid.pubIds.form.AssignPublicIdentifiersForm');
$formTemplate = $this->getAssignPublicIdentifiersFormTemplate();
$assignPublicIdentifiersForm = new AssignPublicIdentifiersForm($formTemplate, $issue, true, $confirmationText);
if (!$request->getUserVar('confirmed')) {
// Display assign pub ids modal
$assignPublicIdentifiersForm->initData($args, $request);
return new JSONMessage(true, $assignPublicIdentifiersForm->fetch($request));
}
// Asign pub ids
$assignPublicIdentifiersForm->readInputData();
$assignPublicIdentifiersForm->execute($request);
// Set the status of any attendant queued articles to STATUS_PUBLISHED.
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$articleDao = DAORegistry::getDAO('ArticleDAO');
$publishedArticles = $publishedArticleDao->getPublishedArticles($issueId);
foreach ($publishedArticles as $publishedArticle) {
$article = $articleDao->getById($publishedArticle->getId());
if ($article && $article->getStatus() == STATUS_QUEUED) {
$article->setStatus(STATUS_PUBLISHED);
$article->stampStatusModified();
$articleDao->updateObject($article);
if (!$articleSearchIndex) {
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
}
$articleSearchIndex->articleMetadataChanged($publishedArticle);
}
// delete article tombstone
$tombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($article->getId());
}
}
$issue->setCurrent(1);
$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());
// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
$delayDuration = $journal->getSetting('delayedOpenAccessDuration');
$delayYears = (int) floor($delayDuration / 12);
$delayMonths = (int) fmod($delayDuration, 12);
$curYear = date('Y');
$curMonth = date('n');
$curDay = date('j');
$delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
$delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
$issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
$issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
}
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueDao->updateCurrent($journalId, $issue);
if ($articleSearchIndex) {
$articleSearchIndex->articleChangesFinished();
}
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationUsers = array();
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$allUsers = $userGroupDao->getUsersByContextId($journalId);
while ($user = $allUsers->next()) {
$notificationUsers[] = array('id' => $user->getId());
}
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
return DAO::getDataChangedEvent();
}
示例4: expedite
/**
* Expedites a submission through the submission process, if the submitter is a manager or editor.
* @param $args array
* @param $request PKPRequest
*/
function expedite($args, $request)
{
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
$user = $request->getUser();
$form = new IssueEntryPublicationMetadataForm($submission->getId(), $user, null, array('expeditedSubmission' => true));
if ($submission && (int) $request->getUserVar('issueId') > 0) {
// Process our submitted form in order to create the published article entry.
$form->readInputData();
if ($form->validate()) {
$form->execute($request);
// Create trivial notification in place on the form, and log the event.
$notificationManager = new NotificationManager();
$user = $request->getUser();
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
// Log consts
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedIssueMetadata')));
// For indexing
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
// Now, create a galley for this submission. Assume PDF, and set to 'available'.
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalley = $articleGalleyDao->newDataObject();
$articleGalley->setGalleyType('pdfarticlegalleyplugin');
$articleGalley->setIsApproved(true);
$articleGalley->setSubmissionId($submission->getId());
$articleGalley->setLocale($submission->getLocale());
$articleGalley->setLabel('PDF');
$articleGalley->setSeq($articleGalleyDao->getNextGalleySequence($submission->getId()));
$articleGalleyId = $articleGalleyDao->insertObject($articleGalley);
// Next, create a galley PROOF file out of the submission file uploaded.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
// SUBMISSION_FILE_... constants
$submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), SUBMISSION_FILE_SUBMISSION);
// Watch for a single file, or any PDFs.
foreach ($submissionFiles as $submissionFile) {
// test both mime type and file extension in case the mime type isn't correct after uploading.
if (count($submissionFiles) == 1 || $submissionFile->getFileType() == 'application/pdf' || preg_match('/\\.pdf$/', $submissionFile->getOriginalFileName())) {
// Get the path of the current file because we change the file stage in a bit.
$currentFilePath = $submissionFile->getFilePath();
// this will be a new file based on the old one.
$submissionFile->setFileId(null);
$submissionFile->setRevision(1);
$submissionFile->setFileStage(SUBMISSION_FILE_PROOF);
$submissionFile->setAssocType(ASSOC_TYPE_GALLEY);
$submissionFile->setAssocId($articleGalleyId);
$submissionFileDao->insertObject($submissionFile, $currentFilePath);
// Update file index
$articleSearchIndex->submissionFileChanged($submission->getId(), SUBMISSION_SEARCH_GALLEY_FILE, $submissionFile->getFileId());
break;
}
}
// Update index
$articleSearchIndex->articleMetadataChanged($submission);
$articleSearchIndex->articleChangesFinished();
// no errors, clear all notifications for this submission which may have been created during the submission process and close the modal.
$context = $request->getContext();
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationFactory = $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), null, null, $context->getId());
return new JSONMessage(true);
} else {
return new JSONMessage(true, $form->fetch($request));
}
}
return new JSONMessage(true, $form->fetch($request));
}
示例5: execute
/**
* Save changes to the galley.
* @return int the galley ID
*/
function execute($fileName = null, $createRemote = false)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->articleId);
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$fileName = isset($fileName) ? $fileName : 'galleyFile';
$journal =& Request::getJournal();
$fileId = null;
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($this->articleId, $journal->getId());
if (isset($this->galley)) {
$galley =& $this->galley;
// Upload galley file
if ($articleFileManager->uploadedFileExists($fileName)) {
if ($galley->getFileId()) {
$articleFileManager->uploadPublicFile($fileName, $galley->getFileId());
$fileId = $galley->getFileId();
} else {
$fileId = $articleFileManager->uploadPublicFile($fileName);
$galley->setFileId($fileId);
}
// Update file search index
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleFileChanged($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
$articleSearchIndex->articleChangesFinished();
}
if ($articleFileManager->uploadedFileExists('styleFile')) {
// Upload stylesheet file
$styleFileId = $articleFileManager->uploadPublicFile('styleFile', $galley->getStyleFileId());
$galley->setStyleFileId($styleFileId);
} else {
if ($this->getData('deleteStyleFile')) {
// Delete stylesheet file
$styleFile =& $galley->getStyleFile();
if (isset($styleFile)) {
$articleFileManager->deleteFile($styleFile->getFileId());
}
}
}
// Update existing galley
$galley->setLabel($this->getData('label'));
if ($journal->getSetting('enablePublicGalleyId')) {
$galley->setStoredPubId('publisher-id', $this->getData('publicGalleyId'));
}
$galley->setLocale($this->getData('galleyLocale'));
if ($this->getData('remoteURL')) {
$galley->setRemoteURL($this->getData('remoteURL'));
}
// consider the additional field names from the public identifer plugins
import('classes.plugins.PubIdPluginHelper');
$pubIdPluginHelper = new PubIdPluginHelper();
$pubIdPluginHelper->execute($this, $galley);
parent::execute();
$galleyDao->updateGalley($galley);
} else {
// Upload galley file
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileType = $articleFileManager->getUploadedFileType($fileName);
$fileId = $articleFileManager->uploadPublicFile($fileName);
}
if (isset($fileType) && strstr($fileType, 'html')) {
// Assume HTML galley
$galley = new ArticleHTMLGalley();
} else {
$galley = new ArticleGalley();
}
$galley->setArticleId($this->articleId);
$galley->setFileId($fileId);
if ($this->getData('label') == null) {
// Generate initial label based on file type
$enablePublicGalleyId = $journal->getSetting('enablePublicGalleyId');
if ($galley->isHTMLGalley()) {
$galley->setLabel('HTML');
if ($enablePublicGalleyId) {
$galley->setStoredPubId('publisher-id', 'html');
}
} else {
if ($createRemote) {
$galley->setLabel(__('common.remote'));
$galley->setRemoteURL(__('common.remoteURL'));
if ($enablePublicGalleyId) {
$galley->setStoredPubId('publisher-id', strtolower(__('common.remote')));
}
} else {
if (isset($fileType)) {
if (strstr($fileType, 'pdf')) {
$galley->setLabel('PDF');
if ($enablePublicGalleyId) {
$galley->setStoredPubId('publisher-id', 'pdf');
}
} else {
if (strstr($fileType, 'postscript')) {
$galley->setLabel('PostScript');
if ($enablePublicGalleyId) {
$galley->setStoredPubId('publisher-id', 'ps');
//.........这里部分代码省略.........
示例6: execute
//.........这里部分代码省略.........
assert($submitterAssignment);
// At least one author should be assigned
$queuedPayment =& $paymentManager->createQueuedPayment($context->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submitterAssignment->getUserId() : $user->getId(), $submission->getId(), $markAsPaid ? $context->getSetting('publicationFee') : 0, $markAsPaid ? $context->getSetting('currency') : '');
$paymentManager->queuePayment($queuedPayment);
// Since this is a waiver, fulfill the payment immediately
$paymentManager->fulfillQueuedPayment($request, $queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
} else {
// Get the issue for publication.
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueId = $this->getData('issueId');
$issue = $issueDao->getById($issueId, $context->getId());
$sectionDao = DAORegistry::getDAO('SectionDAO');
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
/* @var $publishedArticle PublishedArticle */
if ($publishedArticle) {
if (!$issue || !$issue->getPublished()) {
$fromIssue = $issueDao->getById($publishedArticle->getIssueId(), $context->getId());
if ($fromIssue->getPublished()) {
// Insert article tombstone
import('classes.article.ArticleTombstoneManager');
$articleTombstoneManager = new ArticleTombstoneManager();
$articleTombstoneManager->insertArticleTombstone($submission, $context);
}
}
}
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
// define the access status for the article if none is set.
$accessStatus = $this->getData('accessStatus') != '' ? $this->getData('accessStatus') : ARTICLE_ACCESS_ISSUE_DEFAULT;
$articleDao = DAORegistry::getDAO('ArticleDAO');
if (!is_null($this->getData('pages'))) {
$submission->setPages($this->getData('pages'));
}
if ($issue) {
// Schedule against an issue.
if ($publishedArticle) {
$publishedArticle->setIssueId($issueId);
$publishedArticle->setSequence(REALLY_BIG_NUMBER);
$publishedArticle->setDatePublished($this->getData('datePublished'));
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
// Re-index the published article metadata.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
} else {
$publishedArticle = $publishedArticleDao->newDataObject();
$publishedArticle->setId($submission->getId());
$publishedArticle->setIssueId($issueId);
$publishedArticle->setDatePublished(Core::getCurrentDate());
$publishedArticle->setSequence(REALLY_BIG_NUMBER);
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticleDao->insertObject($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->submissionFilesChanged($publishedArticle);
}
} else {
if ($publishedArticle) {
// This was published elsewhere; make sure we don't
// mess up sequencing information.
$issueId = $publishedArticle->getIssueId();
$publishedArticleDao->deletePublishedArticleByArticleId($submission->getId());
// Delete the article from the search index.
$articleSearchIndex->submissionFileDeleted($submission->getId());
}
}
if ($this->getData('attachPermissions')) {
$submission->setCopyrightYear($this->getData('copyrightYear'));
$submission->setCopyrightHolder($this->getData('copyrightHolder'), null);
// Localized
$submission->setLicenseURL($this->getData('licenseURL'));
} else {
$submission->setCopyrightYear(null);
$submission->setCopyrightHolder(null, null);
$submission->setLicenseURL(null);
}
// 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);
}
$articleDao->updateObject($submission);
$articleSearchIndex->articleChangesFinished();
}
}
示例7: expediteSubmission
/**
* Rush a new submission into the end of the editing queue.
* @param $article object
*/
function expediteSubmission($article, $request)
{
$user =& $request->getUser();
import('classes.submission.editor.EditorAction');
import('classes.submission.sectionEditor.SectionEditorAction');
import('classes.submission.proofreader.ProofreaderAction');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
$submissionFile = $sectionEditorSubmission->getSubmissionFile();
// Add a log entry before doing anything.
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
ArticleLog::logEvent($request, $article, ARTICLE_LOG_EDITOR_EXPEDITE, 'log.editor.submissionExpedited', array('editorName' => $user->getFullName()));
// 1. Ensure that an editor is assigned.
$editAssignments =& $sectionEditorSubmission->getEditAssignments();
if (empty($editAssignments)) {
// No editors are currently assigned; assign self.
EditorAction::assignEditor($article->getId(), $user->getId(), true, false, $request);
}
// 2. Accept the submission and send to copyediting.
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
if (!$sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true)) {
SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT, $request);
$reviewFile = $sectionEditorSubmission->getReviewFile();
SectionEditorAction::setCopyeditFile($sectionEditorSubmission, $reviewFile->getFileId(), $reviewFile->getRevision(), $request);
}
// 3. Add a galley.
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($article->getId());
$galleys =& $sectionEditorSubmission->getGalleys();
$articleSearchIndex = null;
if (empty($galleys)) {
// No galley present -- use copyediting file.
import('classes.file.ArticleFileManager');
$copyeditFile =& $sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL');
$fileType = $copyeditFile->getFileType();
$articleFileManager = new ArticleFileManager($article->getId());
$fileId = $articleFileManager->copyPublicFile($copyeditFile->getFilePath(), $fileType);
if (strstr($fileType, 'html')) {
$galley = new ArticleHTMLGalley();
} else {
$galley = new ArticleGalley();
}
$galley->setArticleId($article->getId());
$galley->setFileId($fileId);
$galley->setLocale(AppLocale::getLocale());
if ($galley->isHTMLGalley()) {
$galley->setLabel('HTML');
} else {
if (strstr($fileType, 'pdf')) {
$galley->setLabel('PDF');
} else {
if (strstr($fileType, 'postscript')) {
$galley->setLabel('Postscript');
} else {
if (strstr($fileType, 'xml')) {
$galley->setLabel('XML');
} else {
$galley->setLabel(__('common.untitled'));
}
}
}
}
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$galleyDao->insertGalley($galley);
// Update file search index
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleFileChanged($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $fileId);
}
$sectionEditorSubmission->setStatus(STATUS_QUEUED);
$sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
if ($articleSearchIndex) {
$articleSearchIndex->articleChangesFinished();
}
}
示例8: updateSection
/**
* Changes the section.
* @param $submission object
* @param $sectionId int
*/
function updateSection($submission, $sectionId)
{
if (HookRegistry::call('SectionEditorAction::updateSection', array(&$submission, &$sectionId))) {
return;
}
$submissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$submission->setSectionId($sectionId);
// FIXME validate this ID?
$submissionDao->updateSectionEditorSubmission($submission);
// Reindex the submission (may be required to update section-specific ranking).
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($submission);
$articleSearchIndex->articleChangesFinished();
}
示例9: deleteArticleById
/**
* Delete an article by ID.
* @param $articleId int
*/
function deleteArticleById($articleId)
{
$this->authorDao->deleteAuthorsByArticle($articleId);
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticleDao->deletePublishedArticleByArticleId($articleId);
$commentDao =& DAORegistry::getDAO('CommentDAO');
$commentDao->deleteBySubmissionId($articleId);
$noteDao =& DAORegistry::getDAO('NoteDAO');
$noteDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$sectionEditorSubmissionDao->deleteDecisionsByArticle($articleId);
$sectionEditorSubmissionDao->deleteReviewRoundsByArticle($articleId);
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignmentDao->deleteBySubmissionId($articleId);
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignmentDao->deleteEditAssignmentsByArticle($articleId);
// Delete copyedit, layout, and proofread signoffs
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$copyedInitialSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
$copyedAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$copyedFinalSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
$layoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadProofreaderSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadLayoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$signoffs = array($copyedInitialSignoffs, $copyedAuthorSignoffs, $copyedFinalSignoffs, $layoutSignoffs, $proofreadAuthorSignoffs, $proofreadProofreaderSignoffs, $proofreadLayoutSignoffs);
foreach ($signoffs as $signoff) {
if ($signoff) {
$signoffDao->deleteObject($signoff);
}
}
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$articleCommentDao->deleteArticleComments($articleId);
$articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalleyDao->deleteGalleysByArticle($articleId);
$articleSearchDao =& DAORegistry::getDAO('ArticleSearchDAO');
$articleSearchDao->deleteArticleKeywords($articleId);
$articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
$articleEventLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
$articleEmailLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$notificationDao =& DAORegistry::getDAO('NotificationDAO');
$notificationDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFileDao->deleteSuppFilesByArticle($articleId);
// Delete article files -- first from the filesystem, then from the database
import('classes.file.ArticleFileManager');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$articleFiles =& $articleFileDao->getArticleFilesByArticle($articleId);
$articleFileManager = new ArticleFileManager($articleId);
foreach ($articleFiles as $articleFile) {
$articleFileManager->deleteFile($articleFile->getFileId());
}
$articleFileDao->deleteArticleFiles($articleId);
// Delete article citations.
$citationDao =& DAORegistry::getDAO('CitationDAO');
$citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
$this->update('DELETE FROM article_settings WHERE article_id = ?', $articleId);
$this->update('DELETE FROM articles WHERE article_id = ?', $articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
$this->flushCache();
}
示例10: deleteById
/**
* Delete an article by ID.
* @param $articleId int
*/
function deleteById($articleId)
{
parent::deleteById($articleId);
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticleDao->deletePublishedArticleByArticleId($articleId);
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalleyDao->deleteGalleysByArticle($articleId);
$articleSearchDao = DAORegistry::getDAO('ArticleSearchDAO');
$articleSearchDao->deleteSubmissionKeywords($articleId);
$commentDao = DAORegistry::getDAO('CommentDAO');
$commentDao->deleteBySubmissionId($submissionId);
// Delete article files -- first from the filesystem, then from the database
import('classes.file.ArticleFileManager');
$articleFileDao = DAORegistry::getDAO('ArticleFileDAO');
$articleFiles = $articleFileDao->getArticleFilesByArticle($articleId);
$articleFileManager = new ArticleFileManager($articleId);
foreach ($articleFiles as $articleFile) {
$articleFileManager->deleteFile($articleFile->getFileId());
}
$articleFileDao->deleteArticleFiles($articleId);
// Delete article citations.
$citationDao = DAORegistry::getDAO('CitationDAO');
$citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
$this->flushCache();
}
示例11: handleArticleNode
//.........这里部分代码省略.........
$articleDao->insertArticle($article);
$dependentItems[] = array('article', $article);
/* --- Handle authors --- */
for ($index = 0; $node = $articleNode->getChildByName('author', $index); $index++) {
if (!NativeImportDom::handleAuthorNode($journal, $node, $issue, $section, $article, $authorErrors, $index)) {
$errors = array_merge($errors, $authorErrors);
$hasErrors = true;
}
}
if ($hasErrors) {
return false;
}
// 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');
ArticleLog::logEventHeadless($journal, $user->getId(), $article, ARTICLE_LOG_ARTICLE_IMPORT, 'log.imported', array('userName' => $user->getFullName(), 'articleId' => $article->getId()));
// Insert published article entry.
$publishedArticle = new PublishedArticle();
$publishedArticle->setId($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->setPublishedArticleId($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++;
}
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 = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($article);
$articleSearchIndex->articleFilesChanged($article);
$articleSearchIndex->articleChangesFinished();
return true;
}
示例12: execute
/**
* Save changes to the supplementary file.
* @return int the supplementary file ID
*/
function execute($fileName = null, $createRemote = false)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getId());
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
if (isset($this->suppFile)) {
parent::execute();
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $this->suppFile->getFileId();
if ($fileId != 0) {
$articleFileManager->uploadSuppFile($fileName, $fileId);
} else {
$fileId = $articleFileManager->uploadSuppFile($fileName);
$this->suppFile->setFileId($fileId);
}
$articleSearchIndex->articleFileChanged($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
}
// Update existing supplementary file
$this->setSuppFileData($this->suppFile);
if ($this->getData('remoteURL')) {
$this->suppFile->setRemoteURL($this->getData('remoteURL'));
}
$suppFileDao->updateSuppFile($this->suppFile);
} else {
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $articleFileManager->uploadSuppFile($fileName);
$articleSearchIndex->articleFileChanged($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
} else {
$fileId = 0;
}
// Insert new supplementary file
$this->suppFile = new SuppFile();
$this->suppFile->setArticleId($this->article->getId());
$this->suppFile->setFileId($fileId);
if ($createRemote) {
$this->suppFile->setRemoteURL(__('common.remoteURL'));
}
parent::execute();
$this->setSuppFileData($this->suppFile);
$suppFileDao->insertSuppFile($this->suppFile);
$this->suppFileId = $this->suppFile->getId();
}
// Index updated metadata.
$articleSearchIndex->suppFileMetadataChanged($this->suppFile);
$articleSearchIndex->articleChangesFinished();
return $this->suppFileId;
}
示例13: publishIssue
/**
* Publish issue
* @param $args array
* @param $request Request
*/
function publishIssue($args, $request)
{
$issueId = (int) array_shift($args);
$this->validate($issueId);
$issue =& $this->issue;
$journal =& $request->getJournal();
$journalId = $journal->getId();
$articleSearchIndex = null;
if (!$issue->getPublished()) {
// Set the status of any attendant queued articles to STATUS_PUBLISHED.
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$publishedArticles =& $publishedArticleDao->getPublishedArticles($issueId);
foreach ($publishedArticles as $publishedArticle) {
$article =& $articleDao->getArticle($publishedArticle->getId());
if ($article && $article->getStatus() == STATUS_QUEUED) {
$article->setStatus(STATUS_PUBLISHED);
$article->stampStatusModified();
$articleDao->updateArticle($article);
// Call initialize permissions again to check if copyright year needs to be initialized.
$article->initializePermissions();
$articleDao->updateLocaleFields($article);
if (!$articleSearchIndex) {
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
}
$articleSearchIndex->articleMetadataChanged($publishedArticle);
}
// delete article tombstone
$tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($article->getId());
unset($article);
}
}
$issue->setCurrent(1);
$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());
// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
if ($journal->getSetting('publishingMode') == PUBLISHING_MODE_SUBSCRIPTION && $journal->getSetting('enableDelayedOpenAccess')) {
$delayDuration = $journal->getSetting('delayedOpenAccessDuration');
$delayYears = (int) floor($delayDuration / 12);
$delayMonths = (int) fmod($delayDuration, 12);
$curYear = date('Y');
$curMonth = date('n');
$curDay = date('j');
$delayOpenAccessYear = $curYear + $delayYears + (int) floor(($curMonth + $delayMonths) / 12);
$delayOpenAccessMonth = (int) fmod($curMonth + $delayMonths, 12);
$issue->setAccessStatus(ISSUE_ACCESS_SUBSCRIPTION);
$issue->setOpenAccessDate(date('Y-m-d H:i:s', mktime(0, 0, 0, $delayOpenAccessMonth, $curDay, $delayOpenAccessYear)));
}
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issueDao->updateCurrentIssue($journalId, $issue);
if ($articleSearchIndex) {
$articleSearchIndex->articleChangesFinished();
}
// Send a notification to associated users
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$roleDao =& DAORegistry::getDAO('RoleDAO');
$notificationUsers = array();
$allUsers = $roleDao->getUsersByJournalId($journalId);
while (!$allUsers->eof()) {
$user =& $allUsers->next();
$notificationUsers[] = array('id' => $user->getId());
unset($user);
}
foreach ($notificationUsers as $userRole) {
$notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId);
}
$notificationManager->sendToMailingList($request, $notificationManager->createNotification($request, UNSUBSCRIBED_USER_NOTIFICATION, NOTIFICATION_TYPE_PUBLISHED_ISSUE, $journalId));
$request->redirect(null, null, 'issueToc', $issue->getId());
}
示例14: execute
//.........这里部分代码省略.........
}
}
$article->setHideCoverPageAbstract($hideCoverPageAbstract, null);
// Localized
$article->setDiscipline($this->getData('discipline'), null);
// Localized
$article->setSubjectClass($this->getData('subjectClass'), null);
// Localized
$article->setSubject($this->getData('subject'), null);
// Localized
$article->setCoverageGeo($this->getData('coverageGeo'), null);
// Localized
$article->setCoverageChron($this->getData('coverageChron'), null);
// Localized
$article->setCoverageSample($this->getData('coverageSample'), null);
// Localized
$article->setType($this->getData('type'), null);
// Localized
$article->setLanguage($this->getData('language'));
// Localized
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
if ($this->isEditor) {
$article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
}
// consider the additional field names from the public identifer plugins
import('classes.plugins.PubIdPluginHelper');
$pubIdPluginHelper = new PubIdPluginHelper();
$pubIdPluginHelper->execute($this, $article);
// Update authors
$authors = $this->getData('authors');
for ($i = 0, $count = count($authors); $i < $count; $i++) {
if ($authors[$i]['authorId'] > 0) {
// Update an existing author
$author =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId());
$isExistingAuthor = true;
} else {
// Create a new author
if (checkPhpVersion('5.0.0')) {
// *5488* PHP4 Requires explicit instantiation-by-reference
$author = new Author();
} else {
$author =& new Author();
}
$isExistingAuthor = false;
}
if ($author != null) {
$author->setSubmissionId($article->getId());
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
$author->setAffiliation($authors[$i]['affiliation'], null);
// Localized
$author->setCountry($authors[$i]['country']);
$author->setEmail($authors[$i]['email']);
$author->setData('orcid', $authors[$i]['orcid']);
$author->setUrl($authors[$i]['url']);
if (array_key_exists('competingInterests', $authors[$i])) {
$author->setCompetingInterests($authors[$i]['competingInterests'], null);
// Localized
}
$author->setBiography($authors[$i]['biography'], null);
// Localized
$author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
$author->setSequence($authors[$i]['seq']);
HookRegistry::call('Submission::Form::MetadataForm::Execute', array(&$author, &$authors[$i]));
if ($isExistingAuthor) {
$authorDao->updateAuthor($author);
} else {
$authorDao->insertAuthor($author);
}
unset($author);
}
}
// Remove deleted authors
$deletedAuthors = preg_split('/:/', $this->getData('deletedAuthors'), -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
$authorDao->deleteAuthorById($deletedAuthors[$i], $article->getId());
}
if ($this->isEditor) {
$article->setCopyrightHolder($this->getData('copyrightHolder'), null);
$article->setCopyrightYear($this->getData('copyrightYear'));
$article->setLicenseURL($this->getData('licenseURL'));
}
parent::execute();
// Save the article
$articleDao->updateArticle($article);
// Update search index
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($article);
$articleSearchIndex->articleChangesFinished();
// Update references list if it changed.
$rawCitationList = $article->getCitations();
if ($previousRawCitationList != $rawCitationList) {
$citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList);
}
return $article->getId();
}
示例15: setDatePublished
/**
* Set the publication date for a published article
* @param $args array
* @param $request object
*/
function setDatePublished($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;
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
if ($publishedArticle) {
$datePublished = $request->getUserDateVar('datePublished');
$publishedArticle->setDatePublished($datePublished);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
// Re-index the published article metadata.
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($publishedArticle);
$articleSearchIndex->articleChangesFinished();
}
$request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
}