本文整理汇总了PHP中ArticleFileManager::uploadCopyeditFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleFileManager::uploadCopyeditFile方法的具体用法?PHP ArticleFileManager::uploadCopyeditFile怎么用?PHP ArticleFileManager::uploadCopyeditFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleFileManager
的用法示例。
在下文中一共展示了ArticleFileManager::uploadCopyeditFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadCopyeditVersion
/**
* Upload the copyedit version of an article.
* @param $sectionEditorSubmission object
* @param $copyeditStage string
*/
function uploadCopyeditVersion($sectionEditorSubmission, $copyeditStage)
{
$articleId = $sectionEditorSubmission->getId();
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
// Perform validity checks.
$initialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
if ($copyeditStage == 'final' && $authorSignoff->getDateCompleted() == null) {
return;
}
if ($copyeditStage == 'author' && $initialSignoff->getDateCompleted() == null) {
return;
}
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName) && !HookRegistry::call('SectionEditorAction::uploadCopyeditVersion', array(&$sectionEditorSubmission))) {
if ($sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) != null) {
$copyeditFileId = $articleFileManager->uploadCopyeditFile($fileName, $sectionEditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true));
} else {
$copyeditFileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
if (isset($copyeditFileId) && $copyeditFileId != 0) {
if ($copyeditStage == 'initial') {
$signoff =& $initialSignoff;
$signoff->setFileId($copyeditFileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId));
} elseif ($copyeditStage == 'author') {
$signoff =& $authorSignoff;
$signoff->setFileId($copyeditFileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId));
} elseif ($copyeditStage == 'final') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
$signoff->setFileId($copyeditFileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($copyeditFileId));
}
$signoffDao->updateObject($signoff);
}
}
示例2: uploadCopyeditVersion
/**
* Upload the revised version of a copyedit file.
* @param $authorSubmission object
* @param $copyeditStage string
*/
function uploadCopyeditVersion($authorSubmission, $copyeditStage)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($authorSubmission->getId());
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
// Authors cannot upload if the assignment is not active, i.e.
// they haven't been notified or the assignment is already complete.
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if (!$authorSignoff->getDateNotified() || $authorSignoff->getDateCompleted()) {
return;
}
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('AuthorAction::uploadCopyeditVersion', array(&$authorSubmission, &$copyeditStage));
if ($authorSignoff->getFileId() != null) {
$fileId = $articleFileManager->uploadCopyeditFile($fileName, $authorSignoff->getFileId());
} else {
$fileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
$authorSignoff->setFileId($fileId);
if ($copyeditStage == 'author') {
$authorSignoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
}
$signoffDao->updateObject($authorSignoff);
}
示例3: uploadCopyeditVersion
/**
* Upload the copyedited version of an article.
* @param $copyeditorSubmission object
* @param $copyeditStage string
* @param $request object
*/
function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage, $request)
{
import('classes.file.ArticleFileManager');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
if ($copyeditStage == 'initial') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
} else {
if ($copyeditStage == 'final') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
}
}
// Only allow an upload if they're in the initial or final copyediting
// stages.
if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage != 'initial' && $copyeditStage != 'final') {
return;
}
}
}
$articleFileManager = new ArticleFileManager($copyeditorSubmission->getId());
$user =& $request->getUser();
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission));
if ($signoff->getFileId() != null) {
$fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true));
} else {
$fileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
if (isset($fileId) && $fileId != 0) {
$signoff->setFileId($fileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
$signoffDao->updateObject($signoff);
// Add log
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $copyeditorSubmission, ARTICLE_LOG_COPYEDITOR_FILE, 'log.copyedit.copyeditorFile', array('copyeditorName' => $user->getFullName(), 'fileId' => $fileId));
}
}
示例4: uploadCopyeditVersion
/**
* Upload the copyedited version of an article.
* @param $copyeditorSubmission object
*/
function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage)
{
import("file.ArticleFileManager");
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
if ($copyeditStage == 'initial') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId());
} else {
if ($copyeditStage == 'final') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getArticleId());
}
}
// Only allow an upload if they're in the initial or final copyediting
// stages.
if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage != 'initial' && $copyeditStage != 'final') {
return;
}
}
}
$articleFileManager = new ArticleFileManager($copyeditorSubmission->getArticleId());
$user =& Request::getUser();
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission));
if ($signoff->getFileId() != null) {
$fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true));
} else {
$fileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
if (isset($fileId) && $fileId != 0) {
$signoff->setFileId($fileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
$signoffDao->updateObject($signoff);
// Add log
import('article.log.ArticleLog');
import('article.log.ArticleEventLogEntry');
$entry = new ArticleEventLogEntry();
$entry->setArticleId($copyeditorSubmission->getArticleId());
$entry->setUserId($user->getId());
$entry->setDateLogged(Core::getCurrentDate());
$entry->setEventType(ARTICLE_LOG_COPYEDIT_COPYEDITOR_FILE);
$entry->setLogMessage('log.copyedit.copyeditorFile');
$entry->setAssocType(ARTICLE_LOG_TYPE_COPYEDIT);
$entry->setAssocId($fileId);
ArticleLog::logEventEntry($copyeditorSubmission->getArticleId(), $entry);
}
}