/**
  * @covers OAIMetadataFormat_DC
  * @covers Dc11SchemaArticleAdapter
  */
 public function testToXml()
 {
     $this->markTestSkipped('Skipped because of weird class interaction with ControlledVocabDAO.');
     //
     // Create test data.
     //
     $journalId = 1;
     // Enable the DOI plugin.
     $pluginSettingsDao = DAORegistry::getDAO('PluginSettingsDAO');
     /* @var $pluginSettingsDao PluginSettingsDAO */
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enabled', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableIssueDoi', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableArticleDoi', 1);
     $pluginSettingsDao->updateSetting($journalId, 'doipubidplugin', 'enableGalleyDoi', 1);
     // Author
     import('classes.article.Author');
     $author = new Author();
     $author->setFirstName('author-firstname');
     $author->setLastName('author-lastname');
     $author->setAffiliation('author-affiliation', 'en_US');
     $author->setEmail('*****@*****.**');
     // Article
     import('classes.article.PublishedArticle');
     $article = $this->getMock('PublishedArticle', array('getBestArticleId'));
     /* @var $article PublishedArticle */
     $article->expects($this->any())->method('getBestArticleId')->will($this->returnValue(9));
     $article->setId(9);
     $article->setJournalId($journalId);
     $author->setSubmissionId($article->getId());
     $article->setPages(15);
     $article->setType('art-type', 'en_US');
     $article->setTitle('article-title-en', 'en_US');
     $article->setTitle('article-title-de', 'de_DE');
     $article->setDiscipline('article-discipline', 'en_US');
     $article->setSubject('article-subject', 'en_US');
     $article->setAbstract('article-abstract', 'en_US');
     $article->setSponsor('article-sponsor', 'en_US');
     $article->setStoredPubId('doi', 'article-doi');
     $article->setLanguage('en_US');
     // Galleys
     import('classes.article.ArticleGalley');
     $galley = new ArticleGalley();
     $galley->setId(98);
     $galley->setStoredPubId('doi', 'galley-doi');
     $galleys = array($galley);
     // Journal
     import('classes.journal.Journal');
     $journal = $this->getMock('Journal', array('getSetting'));
     /* @var $journal Journal */
     $journal->expects($this->any())->method('getSetting')->will($this->returnCallback(array($this, 'getJournalSetting')));
     $journal->setPrimaryLocale('en_US');
     $journal->setPath('journal-path');
     $journal->setId($journalId);
     // Section
     import('classes.journal.Section');
     $section = new Section();
     $section->setIdentifyType('section-identify-type', 'en_US');
     // Issue
     import('classes.issue.Issue');
     $issue = $this->getMock('Issue', array('getIssueIdentification'));
     /* @var $issue Issue */
     $issue->expects($this->any())->method('getIssueIdentification')->will($this->returnValue('issue-identification'));
     $issue->setId(96);
     $issue->setDatePublished('2010-11-05');
     $issue->setStoredPubId('doi', 'issue-doi');
     $issue->setJournalId($journalId);
     //
     // Create infrastructural support objects
     //
     // Router
     import('lib.pkp.classes.core.PKPRouter');
     $router = $this->getMock('PKPRouter', array('url'));
     $application = PKPApplication::getApplication();
     $router->setApplication($application);
     $router->expects($this->any())->method('url')->will($this->returnCallback(array($this, 'routerUrl')));
     // Request
     import('classes.core.Request');
     $request = $this->getMock('Request', array('getRouter'));
     $request->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     Registry::set('request', $request);
     //
     // Create mock DAOs
     //
     // Create a mocked AuthorDAO that returns our test author.
     import('classes.article.AuthorDAO');
     $authorDao = $this->getMock('AuthorDAO', array('getBySubmissionId'));
     $authorDao->expects($this->any())->method('getBySubmissionId')->will($this->returnValue(array($author)));
     DAORegistry::registerDAO('AuthorDAO', $authorDao);
     // Create a mocked OAIDAO that returns our test data.
     import('classes.oai.ojs.OAIDAO');
     $oaiDao = $this->getMock('OAIDAO', array('getJournal', 'getSection', 'getIssue'));
     $oaiDao->expects($this->any())->method('getJournal')->will($this->returnValue($journal));
     $oaiDao->expects($this->any())->method('getSection')->will($this->returnValue($section));
     $oaiDao->expects($this->any())->method('getIssue')->will($this->returnValue($issue));
     DAORegistry::registerDAO('OAIDAO', $oaiDao);
     // Create a mocked ArticleGalleyDAO that returns our test data.
     import('classes.article.ArticleGalleyDAO');
     $articleGalleyDao = $this->getMock('ArticleGalleyDAO', array('getBySubmissionId'));
     $articleGalleyDao->expects($this->any())->method('getBySubmissionId')->will($this->returnValue($galleys));
     DAORegistry::registerDAO('ArticleGalleyDAO', $articleGalleyDao);
     // FIXME: ArticleGalleyDAO::getBySubmissionId returns iterator; array expected here. Fix expectations.
     // Create a mocked PublishedArticleDAO that returns our test article.
     import('classes.article.PublishedArticleDAO');
     $articleDao = $this->getMock('PublishedArticleDAO', array('getPublishedArticleByArticleId'));
     $articleDao->expects($this->any())->method('getPublishedArticleByArticleId')->will($this->returnValue($article));
     DAORegistry::registerDAO('PublishedArticleDAO', $articleDao);
     //
     // Test
     //
     // OAI record
     $record = new OAIRecord();
     $record->setData('article', $article);
     $record->setData('galleys', $galleys);
     $record->setData('journal', $journal);
     $record->setData('section', $section);
     $record->setData('issue', $issue);
     // Instantiate the OAI meta-data format.
     $prefix = OAIMetadataFormatPlugin_DC::getMetadataPrefix();
     $schema = OAIMetadataFormatPlugin_DC::getSchema();
     $namespace = OAIMetadataFormatPlugin_DC::getNamespace();
     $mdFormat = new OAIMetadataFormat_DC($prefix, $schema, $namespace);
     $xml = $mdFormat->toXml($record);
     self::assertXmlStringEqualsXmlFile('tests/plugins/oaiMetadataFormats/dc/expectedResult.xml', $xml);
 }
