本文整理汇总了PHP中Note::setUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::setUserId方法的具体用法?PHP Note::setUserId怎么用?PHP Note::setUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::setUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNote
/**
* Set a note (create a new one)
* @param string $note_text note text that will be created
* @return bool feedback (was the note created properly ?)
*/
public static function createNote($note_text)
{
if (!$note_text || strlen($note_text) == 0) {
Session::add('feedback_negative', Text::get('FEEDBACK_NOTE_CREATION_FAILED'));
return false;
}
$note = new Note();
$note->setNoteText($note_text);
$note->setUserId(Session::get('user_id'));
$note->save();
if ($note) {
return true;
}
// default return
Session::add('feedback_negative', Text::get('FEEDBACK_NOTE_CREATION_FAILED'));
return false;
}
示例2: updateSubmissionNote
/**
* Updates Submission Note
* @param $articleId int
*/
function updateSubmissionNote($articleId, $request)
{
import('classes.file.ArticleFileManager');
$noteDao =& DAORegistry::getDAO('NoteDAO');
$user =& $request->getUser();
$journal =& $request->getJournal();
$note = new Note();
$note->setId($request->getUserVar('noteId'));
$note->setAssocType(ASSOC_TYPE_ARTICLE);
$note->setAssocId($articleId);
$note->setUserId($user->getId());
$note->setDateModified(Core::getCurrentDate());
$note->setContextId($journal->getId());
$note->setTitle($request->getUserVar('title'));
$note->setContents($request->getUserVar('note'));
$note->setFileId($request->getUserVar('fileId'));
if (HookRegistry::call('SectionEditorAction::updateSubmissionNote', array(&$articleId, &$note))) {
return;
}
$articleFileManager = new ArticleFileManager($articleId);
// if there is a new file being uploaded
if ($articleFileManager->uploadedFileExists('upload')) {
// Attach the new file to the note, overwriting existing file if necessary
$fileId = $articleFileManager->uploadSubmissionNoteFile('upload', $note->getFileId(), true);
$note->setFileId($fileId);
} else {
if ($request->getUserVar('removeUploadedFile')) {
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteFile($note->getFileId());
$note->setFileId(0);
}
}
$noteDao->updateObject($note);
}
示例3: importArticles
function importArticles()
{
assert($this->xml->name == 'articles');
$articleDAO =& DAORegistry::getDAO('ArticleDAO');
$articles = $articleDAO->getArticlesByJournalId($this->journal->getId());
$journalFileManager = new JournalFileManager($this->journal);
$publicFileManager =& new PublicFileManager();
$this->nextElement();
while ($this->xml->name == 'article') {
$articleXML = $this->getCurrentElementAsDom();
$article = new Article();
$article->setJournalId($this->journal->getId());
$article->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleXML->userId));
$article->setSectionId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_SECTION, (int) $articleXML->sectionId));
$article->setLocale((string) $articleXML->locale);
$article->setLanguage((string) $articleXML->language);
$article->setCommentsToEditor((string) $articleXML->commentsToEditor);
$article->setCitations((string) $articleXML->citations);
$article->setDateSubmitted((string) $articleXML->dateSubmitted);
$article->setDateStatusModified((string) $articleXML->dateStatusModified);
$article->setLastModified((string) $articleXML->lastModified);
$article->setStatus((int) $articleXML->status);
$article->setSubmissionProgress((int) $articleXML->submissionProgress);
$article->setCurrentRound((int) $articleXML->currentRound);
$article->setPages((string) $articleXML->pages);
$article->setFastTracked((int) $articleXML->fastTracked);
$article->setHideAuthor((int) $articleXML->hideAuthor);
$article->setCommentsStatus((int) $articleXML->commentsStatus);
$articleDAO->insertArticle($article);
$oldArticleId = (int) $articleXML->oldId;
$this->restoreDataObjectSettings($articleDAO, $articleXML->settings, 'article_settings', 'article_id', $article->getId());
$article =& $articleDAO->getArticle($article->getId());
// Reload article with restored settings
$covers = $article->getFileName(null);
if ($covers) {
foreach ($covers as $locale => $oldCoverFileName) {
$sourceFile = $this->publicFolderPath . '/' . $oldCoverFileName;
$extension = $publicFileManager->getExtension($oldCoverFileName);
$destFile = 'cover_issue_' . $article->getId() . "_{$locale}.{$extension}";
$publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile);
unlink($sourceFile);
$article->setFileName($destFile, $locale);
$articleDAO->updateArticle($article);
}
}
$articleFileManager = new ArticleFileManager($article->getId());
$authorDAO =& DAORegistry::getDAO('AuthorDAO');
foreach ($articleXML->author as $authorXML) {
$author = new Author();
$author->setArticleId($article->getId());
$author->setFirstName((string) $authorXML->firstName);
$author->setMiddleName((string) $authorXML->middleName);
$author->setLastName((string) $authorXML->lastName);
$author->setSuffix((string) $authorXML->suffix);
$author->setCountry((string) $authorXML->country);
$author->setEmail((string) $authorXML->email);
$author->setUrl((string) $authorXML->url);
$author->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $authorXML->userGroupId));
$author->setPrimaryContact((int) $authorXML->primaryContact);
$author->setSequence((int) $authorXML->sequence);
$authorDAO->insertAuthor($author);
$this->restoreDataObjectSettings($authorDAO, $authorXML->settings, 'author_settings', 'author_id', $author->getId());
unset($author);
}
$articleEmailLogDAO =& DAORegistry::getDAO('ArticleEmailLogDAO');
$emailLogsXML = array();
foreach ($articleXML->emailLogs->emailLog as $emailLogXML) {
array_unshift($emailLogsXML, $emailLogXML);
}
foreach ($emailLogsXML as $emailLogXML) {
$emailLog = new ArticleEmailLogEntry();
$emailLog->setAssocType(ASSOC_TYPE_ARTICLE);
$emailLog->setAssocId($article->getId());
$emailLog->setSenderId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $emailLogXML->senderId));
$emailLog->setDateSent((string) $emailLogXML->dateSent);
$emailLog->setIPAddress((string) $emailLogXML->IPAddress);
$emailLog->setEventType((int) $emailLogXML->eventType);
$emailLog->setFrom((string) $emailLogXML->from);
$emailLog->setRecipients((string) $emailLogXML->recipients);
$emailLog->setCcs((string) $emailLogXML->ccs);
$emailLog->setBccs((string) $emailLogXML->bccs);
$emailLog->setSubject((string) $emailLogXML->subject);
$emailLog->setBody((string) $emailLogXML->body);
$articleEmailLogDAO->insertObject($emailLog);
$this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $emailLogXML->oldId, $emailLog->getId());
}
$articleFileDAO =& DAORegistry::getDAO('ArticleFileDAO');
foreach ($articleXML->articleFile as $articleFileXML) {
try {
$articleFile = new ArticleFile();
$articleFile->setArticleId($article->getId());
$articleFile->setSourceFileId((int) $articleFileXML->sourceFileId);
$articleFile->setSourceRevision((int) $articleFileXML->sourceRevision);
$articleFile->setRevision((int) $articleFileXML->revision);
$articleFile->setFileName((string) $articleFileXML->fileName);
$articleFile->setFileType((string) $articleFileXML->fileType);
$articleFile->setFileSize((string) $articleFileXML->fileSize);
$articleFile->setOriginalFileName((string) $articleFileXML->originalFileName);
$articleFile->setFileStage((int) $articleFileXML->fileStage);
$articleFile->setAssocId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $articleFileXML->assocId));
//.........这里部分代码省略.........
示例4: updateSubmissionNote
/**
* 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);
}