本文整理汇总了PHP中Author::setEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::setEmail方法的具体用法?PHP Author::setEmail怎么用?PHP Author::setEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::setEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save changes to article.
* @return int the article ID
*/
function execute()
{
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
if (isset($this->article)) {
// Update existing article
$this->article->setLocale($this->getData('locale'));
$this->article->setCommentsToEditor($this->getData('commentsToEditor'));
if ($this->article->getSubmissionProgress() <= $this->step) {
$this->article->stampStatusModified();
$this->article->setSubmissionProgress($this->step + 1);
}
$lastSectionDecision = $this->article->getLastSectionDecision();
$lastSectionDecision->setSectionId($this->getData('sectionId'));
$authorSubmissionDao->updateAuthorSubmission($this->article);
} else {
// Insert new article
$journal =& Request::getJournal();
$user =& Request::getUser();
$this->article = new AuthorSubmission();
$this->article->setLocale($this->getData('locale'));
$this->article->setUserId($user->getId());
$this->article->setJournalId($journal->getId());
$this->article->stampStatusModified();
$this->article->setSubmissionProgress($this->step + 1);
$this->article->setLanguage(String::substr($this->article->getLocale(), 0, 2));
$this->article->setCommentsToEditor($this->getData('commentsToEditor'));
// Set new Section Decision
$sectionDecision =& new SectionDecision();
$sectionDecision->setReviewType(REVIEW_TYPE_INITIAL);
$sectionDecision->setRound(1);
$sectionDecision->setSectionId($this->getData('sectionId'));
$sectionDecision->setDecision(0);
$sectionDecision->setDateDecided(date(Core::getCurrentDate()));
$this->article->addDecision($sectionDecision);
// Set user to initial author
$author = new Author();
$author->setFirstName($user->getFirstName());
$author->setMiddleName($user->getMiddleName());
$author->setLastName($user->getLastName());
$author->setAffiliation($user->getLocalizedAffiliation());
$author->setEmail($user->getEmail());
$author->setPhoneNumber($user->getPhone());
$author->setBiography($user->getBiography(null), null);
$author->setPrimaryContact(1);
$this->article->addAuthor($author);
$authorSubmissionDao->insertAuthorSubmission($this->article);
$this->articleId = $this->article->getId();
}
return $this->articleId;
}
示例2: getPublishedPaperAuthors
/**
* Retrieve all authors from published papers
* @param $schedConfId int
* @return $authors array Author Objects
*/
function getPublishedPaperAuthors($schedConfId)
{
$primaryLocale = AppLocale::getPrimaryLocale();
$locale = AppLocale::getLocale();
$authors = array();
$result =& $this->retrieve('SELECT aa.*,
aspl.setting_value AS affiliation_pl,
asl.setting_value AS affiliation_l
FROM authors aa
LEFT JOIN published_papers pa ON (pa.paper_id = aa.submission_id)
LEFT JOIN author_settings aspl ON (aspl.author_id = aa.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
LEFT JOIN author_settings asl ON (asl.author_id = aa.author_id AND asl.setting_name = ? AND asl.locale = ?)
WHERE pa.sched_conf_id = ?', array('affiliation', $primaryLocale, 'affiliation', $locale, (int) $schedConfId));
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setSubmissionId($row['paper_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation_pl'], $primaryLocale);
$author->setAffiliation($row['affiliation_l'], $locale);
$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;
}
示例3: execute
/**
* Save settings.
*/
function execute()
{
$articleDao = DAORegistry::getDAO('ArticleDAO');
$signoffDao = DAORegistry::getDAO('SignoffDAO');
$sectionEditorSubmissionDao = DAORegistry::getDAO('SectionEditorSubmissionDAO');
$application = PKPApplication::getApplication();
$request = $this->request;
$user = $request->getUser();
$router = $request->getRouter();
$journal = $router->getContext($request);
$article = $articleDao->newDataObject();
$article->setLocale($journal->getPrimaryLocale());
// FIXME in bug #5543
$article->setUserId($user->getId());
$article->setJournalId($journal->getId());
$article->setSectionId($this->getData('sectionId'));
$article->setLanguage($this->getData('language'));
$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'));
$article->setPages($this->getData('pages'));
// 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->insertObject($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 =& $authorDao->getAuthor($authors[$i]['authorId'], $articleId);
$isExistingAuthor = true;
} else {
// Create a new author
$author = new Author();
$isExistingAuthor = false;
}
if ($author != null) {
$author->setSubmissionId($articleId);
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
if (array_key_exists('affiliation', $authors[$i])) {
$author->setAffiliation($authors[$i]['affiliation'], null);
}
$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) {
$authorDao = DAORegistry::getDAO('AuthorDAO');
/* @var $authorDao AuthorDAO */
$authorDao->insertObject($author);
}
}
}
// Add the submission files as galleys
import('lib.pkp.classes.file.TemporaryFileManager');
import('classes.file.ArticleFileManager');
$tempFileIds = $this->getData('tempFileId');
$temporaryFileManager = new TemporaryFileManager();
$articleFileManager = new ArticleFileManager($articleId);
$designatedPrimary = false;
foreach (array_keys($tempFileIds) as $locale) {
$temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId());
$fileId = null;
//.........这里部分代码省略.........
示例4: execute
/**
* Save changes to article.
* @param $request Request
* @return int the article ID
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$authorDao =& DAORegistry::getDAO('AuthorDAO');
$article =& $this->article;
// Retrieve the previous citation list for comparison.
$previousRawCitationList = $article->getCitations();
// Update 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 =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId());
$isExistingAuthor = true;
} else {
// Create a new author
$author = new Author();
$isExistingAuthor = false;
}
if ($author != null) {
$author->setSubmissionId($article->getId());
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
$author->setAffiliation($authors[$i]['affiliation'], null);
$author->setCountry($authors[$i]['country']);
$author->setEmail($authors[$i]['email']);
$author->setData('orcid', $authors[$i]['orcid']);
$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']);
HookRegistry::call('Author::Form::Submit::AuthorSubmitStep3Form::Execute', array(&$author, &$authors[$i]));
if ($isExistingAuthor) {
$authorDao->updateAuthor($author);
} else {
$authorDao->insertAuthor($author);
}
}
unset($author);
}
// Remove deleted authors
$deletedAuthors = preg_split('/:/', $this->getData('deletedAuthors'), -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
$authorDao->deleteAuthorById($deletedAuthors[$i], $article->getId());
}
parent::execute();
// Save the article
$articleDao->updateArticle($article);
// Update references list if it changed.
$citationDao =& DAORegistry::getDAO('CitationDAO');
$rawCitationList = $article->getCitations();
if ($previousRawCitationList != $rawCitationList) {
$citationDao->importCitations($this->request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList);
}
return $this->articleId;
}
示例5: execute
//.........这里部分代码省略.........
}
}
$article->setHideCoverPageAbstract($hideCoverPageAbstract, 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'));
// Localized
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
if ($this->isEditor) {
$article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
}
// consider the additional field names from the public identifer plugins
import('classes.plugins.PubIdPluginHelper');
$pubIdPluginHelper = new PubIdPluginHelper();
$pubIdPluginHelper->execute($this, $article);
// 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 =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId());
$isExistingAuthor = true;
} else {
// Create a new author
if (checkPhpVersion('5.0.0')) {
// *5488* PHP4 Requires explicit instantiation-by-reference
$author = new Author();
} else {
$author =& new Author();
}
$isExistingAuthor = false;
}
if ($author != null) {
$author->setSubmissionId($article->getId());
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
$author->setAffiliation($authors[$i]['affiliation'], null);
// Localized
$author->setCountry($authors[$i]['country']);
$author->setEmail($authors[$i]['email']);
$author->setData('orcid', $authors[$i]['orcid']);
$author->setUrl($authors[$i]['url']);
if (array_key_exists('competingInterests', $authors[$i])) {
$author->setCompetingInterests($authors[$i]['competingInterests'], null);
// Localized
}
$author->setBiography($authors[$i]['biography'], null);
// Localized
$author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0);
$author->setSequence($authors[$i]['seq']);
HookRegistry::call('Submission::Form::MetadataForm::Execute', array(&$author, &$authors[$i]));
if ($isExistingAuthor) {
$authorDao->updateAuthor($author);
} else {
$authorDao->insertAuthor($author);
}
unset($author);
}
}
// Remove deleted authors
$deletedAuthors = preg_split('/:/', $this->getData('deletedAuthors'), -1, PREG_SPLIT_NO_EMPTY);
for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) {
$authorDao->deleteAuthorById($deletedAuthors[$i], $article->getId());
}
if ($this->isEditor) {
$article->setCopyrightHolder($this->getData('copyrightHolder'), null);
$article->setCopyrightYear($this->getData('copyrightYear'));
$article->setLicenseURL($this->getData('licenseURL'));
}
parent::execute();
// Save the article
$articleDao->updateArticle($article);
// Update search index
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleMetadataChanged($article);
$articleSearchIndex->articleChangesFinished();
// Update references list if it changed.
$rawCitationList = $article->getCitations();
if ($previousRawCitationList != $rawCitationList) {
$citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList);
}
return $article->getId();
}
示例6: getPublishedPaperAuthors
/**
* Retrieve all authors from published papers
* @param $schedConfId int
* @return $authors array Author Objects
*/
function getPublishedPaperAuthors($schedConfId)
{
$authors = array();
$result =& $this->retrieve('SELECT aa.* FROM paper_authors aa, published_papers pa WHERE aa.paper_id = pa.paper_id AND pa.sched_conf_id = ? ORDER BY pa.sched_conf_id', $schedConfId);
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setPaperId($row['paper_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;
}
示例7: execute
/**
* Save author
* @see Form::execute()
* @see Form::execute()
*/
function execute()
{
$authorDao = DAORegistry::getDAO('AuthorDAO');
$submission = $this->getSubmission();
$author = $this->getAuthor();
if (!$author) {
// this is a new submission contributor
$author = new Author();
$author->setSubmissionId($submission->getId());
$existingAuthor = false;
} else {
$existingAuthor = true;
if ($submission->getId() !== $author->getSubmissionId()) {
fatalError('Invalid author!');
}
}
$author->setFirstName($this->getData('firstName'));
$author->setMiddleName($this->getData('middleName'));
$author->setLastName($this->getData('lastName'));
$author->setSuffix($this->getData('suffix'));
$author->setAffiliation($this->getData('affiliation'), null);
// localized
$author->setCountry($this->getData('country'));
$author->setEmail($this->getData('email'));
$author->setUrl($this->getData('userUrl'));
$author->setOrcid($this->getData('orcid'));
$author->setUserGroupId($this->getData('userGroupId'));
$author->setBiography($this->getData('biography'), null);
// localized
$author->setPrimaryContact($this->getData('primaryContact') ? true : false);
$author->setIncludeInBrowse($this->getData('includeInBrowse') ? true : false);
// in order to be able to use the hook
parent::execute();
if ($existingAuthor) {
$authorDao->updateObject($author);
$authorId = $author->getId();
} else {
$authorId = $authorDao->insertObject($author);
}
return $authorId;
}
示例8: execute
/**
* Save changes to article.
* @return int the article ID
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$authorDao =& DAORegistry::getDAO('AuthorDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
// Update article
$article =& $this->article;
$article->setTitle($this->getData('title'), null);
// Localized
$section =& $sectionDao->getSection($article->getSectionId());
$article->setAbstract($this->getData('abstract'), null);
// Localized
import('file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if ($publicFileManager->uploadedFileExists('coverPage')) {
$journal = Request::getJournal();
$originalFileName = $publicFileManager->getUploadedFileName('coverPage');
$newFileName = 'cover_article_' . $this->getData('articleId') . '_' . $this->getFormLocale() . '.' . $publicFileManager->getExtension($originalFileName);
$publicFileManager->uploadJournalFile($journal->getId(), 'coverPage', $newFileName);
$article->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $this->getFormLocale());
$article->setFileName($newFileName, $this->getFormLocale());
// Store the image dimensions.
list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newFileName);
$article->setWidth($width, $this->getFormLocale());
$article->setHeight($height, $this->getFormLocale());
}
$article->setCoverPageAltText($this->getData('coverPageAltText'), null);
// Localized
$showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $showCoverPage)) {
$showCoverPage[$locale] = 0;
}
}
$article->setShowCoverPage($showCoverPage, null);
// Localized
$hideCoverPageToc = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageToc'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageToc)) {
$hideCoverPageToc[$locale] = 0;
}
}
$article->setHideCoverPageToc($hideCoverPageToc, null);
// Localized
$hideCoverPageAbstract = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageAbstract'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageAbstract)) {
$hideCoverPageAbstract[$locale] = 0;
}
}
$article->setHideCoverPageAbstract($hideCoverPageAbstract, 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'));
// Localized
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
if ($this->isEditor) {
$article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
}
// 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->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);
//.........这里部分代码省略.........
示例9: testSpeed
//.........这里部分代码省略.........
$control = strtotime('2004-02-29 00:00:00');
// should be two in the db
$r = ReviewPeer::doSelectOne(new Criteria());
$r_id = $r->getId();
$r->setReviewDate($control);
$r->save();
$r2 = ReviewPeer::retrieveByPk($r_id);
// Testing the column validators
// -----------------------------
$bk1 = new Book();
$bk1->setTitle("12345");
// min length is 10
$ret = $bk1->validate();
// Unique validator
$bk2 = new Book();
$bk2->setTitle("Don Juan");
$ret = $bk2->validate();
// Now trying some more complex validation.
$auth1 = new Author();
$auth1->setFirstName("Hans");
// last name required; will fail
$bk1->setAuthor($auth1);
$rev1 = new Review();
$rev1->setReviewDate("08/09/2001");
// will fail: reviewed_by column required
$bk1->addReview($rev1);
$ret2 = $bk1->validate();
$bk2 = new Book();
$bk2->setTitle("12345678901");
// passes
$auth2 = new Author();
$auth2->setLastName("Blah");
//passes
$auth2->setEmail("some@body.com");
//passes
$auth2->setAge(50);
//passes
$bk2->setAuthor($auth2);
$rev2 = new Review();
$rev2->setReviewedBy("Me!");
// passes
$rev2->setStatus("new");
// passes
$bk2->addReview($rev2);
$ret3 = $bk2->validate();
// Testing doCount() functionality
// -------------------------------
$c = new Criteria();
$count = BookPeer::doCount($c);
// Testing many-to-many relationships
// ----------------------------------
// init book club list 1 with 2 books
$blc1 = new BookClubList();
$blc1->setGroupLeader("Crazyleggs");
$blc1->setTheme("Happiness");
$brel1 = new BookListRel();
$brel1->setBook($phoenix);
$brel2 = new BookListRel();
$brel2->setBook($dj);
$blc1->addBookListRel($brel1);
$blc1->addBookListRel($brel2);
$blc1->save();
// init book club list 2 with 1 book
$blc2 = new BookClubList();
$blc2->setGroupLeader("John Foo");
$blc2->setTheme("Default");
示例10: getPublishedArticleAuthors
/**
* Retrieve all authors from published articles
* @param $issueId int
* @return $authors array Author Objects
*/
function getPublishedArticleAuthors($issueId)
{
$primaryLocale = Locale::getPrimaryLocale();
$locale = Locale::getLocale();
$authors = array();
$result =& $this->retrieve('SELECT aa.*
FROM authors aa
LEFT JOIN published_articles pa ON (pa.article_id = aa.submission_id)
WHERE pa.issue_id = ? ORDER BY pa.issue_id', (int) $issueId);
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$author = new Author();
$author->setId($row['author_id']);
$author->setSubmissionId($row['article_id']);
$author->setFirstName($row['first_name']);
$author->setMiddleName($row['middle_name']);
$author->setLastName($row['last_name']);
$author->setAffiliation($row['affiliation_pl'], $primaryLocale);
$author->setAffiliation($row['affiliation_l'], $locale);
$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;
}
示例11: 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->setPaperId($row['paper_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('paper_author_settings', 'author_id', $row['author_id'], $author);
HookRegistry::call('AuthorDAO::_returnAuthorFromRow', array(&$author, &$row));
return $author;
}
示例12: 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;
}
示例13: execute
/**
* Save settings.
*/
function execute($editArticleId)
{
$this->editArticleID = $editArticleId;
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$application =& PKPApplication::getApplication();
$request =& $application->getRequest();
$user =& $request->getUser();
$router =& $request->getRouter();
$journal =& $router->getContext($request);
$article = new Article();
$article->setLocale($journal->getPrimaryLocale());
// FIXME in bug #5543
$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
//add Original Journal to Abstract
$orig_journal = $this->getData('originalJournal');
$abstr = $this->getData('abstract');
foreach (array_keys($abstr) as $abs_key) {
$abstr[$abs_key] .= ' <p id="originalPub"> ' . $orig_journal . ' </p> ';
// $abstr[$abs_key] .= ' <p id="originalPub"> ' . $orig_journal[$abs_key]. ' </p> ';
//OriginalJournal in EditPlugin only a string and not an array...
$this->setData('abstract', $abstr);
}
$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'));
$article->setPages($this->getData('pages'));
// 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);
// As article has an ID already set it
$article->setId($this->editArticleID);
$articleId = $this->editArticleID;
//delete prior Authors to prevent from double saving the same authors
$authorDao =& DAORegistry::getDAO('AuthorDAO');
$authorDao->deleteAuthorsByArticle($articleId);
// 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->setSubmissionId($articleId);
$author->setFirstName($authors[$i]['firstName']);
$author->setMiddleName($authors[$i]['middleName']);
$author->setLastName($authors[$i]['lastName']);
if (array_key_exists('affiliation', $authors[$i])) {
$author->setAffiliation($authors[$i]['affiliation'], null);
}
$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);
}
}
//.........这里部分代码省略.........
示例14: execute
/**
* Save submissionContributor
* @see Form::execute()
* @see Form::execute()
*/
function execute()
{
$authorDao =& DAORegistry::getDAO('AuthorDAO');
$monograph = $this->getMonograph();
$submissionContributor =& $this->getSubmissionContributor();
if (!$submissionContributor) {
// this is a new submission contributor
$submissionContributor = new Author();
$submissionContributor->setMonographId($monograph->getId());
$existingSubmissionContributor = false;
} else {
$existingSubmissionContributor = true;
}
assert($monograph->getId() == $submissionContributor->getMonographId());
$submissionContributor->setFirstName($this->getData('firstName'));
$submissionContributor->setMiddleName($this->getData('middleName'));
$submissionContributor->setLastName($this->getData('lastName'));
$submissionContributor->setAffiliation($this->getData('affiliation'), Locale::getLocale());
// localized
$submissionContributor->setCountry($this->getData('country'));
$submissionContributor->setEmail($this->getData('email'));
$submissionContributor->setUrl($this->getData('url'));
$submissionContributor->setUserGroupId($this->getData('userGroupId'));
$submissionContributor->setBiography($this->getData('biography'), Locale::getLocale());
// localized
$submissionContributor->setPrimaryContact($this->getData('primaryContact') ? true : false);
if ($existingSubmissionContributor) {
$authorDao->updateAuthor($submissionContributor);
$authorId = $submissionContributor->getId();
} else {
$authorId = $authorDao->insertAuthor($submissionContributor);
}
return $authorId;
}
示例15: testToXml
/**
* @covers OAIMetadataFormat_DC
* @covers Dc11SchemaArticleAdapter
*/
public function testToXml()
{
$this->markTestSkipped('Skipped because of weird class interaction with ControlledVocabDAO.');
//
// Create test data.
//
$journalId = 1;
// Enable the DOI plugin.
$pluginSettingsDao = DAORegistry::getDAO('PluginSettingsDAO');
/* @var $pluginSettingsDao PluginSettingsDAO */
$pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enabled', 1);
$pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableIssueDoi', 1);
$pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableArticleDoi', 1);
$pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableGalleyDoi', 1);
// Author
import('classes.article.Author');
$author = new Author();
$author->setFirstName('author-firstname');
$author->setLastName('author-lastname');
$author->setAffiliation('author-affiliation', 'en_US');
$author->setEmail('someone@example.com');
// Article
import('classes.article.PublishedArticle');
$article = $this->getMock('PublishedArticle', array('getBestArticleId'));
/* @var $article PublishedArticle */
$article->expects($this->any())->method('getBestArticleId')->will($this->returnValue(9));
$article->setId(9);
$article->setJournalId($journalId);
$author->setSubmissionId($article->getId());
$article->setPages(15);
$article->setType('art-type', 'en_US');
$article->setTitle('article-title-en', 'en_US');
$article->setTitle('article-title-de', 'de_DE');
$article->setDiscipline('article-discipline', 'en_US');
$article->setSubject('article-subject', 'en_US');
$article->setAbstract('article-abstract', 'en_US');
$article->setSponsor('article-sponsor', 'en_US');
$article->setStoredPubId('doi', 'article-doi');
$article->setLanguage('en_US');
// Galleys
import('classes.article.ArticleGalley');
$galley = new ArticleGalley();
$galley->setId(98);
$galley->setStoredPubId('doi', 'galley-doi');
$galleys = array($galley);
// Journal
import('classes.journal.Journal');
$journal = $this->getMock('Journal', array('getSetting'));
/* @var $journal Journal */
$journal->expects($this->any())->method('getSetting')->will($this->returnCallback(array($this, 'getJournalSetting')));
$journal->setPrimaryLocale('en_US');
$journal->setPath('journal-path');
$journal->setId($journalId);
// Section
import('classes.journal.Section');
$section = new Section();
$section->setIdentifyType('section-identify-type', 'en_US');
// Issue
import('classes.issue.Issue');
$issue = $this->getMock('Issue', array('getIssueIdentification'));
/* @var $issue Issue */
$issue->expects($this->any())->method('getIssueIdentification')->will($this->returnValue('issue-identification'));
$issue->setId(96);
$issue->setDatePublished('2010-11-05');
$issue->setStoredPubId('doi', 'issue-doi');
$issue->setJournalId($journalId);
//
// Create infrastructural support objects
//
// Router
import('lib.pkp.classes.core.PKPRouter');
$router = $this->getMock('PKPRouter', array('url'));
$application = PKPApplication::getApplication();
$router->setApplication($application);
$router->expects($this->any())->method('url')->will($this->returnCallback(array($this, 'routerUrl')));
// Request
import('classes.core.Request');
$request = $this->getMock('Request', array('getRouter'));
$request->expects($this->any())->method('getRouter')->will($this->returnValue($router));
Registry::set('request', $request);
//
// Create mock DAOs
//
// Create a mocked AuthorDAO that returns our test author.
import('classes.article.AuthorDAO');
$authorDao = $this->getMock('AuthorDAO', array('getBySubmissionId'));
$authorDao->expects($this->any())->method('getBySubmissionId')->will($this->returnValue(array($author)));
DAORegistry::registerDAO('AuthorDAO', $authorDao);
// Create a mocked OAIDAO that returns our test data.
import('classes.oai.ojs.OAIDAO');
$oaiDao = $this->getMock('OAIDAO', array('getJournal', 'getSection', 'getIssue'));
$oaiDao->expects($this->any())->method('getJournal')->will($this->returnValue($journal));
$oaiDao->expects($this->any())->method('getSection')->will($this->returnValue($section));
$oaiDao->expects($this->any())->method('getIssue')->will($this->returnValue($issue));
DAORegistry::registerDAO('OAIDAO', $oaiDao);
// Create a mocked ArticleGalleyDAO that returns our test data.
//.........这里部分代码省略.........