Example #2
0
 /**
  * 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);
     }
 }
Example #3
0
 /**
  * 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();
 }
Example #4
0
 function handleAuthorNode(&$conference, &$schedConf, &$authorNode, &$track, &$paper, &$errors)
 {
     $errors = array();
     $conferenceSupportedLocales = array_keys($conference->getSupportedLocaleNames());
     // => conference locales must be set up before
     $conferencePrimaryLocale = $conference->getPrimaryLocale();
     $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('affiliation')) {
         $author->setAffiliation($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());
     }
     for ($index = 0; $node = $authorNode->getChildByName('biography', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $conferencePrimaryLocale;
         } 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->setPrimaryContact($authorNode->getAttribute('primary_contact') === 'true' ? 1 : 0);
     $paper->addAuthor($author);
     // instead of $author->setSequence($index+1);
     return true;
 }
 function handleAuthorNode(&$journal, &$authorNode, &$issue, &$section, &$article, &$errors)
 {
     $errors = array();
     $journalSupportedLocales = array_keys($journal->getSupportedLocaleNames());
     // => journal locales must be set up before
     $journalPrimaryLocale = $journal->getPrimaryLocale();
     $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());
     }
     for ($index = 0; $node = $authorNode->getChildByName('affiliation', $index); $index++) {
         $locale = $node->getAttribute('locale');
         if ($locale == '') {
             $locale = $journalPrimaryLocale;
         } 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($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 = $journalPrimaryLocale;
         } 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 = $journalPrimaryLocale;
         } 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->setPrimaryContact($authorNode->getAttribute('primary_contact') === 'true' ? 1 : 0);
     $article->addAuthor($author);
     // instead of $author->setSequence($index+1);
     return true;
 }
Example #6
0
 /**
  * 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;
 }
Example #7
0
 /**
  * Save author
  * @see Form::execute()
  * @see Form::execute()
  */
 function execute()
 {
     $authorDao = DAORegistry::getDAO('AuthorDAO');
     $submission = $this->getSubmission();
     $author = $this->getAuthor();
     if (!$author) {
         // this is a new submission contributor
         $author = new Author();
         $author->setSubmissionId($submission->getId());
         $existingAuthor = false;
     } else {
         $existingAuthor = true;
         if ($submission->getId() !== $author->getSubmissionId()) {
             fatalError('Invalid author!');
         }
     }
     $author->setFirstName($this->getData('firstName'));
     $author->setMiddleName($this->getData('middleName'));
     $author->setLastName($this->getData('lastName'));
     $author->setSuffix($this->getData('suffix'));
     $author->setAffiliation($this->getData('affiliation'), null);
     // localized
     $author->setCountry($this->getData('country'));
     $author->setEmail($this->getData('email'));
     $author->setUrl($this->getData('userUrl'));
     $author->setOrcid($this->getData('orcid'));
     $author->setUserGroupId($this->getData('userGroupId'));
     $author->setBiography($this->getData('biography'), null);
     // localized
     $author->setPrimaryContact($this->getData('primaryContact') ? true : false);
     $author->setIncludeInBrowse($this->getData('includeInBrowse') ? true : false);
     // in order to be able to use the hook
     parent::execute();
     if ($existingAuthor) {
         $authorDao->updateObject($author);
         $authorId = $author->getId();
     } else {
         $authorId = $authorDao->insertObject($author);
     }
     return $authorId;
 }
 /**
  * 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;
 }
    /**
     * 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;
    }
 /**
  * Save submissionContributor
  * @see Form::execute()
  * @see Form::execute()
  */
 function execute()
 {
     $authorDao =& DAORegistry::getDAO('AuthorDAO');
     $monograph = $this->getMonograph();
     $submissionContributor =& $this->getSubmissionContributor();
     if (!$submissionContributor) {
         // this is a new submission contributor
         $submissionContributor = new Author();
         $submissionContributor->setMonographId($monograph->getId());
         $existingSubmissionContributor = false;
     } else {
         $existingSubmissionContributor = true;
     }
     assert($monograph->getId() == $submissionContributor->getMonographId());
     $submissionContributor->setFirstName($this->getData('firstName'));
     $submissionContributor->setMiddleName($this->getData('middleName'));
     $submissionContributor->setLastName($this->getData('lastName'));
     $submissionContributor->setAffiliation($this->getData('affiliation'), Locale::getLocale());
     // localized
     $submissionContributor->setCountry($this->getData('country'));
     $submissionContributor->setEmail($this->getData('email'));
     $submissionContributor->setUrl($this->getData('url'));
     $submissionContributor->setUserGroupId($this->getData('userGroupId'));
     $submissionContributor->setBiography($this->getData('biography'), Locale::getLocale());
     // localized
     $submissionContributor->setPrimaryContact($this->getData('primaryContact') ? true : false);
     if ($existingSubmissionContributor) {
         $authorDao->updateAuthor($submissionContributor);
         $authorId = $submissionContributor->getId();
     } else {
         $authorId = $authorDao->insertAuthor($submissionContributor);
     }
     return $authorId;
 }
 /**
  * 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.
  * @return int the article ID
  */
 function execute()
 {
     $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
     if (isset($this->article)) {
         // Update existing article
         $this->article->setLocale($this->getData('locale'));
         $this->article->setCommentsToEditor($this->getData('commentsToEditor'));
         if ($this->article->getSubmissionProgress() <= $this->step) {
             $this->article->stampStatusModified();
             $this->article->setSubmissionProgress($this->step + 1);
         }
         $lastSectionDecision = $this->article->getLastSectionDecision();
         $lastSectionDecision->setSectionId($this->getData('sectionId'));
         $authorSubmissionDao->updateAuthorSubmission($this->article);
     } else {
         // Insert new article
         $journal =& Request::getJournal();
         $user =& Request::getUser();
         $this->article = new AuthorSubmission();
         $this->article->setLocale($this->getData('locale'));
         $this->article->setUserId($user->getId());
         $this->article->setJournalId($journal->getId());
         $this->article->stampStatusModified();
         $this->article->setSubmissionProgress($this->step + 1);
         $this->article->setLanguage(String::substr($this->article->getLocale(), 0, 2));
         $this->article->setCommentsToEditor($this->getData('commentsToEditor'));
         // Set new Section Decision
         $sectionDecision =& new SectionDecision();
         $sectionDecision->setReviewType(REVIEW_TYPE_INITIAL);
         $sectionDecision->setRound(1);
         $sectionDecision->setSectionId($this->getData('sectionId'));
         $sectionDecision->setDecision(0);
         $sectionDecision->setDateDecided(date(Core::getCurrentDate()));
         $this->article->addDecision($sectionDecision);
         // Set user to initial author
         $author = new Author();
         $author->setFirstName($user->getFirstName());
         $author->setMiddleName($user->getMiddleName());
         $author->setLastName($user->getLastName());
         $author->setAffiliation($user->getLocalizedAffiliation());
         $author->setEmail($user->getEmail());
         $author->setPhoneNumber($user->getPhone());
         $author->setBiography($user->getBiography(null), null);
         $author->setPrimaryContact(1);
         $this->article->addAuthor($author);
         $authorSubmissionDao->insertAuthorSubmission($this->article);
         $this->articleId = $this->article->getId();
     }
     return $this->articleId;
 }
 /**
  * @covers OAIMetadataFormat_DC
  * @covers Dc11SchemaArticleAdapter
  */
 public function testToXml()
 {
     //
     // Create test data.
     //
     // Author
     import('classes.article.Author');
     $author = new Author();
     $author->setFirstName('author-firstname');
     $author->setLastName('author-lastname');
     $author->setAffiliation('author-affiliation', 'en_US');
     // Supplementary file
     import('classes.article.SuppFile');
     $suppFile = new SuppFile();
     $suppFile->setFileId(999);
     // Article
     import('classes.article.PublishedArticle');
     $article = $this->getMock('PublishedArticle', array('getBestArticleId'));
     /* @var $article PublishedArticle */
     $article->expects($this->any())->method('getBestArticleId')->will($this->returnValue(9));
     $article->setId(9);
     $article->addAuthor($author);
     $article->setSuppFiles(array($suppFile));
     $article->setPages(15);
     $article->setType('art-type', 'en_US');
     $article->setTitle('article-title-en', 'en_US');
     $article->setTitle('article-title-de', 'de_DE');
     $article->setDiscipline('article-discipline', 'en_US');
     $article->setSubject('article-subject', 'en_US');
     $article->setSubjectClass('article-subject-class', 'en_US');
     $article->setAbstract('article-abstract', 'en_US');
     $article->setSponsor('article-sponsor', 'en_US');
     $article->setStoredDOI('article-doi');
     $article->setLanguage('en_US');
     $article->setCoverageGeo('article-coverage-geo', 'en_US');
     $article->setCoverageChron('article-coverage-chron', 'en_US');
     $article->setCoverageSample('article-coverage-sample', 'en_US');
     // Galleys
     import('classes.article.ArticleGalley');
     $galley = new ArticleGalley();
     $galley->setFileType('galley-filetype');
     $galleys = array($galley);
     // Journal
     import('classes.journal.Journal');
     $journal = $this->getMock('Journal', array('getSetting'));
     /* @var $journal Journal */
     $journal->expects($this->any())->method('getSetting')->will($this->returnCallback(array($this, 'getJournalSetting')));
     $journal->setPrimaryLocale('en_US');
     $journal->setPath('journal-path');
     // Section
     import('classes.journal.Section');
     $section = new Section();
     $section->setIdentifyType('section-identify-type', 'en_US');
     // Issue
     import('classes.issue.Issue');
     $issue = $this->getMock('Issue', array('getIssueIdentification'));
     /* @var $issue Issue */
     $issue->expects($this->any())->method('getIssueIdentification')->will($this->returnValue('issue-identification'));
     $issue->setDatePublished('2010-11-05');
     //
     // Create infrastructural support objects
     //
     // Router
     import('lib.pkp.classes.core.PKPRouter');
     $router = $this->getMock('PKPRouter', array('url'));
     $application = PKPApplication::getApplication();
     $router->setApplication($application);
     $router->expects($this->any())->method('url')->will($this->returnValue('router-url'));
     // Request
     import('classes.core.Request');
     $request = $this->getMock('Request', array('getRouter'));
     $request->expects($this->any())->method('getRouter')->will($this->returnValue($router));
     Registry::set('request', $request);
     //
     // Create mock DAOs
     //
     // Create a mocked OAIDAO that returns our test data.
     import('classes.oai.ojs.OAIDAO');
     $oaiDao = $this->getMock('OAIDAO', array('getJournal', 'getSection', 'getIssue'));
     $oaiDao->expects($this->any())->method('getJournal')->will($this->returnValue($journal));
     $oaiDao->expects($this->any())->method('getSection')->will($this->returnValue($section));
     $oaiDao->expects($this->any())->method('getIssue')->will($this->returnValue($issue));
     DAORegistry::registerDAO('OAIDAO', $oaiDao);
     // Create a mocked ArticleGalleyDAO that returns our test data.
     import('classes.article.ArticleGalleyDAO');
     $articleGalleyDao = $this->getMock('OAIDAO', array('getGalleysByArticle'));
     $articleGalleyDao->expects($this->any())->method('getGalleysByArticle')->will($this->returnValue($galleys));
     DAORegistry::registerDAO('ArticleGalleyDAO', $articleGalleyDao);
     //
     // Test
     //
     // OAI record
     $record = new OAIRecord();
     $record->setData('article', $article);
     $record->setData('galleys', $galleys);
     $record->setData('journal', $journal);
     $record->setData('section', $section);
     $record->setData('issue', $issue);
     // Instantiate the OAI meta-data format.
     $prefix = OAIMetadataFormatPlugin_DC::getMetadataPrefix();
     $schema = OAIMetadataFormatPlugin_DC::getSchema();
     $namespace = OAIMetadataFormatPlugin_DC::getNamespace();
     $mdFormat = new OAIMetadataFormat_DC($prefix, $schema, $namespace);
     $xml = $mdFormat->toXml($record);
     self::assertXmlStringEqualsXmlFile('tests/plugins/oaiMetadataFormats/dc/expectedResult.xml', $xml);
 }
 /**
  * Save changes to submission.
  * @return int the monograph ID
  */
 function execute()
 {
     $monographDao =& DAORegistry::getDAO('MonographDAO');
     if (isset($this->monograph)) {
         // Update existing monograph
         $this->monograph->setSeriesId($this->getData('seriesId'));
         $this->monograph->setLocale($this->getData('locale'));
         $this->monograph->setCommentsToEditor($this->getData('commentsToEditor'));
         if ($this->monograph->getSubmissionProgress() <= $this->step) {
             $this->monograph->stampStatusModified();
             $this->monograph->setSubmissionProgress($this->step + 1);
         }
         $monographDao->updateMonograph($this->monograph);
     } else {
         $press =& Request::getPress();
         $user =& Request::getUser();
         // Get the session and the user group id currently used
         $sessionMgr =& SessionManager::getManager();
         $session =& $sessionMgr->getUserSession();
         // Create new monograph
         $this->monograph = new Monograph();
         $this->monograph->setLocale($this->getData('locale'));
         $this->monograph->setUserId($user->getId());
         $this->monograph->setPressId($press->getId());
         $this->monograph->setSeriesId($this->getData('seriesId'));
         $this->monograph->stampStatusModified();
         $this->monograph->setSubmissionProgress($this->step + 1);
         $this->monograph->setLanguage(String::substr($this->monograph->getLocale(), 0, 2));
         $this->monograph->setCommentsToEditor($this->getData('commentsToEditor'));
         $this->monograph->setWorkType($this->getData('isEditedVolume') ? WORK_TYPE_EDITED_VOLUME : WORK_TYPE_AUTHORED_WORK);
         $this->monograph->setCurrentStageId(WORKFLOW_STAGE_ID_SUBMISSION);
         // Get a default user group id for an Author
         $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
         $defaultAuthorGroup =& $userGroupDao->getDefaultByRoleId($press->getId(), ROLE_ID_AUTHOR);
         // Set user to initial author
         $authorDao =& DAORegistry::getDAO('AuthorDAO');
         $user =& Request::getUser();
         $author = new Author();
         $author->setFirstName($user->getFirstName());
         $author->setMiddleName($user->getMiddleName());
         $author->setLastName($user->getLastName());
         $author->setAffiliation($user->getAffiliation(null), null);
         $author->setCountry($user->getCountry());
         $author->setEmail($user->getEmail());
         $author->setUrl($user->getUrl());
         $author->setUserGroupId($defaultAuthorGroup->getId());
         $author->setBiography($user->getBiography(null), null);
         $author->setPrimaryContact(1);
         $monographDao->insertMonograph($this->monograph);
         $this->monographId = $this->monograph->getId();
         $author->setSubmissionId($this->monographId);
         $authorDao->insertAuthor($author);
     }
     return $this->monographId;
 }
