本文整理汇总了PHP中ArticleSearchIndex::updateFileIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::updateFileIndex方法的具体用法?PHP ArticleSearchIndex::updateFileIndex怎么用?PHP ArticleSearchIndex::updateFileIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::updateFileIndex方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save changes to the supplementary file.
* @return int the supplementary file ID
*/
function execute($fileName = null)
{
import("file.ArticleFileManager");
$articleFileManager =& new ArticleFileManager($this->article->getArticleId());
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
if (isset($this->suppFile)) {
$suppFile =& $this->suppFile;
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$articleFileManager->uploadSuppFile($fileName, $suppFile->getFileId());
import('search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
}
// Index metadata
ArticleSearchIndex::indexSuppFileMetadata($suppFile);
// Update existing supplementary file
$this->setSuppFileData($suppFile);
$suppFileDao->updateSuppFile($suppFile);
} else {
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $articleFileManager->uploadSuppFile($fileName);
import('search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
} else {
$fileId = 0;
}
// Insert new supplementary file
$suppFile =& new SuppFile();
$suppFile->setArticleId($this->article->getArticleId());
$suppFile->setFileId($fileId);
$this->setSuppFileData($suppFile);
$suppFileDao->insertSuppFile($suppFile);
$this->suppFileId = $suppFile->getSuppFileId();
}
return $this->suppFileId;
}
示例2: execute
//.........这里部分代码省略.........
foreach (array_keys($tempFileIds) as $locale) {
$temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
$fileId = null;
if ($temporaryFile) {
$fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_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 ($locale == $journal->getPrimaryLocale()) {
$article->setSubmissionFileId($fileId);
$article->SetReviewFileId($fileId);
}
// Update file search index
import('classes.search.ArticleSearchIndex');
if (isset($galley)) {
ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
}
}
// 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);
$sectionEditorSubmission->setReviewFile($articleFileManager->getFile($article->getSubmissionFileId()));
import('classes.submission.sectionEditor.SectionEditorAction');
SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT);
// Create signoff infrastructure
$copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
$copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
$copyeditInitialSignoff->setUserId(0);
$copyeditAuthorSignoff->setUserId($user->getId());
$copyeditFinalSignoff->setUserId(0);
$signoffDao->updateObject($copyeditInitialSignoff);
$signoffDao->updateObject($copyeditAuthorSignoff);
$signoffDao->updateObject($copyeditFinalSignoff);
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$layoutSignoff->setUserId(0);
$signoffDao->updateObject($layoutSignoff);
$proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
$proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$proofAuthorSignoff->setUserId($user->getId());
$proofProofreaderSignoff->setUserId(0);
$proofLayoutEditorSignoff->setUserId(0);
$signoffDao->updateObject($proofAuthorSignoff);
$signoffDao->updateObject($proofProofreaderSignoff);
$signoffDao->updateObject($proofLayoutEditorSignoff);
import('classes.author.form.submit.AuthorSubmitForm');
AuthorSubmitForm::assignEditors($article);
$articleDao->updateArticle($article);
// Add to end of editing queue
import('classes.submission.editor.EditorAction');
if (isset($galley)) {
EditorAction::expediteSubmission($article);
}
if ($this->getData('destination') == "issue") {
// Add to an existing issue
$issueId = $this->getData('issueId');
$this->scheduleForPublication($articleId, $issueId);
}
// Index article.
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::indexArticleMetadata($article);
// Import the references list.
$citationDao =& DAORegistry::getDAO('CitationDAO');
$rawCitationList = $article->getCitations();
$citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList);
}
示例3: 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();
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::updateFileIndex($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $fileId);
}
$sectionEditorSubmission->setStatus(STATUS_QUEUED);
$sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
}
示例4: execute
/**
* Save changes to the galley.
* @return int the galley ID
*/
function execute($fileName = null)
{
import('file.ArticleFileManager');
$articleFileManager =& new ArticleFileManager($this->articleId);
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$fileName = isset($fileName) ? $fileName : 'galleyFile';
$journal =& Request::getJournal();
if (isset($this->galley)) {
$galley =& $this->galley;
// Upload galley file
if ($articleFileManager->uploadedFileExists($fileName)) {
if ($galley->getFileId()) {
$articleFileManager->uploadPublicFile($fileName, $galley->getFileId());
} else {
$fileId = $articleFileManager->uploadPublicFile($fileName);
$galley->setFileId($fileId);
}
// Update file search index
import('search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
}
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->setPublicGalleyId($this->getData('publicGalleyId'));
}
$galley->setLocale($this->getData('galleyLocale'));
$galleyDao->updateGalley($galley);
} else {
// Upload galley file
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileType = $articleFileManager->getUploadedFileType($fileName);
$fileId = $articleFileManager->uploadPublicFile($fileName);
// Update file search index
import('search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $fileId);
} else {
$fileId = 0;
}
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->setPublicGalleyId('html');
}
} else {
if (isset($fileType)) {
if (strstr($fileType, 'pdf')) {
$galley->setLabel('PDF');
if ($enablePublicGalleyId) {
$galley->setPublicgalleyId('pdf');
}
} else {
if (strstr($fileType, 'postscript')) {
$galley->setLabel('PostScript');
if ($enablePublicGalleyId) {
$galley->setPublicgalleyId('ps');
}
} else {
if (strstr($fileType, 'xml')) {
$galley->setLabel('XML');
if ($enablePublicGalleyId) {
$galley->setPublicgalleyId('xml');
}
}
}
}
}
}
if ($galley->getLabel() == null) {
$galley->setLabel(Locale::translate('common.untitled'));
}
} else {
//.........这里部分代码省略.........
示例5: indexArticleFiles
/**
* Index all article files (supplementary and galley).
* @param $article Article
*/
function indexArticleFiles(&$article)
{
// Index supplementary files
$fileDao =& DAORegistry::getDAO('SuppFileDAO');
$files =& $fileDao->getSuppFilesByArticle($article->getId());
foreach ($files as $file) {
if ($file->getFileId()) {
ArticleSearchIndex::updateFileIndex($article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $file->getFileId());
}
ArticleSearchIndex::indexSuppFileMetadata($file);
}
unset($files);
// Index galley files
$fileDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$files =& $fileDao->getGalleysByArticle($article->getId());
foreach ($files as $file) {
if ($file->getFileId()) {
ArticleSearchIndex::updateFileIndex($article->getId(), ARTICLE_SEARCH_GALLEY_FILE, $file->getFileId());
}
}
}
示例6: execute
//.........这里部分代码省略.........
}
$author->setBiography($authors[$i]['biography'], null);
$author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
$author->setSequence($authors[$i]['seq']);
if ($isExistingAuthor == false) {
$article->addAuthor($author);
}
}
}
// Check whether the user gave a handle and create a handleSubmissionFile in case
$submissionHandle = $this->getData('submissionHandle');
$handleSubmissionFileId;
$handleCheck = FALSE;
//import FileManager before creating files because otherwise naming of the copied files failes
import('classes.file.ArticleFileManager');
foreach (array_keys($submissionHandle) as $locale) {
if (!empty($submissionHandle[$locale])) {
$this->deleteOldFile("submission/original", $articleId);
// $this->deleteOldFile("submission/copyedit", $articleId);
$handleCheck = TRUE;
$handleSubmissionId = $this->createHandleTXTFile($submissionHandle[$locale], $articleId, 'submission');
$handleSubmissionPDFId = $this->createHandlePDF($submissionHandle[$locale], $articleId, 'submission');
//Add the handle submission files as galley
$this->setGalley($articleId, $handleSubmissionPDFId, $locale, 'application/pdf');
}
if ($handleCheck == TRUE) {
if ($locale == $journal->getPrimaryLocale()) {
$article->setSubmissionFileId($handleSubmissionPDFId);
$article->SetReviewFileId($handleSubmissionPDFId);
}
// Update file search index
import('classes.search.ArticleSearchIndex');
if (isset($galley)) {
ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
}
}
}
// Add the submission files as galleys
import('classes.file.TemporaryFileManager');
import('classes.file.ArticleFileManager');
$tempFileIds = $this->getData('tempFileId');
$temporaryFileManager = new TemporaryFileManager();
$articleFileManager = new ArticleFileManager($articleId);
$tempFileCheck = FALSE;
foreach (array_keys($tempFileIds) as $locale) {
$temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
$fileId = null;
if ($temporaryFile) {
$this->deleteOldFile("submission/original", $articleId);
$this->deleteOldFile("submission/copyedit", $articleId);
$tempFileCheck = TRUE;
$fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION);
$fileType = $temporaryFile->getFileType();
$this->setGalley($articleId, $fileId, $locale, $fileType);
// $galley =& $this->setGalley($articleId, $fileId, $locale, $fileType);
}
if ($tempFileCheck == TRUE) {
if ($locale == $journal->getPrimaryLocale()) {
$article->setSubmissionFileId($fileId);
$article->SetReviewFileId($fileId);
}
// Update file search index
import('classes.search.ArticleSearchIndex');
if (isset($galley)) {
ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
}
示例7: 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;
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::updateFileIndex($this->articleId, ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId());
}
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->setPublicGalleyId(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');
}
} else {
if (strstr($fileType, 'xml')) {
$galley->setLabel('XML');
//.........这里部分代码省略.........
示例8: 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';
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);
}
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
}
// Index metadata
ArticleSearchIndex::indexSuppFileMetadata($this->suppFile);
// 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);
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($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();
}
return $this->suppFileId;
}
示例9: execute
/**
* Save changes to the supplementary file.
* @return int the supplementary file ID
*/
function execute($fileName = null)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getArticleId());
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
if (isset($this->suppFile)) {
$suppFile =& $this->suppFile;
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$articleFileManager->uploadSuppFile($fileName, $suppFile->getFileId());
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
}
// Index metadata
ArticleSearchIndex::indexSuppFileMetadata($suppFile);
// Update existing supplementary file
$this->setSuppFileData($suppFile);
$suppFileDao->updateSuppFile($suppFile);
} else {
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $articleFileManager->uploadSuppFile($fileName);
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
// Insert new supplementary file
$suppFile = new SuppFile();
$suppFile->setArticleId($this->article->getArticleId());
$suppFile->setFileId($fileId);
$this->setSuppFileData($suppFile);
$suppFileDao->insertSuppFile($suppFile);
$this->suppFileId = $suppFile->getId();
} else {
$fileId = 0;
}
}
// Notifications
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$journal =& Request::getJournal();
$url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($this->article->getArticleId(), 'submissionReview'));
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $this->article->getSectionId());
foreach ($sectionEditors as $sectionEditor) {
$notificationSectionEditors[] = array('id' => $sectionEditor->getId());
}
if ($suppFile->getData('type') == 'Raw Data File') {
$message = 'notification.type.rawDataSubmitted';
}
if ($suppFile->getData('type') == 'Other Supplementary Research Output') {
$message = 'notification.type.otherSuppResearchOutput';
}
if ($suppFile->getData('type') == 'Progress Report') {
$message = 'notification.type.progressReport';
}
if ($suppFile->getData('type') == 'Completion Report') {
$message = 'notification.type.completionReport';
}
if ($suppFile->getData('type') == 'Extension Request') {
$message = 'notification.type.extensionRequest';
}
if ($this->getData('type') == "Supp File") {
$message = 'notification.type.suppFile';
}
if (isset($message)) {
foreach ($notificationSectionEditors as $userRole) {
$notificationManager->createNotification($userRole['id'], $message, $this->article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED);
}
}
return $this->suppFileId;
}
示例10: execute
/**
* Save changes to the supplementary file.
* @return int the supplementary file ID
*/
function execute($fileName = null)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getArticleId());
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$fileName = 'uploadSuppFile';
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $articleFileManager->uploadSuppFile($fileName);
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
// Insert new supplementary file
$suppFile = new SuppFile();
$suppFile->setArticleId($this->article->getArticleId());
$suppFile->setFileId($fileId);
$this->setSuppFileData($suppFile);
$suppFileDao->insertSuppFile($suppFile);
$this->suppFileId = $suppFile->getId();
} else {
$fileId = 0;
}
// Save article settings (withdrawReason and withdrawComments)
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $this->article;
$article->setWithdrawReason($this->getData('withdrawReason'), null);
if ($article->getWithdrawReason('en_US') == "2") {
$article->setWithdrawReason($this->getData('otherReason'), null);
}
$article->setWithdrawComments($this->getData('withdrawComments'), null);
// Save the article
$articleDao->updateArticle($article);
return $this->suppFileId;
}