本文整理汇总了PHP中ArticleSearchIndex::indexSuppFileMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::indexSuppFileMetadata方法的具体用法?PHP ArticleSearchIndex::indexSuppFileMetadata怎么用?PHP ArticleSearchIndex::indexSuppFileMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::indexSuppFileMetadata方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
/**
* 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;
}
示例3: 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());
}
}
}
示例4: 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;
}