本文整理汇总了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;
}