/** * 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; }
/** * 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; }
/** * Save changes to article. * @param $request PKPRequest * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $citationDao =& DAORegistry::getDAO('CitationDAO'); /* @var $citationDao CitationDAO */ $article =& $this->article; // Retrieve the previous citation list for comparison. $previousRawCitationList = $article->getCitations(); // Update article $article->setTitle($this->getData('title'), null); // Localized $section =& $sectionDao->getSection($article->getSectionId()); $article->setAbstract($this->getData('abstract'), null); // Localized import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); if ($publicFileManager->uploadedFileExists(COVER_PAGE_IMAGE_NAME)) { $journal = Request::getJournal(); $originalFileName = $publicFileManager->getUploadedFileName(COVER_PAGE_IMAGE_NAME); $type = $publicFileManager->getUploadedFileType(COVER_PAGE_IMAGE_NAME); $newFileName = 'cover_article_' . $this->article->getId() . '_' . $this->getFormLocale() . $publicFileManager->getImageExtension($type); $publicFileManager->uploadJournalFile($journal->getId(), COVER_PAGE_IMAGE_NAME, $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); } // 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(); }
/** * Save changes to article. * @param $request Request * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; $articleSitesData = $this->getData('articleSites'); $articleSites = $article->getArticleSites(); import('classes.journal.TrialSite'); import('classes.article.ArticleSite'); // Remove deleted article sites foreach ($articleSites as $articleSite) { $isPresent = false; foreach ($articleSitesData as $articleSiteData) { if (!empty($articleSiteData['id'])) { if ($articleSite->getId() == $articleSiteData['id']) { $isPresent = true; } } } if (!$isPresent) { $article->removeArticleSite($articleSite->getId()); } unset($isPresent); unset($articleSite); } // Update / Insters article sites foreach ($articleSitesData as $articleSiteData) { if (isset($articleSiteData['id'])) { $articleSite = $article->getArticleSite($articleSiteData['id']); $isExistingSite = true; } else { $articleSite = new ArticleSite(); $isExistingSite = false; } $articleSite->setArticleId($article->getId()); if ($articleSiteData['siteSelect'] == "OTHER") { $trialSite = new TrialSite(); $trialSite->setName($articleSiteData['siteName']); $trialSite->setAddress($articleSiteData['siteAddress']); $trialSite->setCity($articleSiteData['siteCity']); $trialSite->setRegion($articleSiteData['siteRegion']); $trialSite->setLicensure($articleSiteData['siteLicensure']); $trialSite->setAccreditation($articleSiteData['siteAccreditation']); $articleSite->setSiteId($this->trialSiteDao->insertTrialSite($trialSite)); } else { $articleSite->setSiteId($articleSiteData['siteSelect']); } $articleSite->setAuthority($articleSiteData['authority']); $articleSite->setERCId($articleSiteData['erc']); $articleSite->setPrimaryPhone($articleSiteData['primaryPhone']); $articleSite->setSecondaryPhone($articleSiteData['secondaryPhone']); $articleSite->setFax($articleSiteData['fax']); $articleSite->setEmail($articleSiteData['email']); $articleSite->setSubjectsNumber($articleSiteData['subjectsNumber']); $investigatorsData = $articleSiteData['investigators']; $investigators = $articleSite->getInvestigators(); // Remove deleted investigators foreach ($investigators as $investigator) { $isPresent = false; foreach ($investigatorsData as $investigatorData) { if (!empty($investigatorData['id'])) { if ($investigator->getId() == $investigatorData['id']) { $isPresent = true; } } } if (!$isPresent) { $articleSite->removeInvestigator($investigator->getId()); } unset($isPresent); unset($investigator); } // Update / Insert Investigators $investigatorIterator = 1; foreach ($investigatorsData as $investigatorData) { if (isset($investigatorData['id'])) { $investigator = $articleSite->getInvestigator($investigatorData['id']); } else { $investigator = new Author(); } if ($isExistingSite) { $investigator->setSiteId($articleSite->getId()); } if ($investigatorIterator == 1) { $investigator->setPrimaryContact(1); } $investigator->setSequence($investigatorIterator); $investigator->setFirstName($investigatorData['firstName']); $investigator->setLastName($investigatorData['lastName']); $investigator->setExpertise($investigatorData['expertise']); $investigator->setPrimaryPhoneNumber($investigatorData['iPrimaryPhone']); $investigator->setSecondaryPhoneNumber($investigatorData['iSecondaryPhone']); $investigator->setFaxNumber($investigatorData['iFax']); $investigator->setEmail($investigatorData['iEmail']); $articleSite->addInvestigator($investigator); $investigatorIterator++; } $article->addArticleSite($articleSite); } //update step if ($article->getSubmissionProgress() <= $this->step) { $article->stampStatusModified(); $article->setSubmissionProgress($this->step + 1); } elseif ($article->getSubmissionProgress() == 9) { $article->setSubmissionProgress(8); } parent::execute(); // Save the article $articleDao->updateArticle($article); return $this->articleId; }
/** * 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; }
/** * Save changes to paper. * @return int the paper ID */ function execute() { $paperDao =& DAORegistry::getDAO('PaperDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); $trackDao =& DAORegistry::getDAO('TrackDAO'); // Update paper $paper =& $this->paper; $paper->setTitle($this->getData('title'), null); // Localized $track =& $trackDao->getTrack($paper->getTrackId()); $paper->setAbstract($this->getData('abstract'), null); // Localized $paper->setDiscipline($this->getData('discipline'), null); // Localized $paper->setSubjectClass($this->getData('subjectClass'), null); // Localized $paper->setSubject($this->getData('subject'), null); // Localized $paper->setCoverageGeo($this->getData('coverageGeo'), null); // Localized $paper->setCoverageChron($this->getData('coverageChron'), null); // Localized $paper->setCoverageSample($this->getData('coverageSample'), null); // Localized $paper->setType($this->getData('type'), null); // Localized $paper->setLanguage($this->getData('language')); $paper->setSponsor($this->getData('sponsor'), null); // Localized $paper->setCitations($this->getData('citations')); // 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 =& $paper->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']); $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $paper->addAuthor($author); } } } // Remove deleted authors $deletedAuthors = explode(':', $this->getData('deletedAuthors')); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $paper->removeAuthor($deletedAuthors[$i]); } // Save the paper $paperDao->updatePaper($paper); // Update search index import('search.PaperSearchIndex'); PaperSearchIndex::indexPaperMetadata($paper); return $paper->getId(); }
/** * Save changes to paper. * @return int the paper ID */ function execute() { $paperDao =& DAORegistry::getDAO('PaperDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); $paper =& $this->paper; $conference =& Request::getConference(); $schedConf =& Request::getSchedConf(); $user =& Request::getUser(); // Update paper $paper->setTitle($this->getData('title'), null); // Localized $reviewMode = $this->paper->getReviewMode(); if ($reviewMode != REVIEW_MODE_PRESENTATIONS_ALONE) { $paper->setAbstract($this->getData('abstract'), null); // Localized } $paper->setDiscipline($this->getData('discipline'), null); // Localized $paper->setSubjectClass($this->getData('subjectClass'), null); // Localized $paper->setSubject($this->getData('subject'), null); // Localized $paper->setCoverageGeo($this->getData('coverageGeo'), null); // Localized $paper->setCoverageChron($this->getData('coverageChron'), null); // Localized $paper->setCoverageSample($this->getData('coverageSample'), null); // Localized $paper->setType($this->getData('type'), null); // Localized $paper->setLanguage($this->getData('language')); // Localized $paper->setSponsor($this->getData('sponsor'), null); // Localized $paper->setCitations($this->getData('citations')); // Update the submission progress if necessary. if ($paper->getSubmissionProgress() <= $this->step) { $paper->stampStatusModified(); // If we aren't about to collect the paper, the submission is complete // (for now) $reviewMode = $this->paper->getReviewMode(); if ($reviewMode == REVIEW_MODE_BOTH_SIMULTANEOUS || $reviewMode == REVIEW_MODE_PRESENTATIONS_ALONE) { if (!$schedConf->getSetting('acceptSupplementaryReviewMaterials')) { $paper->setSubmissionProgress($this->step + 2); } else { $paper->setSubmissionProgress($this->step + 1); } // The line below is necessary to ensure that // the paper upload goes in with the correct // stage number (i.e. paper). $paper->setCurrentStage(REVIEW_STAGE_PRESENTATION); } else { $paper->setDateSubmitted(Core::getCurrentDate()); $paper->stampStatusModified(); $paper->setCurrentStage(REVIEW_STAGE_ABSTRACT); $this->assignDirectors($paper); if ($schedConf->getSetting('acceptSupplementaryReviewMaterials')) { $paper->setSubmissionProgress($this->step + 2); } else { $paper->setSubmissionProgress(0); $this->confirmSubmission($paper, $user, $schedConf, $conference, 'SUBMISSION_ACK'); } } } // 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 =& $paper->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']); $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $paper->addAuthor($author); } } unset($author); } // Remove deleted authors $deletedAuthors = explode(':', $this->getData('deletedAuthors')); for ($i = 0, $count = count($deletedAuthors); $i < $count; $i++) { $paper->removeAuthor($deletedAuthors[$i]); } // Save the paper $paperDao->updatePaper($paper); // Log the submission, even though it may not be "complete" // at this step. This is important because we don't otherwise // capture changes in review process. import('paper.log.PaperLog'); import('paper.log.PaperEventLogEntry'); PaperLog::logEvent($this->paperId, PAPER_LOG_ABSTRACT_SUBMIT, LOG_TYPE_AUTHOR, $user->getId(), 'log.author.abstractSubmitted', array('submissionId' => $paper->getId(), 'authorName' => $user->getFullName())); return $this->paperId; }
/** * 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); // Localized } $author->setBiography($authors[$i]['biography'], null); // Localized $author->setPrimaryContact($this->getData('primaryContact') == $i ? 1 : 0); $author->setSequence($authors[$i]['seq']); if ($isExistingAuthor == false) { $article->addAuthor($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); // Update search index import('search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); return $article->getId(); }
/** * Save settings. */ function execute() { $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 $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->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->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); } } } // Add the submission files as galleys import('classes.file.TemporaryFileManager'); import('classes.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 = null; if ($temporaryFile) { $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); if (strstr($fileType, 'html')) { import('classes.article.ArticleHTMLGalley'); $galley = new ArticleHTMLGalley(); } else { import('classes.article.ArticleGalley'); $galley = new ArticleGalley(); } $galley->setArticleId($articleId); $galley->setFileId($fileId); $galley->setLocale($locale); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(__('common.untitled')); } } } } $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); } if ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($fileId); $article->SetReviewFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId); import('classes.submission.author.AuthorAction'); AuthorAction::designateReviewVersion($authorSubmission, true); // Accept the submission $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $articleFileManager = new ArticleFileManager($articleId); $sectionEditorSubmission->setReviewFile($articleFileManager->getFile($article->getSubmissionFileId())); import('classes.submission.sectionEditor.SectionEditorAction'); SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); // Create signoff infrastructure $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateArticle($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article); } if ($this->getData('destination') == "issue") { // Add to an existing issue $issueId = $this->getData('issueId'); $this->scheduleForPublication($articleId, $issueId); } // Index article. import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); // Import the references list. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); }
/** * 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; }
/** * 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; }
/** * Handle an author node (i.e. convert an author from DOM to DAO). * @param $journal Journal * @param $authorNode DOMElement * @param $issue Issue * @param $section Section * @param $article Article * @param $errors array * @param $authorIndex int 0 for first author, 1 for second, ... */ function handleAuthorNode(&$journal, &$authorNode, &$issue, &$section, &$article, &$errors, $authorIndex) { $errors = array(); $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames()); // => journal locales must be set up before $author = new Author(); if ($node = $authorNode->getChildByName('firstname')) { $author->setFirstName((string) $node->getValue()); } if ($node = $authorNode->getChildByName('middlename')) { $author->setMiddleName($node->getValue()); } if ($node = $authorNode->getChildByName('lastname')) { $author->setLastName((string) $node->getValue()); } $author->setSequence($authorIndex + 1); // 1-based for ($index = 0; $node = $authorNode->getChildByName('affiliation', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $article->getLocale(); } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleAuthorAffiliationLocaleUnsupported', array('authorFullName' => $author->getFullName(), 'articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $author->setAffiliation($node->getValue(), $locale); } if ($node = $authorNode->getChildByName('country')) { $author->setCountry($node->getValue()); } if ($node = $authorNode->getChildByName('email')) { $author->setEmail((string) $node->getValue()); } if ($node = $authorNode->getChildByName('url')) { $author->setUrl($node->getValue()); } for ($index = 0; $node = $authorNode->getChildByName('competing_interests', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $article->getLocale(); } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleAuthorCompetingInterestsLocaleUnsupported', array('authorFullName' => $author->getFullName(), 'articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $author->setCompetingInterests($node->getValue(), $locale); } for ($index = 0; $node = $authorNode->getChildByName('biography', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $article->getLocale(); } elseif (!in_array($locale, $journalSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.articleAuthorBiographyLocaleUnsupported', array('authorFullName' => $author->getFullName(), 'articleTitle' => $article->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification(), 'locale' => $locale)); return false; } $author->setBiography($node->getValue(), $locale); } $author->setSubmissionId($article->getId()); $author->setPrimaryContact($authorNode->getAttribute('primary_contact') === 'true' ? 1 : 0); $authorDao =& DAORegistry::getDAO('AuthorDAO'); /* @var $authorDao AuthorDAO */ $authorDao->insertAuthor($author); return true; }
/** * 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; }
/** * 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); } } } // Check whether the user gave a handle and create a handleSubmissionFile in case $submissionHandle = $this->getData('submissionHandle'); $handleSubmissionFileId; $handleCheck = FALSE; //import FileManager before creating files because otherwise naming of the copied files failes import('classes.file.ArticleFileManager'); foreach (array_keys($submissionHandle) as $locale) { if (!empty($submissionHandle[$locale])) { $this->deleteOldFile("submission/original", $articleId); // $this->deleteOldFile("submission/copyedit", $articleId); $handleCheck = TRUE; $handleSubmissionId = $this->createHandleTXTFile($submissionHandle[$locale], $articleId, 'submission'); $handleSubmissionPDFId = $this->createHandlePDF($submissionHandle[$locale], $articleId, 'submission'); //Add the handle submission files as galley $this->setGalley($articleId, $handleSubmissionPDFId, $locale, 'application/pdf'); } if ($handleCheck == TRUE) { if ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($handleSubmissionPDFId); $article->SetReviewFileId($handleSubmissionPDFId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } } // Add the submission files as galleys import('classes.file.TemporaryFileManager'); import('classes.file.ArticleFileManager'); $tempFileIds = $this->getData('tempFileId'); $temporaryFileManager = new TemporaryFileManager(); $articleFileManager = new ArticleFileManager($articleId); $tempFileCheck = FALSE; foreach (array_keys($tempFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $this->deleteOldFile("submission/original", $articleId); $this->deleteOldFile("submission/copyedit", $articleId); $tempFileCheck = TRUE; $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); $this->setGalley($articleId, $fileId, $locale, $fileType); // $galley =& $this->setGalley($articleId, $fileId, $locale, $fileType); } if ($tempFileCheck == TRUE) { if ($locale == $journal->getPrimaryLocale()) { $article->setSubmissionFileId($fileId); $article->SetReviewFileId($fileId); } // Update file search index import('classes.search.ArticleSearchIndex'); if (isset($galley)) { ArticleSearchIndex::updateFileIndex($galley->getArticleId(), ARTICLE_SEARCH_GALLEY_FILE, $galley->getFileId()); } } } //Check whether the user gave a handle and create handleSupplFile in case $supplHandle = $this->getData('supplHandle'); $handleSuppFileId = null; foreach (array_keys($supplHandle) as $locale) { if (!empty($supplHandle[$locale])) { $this->deleteOldFile("supp", $articleId); $handleSuppFileId = $this->createHandleTXTFile($supplHandle[$locale], $articleId, 'supplementary'); $handleSupplPDFFileID = $this->createHandlePDF($submissionHandle[$locale], $articleId, 'supplementary'); } } //Add uploaded Supplementary file $tempSupplFileIds = $this->getData('tempSupplFileId'); foreach (array_keys($tempSupplFileIds) as $locale) { $temporaryFile = $temporaryFileManager->getFile($tempSupplFileIds[$locale], $user->getId()); $fileId = null; if ($temporaryFile) { $this->deleteOldFile("supp", $articleId); $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, ARTICLE_FILE_SUPP); $fileType = $temporaryFile->getFileType(); } } // Designate this as the review version by default. /*$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId); import('classes.submission.author.AuthorAction'); AuthorAction::designateReviewVersion($authorSubmission, true); */ // Accept the submission /*$sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $articleFileManager = new ArticleFileManager($articleId); $sectionEditorSubmission->setReviewFile($articleFileManager->getFile($article->getSubmissionFileId())); import('classes.submission.sectionEditor.SectionEditorAction'); SectionEditorAction::recordDecision($sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); */ // Create signoff infrastructure $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateArticle($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article); } // As the article already has an issue, just get it from database $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueByArticleId($this->editArticleID); $issueId = $issue->getIssueId(); //$this->scheduleForPublication($articleId, $issueId); // Index article. import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); // Import the references list. $citationDao =& DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); }
/** * Save changes to article. * @param $request PKPRequest * @return int the article ID */ function execute(&$request) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $this->article; // Retrieve the previous citation list for comparison. $previousRawCitationList = $article->getCitations(); /////////////////////////////////////////// ////////////// 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->setSubmissionId($article->getId()); if (isset($authors[$i]['firstName'])) { $author->setFirstName($authors[$i]['firstName']); } if (isset($authors[$i]['middleName'])) { $author->setMiddleName($authors[$i]['middleName']); } if (isset($authors[$i]['lastName'])) { $author->setLastName($authors[$i]['lastName']); } if (isset($authors[$i]['affiliation'])) { $author->setAffiliation($authors[$i]['affiliation']); } if (isset($authors[$i]['phone'])) { $author->setPhoneNumber($authors[$i]['phone']); } if (isset($authors[$i]['email'])) { $author->setEmail($authors[$i]['email']); } $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]); } /////////////////////////////////////////// //////////// Update Abstract(s) /////////// /////////////////////////////////////////// import('classes.article.ProposalAbstract'); $journal = Request::getJournal(); $abstracts = $this->getData('abstracts'); foreach ($journal->getSupportedLocaleNames() as $localeKey => $localeValue) { if ($abstracts[$localeKey]['abstractId'] > 0) { $abstract = $article->getAbstractByLocale($localeKey); $isExistingAbstract = true; } else { $abstract = new ProposalAbstract(); $isExistingAbstract = false; } if ($abstract != null) { $abstract->setArticleId($article->getId()); $abstract->setLocale($localeKey); $abstract->setScientificTitle($abstracts[$localeKey]['scientificTitle']); $abstract->setPublicTitle($abstracts[$localeKey]['publicTitle']); $abstract->setBackground($abstracts[$localeKey]['background']); $abstract->setObjectives($abstracts[$localeKey]['objectives']); $abstract->setStudyMethods($abstracts[$localeKey]['studyMethods']); $abstract->setExpectedOutcomes($abstracts[$localeKey]['expectedOutcomes']); $abstract->setKeywords($abstracts[$localeKey]['keywords']); if ($isExistingAbstract == false) { $article->addAbstract($abstract); } } unset($abstract); } /////////////////////////////////////////// ///////// Update Proposal Details ///////// /////////////////////////////////////////// $proposalDetailsData = $this->getData('proposalDetails'); import('classes.article.ProposalDetails'); $proposalDetails = new ProposalDetails(); $institutionDao =& DAORegistry::getDAO('InstitutionDAO'); import('classes.journal.Institution'); $proposalDetails->setArticleId($article->getId()); $proposalDetails->setStudentResearch($proposalDetailsData['studentInitiatedResearch']); $proposalDetails->setStartDate($proposalDetailsData['startDate']); $proposalDetails->setEndDate($proposalDetailsData['endDate']); if ($proposalDetailsData['keyImplInstitution'] == "OTHER") { $institution = new Institution(); $institution->setInstitutionName($proposalDetailsData['otherInstitutionName']); $institution->setInstitutionAcronym($proposalDetailsData['otherInstitutionAcronym']); $institution->setInstitutionType($proposalDetailsData['otherInstitutionType']); $institution->setInstitutionInternational($proposalDetailsData['international']); if ($proposalDetailsData['international'] == INSTITUTION_NATIONAL) { $institution->setInstitutionLocation($proposalDetailsData['locationCountry']); } elseif ($proposalDetailsData['international'] == INSTITUTION_INTERNATIONAL) { $institution->setInstitutionLocation($proposalDetailsData['locationInternational']); } $institutionId = $institutionDao->insertInstitution($institution); $proposalDetails->setKeyImplInstitution($institutionId); unset($institution); } else { $proposalDetails->setKeyImplInstitution($proposalDetailsData['keyImplInstitution']); } $proposalDetails->setMultiCountryResearch($proposalDetailsData['multiCountryResearch']); if ($proposalDetailsData['multiCountryResearch'] == PROPOSAL_DETAIL_YES) { $countriesArray = $proposalDetailsData['countries']; $countries = implode(",", $countriesArray); $proposalDetails->setCountries($countries); } $proposalDetails->setNationwide($proposalDetailsData['nationwide']); if ($proposalDetailsData['nationwide'] != PROPOSAL_DETAIL_YES) { $geoAreasArray = $proposalDetailsData['geoAreas']; $proposalDetails->setGeoAreasFromArray($geoAreasArray); } $researchDomainsArray = $proposalDetailsData['researchDomains']; $proposalDetails->setResearchDomainsFromArray($researchDomainsArray); $researchFieldsArray = $proposalDetailsData['researchFields']; foreach ($researchFieldsArray as $i => $field) { if ($field == "OTHER") { $otherField = $proposalDetailsData['otherResearchField']; if ($otherField != "") { $researchFieldsArray[$i] = "Other (" . $otherField . ")"; } } } $proposalDetails->setResearchFieldsFromArray($researchFieldsArray); $proposalDetails->setHumanSubjects($proposalDetailsData['withHumanSubjects']); if ($proposalDetailsData['withHumanSubjects'] == PROPOSAL_DETAIL_YES) { $proposalTypesArray = $proposalDetailsData['proposalTypes']; foreach ($proposalTypesArray as $i => $type) { if ($type == "OTHER") { $otherType = $proposalDetailsData['otherProposalType']; if ($otherType != "") { $proposalTypesArray[$i] = "Other (" . $otherType . ")"; } } } $proposalDetails->setProposalTypesFromArray($proposalTypesArray); } $proposalDetails->setDataCollection($proposalDetailsData['dataCollection']); if ($proposalDetailsData['reviewedByOtherErc'] == PROPOSAL_DETAIL_YES) { $proposalDetails->setCommitteeReviewed($proposalDetailsData['otherErcDecision']); } else { $proposalDetails->setCommitteeReviewed(PROPOSAL_DETAIL_NO); } // Update or insert student research import('classes.article.StudentResearch'); $studentResearchInfo = new StudentResearch(); $studentResearchInfo->setArticleId($article->getId()); $studentResearchData = $this->getData('studentResearch'); $studentResearchInfo->setInstitution($studentResearchData['studentInstitution']); $studentResearchInfo->setDegree($studentResearchData['academicDegree']); $studentResearchInfo->setSupervisorName($studentResearchData['supervisorName']); $studentResearchInfo->setSupervisorEmail($studentResearchData['supervisorEmail']); $proposalDetails->setStudentResearchInfo($studentResearchInfo); $article->setProposalDetails($proposalDetails); /////////////////////////////////////////// //////// Update Sources of Monetary /////// /////////////////////////////////////////// $sources = $article->getSources(); $sourcesData = $this->getData('sources'); //Remove sources foreach ($sources as $source) { $isPresent = false; foreach ($sourcesData as $sourceData) { if (!empty($sourceData['sourceId'])) { if ($source->getSourceId() == $sourceData['sourceId']) { $isPresent = true; } } } if (!$isPresent) { $article->removeSource($source->getSourceId()); } unset($source); } for ($i = 0, $count = count($sourcesData); $i < $count; $i++) { if (!empty($sourcesData[$i]['sourceId'])) { // Update an existing source $source =& $article->getSource($sourcesData[$i]['sourceId']); $isExistingSource = true; } else { // Create a new source $source = new ProposalSource(); $isExistingSource = false; } if ($source != null) { $source->setArticleId($article->getId()); if ($sourcesData[$i]['institution'] == "OTHER") { $institution = new Institution(); $institution->setInstitutionName($sourcesData[$i]['otherInstitutionName']); $institution->setInstitutionAcronym($sourcesData[$i]['otherInstitutionAcronym']); $institution->setInstitutionType($sourcesData[$i]['otherInstitutionType']); $institution->setInstitutionInternational($sourcesData[$i]['international']); if ($sourcesData[$i]['international'] == INSTITUTION_NATIONAL) { $institution->setInstitutionLocation($sourcesData[$i]['locationCountry']); } elseif ($proposalDetailsData['international'] == INSTITUTION_INTERNATIONAL) { $institution->setInstitutionLocation($sourcesData[$i]['locationInternational']); } $institutionId = $institutionDao->insertInstitution($institution); $source->setInstitutionId($institutionId); unset($institution); } elseif ($sourcesData[$i]['institution'] == "KII") { $source->setInstitutionId($proposalDetails->getKeyImplInstitution()); } else { $source->setInstitutionId($sourcesData[$i]['institution']); } $source->setSourceAmount($sourcesData[$i]['amount']); if (!$isExistingSource) { $article->addSource($source); } } unset($source); } /////////////////////////////////////////// ///////////// Risk Assessment ///////////// /////////////////////////////////////////// import('classes.article.RiskAssessment'); $riskAssessment = new RiskAssessment(); $riskAssessmentData = $this->getData('riskAssessment'); $riskAssessment->setArticleId($article->getId()); $riskAssessment->setIdentityRevealed($riskAssessmentData['identityRevealed']); $riskAssessment->setUnableToConsent($riskAssessmentData['unableToConsent']); $riskAssessment->setUnder18($riskAssessmentData['under18']); $riskAssessment->setDependentRelationship($riskAssessmentData['dependentRelationship']); $riskAssessment->setEthnicMinority($riskAssessmentData['ethnicMinority']); $riskAssessment->setImpairment($riskAssessmentData['impairment']); $riskAssessment->setPregnant($riskAssessmentData['pregnant']); $riskAssessment->setNewTreatment($riskAssessmentData['newTreatment']); $riskAssessment->setBioSamples($riskAssessmentData['bioSamples']); $riskAssessment->setExportHumanTissue($riskAssessmentData['exportHumanTissue']); $riskAssessment->setExportReason($riskAssessmentData['exportReason']); $riskAssessment->setRadiation($riskAssessmentData['radiation']); $riskAssessment->setDistress($riskAssessmentData['distress']); $riskAssessment->setInducements($riskAssessmentData['inducements']); $riskAssessment->setSensitiveInfo($riskAssessmentData['sensitiveInfo']); $riskAssessment->setReproTechnology($riskAssessmentData['reproTechnology']); $riskAssessment->setGenetic($riskAssessmentData['genetic']); $riskAssessment->setStemCell($riskAssessmentData['stemCell']); $riskAssessment->setBiosafety($riskAssessmentData['biosafety']); $riskAssessment->setRiskLevel($riskAssessmentData['riskLevel']); $riskAssessment->setListRisks($riskAssessmentData['listRisks']); $riskAssessment->setHowRisksMinimized($riskAssessmentData['howRisksMinimized']); $riskAssessment->setRisksToTeam(isset($riskAssessmentData['risksToTeam']) ? 1 : 0); $riskAssessment->setRisksToSubjects(isset($riskAssessmentData['risksToSubjects']) ? 1 : 0); $riskAssessment->setRisksToCommunity(isset($riskAssessmentData['risksToCommunity']) ? 1 : 0); $riskAssessment->setBenefitsToParticipants(isset($riskAssessmentData['benefitsToParticipants']) ? 1 : 0); $riskAssessment->setKnowledgeOnCondition(isset($riskAssessmentData['knowledgeOnCondition']) ? 1 : 0); $riskAssessment->setKnowledgeOnDisease(isset($riskAssessmentData['knowledgeOnDisease']) ? 1 : 0); $riskAssessment->setMultiInstitutions($riskAssessmentData['multiInstitutions']); $riskAssessment->setConflictOfInterest($riskAssessmentData['conflictOfInterest']); $article->setRiskAssessment($riskAssessment); 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($request, ASSOC_TYPE_ARTICLE, $article->getId(), $rawCitationList); } }
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)); $articleFile->setDateUploaded((string) $articleFileXML->dateUploaded); $articleFile->setDateModified((string) $articleFileXML->dateModified); $articleFile->setRound((int) $articleFileXML->round); $articleFile->setViewable((int) $articleFileXML->viewable); $articleFileDAO->insertArticleFile($articleFile); $oldArticleFileId = (int) $articleFileXML->oldId; $oldFileName = $articleFile->getFileName(); $stagePath = $articleFileManager->fileStageToPath($articleFile->getFileStage()); $fileInTransferPackage = $this->journalFolderPath . "/articles/{$oldArticleId}/{$stagePath}/{$oldFileName}"; $newFileName = $articleFileManager->generateFilename($articleFile, $articleFile->getFileStage(), $articleFile->getOriginalFileName()); $newFilePath = "/articles/" . $article->getId() . "/{$stagePath}/{$newFileName}"; $journalFileManager->copyFile($fileInTransferPackage, $journalFileManager->filesDir . $newFilePath); unlink($fileInTransferPackage); $articleFileDAO->updateArticleFile($articleFile); $this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, $oldArticleFileId, $articleFile->getFileId()); } catch (Exception $e) { } } $articleFiles = $articleFileDAO->getArticleFilesByArticle($article->getId()); foreach ($articleFiles as $articleFile) { try { $articleFile->setSourceFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, $articleFile->getSourceFileId())); $articleFileDAO->updateArticleFile($articleFile); } catch (Exception $e) { } } $suppFileDAO =& DAORegistry::getDAO('SuppFileDAO'); foreach ($articleXML->suppFile as $suppFileXML) { $suppFile =& new SuppFile(); $suppFile->setArticleId($article->getId()); $suppFile->setRemoteURL((string) $suppFileXML->remoteURL); $suppFile->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $suppFileXML->fileId)); $suppFile->setType((string) $suppFileXML->type); $suppFile->setDateCreated((string) $suppFileXML->dateCreated); $suppFile->setLanguage((string) $suppFileXML->language); $suppFile->setShowReviewers((int) $suppFileXML->showReviewers); $suppFile->setDateSubmitted((string) $suppFileXML->dateSubmitted); $suppFile->setSequence((int) $suppFileXML->sequence); $suppFileDAO->insertSuppFile($suppFile); $this->restoreDataObjectSettings($suppFileDAO, $suppFileXML->settings, 'article_supp_file_settings', 'supp_id', $suppFile->getId()); } $articleCommentDAO =& DAORegistry::getDAO('ArticleCommentDAO'); foreach ($articleXML->articleComment as $articleCommentXML) { $articleComment = new ArticleComment(); $articleComment->setArticleId($article->getId()); $articleComment->setAssocId($article->getId()); $articleComment->setCommentType((int) $articleCommentXML->commentType); $articleComment->setRoleId((int) $articleCommentXML->roleId); $articleComment->setAuthorId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleCommentXML->authorId)); $articleComment->setCommentTitle((string) $articleCommentXML->commentTitle); $articleComment->setComments((string) $articleCommentXML->comments); $articleComment->setDatePosted((string) $articleCommentXML->datePosted); $articleComment->setDateModified((string) $articleCommentXML->dateModified); $articleComment->setViewable((int) $articleCommentXML->viewable); $articleCommentDAO->insertArticleComment($articleComment); } $articleGalleyDAO =& DAORegistry::getDAO('ArticleGalleyDAO'); foreach ($articleXML->articleGalley as $articleGalleyXML) { $articleGalley = null; if ($articleGalleyXML->htmlGalley == "1") { $articleGalley = new ArticleHTMLGalley(); } else { $articleGalley = new ArticleGalley(); } $articleGalley->setArticleId($article->getId()); $articleGalley->setLocale((string) $articleGalleyXML->locale); $articleGalley->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyXML->fileId)); $articleGalley->setLabel((string) $articleGalleyXML->label); $articleGalley->setSequence((int) $articleGalleyXML->sequence); $articleGalley->setRemoteURL((string) $articleGalleyXML->remoteURL); if ($articleGalley instanceof ArticleHTMLGalley) { $articleGalley->setStyleFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyXML->styleFileId)); } $articleGalleyDAO->insertGalley($articleGalley); if ($articleGalley instanceof ArticleHTMLGalley) { foreach ($articleGalleyXML->htmlGalleyImage as $articleGalleyImageXML) { $imageId = $this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleGalleyImageXML); $articleGalleyDAO->insertGalleyImage($articleGalley->getId(), $imageId); } } $this->restoreDataObjectSettings($articleGalleyDAO, $articleGalleyXML->settings, 'article_galley_settings', 'galley_id', $articleGalley->getId()); } $noteDAO =& DAORegistry::getDAO('NoteDAO'); foreach ($articleXML->articleNote as $articleNoteXML) { $articleNote = new Note(); $articleNote->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleNoteXML->userId)); $articleNote->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleNoteXML->fileId)); $articleNote->setAssocType(ASSOC_TYPE_ARTICLE); $articleNote->setAssocId($article->getId()); $articleNote->setDateCreated((string) $articleNoteXML->dateCreated); $articleNote->setDateModified((string) $articleNoteXML->dateModified); $articleNote->setContents((string) $articleNoteXML->contents); $articleNote->setTitle((string) $articleNoteXML->title); $noteDAO->insertObject($articleNote); } $editAssignmentDAO =& DAORegistry::getDAO('EditAssignmentDAO'); foreach ($articleXML->editAssignment as $editAssignmentXML) { $editAssignment = new EditAssignment(); $editAssignment->setArticleId($article->getId()); $editAssignment->setEditorId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $editAssignmentXML->editorId)); $editAssignment->setCanReview((int) $editAssignmentXML->canReview); $editAssignment->setCanEdit((int) $editAssignmentXML->canEdit); $editAssignment->setDateUnderway((string) $editAssignmentXML->dateUnderway); $editAssignment->setDateNotified((string) $editAssignmentXML->dateNotified); $editAssignmentDAO->insertEditAssignment($editAssignment); } $reviewAssignmentDAO =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewFormResponseDAO =& DAORegistry::getDAO('ReviewFormResponseDAO'); foreach ($articleXML->reviewAssignment as $reviewAssignmentXML) { $reviewAssignment = new ReviewAssignment(); $reviewAssignment->setSubmissionId($article->getId()); $reviewAssignment->setReviewerId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $reviewAssignmentXML->reviewerId)); try { $reviewAssignment->setReviewerFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $reviewAssignmentXML->reviewerFileId)); } catch (Exception $e) { $this->logger->log("Arquivo do artigo {$oldArticleId} não encontrado. ID: " . (int) $reviewAssignmentXML->reviewerFileId . "\n"); } $reviewAssignment->setReviewFormId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM, (int) $reviewAssignmentXML->reviewFormId)); $reviewAssignment->setReviewRoundId((int) $reviewAssignmentXML->reviewRoundId); $reviewAssignment->setStageId((int) $reviewAssignmentXML->stageId); $reviewAssignment->setReviewerFullName((string) $reviewAssignmentXML->reviewerFullName); $reviewAssignment->setCompetingInterests((string) $reviewAssignmentXML->competingInterests); $reviewAssignment->setRegretMessage((string) $reviewAssignmentXML->regretMessage); $reviewAssignment->setRecommendation((string) $reviewAssignmentXML->recommendation); $reviewAssignment->setDateAssigned((string) $reviewAssignmentXML->dateAssigned); $reviewAssignment->setDateNotified((string) $reviewAssignmentXML->dateNotified); $reviewAssignment->setDateConfirmed((string) $reviewAssignmentXML->dateConfirmed); $reviewAssignment->setDateCompleted((string) $reviewAssignmentXML->dateCompleted); $reviewAssignment->setDateAcknowledged((string) $reviewAssignmentXML->dateAcknowledged); $reviewAssignment->setDateDue((string) $reviewAssignmentXML->dateDue); $reviewAssignment->setDateResponseDue((string) $reviewAssignmentXML->dateResponseDue); $reviewAssignment->setLastModified((string) $reviewAssignmentXML->lastModified); $reviewAssignment->setDeclined((int) $reviewAssignmentXML->declined); $reviewAssignment->setReplaced((int) $reviewAssignmentXML->replaced); $reviewAssignment->setCancelled((int) $reviewAssignmentXML->cancelled); $reviewAssignment->setQuality((int) $reviewAssignmentXML->quality); $reviewAssignment->setDateRated((string) $reviewAssignmentXML->dateRated); $reviewAssignment->setDateReminded((string) $reviewAssignmentXML->dateReminded); $reviewAssignment->setReminderWasAutomatic((int) $reviewAssignmentXML->reminderWasAutomatic); $reviewAssignment->setRound((int) $reviewAssignmentXML->round); $reviewAssignment->setReviewRevision((int) $reviewAssignmentXML->reviewRevision); $reviewAssignment->setReviewMethod((int) $reviewAssignmentXML->reviewMethod); $reviewAssignment->setUnconsidered((int) $reviewAssignmentXML->unconsidered); $reviewAssignmentDAO->insertObject($reviewAssignment); foreach ($reviewAssignmentXML->formResponses->formResponse as $formResponseXML) { $reviewFormResponseDAO->update('INSERT INTO review_form_responses (review_form_element_id, review_id, response_type, response_value) VALUES (?, ?, ?, ?)', array($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_REVIEW_FORM_ELEMENT, (int) $formResponseXML->reviewFormElementId), $reviewAssignment->getId(), (string) $formResponseXML->responseType, (string) $formResponseXML->responseValue)); } } $signoffDAO =& DAORegistry::getDAO('SignoffDAO'); foreach ($articleXML->signoff as $signoffXML) { $signoff = new Signoff(); $signoff->setAssocType(ASSOC_TYPE_ARTICLE); $signoff->setAssocId($article->getId()); $signoff->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $signoffXML->userId)); $signoff->setFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $signoffXML->fileId)); $signoff->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $signoffXML->userGroupId)); $signoff->setSymbolic((string) $signoffXML->symbolic); $signoff->setFileRevision((int) $signoffXML->fileRevision); $signoff->setDateUnderway((string) $signoffXML->dateUnderway); $signoff->setDateNotified((string) $signoffXML->dateNotified); $signoff->setDateCompleted((string) $signoffXML->dateCompleted); $signoff->setDateAcknowledged((string) $signoffXML->dateAcknowledged); $signoffDAO->insertObject($signoff); } $editorSubmissionDAO =& DAORegistry::getDAO('EditorSubmissionDAO'); foreach ($articleXML->editDecisions as $editDecisionXML) { $editDecisions =& $editorSubmissionDAO->update('INSERT INTO edit_decisions (article_id, round, editor_id, decision, date_decided) values (?, ?, ?, ?, ?)', array($article->getId(), (string) $editDecisionXML->round, $this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $editDecisionXML->editorId), (string) $editDecisionXML->decision, (string) $editDecisionXML->dateDecided)); } $publishedArticleDAO =& DAORegistry::getDAO('PublishedArticleDAO'); if (isset($articleXML->publishedArticle)) { $publishedArticleXML = $articleXML->publishedArticle; $publishedArticle = new PublishedArticle(); $publishedArticle->setId($article->getId()); $publishedArticle->setIssueId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ISSUE, (int) $publishedArticleXML->issueId)); $publishedArticle->setDatePublished((string) $publishedArticleXML->datePublished); $publishedArticle->setSeq((int) $publishedArticleXML->seq); $publishedArticle->setAccessStatus((int) $publishedArticleXML->accessStatus); $publishedArticleDAO->insertPublishedArticle($publishedArticle); } $articleEventLogDAO =& DAORegistry::getDAO('ArticleEventLogDAO'); $eventLogsXML =& iterator_to_array($articleXML->eventLogs->eventLog); $eventLogsXML = array(); foreach ($articleXML->eventLogs->eventLog as $eventLogXML) { array_unshift($eventLogsXML, $eventLogXML); } foreach ($eventLogsXML as $eventLogXML) { $eventLog = new ArticleEventLogEntry(); $eventLog->setAssocType(ASSOC_TYPE_ARTICLE); $eventLog->setAssocId($article->getId()); $eventLog->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $eventLogXML->userId)); $eventLog->setDateLogged((string) $eventLogXML->dateLogged); $eventLog->setIPAddress((string) $eventLogXML->IPAddress); $eventLog->setEventType((int) $eventLogXML->eventType); $eventLog->setMessage((string) $eventLogXML->message); $eventLog->setIsTranslated((int) $eventLogXML->isTranslated); $articleEventLogDAO->insertObject($eventLog); $this->restoreDataObjectSettings($articleEventLogDAO, $eventLogXML->settings, 'event_log_settings', 'log_id', $eventLog->getId()); } try { $article->setSubmissionFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->submissionFileId)); } catch (Exception $e) { } try { $article->setRevisedFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->revisedFileId)); } catch (Exception $e) { } try { $article->setReviewFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->reviewFileId)); } catch (Exception $e) { } try { $article->setEditorFileId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_ARTICLE_FILE, (int) $articleXML->editorFileId)); } catch (Exception $e) { } $articleDAO->updateArticle($article); $this->nextElement(); } }
/** * 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; if ($temporaryFile) { $fileId = $articleFileManager->temporaryFileToArticleFile($temporaryFile, SUBMISSION_FILE_SUBMISSION); $fileType = $temporaryFile->getFileType(); if (strstr($fileType, 'html')) { import('classes.article.ArticleHTMLGalley'); $galley = new ArticleHTMLGalley(); } else { import('classes.article.ArticleGalley'); $galley = new ArticleGalley(); } $galley->setArticleId($articleId); $galley->setFileId($fileId); $galley->setLocale($locale); if ($galley->isHTMLGalley()) { $galley->setLabel('HTML'); } else { if (strstr($fileType, 'pdf')) { $galley->setLabel('PDF'); } else { if (strstr($fileType, 'postscript')) { $galley->setLabel('Postscript'); } else { if (strstr($fileType, 'xml')) { $galley->setLabel('XML'); } else { $galley->setLabel(__('common.untitled')); } } } } $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO'); $galleyDao->insertGalley($galley); if (!$designatedPrimary) { $article->setSubmissionFileId($fileId); if ($locale == $journal->getPrimaryLocale()) { // Used to make sure that *some* file // is designated Review Version, but // preferrably the primary locale. $designatedPrimary = true; } } } // Update file search index import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); if (isset($galley)) { $articleSearchIndex->articleFileChanged($galley->getArticleId(), SUBMISSION_SEARCH_GALLEY_FILE, $galley->getFileId()); } $articleSearchIndex->articleChangesFinished(); } // Designate this as the review version by default. $authorSubmissionDao = DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($articleId); import('classes.submission.author.AuthorAction'); AuthorAction::designateReviewVersion($authorSubmission, true); // Accept the submission $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId); $articleFileManager = new ArticleFileManager($articleId); import('classes.submission.sectionEditor.SectionEditorAction'); assert(false); // FIXME: $decisionLabels missing from call below. SectionEditorAction::recordDecision($this->request, $sectionEditorSubmission, SUBMISSION_EDITOR_DECISION_ACCEPT); import('classes.author.form.submit.AuthorSubmitForm'); AuthorSubmitForm::assignEditors($article); $articleDao->updateObject($article); // Add to end of editing queue import('classes.submission.editor.EditorAction'); if (isset($galley)) { EditorAction::expediteSubmission($article, $this->request); } if ($this->getData('destination') == "issue") { // Add to an existing issue $issueId = $this->getData('issueId'); $this->scheduleForPublication($articleId, $issueId); } // Import the references list. $citationDao = DAORegistry::getDAO('CitationDAO'); $rawCitationList = $article->getCitations(); $citationDao->importCitations($request, ASSOC_TYPE_ARTICLE, $articleId, $rawCitationList); // Index article. import('classes.search.ArticleSearchIndex'); $articleSearchIndex = new ArticleSearchIndex(); $articleSearchIndex->articleMetadataChanged($article); $articleSearchIndex->articleChangesFinished(); }
/** * Handle an author node (i.e. convert an author from DOM to DAO). * @param $journal Journal * @param $authorNode DOMElement * @param $issue Issue * @param $section Section * @param $article Article * @param $errors array * @param $authorIndex int 0 for first author, 1 for second, ... */ function handleAuthorNode(&$conference, &$schedConf, &$authorNode, &$track, &$paper, &$errors, $authorIndex) { $errors = array(); $conferenceSupportedLocales = array_keys($conference->getSupportedLocaleNames()); // => conference locales must be set up before $author = new Author(); if ($node = $authorNode->getChildByName('firstname')) { $author->setFirstName($node->getValue()); } if ($node = $authorNode->getChildByName('middlename')) { $author->setMiddleName($node->getValue()); } if ($node = $authorNode->getChildByName('lastname')) { $author->setLastName($node->getValue()); } if ($node = $authorNode->getChildByName('country')) { $author->setCountry($node->getValue()); } if ($node = $authorNode->getChildByName('email')) { $author->setEmail($node->getValue()); } if ($node = $authorNode->getChildByName('url')) { $author->setUrl($node->getValue()); } $author->setSequence($authorIndex + 1); // 1-based for ($index = 0; $node = $authorNode->getChildByName('affiliation', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $paper->getLocale(); } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperAuthorAffiliationLocaleUnsupported', array('authorFullName' => $author->getFullName(), 'paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $author->setAffiliation($node->getValue(), $locale); } for ($index = 0; $node = $authorNode->getChildByName('biography', $index); $index++) { $locale = $node->getAttribute('locale'); if ($locale == '') { $locale = $paper->getLocale(); } elseif (!in_array($locale, $conferenceSupportedLocales)) { $errors[] = array('plugins.importexport.native.import.error.paperAuthorBiographyLocaleUnsupported', array('authorFullName' => $author->getFullName(), 'paperTitle' => $paper->getLocalizedTitle(), 'locale' => $locale)); return false; } $author->setBiography($node->getValue(), $locale); } $author->setSubmissionId($paper->getId()); $author->setPrimaryContact($authorNode->getAttribute('primary_contact') === 'true' ? 1 : 0); $authorDao = DAORegistry::getDAO('AuthorDAO'); /* @var $authorDao AuthorDAO */ $authorDao->insertObject($author); return true; }