Example #15
0
 /**
  * Import papers (including metadata and files).
  */
 function importPapers()
 {
     if ($this->hasOption('verbose')) {
         printf("Importing papers\n");
     }
     import('classes.file.PaperFileManager');
     import('classes.search.PaperSearchIndex');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     $paperDao =& DAORegistry::getDAO('PaperDAO');
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $unassignedTrackId = null;
     $result =& $this->importDao->retrieve('SELECT * FROM papers ORDER by id');
     while (!$result->EOF) {
         $row =& $result->fields;
         $schedConf =& $this->schedConfMap[$row['cf']];
         $schedConfId = $schedConf->getId();
         // Bring in the primary user for this paper.
         $user = $userDao->getUserByUsername(Core::cleanVar($row['login']));
         if (!$user) {
             unset($user);
             $user = new User();
             $user->setUsername(Core::cleanVar($row['login']));
             $user->setFirstName(Core::cleanVar($row['first_name']));
             $user->setLastName(Core::cleanVar($row['surname']));
             $user->setAffiliation(Core::cleanVar($row['affiliation']), Locale::getLocale());
             $user->setEmail(Core::cleanVar($row['email']));
             $user->setUrl(Core::cleanVar($row['url']));
             $user->setBiography(Core::cleanVar($row['bio']), Locale::getLocale());
             $user->setLocales(array());
             $user->setDateRegistered($row['created']);
             $user->setDateLastLogin($row['created']);
             $user->setMustChangePassword(1);
             $password = Validation::generatePassword();
             $user->setPassword(Validation::encryptCredentials($user->getUsername(), $password));
             if ($this->hasOption('emailUsers')) {
                 import('classes.mail.MailTemplate');
                 $mail = new MailTemplate('USER_REGISTER');
                 $mail->setFrom($schedConf->getSetting('contactEmail'), $schedConf->getSetting('contactName'));
                 $mail->assignParams(array('username' => $user->getUsername(), 'password' => $password, 'conferenceName' => $schedConf->getFullTitle()));
                 $mail->addRecipient($user->getEmail(), $user->getFullName());
                 $mail->send();
             }
             $user->setDisabled(0);
             $otherUser =& $userDao->getUserByEmail(Core::cleanVar($row['email']));
             if ($otherUser !== null) {
                 // User exists with this email -- munge it to make unique
                 $user->setEmail('ocs-' . Core::cleanVar($row['login']) . '+' . Core::cleanVar($row['email']));
                 $this->conflicts[] = array(&$otherUser, &$user);
             }
             unset($otherUser);
             $userDao->insertUser($user);
             // Make this user a author
             $role = new Role();
             $role->setSchedConfId($schedConf->getId());
             $role->setConferenceId($schedConf->getConferenceId());
             $role->setUserId($user->getId());
             $role->setRoleId(ROLE_ID_AUTHOR);
             $roleDao->insertRole($role);
             unset($role);
         }
         $userId = $user->getId();
         // Bring in the basic entry for the paper
         $paper = new Paper();
         $paper->setUserId($userId);
         $paper->setLocale(Locale::getPrimaryLocale());
         $paper->setSchedConfId($schedConfId);
         $oldTrackId = $row['primary_track_id'];
         if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
             $oldTrackId = $row['secondary_track_id'];
         }
         if (!$oldTrackId || !isset($this->trackMap[$oldTrackId])) {
             if (!$unassignedTrackId) {
                 // Create an "Unassigned" track to use for submissions
                 // that didn't have a track in OCS 1.x.
                 $track = new Track();
                 $track->setSchedConfId($schedConf->getId());
                 $track->setTitle('UNASSIGNED', Locale::getLocale());
                 $track->setSequence(REALLY_BIG_NUMBER);
                 $track->setDirectorRestricted(1);
                 $track->setMetaReviewed(1);
                 $unassignedTrackId = $trackDao->insertTrack($track);
             }
             $newTrackId = $unassignedTrackId;
         } else {
             $newTrackId = $this->trackMap[$oldTrackId];
         }
         $paper->setTrackId($newTrackId);
         $paper->setTitle(Core::cleanVar($row['title']), Locale::getLocale());
         $paper->setAbstract(Core::cleanVar($row['abstract']), Locale::getLocale());
         $paper->setDiscipline(Core::cleanVar($row['discipline']), Locale::getLocale());
         $paper->setSponsor(Core::cleanVar($row['sponsor']), Locale::getLocale());
         $paper->setSubject(Core::cleanVar($row['topic']), Locale::getLocale());
         $paper->setLanguage(Core::cleanVar($row['language']));
         $paper->setDateSubmitted($row['created']);
         $paper->setDateStatusModified($row['timestamp']);
         // $paper->setTypeConst($row['present_format'] == 'multiple' ? SUBMISSION_TYPE_PANEL : SUBMISSION_TYPE_SINGLE); FIXME
         $paper->setCurrentRound(REVIEW_ROUND_ABSTRACT);
         $paper->setSubmissionProgress(0);
         $paper->setPages('');
         // Bring in authors
         $firstNames = split("\n", Core::cleanVar($row['first_name'] . "\n" . $row['add_first_names']));
         $lastNames = split("\n", Core::cleanVar($row['surname'] . "\n" . $row['add_surnames']));
         $emails = split("\n", Core::cleanVar($row['email'] . "\n" . $row['add_emails']));
         $affiliations = split("\n", Core::cleanVar($row['affiliation'] . "\n" . $row['add_affiliations']));
         $urls = split("\n", Core::cleanVar($row['url'] . "\n" . $row['add_urls']));
         foreach ($emails as $key => $email) {
             if (empty($email)) {
                 continue;
             }
             $author = new Author();
             $author->setEmail($email);
             $author->setFirstName($firstNames[$key]);
             $author->setLastName($lastNames[$key]);
             $author->setAffiliation($affiliations[$key], Locale::getLocale());
             @$author->setUrl($urls[$key]);
             // Suppress warnings from inconsistent OCS 1.x data
             $author->setPrimaryContact($key == 0 ? 1 : 0);
             $paper->addAuthor($author);
             unset($author);
         }
         switch ($row['accepted']) {
             case 'true':
                 $paper->setStatus(STATUS_PUBLISHED);
                 $paperId = $paperDao->insertPaper($paper);
                 $publishedPaper = new PublishedPaper();
                 $publishedPaper->setPaperId($paperId);
                 $publishedPaper->setSchedConfId($schedConfId);
                 $publishedPaper->setDatePublished(Core::getCurrentDate());
                 $publishedPaper->setSeq(REALLY_BIG_NUMBER);
                 $publishedPaper->setViews(0);
                 $publishedPaperDao->insertPublishedPaper($publishedPaper);
                 $publishedPaperDao->resequencePublishedPapers($paper->getTrackId(), $schedConfId);
                 break;
             case 'reject':
                 $paper->setStatus(STATUS_DECLINED);
                 $paperId = $paperDao->insertPaper($paper);
                 break;
             default:
                 $paper->setStatus(STATUS_QUEUED);
                 $paperId = $paperDao->insertPaper($paper);
         }
         $this->paperMap[$row['id']] =& $paper;
         $paperFileManager = new PaperFileManager($paperId);
         if (!empty($row['paper']) && $row['paper'] != 'PDF') {
             $format = 'text/html';
             $extension = $paperFileManager->getDocumentExtension($format);
             $fileId = $paperFileManager->writeSubmissionFile('migratedFile' . $extension, $row['paper'], $format);
             $paper->setSubmissionFileId($fileId);
             $paperDao->updatePaper($paper);
             $fileId = $paperFileManager->writePublicFile('migratedGalley' . $extension, $row['paper'], $format);
             PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId);
             if (strstr($format, 'html')) {
                 $galley = new PaperHTMLGalley();
                 $galley->setLabel('HTML');
             } else {
                 $galley = new PaperGalley();
                 switch ($format) {
                     case 'application/pdf':
                         $galley->setLabel('PDF');
                         break;
                     case 'application/postscript':
                         $galley->setLabel('PostScript');
                         break;
                     case 'application/msword':
                         $galley->setLabel('Word');
                         break;
                     case 'text/xml':
                         $galley->setLabel('XML');
                         break;
                     case 'application/powerpoint':
                         $galley->setLabel('Slideshow');
                         break;
                     default:
                         $galley->setLabel('Untitled');
                         break;
                 }
             }
             $galley->setLocale(Locale::getLocale());
             $galley->setPaperId($paperId);
             $galley->setFileId($fileId);
             $galleyDao->insertGalley($galley);
             unset($galley);
         } elseif ($row['paper'] == 'PDF') {
             $fileId = $paperFileManager->copySubmissionFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf');
             $paper->setSubmissionFileId($fileId);
             $paperDao->updatePaper($paper);
             $fileId = $paperFileManager->copyPublicFile($this->importPath . '/papers/' . $row['pdf'], 'application/pdf');
             PaperSearchIndex::updateFileIndex($paperId, PAPER_SEARCH_GALLEY_FILE, $fileId);
             $galley = new PaperGalley();
             $galley->setLabel('PDF');
             $galley->setLocale(Locale::getLocale());
             $galley->setPaperId($paperId);
             $galley->setFileId($fileId);
             $galleyDao->insertGalley($galley);
             unset($galley);
         }
         // FIXME: The following fields from OCS 1.x are UNUSED:
         // program_insert approach coverage format relation appendix_names appendix_dates
         // appendix appendix_pdf secondary_track_id multiple_* restrict_access paper_email
         // delete_paper comment_email
         unset($user);
         unset($paper);
         unset($schedConf);
         unset($paperFileManager);
         $result->MoveNext();
     }
     $result->Close();
 }
