/**
  * Internal function to return a student research object from a row.
  * @param $row array
  * @return StudentResearch object
  */
 function &_returnStudentResearchFromRow(&$row)
 {
     $studentResearch = new StudentResearch();
     $studentResearch->setArticleId($row['article_id']);
     $studentResearch->setInstitution($row['institution']);
     $studentResearch->setDegree($row['degree']);
     $studentResearch->setSupervisorName($row['supervisor_name']);
     $studentResearch->setSupervisorEmail($row['supervisor_email']);
     HookRegistry::call('StudentResearchDAO::_returnStudentResearchFromRow', array(&$studentResearch, &$row));
     return $studentResearch;
 }
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);
     }
 }
 /**
  * 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;
 }