本文整理汇总了PHP中ArticleSearchIndex::articleMetadataChanged方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::articleMetadataChanged方法的具体用法?PHP ArticleSearchIndex::articleMetadataChanged怎么用?PHP ArticleSearchIndex::articleMetadataChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::articleMetadataChanged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save changes to submission.
* @param $request PKPRequest
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$submissionDao = Application::getSubmissionDAO();
$submission->setSectionId($this->getData('sectionId'));
$submissionDao->updateObject($submission);
if ($submission->getDatePublished()) {
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::articleMetadataChanged($submission);
}
}
示例2: 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;
}
示例3: execute
/**
* Save the metadata.
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$submissionDao = Application::getSubmissionDAO();
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
$isExistingEntry = $publishedArticle ? true : false;
if ($isExistingEntry) {
// Update the search index for this published article.
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::articleMetadataChanged($submission);
}
$submissionDao->updateObject($submission);
}
示例4: execute
//.........这里部分代码省略.........
/* @var $authorDao AuthorDAO */
$authorDao->insertObject($author);
}
}
}
// Add the submission files as galleys
import('lib.pkp.classes.file.TemporaryFileManager');
import('classes.file.ArticleFileManager');
$tempFileIds = $this->getData('tempFileId');
$temporaryFileManager = new TemporaryFileManager();
$articleFileManager = new ArticleFileManager($articleId);
$designatedPrimary = false;
foreach (array_keys($tempFileIds) as $locale) {
$temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
$fileId = null;
if ($temporaryFile) {
$fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, SUBMISSION_FILE_SUBMISSION);
$fileType = $temporaryFile->getFileType();
if (strstr($fileType, 'html')) {
import('classes.article.ArticleHTMLGalley');
$galley = new ArticleHTMLGalley();
} else {
import('classes.article.ArticleGalley');
$galley = new ArticleGalley();
}
$galley->setArticleId($articleId);
$galley->setFileId($fileId);
$galley->setLocale($locale);
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);
if (!$designatedPrimary) {
$article->setSubmissionFileId($fileId);
if ($locale == $journal->getPrimaryLocale()) {
// Used to make sure that *some* file
// is designated Review Version, but
// preferrably the primary locale.
$designatedPrimary = true;
}
}
}
// Update file search index
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
if (isset($galley)) {
$articleSearchIndex->articleFileChanged($galley->getArticleId(), SUBMISSION_SEARCH_GALLEY_FILE, $galley->getFileId());
}
$articleSearchIndex->articleChangesFinished();
}
// Designate this as the review version by default.
$authorSubmissionDao = DAORegistry::getDAO('AuthorSubmissionDAO');
$authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId);
import('classes.submission.author.AuthorAction');
AuthorAction::designateReviewVersion($authorSubmission, true);
// Accept the submission
$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
$articleFileManager = new ArticleFileManager($articleId);
import('classes.submission.sectionEditor.SectionEditorAction');
assert(false);
// FIXME: $decisionLabels missing from call below.
SectionEditorAction::recordDecision($this->request, $sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT);
import('classes.author.form.submit.AuthorSubmitForm');
AuthorSubmitForm::assignEditors($article);
$articleDao->updateObject($article);
// Add to end of editing queue
import('classes.submission.editor.EditorAction');
if (isset($galley)) {
EditorAction::expediteSubmission($article, $this->request);
}
if ($this->getData('destination') == "issue") {
// Add to an existing issue
$issueId = $this->getData('issueId');
$this->scheduleForPublication($articleId, $issueId);
}
// Import the references list.
$citationDao = DAORegistry::getDAO('CitationDAO');
$rawCitationList = $article->getCitations();
$citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList);
// Index article.
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($article);
$articleSearchIndex->articleChangesFinished();
}
示例5: 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();
}
示例6: 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()) {
// 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));
$dispatcher = $request->getDispatcher();
// FIXME: Find a better way to reload the containing tabs.
// Without this, issues don't move between tabs properly.
return $request->redirectUrlJson($dispatcher->url($request, ROUTE_PAGE, null, 'manageIssues'));
}
示例7: 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();
}
示例8: 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();
}
示例9: 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));
}
示例10: execute
/**
* Save the metadata and store the catalog data for this published
* monograph.
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$context = $request->getContext();
$waivePublicationFee = $request->getUserVar('waivePublicationFee') ? true : false;
if ($waivePublicationFee) {
$markAsPaid = $request->getUserVar('markAsPaid');
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$user = $request->getUser();
// Get a list of author user IDs
$authorUserIds = array();
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR);
$submitterAssignment = $submitterAssignments->next();
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'));
//.........这里部分代码省略.........
示例11: 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');
}
示例12: execute
/**
* Save changes to submission.
* @param $request PKPRequest
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$submissionDao = Application::getSubmissionDAO();
// if section changed consider reordering
$reorder = false;
$oldSectionId = $submission->getSectionId();
if ($oldSectionId != $this->getData('sectionId')) {
$reorder = true;
$submission->setSectionId($this->getData('sectionId'));
}
$locale = AppLocale::getLocale();
// Copy an uploaded cover file for the article, if there is one.
if ($temporaryFileId = $this->getData('temporaryFileId')) {
$user = $request->getUser();
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$newFileName = 'article_' . $submission->getId() . '_cover_' . $locale . $publicFileManager->getImageExtension($temporaryFile->getFileType());
$journal = $request->getJournal();
$publicFileManager->copyJournalFile($journal->getId(), $temporaryFile->getFilePath(), $newFileName);
$submission->setCoverImage($newFileName, $locale);
}
$submission->setCoverImageAltText($this->getData('coverImageAltText'), $locale);
$submissionDao->updateObject($submission);
if ($reorder) {
// see if it is a published article
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
/* @var $publishedArticle PublishedArticle */
if ($publishedArticle) {
// Resequence the articles.
$publishedArticle->setSequence(REALLY_BIG_NUMBER);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
$publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $publishedArticle->getIssueId());
// The reordering for the old section is not necessary, but for the correctness sake
$publishedArticleDao->resequencePublishedArticles($oldSectionId, $publishedArticle->getIssueId());
}
}
if ($submission->getDatePublished()) {
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::articleMetadataChanged($submission);
}
}
示例13: 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;
}
示例14: execute
/**
* Save changes to submission.
* @param $request PKPRequest
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$submissionDao = Application::getSubmissionDAO();
$submission->setSectionId($this->getData('sectionId'));
// Copy an uploaded cover file for the article, if there is one.
if ($temporaryFileId = $this->getData('temporaryFileId')) {
$user = $request->getUser();
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$newFileName = 'article_' . $submission->getId() . '_cover' . $publicFileManager->getImageExtension($temporaryFile->getFileType());
$journal = $request->getJournal();
$publicFileManager->copyJournalFile($journal->getId(), $temporaryFile->getFilePath(), $newFileName);
$submission->setCoverImage($newFileName);
}
$submission->setCoverImageAltText($this->getData('coverImageAltText'));
$submissionDao->updateObject($submission);
if ($submission->getDatePublished()) {
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::articleMetadataChanged($submission);
}
}
示例15: 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());
}