Example #16
0
 /**
  * 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;
 }
 /**
  * @see MetadataDataObjectAdapter::injectMetadataIntoDataObject()
  * @param $mods34Description MetadataDescription
  * @param $submission Submission
  * @param $authorClassName string the application specific author class name
  */
 function &injectMetadataIntoDataObject(&$mods34Description, &$submission, $authorClassName)
 {
     assert(is_a($submission, 'Submission'));
     assert($mods34Description->getMetadataSchemaName() == 'plugins.metadata.mods34.schema.Mods34Schema');
     // Get the cataloging language.
     $catalogingLanguage = $mods34Description->getStatement('recordInfo/languageOfCataloging/languageTerm[@authority="iso639-2b"]');
     $catalogingLocale = Locale::getLocaleFrom3LetterIso($catalogingLanguage);
     assert(!is_null($catalogingLocale));
     // Title
     $localizedTitles = $mods34Description->getStatementTranslations('titleInfo/title');
     if (is_array($localizedTitles)) {
         foreach ($localizedTitles as $locale => $title) {
             $submission->setTitle($title, $locale);
         }
     }
     // Names: authors and sponsor
     $foundSponsor = false;
     $nameDescriptions =& $mods34Description->getStatement('name');
     if (is_array($nameDescriptions)) {
         foreach ($nameDescriptions as $nameDescription) {
             /* @var $nameDescription MetadataDescription */
             // Check that we find the expected name schema.
             assert($nameDescription->getMetadataSchemaName() == 'lib.pkp.plugins.metadata.mods34.schema.Mods34NameSchema');
             // Retrieve the name type and role.
             $nameType = $nameDescription->getStatement('[@type]');
             $nameRoles = $nameDescription->getStatement('role/roleTerm[@type="code" @authority="marcrelator"]');
             // Transport the name into the submission depending
             // on name type and role.
             // FIXME: Move this to a dedicated adapter in the Author class.
             if (is_array($nameRoles)) {
                 switch ($nameType) {
                     // Authors
                     case 'personal':
                         // Only authors go into the submission.
                         if (in_array('aut', $nameRoles)) {
                             // Instantiate a new author object.
                             import($authorClassName);
                             $author = new Author();
                             // Family Name
                             $author->setLastName($nameDescription->getStatement('namePart[@type="family"]'));
                             // Given Names
                             $givenNames = $nameDescription->getStatement('namePart[@type="given"]');
                             if (!empty($givenNames)) {
                                 $givenNames = explode(' ', $givenNames, 2);
                                 if (isset($givenNames[0])) {
                                     $author->setFirstName($givenNames[0]);
                                 }
                                 if (isset($givenNames[1])) {
                                     $author->setMiddleName($givenNames[1]);
                                 }
                             }
                             // Affiliation
                             // NB: Our MODS mapping currently doesn't support translation for names.
                             // This can be added when required by data providers. We assume the cataloging
                             // language for the record.
                             $affiliation = $nameDescription->getStatement('affiliation');
                             if (!empty($affiliation)) {
                                 $author->setAffiliation($affiliation, $catalogingLocale);
                             }
                             // Terms of address (unmapped field)
                             $termsOfAddress = $nameDescription->getStatement('namePart[@type="termsOfAddress"]');
                             if ($termsOfAddress) {
                                 $author->setData('nlm34:namePart[@type="termsOfAddress"]', $termsOfAddress);
                             }
                             // Date (unmapped field)
                             $date = $nameDescription->getStatement('namePart[@type="date"]');
                             if ($date) {
                                 $author->setData('nlm34:namePart[@type="date"]', $date);
                             }
                             // Add the author to the submission.
                             $submission->addAuthor($author);
                             unset($author);
                         }
                         break;
                         // Sponsor
                         // NB: Our MODS mapping currently doesn't support translation for names.
                         // This can be added when required by data providers. We assume the cataloging
                         // language for the record.
                     // Sponsor
                     // NB: Our MODS mapping currently doesn't support translation for names.
                     // This can be added when required by data providers. We assume the cataloging
                     // language for the record.
                     case 'corporate':
                         // Only the first sponsor goes into the submission.
                         if (!$foundSponsor && in_array('spn', $nameRoles)) {
                             $foundSponsor = true;
                             $submission->setSponsor($nameDescription->getStatement('namePart'), $catalogingLocale);
                         }
                         break;
                 }
             }
             unset($nameDescription);
         }
     }
     // Creation date
     $dateSubmitted = $mods34Description->getStatement('originInfo/dateCreated[@encoding="w3cdtf"]');
     if ($dateSubmitted) {
         $submission->setDateSubmitted($dateSubmitted);
     }
     // Submission language
     $submissionLanguage = $mods34Description->getStatement('language/languageTerm[@type="code" @authority="iso639-2b"]');
     $submissionLocale = Locale::get2LetterFrom3LetterIsoLanguage($submissionLanguage);
     if ($submissionLocale) {
         $submission->setLanguage($submissionLocale);
     }
     // Pages (extent)
     $pages = $mods34Description->getStatement('physicalDescription/extent');
     if ($pages) {
         $submission->setPages($pages);
     }
     // Abstract
     $localizedAbstracts = $mods34Description->getStatementTranslations('abstract');
     if (is_array($localizedAbstracts)) {
         foreach ($localizedAbstracts as $locale => $abstract) {
             $submission->setAbstract($abstract, $locale);
         }
     }
     // Discipline, subject class and subject
     // FIXME: We currently ignore discipline, subject class and subject because we cannot
     // distinguish them within a list of MODS topic elements. Can we use several subject
     // statements with different authorities instead?
     // Geographical coverage
     $localizedCoverageGeos = $mods34Description->getStatementTranslations('subject/geographic');
     if (is_array($localizedCoverageGeos)) {
         foreach ($localizedCoverageGeos as $locale => $localizedCoverageGeo) {
             $submission->setCoverageGeo($localizedCoverageGeo, $locale);
         }
     }
     // Chronological coverage
     $localizedCoverageChrons = $mods34Description->getStatementTranslations('subject/temporal');
     if (is_array($localizedCoverageChrons)) {
         foreach ($localizedCoverageChrons as $locale => $localizedCoverageChron) {
             $submission->setCoverageChron($localizedCoverageChron, $locale);
         }
     }
     // Record identifier
     // NB: We currently don't override the submission id with the record identifier in MODS
     // to make sure that MODS records can be transported between different installations.
     // Handle unmapped fields.
     $this->injectUnmappedDataObjectMetadataFields($mods34Description, $submission);
     return $submission;
 }
