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