本文整理匯總了PHP中ArticleFileManager::uploadReportFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleFileManager::uploadReportFile方法的具體用法?PHP ArticleFileManager::uploadReportFile怎麽用?PHP ArticleFileManager::uploadReportFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArticleFileManager
的用法示例。
在下文中一共展示了ArticleFileManager::uploadReportFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Save changes to the report file.
* @return int the report file ID
*/
function execute($fileName = null)
{
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getArticleId());
$fileName = isset($fileName) ? $fileName : 'uploadReportFile';
$lastDecision = $this->article->getLastSectionDecision();
$lastDecisionDecision = $lastDecision->getDecision();
$lastDecisionType = $lastDecision->getReviewType();
// Ensure to start a new round of review when needed, and if the file to upload is correct
if (($lastDecisionDecision == SUBMISSION_SECTION_DECISION_APPROVED || $lastDecisionDecision == SUBMISSION_SECTION_DECISION_EXEMPTED || ($lastDecisionType == REVIEW_TYPE_PR || $lastDecisionType == REVIEW_TYPE_FR) && ($lastDecisionDecision == SUBMISSION_SECTION_DECISION_INCOMPLETE || $lastDecisionDecision == SUBMISSION_SECTION_DECISION_RESUBMIT)) && $articleFileManager->uploadedFileExists($fileName)) {
$this->fileId = $articleFileManager->uploadReportFile($fileName);
} else {
$this->fileId = 0;
}
if ($this->fileId && $this->fileId > 0) {
$sectionDecision =& new SectionDecision();
$sectionDecision->setSectionId($lastDecision->getSectionId());
$sectionDecision->setDecision(0);
$sectionDecision->setDateDecided(date(Core::getCurrentDate()));
$sectionDecision->setArticleId($this->article->getArticleId());
if ($this->getData('type') == 'progress') {
$sectionDecision->setReviewType(REVIEW_TYPE_PR);
} else {
$sectionDecision->setReviewType(REVIEW_TYPE_FR);
}
if ($lastDecisionType == $sectionDecision->getReviewType()) {
$lastRound = (int) $lastDecision->getRound();
$sectionDecision->setRound($lastRound + 1);
} else {
$sectionDecision->setRound(1);
}
$sectionDecisionDao->insertSectionDecision($sectionDecision);
$articleDao->changeArticleStatus($this->article->getArticleId(), STATUS_QUEUED);
}
// Notifications
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$journal =& Request::getJournal();
$url = Request::url($journal->getPath(), 'sectionEditor', 'submissionReview', array($this->article->getArticleId()));
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $lastDecision->getSectionId());
foreach ($sectionEditors as $sectionEditor) {
$notificationSectionEditors[] = array('id' => $sectionEditor->getId());
}
if ($this->getData('type') == 'progress') {
$message = 'notification.type.progressReport';
} else {
$message = 'notification.type.completionReport';
}
if (isset($message)) {
foreach ($notificationSectionEditors as $userRole) {
$notificationManager->createNotification($userRole['id'], $message, $this->article->getProposalId(), $url, 1, NOTIFICATION_TYPE_SUPP_FILE_MODIFIED);
}
}
return $this->fileId;
}