Example #18
0
 /**
  * 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();
 }
 /**
  * Private function for returning a sample research proposal
  * @param type $approvalNotice
  * @return \SectionEditorSubmission
  */
 private function _createSampleProposal($approvalNotice)
 {
     $institutionDao =& DAORegistry::getDAO('InstitutionDAO');
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     // Create the submission
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $sectionEditorSubmission = new SectionEditorSubmission();
     $sectionEditorSubmission->setProposalId('2014.76.RV');
     $sectionEditorSubmission->setDateSubmitted('2014-06-13 14:57:17');
     // Create the decision
     import('classes.article.SectionDecision');
     $sectionDecision = new SectionDecision();
     $sectionDecision->setSectionId($sectionDao->getRandomSectionId());
     $reviewTypes = $approvalNotice->getReviewTypesArray();
     if ($reviewTypes[0] != APPROVAL_NOTICE_TYPE_ALL) {
         $sectionDecision->setReviewType($reviewTypes[0]);
     } else {
         $sectionDecision->setReviewType(1);
     }
     $sectionDecision->setRound(2);
     $sectionEditorSubmission->setDecisions(array(0 => $sectionDecision));
     // Create the investigators
     import('classes.article.Author');
     $firstInvestigator = new Author();
     $firstInvestigator->setFirstName('Jane');
     $firstInvestigator->setLastName('Roe');
     $firstInvestigator->setPrimaryContact(1);
     $firstInvestigator->setAffiliation('World Health Organization, Western Pacific Regional Office');
     $coInvestigator1 = new Author();
     $coInvestigator1->setFirstName('John');
     $coInvestigator1->setLastName('Doe');
     $coInvestigator1->setPrimaryContact(0);
     $coInvestigator1->setAffiliation('National Public Health Institution');
     $coInvestigator2 = new Author();
     $coInvestigator2->setFirstName('Marie');
     $coInvestigator2->setMiddleName('Elizabeth');
     $coInvestigator2->setLastName('Watson');
     $coInvestigator2->setPrimaryContact(0);
     $coInvestigator2->setAffiliation('HUYBN');
     $coInvestigator3 = new Author();
     $coInvestigator3->setFirstName('Pascal');
     $coInvestigator3->setLastName('Lavaud');
     $coInvestigator3->setPrimaryContact(0);
     $coInvestigator3->setAffiliation('Cabinet MEDICAL, Avenue Bollée');
     $sectionEditorSubmission->setAuthors(array(0 => $firstInvestigator, 1 => $coInvestigator1, 2 => $coInvestigator2, 3 => $coInvestigator3));
     return $sectionEditorSubmission;
 }
 /**
  * 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);
 }
 /**
  * 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;
 }
Example #22
0
 /**
  * Save changes to paper.
  * @return int the paper ID
  */
 function execute()
 {
     $paperDao = DAORegistry::getDAO('PaperDAO');
     if (isset($this->paper)) {
         $reviewMode = $this->paper->getReviewMode();
         // Update existing paper
         $this->paper->setTrackId($this->getData('trackId'));
         $this->paper->setLocale($this->getData('locale'));
         $this->paper->setCommentsToDirector($this->getData('commentsToDirector'));
         $this->paper->setData('sessionType', $this->getData('sessionType'));
         if ($this->paper->getSubmissionProgress() <= $this->step) {
             $this->paper->stampStatusModified();
             if ($reviewMode == REVIEW_MODE_ABSTRACTS_ALONE) {
                 $this->paper->setSubmissionProgress($this->step + 2);
             } else {
                 $this->paper->setSubmissionProgress($this->step + 1);
             }
         }
         $paperDao->updatePaper($this->paper);
     } else {
         // Insert new paper
         $conference =& Request::getConference();
         $schedConf =& Request::getSchedConf();
         $user =& Request::getUser();
         $this->paper = new Paper();
         $this->paper->setLocale($this->getData('locale'));
         $this->paper->setUserId($user->getId());
         $this->paper->setSchedConfId($schedConf->getId());
         $this->paper->setTrackId($this->getData('trackId'));
         $this->paper->stampStatusModified();
         $reviewMode = $schedConf->getSetting('reviewMode');
         $this->paper->setReviewMode($reviewMode);
         $this->paper->setLanguage(String::substr($this->paper->getLocale(), 0, 2));
         $this->paper->setCommentsToDirector($this->getData('commentsToDirector'));
         switch ($reviewMode) {
             case REVIEW_MODE_ABSTRACTS_ALONE:
             case REVIEW_MODE_BOTH_SEQUENTIAL:
                 $this->paper->setSubmissionProgress($this->step + 2);
                 $this->paper->setCurrentRound(REVIEW_ROUND_ABSTRACT);
                 break;
             case REVIEW_MODE_PRESENTATIONS_ALONE:
             case REVIEW_MODE_BOTH_SIMULTANEOUS:
                 $this->paper->setSubmissionProgress($this->step + 1);
                 $this->paper->setCurrentRound(REVIEW_ROUND_PRESENTATION);
                 break;
         }
         $this->paper->setData('sessionType', $this->getData('sessionType'));
         $paperDao->insertPaper($this->paper);
         $this->paperId = $this->paper->getPaperId();
         // Set user to initial author
         $authorDao = DAORegistry::getDAO('AuthorDAO');
         /* @var $authorDao AuthorDAO */
         $user =& Request::getUser();
         $author = new Author();
         $author->setSubmissionId($this->paperId);
         $author->setFirstName($user->getFirstName());
         $author->setMiddleName($user->getMiddleName());
         $author->setLastName($user->getLastName());
         $author->setAffiliation($user->getAffiliation(null), null);
         $author->setCountry($user->getCountry());
         $author->setEmail($user->getEmail());
         $author->setUrl($user->getUrl());
         $author->setBiography($user->getBiography(null), null);
         $author->setPrimaryContact(1);
         $authorDao->insertObject($author);
     }
     return $this->paperId;
 }
