本文整理汇总了PHP中ArticleSearchIndex::submissionFileChanged方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::submissionFileChanged方法的具体用法?PHP ArticleSearchIndex::submissionFileChanged怎么用?PHP ArticleSearchIndex::submissionFileChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::submissionFileChanged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateFileIndexViaPluginHook
/**
* @covers ArticleSearchIndex
*/
public function testUpdateFileIndexViaPluginHook()
{
// Diverting to the search plugin hook.
HookRegistry::register('ArticleSearchIndex::submissionFileChanged', array($this, 'callbackUpdateFileIndex'));
// Simulate updating an article file via hook.
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->submissionFileChanged(0, 1, 2);
// Test whether the hook was called.
$calledHooks = HookRegistry::getCalledHooks();
$lastHook = array_pop($calledHooks);
self::assertEquals('ArticleSearchIndex::submissionFileChanged', $lastHook[0]);
// Remove the test hook.
HookRegistry::clear('ArticleSearchIndex::submissionFileChanged');
}
示例2: 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));
}