本文整理汇总了PHP中Author::setArticleId方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::setArticleId方法的具体用法?PHP Author::setArticleId怎么用?PHP Author::setArticleId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::setArticleId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
//.........这里部分代码省略.........
示例2: execute
/**
* Save changes to article.
* @return int the article ID
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$authorDao =& DAORegistry::getDAO('AuthorDAO');
// Update article
$article =& $this->article;
$article->setTitle($this->getData('title'), null);
// Localized
$article->setAbstract($this->getData('abstract'), null);
// Localized
$article->setDiscipline($this->getData('discipline'), null);
// Localized
$article->setSubjectClass($this->getData('subjectClass'), null);
// Localized
$article->setSubject($this->getData('subject'), null);
// Localized
$article->setCoverageGeo($this->getData('coverageGeo'), null);
// Localized
$article->setCoverageChron($this->getData('coverageChron'), null);
// Localized
$article->setCoverageSample($this->getData('coverageSample'), null);
// Localized
$article->setType($this->getData('type'), null);
// Localized
$article->setLanguage($this->getData('language'));
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
if ($article->getSubmissionProgress() <= $this->step) {
$article->stampStatusModified();
$article->setSubmissionProgress($this->step + 1);
}
// Update authors
$authors = $this->getData('authors');
for ($i = 0, $count = count($authors); $i < $count; $i++) {
if ($authors[$i]['authorId'] > 0) {
// Update an existing author
$author =& $article->getAuthor($authors[$i]['authorId']);
$isExistingAuthor = true;
} else {
// Create a new author
$author = new Author();
$isExistingAuthor = false;
}
if ($author != null) {
$author->setArticleId($article->getId());
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
$author->setAffiliation($authors[$i]['affiliation']);
$author->setCountry($authors[$i]['country']);
$author->setEmail($authors[$i]['email']);
$author->setUrl($authors[$i]['url']);
if (array_key_exists('competingInterests', $authors[$i])) {
$author->setCompetingInterests($authors[$i]['competingInterests'], null);
}
$author->setBiography($authors[$i]['biography'], null);
$author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
$author->setSequence($authors[$i]['seq']);
if ($isExistingAuthor == false) {
$article->addAuthor($author);
}
}
unset($author);
}
// Remove deleted authors
$deletedAuthors = explode(':', $this->getData('deletedAuthors'));
for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
$article->removeAuthor($deletedAuthors[$i]);
}
parent::execute();
// Save the article
$articleDao->updateArticle($article);
return $this->articleId;
}
示例3: execute
/**
* Save settings.
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$journal =& Request::getJournal();
$user =& Request::getUser();
$article = new Article();
$article->setUserId($user->getId());
$article->setJournalId($journal->getId());
$article->setSectionId($this->getData('sectionId'));
$article->setLanguage(String::substr($journal->getPrimaryLocale(), 0, 2));
$article->setTitle($this->getData('title'), null);
// Localized
$article->setAbstract($this->getData('abstract'), null);
// Localized
$article->setDiscipline($this->getData('discipline'), null);
// Localized
$article->setSubjectClass($this->getData('subjectClass'), null);
// Localized
$article->setSubject($this->getData('subject'), null);
// Localized
$article->setCoverageGeo($this->getData('coverageGeo'), null);
// Localized
$article->setCoverageChron($this->getData('coverageChron'), null);
// Localized
$article->setCoverageSample($this->getData('coverageSample'), null);
// Localized
$article->setType($this->getData('type'), null);
// Localized
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
// Set some default values so the ArticleDAO doesn't complain when adding this article
$article->setDateSubmitted(Core::getCurrentDate());
$article->setStatus(STATUS_PUBLISHED);
$article->setSubmissionProgress(0);
$article->stampStatusModified();
$article->setCurrentRound(1);
$article->setFastTracked(1);
$article->setHideAuthor(0);
$article->setCommentsStatus(0);
// Insert the article to get it's ID
$articleDao->insertArticle($article);
$articleId = $article->getId();
// Add authors
$authors = $this->getData('authors');
for ($i = 0, $count = count($authors); $i < $count; $i++) {
if ($authors[$i]['authorId'] > 0) {
// Update an existing author
$author =& $article->getAuthor($authors[$i]['authorId']);
$isExistingAuthor = true;
} else {
// Create a new author
$author = new Author();
$isExistingAuthor = false;
}
if ($author != null) {
$author->setArticleId($articleId);
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
$author->setAffiliation($authors[$i]['affiliation']);
$author->setCountry($authors[$i]['country']);
$author->setEmail($authors[$i]['email']);
$author->setUrl($authors[$i]['url']);
if (array_key_exists('competingInterests', $authors[$i])) {
$author->setCompetingInterests($authors[$i]['competingInterests'], null);
}
$author->setBiography($authors[$i]['biography'], null);
$author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
$author->setSequence($authors[$i]['seq']);
if ($isExistingAuthor == false) {
$article->addAuthor($author);
}
}
}
// Add the submission files as galleys
import('file.TemporaryFileManager');
import('file.ArticleFileManager');
$tempFileIds = $this->getData('tempFileId');
$temporaryFileManager = new TemporaryFileManager();
$articleFileManager = new ArticleFileManager($articleId);
foreach (array_keys($tempFileIds) as $locale) {
$temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
$fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION);
$fileType = $temporaryFile->getFileType();
if (strstr($fileType, 'html')) {
import('article.ArticleHTMLGalley');
$galley = new ArticleHTMLGalley();
} else {
import('article.ArticleGalley');
$galley = new ArticleGalley();
}
$galley->setArticleId($articleId);
$galley->setFileId($fileId);
$galley->setLocale($locale);
//.........这里部分代码省略.........
示例4: Author
/**
* Internal function to return an Author object from a row.
* @param $row array
* @return Author
*/
function &_returnAuthorFromRow(&$row)
{
$author = new Author();
$author->setId($row['author_id']);
$author->setArticleId($row['article_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation']);
$author->setCountry($row['country']);
$author->setEmail($row['email']);
$author->setUrl($row['url']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$this->getDataObjectSettings('article_author_settings', 'author_id', $row['author_id'], $author);
HookRegistry::call('AuthorDAO::_returnAuthorFromRow', array(&$author, &$row));
return $author;
}
示例5: getPublishedArticleAuthors
/**
* Retrieve all authors from published articles
* @param $issueId int
* @return $authors array Author Objects
*/
function getPublishedArticleAuthors($issueId)
{
$authors = array();
$result =& $this->retrieve('SELECT aa.* FROM article_authors aa, published_articles pa WHERE aa.article_id = pa.article_id AND pa.issue_id = ? ORDER BY pa.issue_id', $issueId);
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setArticleId($row['article_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation']);
$author->setEmail($row['email']);
$author->setBiography($row['biography']);
$author->setPrimaryContact($row['primary_contact']);
$author->setSequence($row['seq']);
$authors[] = $author;
$result->moveNext();
}
$result->Close();
unset($result);
return $authors;
}