Example #23
0
 /**
  * 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();
 }
Example #24
0
 /**
  * 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;
 }
Example #25
0
    /**
     * 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.
  * @return int the article ID
  */
 function execute()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     if (isset($this->article)) {
         // Update existing article
         $this->article->setSectionId($this->getData('sectionId'));
         $this->article->setLocale($this->getData('locale'));
         $this->article->setCommentsToEditor($this->getData('commentsToEditor'));
         if ($this->article->getSubmissionProgress() <= $this->step) {
             $this->article->stampStatusModified();
             $this->article->setSubmissionProgress($this->step + 1);
         }
         $articleDao->updateArticle($this->article);
     } else {
         // Insert new article
         $journal =& $this->request->getJournal();
         $user =& $this->request->getUser();
         $this->article = new Article();
         $this->article->setLocale($this->getData('locale'));
         $this->article->setUserId($user->getId());
         $this->article->setJournalId($journal->getId());
         $this->article->setSectionId($this->getData('sectionId'));
         $this->article->stampStatusModified();
         $this->article->setSubmissionProgress($this->step + 1);
         $this->article->setLanguage(String::substr($this->article->getLocale(), 0, 2));
         $this->article->setCommentsToEditor($this->getData('commentsToEditor'));
         $articleDao->insertArticle($this->article);
         $this->articleId = $this->article->getId();
         // Set user to initial author
         $authorDao =& DAORegistry::getDAO('AuthorDAO');
         /* @var $authorDao AuthorDAO */
         $user =& $this->request->getUser();
         $author = new Author();
         $author->setSubmissionId($this->articleId);
         $author->setFirstName($user->getFirstName());
         $author->setMiddleName($user->getMiddleName());
         $author->setLastName($user->getLastName());
         $author->setAffiliation($user->getAffiliation(null), null);
         $author->setCountry($user->getCountry());
         $author->setEmail($user->getEmail());
         $author->setData('orcid', $user->getData('orcid'));
         $author->setUrl($user->getUrl());
         $author->setBiography($user->getBiography(null), null);
         $author->setPrimaryContact(1);
         $authorDao->insertAuthor($author);
     }
     return $this->articleId;
 }
