/** * Updates Submission Note * @param $paperId int */ function updateSubmissionNote($paperId) { import('file.PaperFileManager'); $paperNoteDao =& DAORegistry::getDAO('PaperNoteDAO'); $user =& Request::getUser(); $paperNote = new PaperNote(); $paperNote->setNoteId(Request::getUserVar('noteId')); $paperNote->setPaperId($paperId); $paperNote->setUserId($user->getId()); $paperNote->setDateModified(Core::getCurrentDate()); $paperNote->setTitle(Request::getUserVar('title')); $paperNote->setNote(Request::getUserVar('note')); $paperNote->setFileId(Request::getUserVar('fileId')); if (HookRegistry::call('TrackDirectorAction::updateSubmissionNote', array(&$paperId, &$paperNote))) { return; } $paperFileManager = new PaperFileManager($paperId); if ($paperFileManager->uploadError('upload')) { return false; } // if there is a new file being uploaded if ($paperFileManager->uploadedFileExists('upload')) { // Attach the new file to the note, overwriting existing file if necessary $fileId = $paperFileManager->uploadSubmissionNoteFile('upload', $paperNote->getFileId(), true); $paperNote->setFileId($fileId); } else { if (Request::getUserVar('removeUploadedFile')) { $paperFileManager = new PaperFileManager($paperId); $paperFileManager->deleteFile($paperNote->getFileId()); $paperNote->setFileId(0); } } $paperNoteDao->updatePaperNote($paperNote); }
/** * Updates Submission Note * @param $paperId int */ function updateSubmissionNote($paperId) { import('classes.file.PaperFileManager'); $noteDao = DAORegistry::getDAO('NoteDAO'); $user =& Request::getUser(); $conference =& Request::getConference(); $note = new Note(); $note->setId(Request::getUserVar('noteId')); $note->setAssocType(ASSOC_TYPE_PAPER); $note->setAssocId($paperId); $note->setUserId($user->getId()); $note->setDateModified(Core::getCurrentDate()); $note->setContextId($conference->getId()); $note->setTitle(Request::getUserVar('title')); $note->setContents(Request::getUserVar('note')); $note->setFileId(Request::getUserVar('fileId')); if (HookRegistry::call('SectionEditorAction::updateSubmissionNote', array(&$paperId, &$note))) { return; } $paperFileManager = new PaperFileManager($paperId); // if there is a new file being uploaded if ($paperFileManager->uploadedFileExists('upload')) { // Attach the new file to the note, overwriting existing file if necessary $fileId = $paperFileManager->uploadSubmissionNoteFile('upload', $note->getFileId(), true); $note->setFileId($fileId); } else { if (Request::getUserVar('removeUploadedFile')) { $paperFileManager = new PaperFileManager($paperId); $paperFileManager->deleteFile($note->getFileId()); $note->setFileId(0); } } $noteDao->updateObject($note); }