Example #27
0
 /**
  * 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();
 }
 /**
  * Private function for returning a sample research proposal
  * @param type $approvalNotice
  * @return \SectionEditorSubmission
  */
 private function _createSampleProposal($approvalNotice)
 {
     $institutionDao =& DAORegistry::getDAO('InstitutionDAO');
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     // Create the submission
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $sectionEditorSubmission = new SectionEditorSubmission();
     $sectionEditorSubmission->setProposalId('2014.76.RV');
     $sectionEditorSubmission->setDateSubmitted('2014-06-13 14:57:17');
     // Create the decision
     import('classes.article.SectionDecision');
     $sectionDecision = new SectionDecision();
     $sectionDecision->setSectionId($sectionDao->getRandomSectionId());
     $reviewTypes = $approvalNotice->getReviewTypesArray();
     if ($reviewTypes[0] != APPROVAL_NOTICE_TYPE_ALL) {
         $sectionDecision->setReviewType($reviewTypes[0]);
     } else {
         $sectionDecision->setReviewType(1);
     }
     $sectionDecision->setRound(2);
     $sectionEditorSubmission->setDecisions(array(0 => $sectionDecision));
     // Create the investigators
     import('classes.article.Author');
     $firstInvestigator = new Author();
     $firstInvestigator->setFirstName('Jane');
     $firstInvestigator->setLastName('Roe');
     $firstInvestigator->setPrimaryContact(1);
     $firstInvestigator->setAffiliation('World Health Organization, Western Pacific Regional Office');
     $coInvestigator1 = new Author();
     $coInvestigator1->setFirstName('John');
     $coInvestigator1->setLastName('Doe');
     $coInvestigator1->setPrimaryContact(0);
     $coInvestigator1->setAffiliation('National Public Health Institution');
     $coInvestigator2 = new Author();
     $coInvestigator2->setFirstName('Marie');
     $coInvestigator2->setMiddleName('Elizabeth');
     $coInvestigator2->setLastName('Watson');
     $coInvestigator2->setPrimaryContact(0);
     $coInvestigator2->setAffiliation('HUYBN');
     $coInvestigator3 = new Author();
     $coInvestigator3->setFirstName('Pascal');
     $coInvestigator3->setLastName('Lavaud');
     $coInvestigator3->setPrimaryContact(0);
     $coInvestigator3->setAffiliation('Cabinet MEDICAL, Avenue Bollée');
     $sectionEditorSubmission->setAuthors(array(0 => $firstInvestigator, 1 => $coInvestigator1, 2 => $coInvestigator2, 3 => $coInvestigator3));
     // Create the abstract
     import('classes.article.ProposalAbstract');
     $abstract = new ProposalAbstract();
     $abstract->setLocale('en_US');
     $abstract->setScientificTitle('Here, the scientific title of the concerned health research proposal will appear.');
     $abstract->setPublicTitle('Here, the public title of the concerned health research proposal will appear.');
     $abstract->setBackground('Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear. Here, the background of the concerned health research proposal will appear.');
     $abstract->setObjectives('Here, the objectives of the concerned health research proposal will appear. Here, the objectives of the concerned health research proposal will appear. Here, the objectives of the concerned health research proposal will appear. Here, the objectives of the concerned health research proposal will appear. Here, the objectives of the concerned health research proposal will appear.');
     $abstract->setStudyMethods('Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear. Here, the study methods of the concerned health research proposal will appear.');
     $abstract->setExpectedOutcomes('Here, the expected outcomes of the concerned health research proposal will appear. Here, the expected outcomes of the concerned health research proposal will appear. Here, the expected outcomes of the concerned health research proposal will appear. Here, the expected outcomes of the concerned health research proposal will appear. Here, the expected outcomes of the concerned health research proposal will appear. Here, the expected outcomes of the concerned health research proposal will appear.');
     $sectionEditorSubmission->setAbstracts(array(0 => $abstract));
     // Create proposal details
     import('classes.article.ProposalDetails');
     $details = new ProposalDetails();
     import('classes.article.StudentResearch');
     $studentResearch = new StudentResearch();
     $studentResearch->setInstitution('National University of Public Health');
     $studentResearch->setDegree(STUDENT_DEGREE_PHD);
     $studentResearch->setSupervisorName('Dr. Arwin Wagala');
     $details->setStudentResearchInfo($studentResearch);
     $details->setStartDate('2014-04-08');
     $details->setEndDate('2017-09-02');
     $details->setKeyImplInstitution($institutionDao->getRandomInstitutionId());
     $details->setMultiCountryResearch(PROPOSAL_DETAIL_YES);
     $details->setCountries('GE,AM');
     $details->setGeoAreas($extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_GEO_AREA) . '+' . $extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_GEO_AREA) . '+' . $extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_GEO_AREA));
     $details->setResearchDomains($extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_RESEARCH_DOMAIN));
     $details->setResearchFields($extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_RESEARCH_FIELD) . '+' . $extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_RESEARCH_FIELD));
     $details->setProposalTypes($extraFieldDao->getRandomFieldIdByType(EXTRA_FIELD_PROPOSAL_TYPE));
     $details->setDataCollection(PROPOSAL_DETAIL_BOTH_DATA_COLLECTION);
     $sectionEditorSubmission->setProposalDetails($details);
     return $sectionEditorSubmission;
 }