/**
  * Display a summary of the status of an author's submission.
  */
 function submission($args)
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     list($journal, $submission) = TrackSubmissionHandler::validate($articleId);
     parent::setupTemplate(true, $articleId);
     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $journalSettings = $journalSettingsDao->getJournalSettings($journal->getJournalId());
     // Setting the round.
     $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
     $templateMgr =& TemplateManager::getManager();
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
     if ($publishedArticle) {
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
         $templateMgr->assign_by_ref('issue', $issue);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($submission->getSectionId());
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalSettings', $journalSettings);
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
     $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
     $templateMgr->assign('round', $round);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     import('submission.sectionEditor.SectionEditorSubmission');
     $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     // Set up required Payment Related Information
     import('payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
         $templateMgr->assign('authorFees', true);
         $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         if ($paymentManager->submissionEnabled()) {
             $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getJournalId(), $articleId));
         }
         if ($paymentManager->fastTrackEnabled()) {
             $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getJournalId(), $articleId));
         }
         if ($paymentManager->publicationEnabled()) {
             $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDAO->getPublicationCompletedPayment($journal->getJournalId(), $articleId));
         }
     }
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole');
     $templateMgr->display('author/submission.tpl');
 }
 /**
  * Records an editor's submission decision.
  * @param $sectionEditorSubmission object
  * @param $decision int
  * @param $request object
  */
 function recordDecision(&$sectionEditorSubmission, $decision, $request)
 {
     $editAssignments =& $sectionEditorSubmission->getEditAssignments();
     if (empty($editAssignments)) {
         return;
     }
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $user =& $request->getUser();
     $editorDecision = array('editDecisionId' => null, 'editorId' => $user->getId(), 'decision' => $decision, 'dateDecided' => date(Core::getCurrentDate()));
     if (!HookRegistry::call('SectionEditorAction::recordDecision', array(&$sectionEditorSubmission, $editorDecision))) {
         $sectionEditorSubmission->setStatus(STATUS_QUEUED);
         $sectionEditorSubmission->stampStatusModified();
         $sectionEditorSubmission->addDecision($editorDecision, $sectionEditorSubmission->getCurrentRound());
         $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
         $decisions = SectionEditorSubmission::getEditorDecisionOptions();
         // Add log
         import('classes.article.log.ArticleLog');
         AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_OJS_EDITOR);
         ArticleLog::logEvent($request, $sectionEditorSubmission, ARTICLE_LOG_EDITOR_DECISION, 'log.editor.decision', array('editorName' => $user->getFullName(), 'decision' => __($decisions[$decision])));
     }
 }
 /**
  * Records an editor's submission decision.
  * @param $sectionEditorSubmission object
  * @param $decision int
  */
 function recordDecision($sectionEditorSubmission, $decision)
 {
     $editAssignments =& $sectionEditorSubmission->getEditAssignments();
     if (empty($editAssignments)) {
         return;
     }
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $user =& Request::getUser();
     $editorDecision = array('editDecisionId' => null, 'editorId' => $user->getUserId(), 'decision' => $decision, 'dateDecided' => date(Core::getCurrentDate()));
     if (!HookRegistry::call('SectionEditorAction::recordDecision', array(&$sectionEditorSubmission, $editorDecision))) {
         $sectionEditorSubmission->setStatus(STATUS_QUEUED);
         $sectionEditorSubmission->stampStatusModified();
         $sectionEditorSubmission->addDecision($editorDecision, $sectionEditorSubmission->getCurrentRound());
         $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
         $decisions = SectionEditorSubmission::getEditorDecisionOptions();
         // Add log
         import('article.log.ArticleLog');
         import('article.log.ArticleEventLogEntry');
         ArticleLog::logEvent($sectionEditorSubmission->getArticleId(), ARTICLE_LOG_EDITOR_DECISION, ARTICLE_LOG_TYPE_EDITOR, $user->getUserId(), 'log.editor.decision', array('editorName' => $user->getFullName(), 'articleId' => $sectionEditorSubmission->getArticleId(), 'decision' => Locale::translate($decisions[$decision])));
     }
 }
 function submissionRegrets($args)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     list($journal, $submission) = SubmissionEditHandler::validate($articleId);
     parent::setupTemplate(true, $articleId, 'review');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $cancelsAndRegrets = $reviewAssignmentDao->getCancelsAndRegrets($articleId);
     $reviewFilesByRound = $reviewAssignmentDao->getReviewFilesByRound($articleId);
     $reviewAssignments =& $submission->getReviewAssignments();
     $editorDecisions = $submission->getDecisions();
     $numRounds = $submission->getCurrentRound();
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses = array();
     if (isset($reviewAssignments[$numRounds - 1])) {
         foreach ($reviewAssignments[$numRounds - 1] as $reviewAssignment) {
             $reviewFormResponses[$reviewAssignment->getReviewId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getReviewId());
         }
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign_by_ref('cancelsAndRegrets', $cancelsAndRegrets);
     $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
     $templateMgr->assign_by_ref('editorDecisions', $editorDecisions);
     $templateMgr->assign('numRounds', $numRounds);
     $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
     $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     import('submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->display('sectionEditor/submissionRegrets.tpl');
 }
 /**
  * Constructor.
  */
 function EditorSubmission()
 {
     parent::SectionEditorSubmission();
 }
 /**
  * Display specific details of an author's submission.
  */
 function submissionReview($args)
 {
     $user =& Request::getUser();
     $journal =& Request::getJournal();
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId);
     $authorSubmission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     Locale::requireComponents(array(LOCALE_COMPONENT_OJS_EDITOR));
     // editor.article.decision etc. FIXME?
     $templateMgr =& TemplateManager::getManager();
     //%CBP% Handle the author marking an item of work as creatively complete
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     if ($requestArgs = Request::getUserVar("f") == "creatively_complete") {
         $CBPPlatformDao->setArticleAsCreativelyComplete($articleId);
     }
     $templateMgr->assign_by_ref('creativelyComplete', $CBPPlatformDao->getArticleCreativelyComplete($articleId));
     //%CBP% Handle author request to bring editor into proceedings (WORKSHOP BASED ONLY)
     $templateMgr->assign_by_ref('workshop', $CBPPlatformDao->getWorkshop($journal->getJournalId()));
     if ($requestArgs = Request::getUserVar("f") == "editor_request") {
         $CBPPlatformDao->setAuthorRequestEditorAttention($articleId);
     }
     $templateMgr->assign_by_ref('editorRequest', $CBPPlatformDao->getAuthorRequestEditorAttention($articleId));
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewModifiedByRound = $reviewAssignmentDao->getLastModifiedByRound($articleId);
     $reviewEarliestNotificationByRound = $reviewAssignmentDao->getEarliestNotificationByRound($articleId);
     $reviewFilesByRound =& $reviewAssignmentDao->getReviewFilesByRound($articleId);
     $authorViewableFilesByRound =& $reviewAssignmentDao->getAuthorViewableFilesByRound($articleId);
     $editorDecisions = $authorSubmission->getDecisions($authorSubmission->getCurrentRound());
     $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1] : null;
     //%CBP% Get reviewer comments and display to author
     $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
     $reviewerComments = $CBPPlatformDao->getReviewerComments($articleId, null, null, 1);
     foreach ($reviewerComments as &$reviewRound) {
         foreach ($reviewRound as &$reviewerComment) {
             if ($reviewerComment['reviewer_file_id']) {
                 $reviewerComment['articleFile'] = $articleFileDao->getArticleFile($reviewerComment['reviewer_file_id']);
             }
         }
     }
     $templateMgr->assign_by_ref('reviewerComments', $reviewerComments);
     $reviewAssignments =& $authorSubmission->getReviewAssignments();
     $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
     $templateMgr->assign_by_ref('submission', $authorSubmission);
     $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
     $templateMgr->assign_by_ref('authorViewableFilesByRound', $authorViewableFilesByRound);
     $templateMgr->assign_by_ref('reviewModifiedByRound', $reviewModifiedByRound);
     $reviewIndexesByRound = array();
     for ($round = 1; $round <= $authorSubmission->getCurrentRound(); $round++) {
         $reviewIndexesByRound[$round] = $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round);
     }
     $templateMgr->assign_by_ref('reviewIndexesByRound', $reviewIndexesByRound);
     $templateMgr->assign('reviewEarliestNotificationByRound', $reviewEarliestNotificationByRound);
     $templateMgr->assign_by_ref('submissionFile', $authorSubmission->getSubmissionFile());
     $templateMgr->assign_by_ref('revisedFile', $authorSubmission->getRevisedFile());
     $templateMgr->assign_by_ref('suppFiles', $authorSubmission->getSuppFiles());
     $templateMgr->assign('lastEditorDecision', $lastDecision);
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $templateMgr->assign('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole.review');
     $templateMgr->display('author/submissionReview.tpl');
 }
 /**
  * Return the object representing the next row.
  * @return object
  */
 function &next()
 {
     $row =& parent::next();
     if ($row == null) {
         return $row;
     }
     $ret = array('articleId' => $row['article_id']);
     $ret['dateSubmitted'] = $this->journalStatisticsDao->dateFromDB($row['date_submitted']);
     $article =& $this->articleDao->getArticle($row['article_id']);
     $ret['title'] = $article->getArticleTitle();
     $section =& $this->getSection($row['section_id']);
     $ret['section'] = $section->getSectionTitle();
     // Author Names & Affiliations
     $maxAuthors = $this->getMaxAuthors();
     $ret['authors'] = $maxAuthors == 0 ? array() : array_fill(0, $maxAuthors, '');
     $ret['affiliations'] = $maxAuthors == 0 ? array() : array_fill(0, $maxAuthors, '');
     $ret['countries'] = $maxAuthors == 0 ? array() : array_fill(0, $maxAuthors, '');
     $authors =& $this->authorDao->getAuthorsByArticle($row['article_id']);
     $authorIndex = 0;
     foreach ($authors as $author) {
         $ret['authors'][$authorIndex] = $author->getFullName();
         $ret['affiliations'][$authorIndex] = $author->getAffiliation();
         $country = $author->getCountry();
         if (!empty($country)) {
             $ret['countries'][$authorIndex] = $this->countryDao->getCountry($country);
         }
         $authorIndex++;
     }
     if ($this->type === REPORT_TYPE_EDITOR) {
         $user = null;
         if ($row['editor_id']) {
             $user =& $this->userDao->getUser($row['editor_id']);
         }
         $ret['editor'] = $user ? $user->getFullName() : '';
     } else {
         $editAssignments =& $this->editAssignmentDao->getEditAssignmentsByArticleId($row['article_id']);
         $maxEditors = $this->getMaxEditors();
         $ret['editors'] = $maxEditors == 0 ? array() : array_fill(0, $maxEditors, '');
         $editorIndex = 0;
         while ($editAssignment =& $editAssignments->next()) {
             $ret['editors'][$editorIndex++] = $editAssignment->getEditorFullName();
         }
     }
     // Reviewer Names
     $ratingOptions =& ReviewAssignment::getReviewerRatingOptions();
     if ($this->type === REPORT_TYPE_REVIEWER) {
         $user = null;
         if ($row['reviewer_id']) {
             $user =& $this->userDao->getUser($row['reviewer_id']);
         }
         $ret['reviewer'] = $user ? $user->getFullName() : '';
         if ($row['quality']) {
             $ret['score'] = Locale::translate($ratingOptions[$row['quality']]);
         } else {
             $ret['score'] = '';
         }
         $ret['affiliation'] = $user ? $user->getAffiliation() : '';
     } else {
         $maxReviewers = $this->getMaxReviewers();
         $ret['reviewers'] = $maxReviewers == 0 ? array() : array_fill(0, $maxReviewers, '');
         $ret['scores'] = $maxReviewers == 0 ? array() : array_fill(0, $maxReviewers, '');
         $ret['recommendations'] = $maxReviewers == 0 ? array() : array_fill(0, $maxReviewers, '');
         $reviewAssignments =& $this->reviewAssignmentDao->getReviewAssignmentsByArticleId($row['article_id']);
         $reviewerIndex = 0;
         foreach ($reviewAssignments as $reviewAssignment) {
             $reviewerId = $reviewAssignment->getReviewerId();
             $ret['reviewers'][$reviewerIndex] = $reviewAssignment->getReviewerFullName();
             $rating = $reviewAssignment->getQuality();
             if ($rating != '') {
                 $ret['scores'][$reviewerIndex] = Locale::translate($ratingOptions[$rating]);
             }
             $recommendation = $reviewAssignment->getRecommendation();
             if ($recommendation !== '' && $recommendation !== null) {
                 $recommendationOptions =& $reviewAssignment->getReviewerRecommendationOptions();
                 $ret['recommendations'][$reviewerIndex] = Locale::translate($recommendationOptions[$recommendation]);
             }
             $reviewerIndex++;
         }
     }
     // Fetch the last editorial decision for this article.
     $editorDecisions = $this->authorSubmissionDao->getEditorDecisions($row['article_id']);
     $lastDecision = array_pop($editorDecisions);
     if ($lastDecision) {
         import('submission.sectionEditor.SectionEditorSubmission');
         $decisionOptions =& SectionEditorSubmission::getEditorDecisionOptions();
         $ret['decision'] = Locale::translate($decisionOptions[$lastDecision['decision']]);
         $ret['dateDecided'] = $lastDecision['dateDecided'];
         $decisionTime = strtotime($lastDecision['dateDecided']);
         $submitTime = strtotime($ret['dateSubmitted']);
         if ($decisionTime === false || $decisionTime === -1 || $submitTime === false || $submitTime === -1) {
             $ret['daysToDecision'] = '';
         } else {
             $ret['daysToDecision'] = round(($decisionTime - $submitTime) / 3600 / 24);
         }
     } else {
         $ret['decision'] = '';
         $ret['daysToDecision'] = '';
         $ret['dateDecided'] = '';
     }
     $ret['daysToPublication'] = '';
     if ($row['pub_id']) {
         $submitTime = strtotime($ret['dateSubmitted']);
         $publishTime = strtotime($this->journalStatisticsDao->dateFromDB($row['date_published']));
         if ($publishTime > $submitTime) {
             // Imported documents can be published before
             // they were submitted -- in this case, ignore
             // this metric (as opposed to displaying
             // negative numbers).
             $ret['daysToPublication'] = round(($publishTime - $submitTime) / 3600 / 24);
         }
     }
     $ret['status'] = $row['status'];
     return $ret;
 }
 /**
  * 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;
 }
 function submissionReview($args)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
     $journal =& Request::getJournal();
     $submission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     Locale::requireComponents(array(LOCALE_COMPONENT_OJS_MANAGER));
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $templateMgr =& TemplateManager::getManager();
     //%CBP% Display is an article has been marked as creatively complete or not
     $templateMgr->assign_by_ref('creativelyComplete', $CBPPlatformDao->getArticleCreativelyComplete($articleId));
     $templateMgr->assign_by_ref('editorAttention', $CBPPlatformDao->getAuthorRequestEditorAttention($articleId));
     //has an author requested editor attention?
     $workshop = $CBPPlatformDao->getWorkshop($journal->getJournalId());
     if ($workshop != "structured") {
         //%CBP% Get reviewer comments and display to author
         $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
         $reviewerComments = $CBPPlatformDao->getReviewerComments($articleId, null, null, 0);
         foreach ($reviewerComments as &$reviewRound) {
             foreach ($reviewRound as &$reviewerComment) {
                 if ($reviewerComment['reviewer_file_id']) {
                     $reviewerComment['articleFile'] = $articleFileDao->getArticleFile($reviewerComment['reviewer_file_id']);
                 }
             }
         }
         $templateMgr->assign_by_ref('reviewerComments', $reviewerComments);
         if ($workshop == "workshop") {
             $templateMgr->assign_by_ref('workshop', $workshop = "workshop");
         } else {
             $templateMgr->assign_by_ref('workshop', $workshop = 1);
         }
     }
     // Setting the round.
     $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sections =& $sectionDao->getJournalSections($journal->getId());
     $showPeerReviewOptions = $round == $submission->getCurrentRound() && $submission->getReviewFile() != null ? true : false;
     $editorDecisions = $submission->getDecisions($round);
     $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
     $lastDecisionMaker = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['editorId'] : null;
     $decisionMaker = $userDao->getUser($lastDecisionMaker);
     if ($decisionMaker) {
         $lastDecisionMaker = $decisionMaker->getFullName();
     }
     $editAssignments =& $submission->getEditAssignments();
     $allowRecommendation = $submission->getCurrentRound() == $round && $submission->getReviewFileId() != null && !empty($editAssignments);
     //%CBP% fixing bug for workshops, which was enabling decisions to be made after the intial decision was made
     if ($lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT) {
         //$allowRecommendation = false;
     }
     $allowResubmit = $lastDecision == SUBMISSION_EDITOR_DECISION_RESUBMIT && $sectionEditorSubmissionDao->getMaxReviewRound($articleId) == $round ? true : false;
     $allowCopyedit = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT && $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == null ? true : false;
     // Prepare an array to store the 'Notify Reviewer' email logs
     $notifyReviewerLogs = array();
     foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
         $notifyReviewerLogs[$reviewAssignment->getId()] = array();
     }
     // Parse the list of email logs and populate the array.
     import('classes.article.log.ArticleLog');
     $emailLogEntries =& ArticleLog::getEmailLogEntries($articleId);
     foreach ($emailLogEntries->toArray() as $emailLog) {
         if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
             if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
                 array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
             }
         }
     }
     // get journal published review form titles
     $reviewFormTitles =& $reviewFormDao->getTitlesByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), 1);
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses = array();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewFormTitles = array();
     foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
         $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
         if ($reviewForm) {
             $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
         }
         unset($reviewForm);
         $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
     }
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round));
     $templateMgr->assign('round', $round);
     $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
     $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
     $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
     $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
     $templateMgr->assign('showPeerReviewOptions', $showPeerReviewOptions);
     $templateMgr->assign_by_ref('sections', $sections->toArray());
     $templateMgr->assign('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     $templateMgr->assign_by_ref('lastDecision', $lastDecision);
     $templateMgr->assign_by_ref('lastDecisionMaker', $lastDecisionMaker);
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
     $templateMgr->assign('allowRecommendation', $allowRecommendation);
     $templateMgr->assign('allowResubmit', $allowResubmit);
     $templateMgr->assign('allowCopyedit', $allowCopyedit);
     $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
     $templateMgr->display('sectionEditor/submissionReview.tpl');
 }
 /**
  * View the submission review page.
  * @param $args array
  * @param $request PKPRequest
  */
 function submissionReview($args, &$request)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
     $journal =& Request::getJournal();
     $submission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     AppLocale::requireComponents(LOCALE_COMPONENT_OJS_MANAGER);
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     // Setting the round.
     $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound();
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sections =& $sectionDao->getJournalSections($journal->getId());
     $showPeerReviewOptions = $round == $submission->getCurrentRound() && $submission->getReviewFile() != null ? true : false;
     $editorDecisions = $submission->getDecisions($round);
     $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null;
     $editAssignments =& $submission->getEditAssignments();
     $allowRecommendation = $submission->getCurrentRound() == $round && $submission->getReviewFileId() != null && !empty($editAssignments);
     $allowResubmit = $lastDecision == SUBMISSION_EDITOR_DECISION_RESUBMIT && $sectionEditorSubmissionDao->getMaxReviewRound($articleId) == $round ? true : false;
     $allowCopyedit = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT && $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true) == null ? true : false;
     // Prepare an array to store the 'Notify Reviewer' email logs
     $notifyReviewerLogs = array();
     foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
         $notifyReviewerLogs[$reviewAssignment->getId()] = array();
     }
     // Parse the list of email logs and populate the array.
     $emailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
     $emailLogEntries =& $emailLogDao->getByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
     foreach ($emailLogEntries->toArray() as $emailLog) {
         if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
             if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
                 array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
             }
         }
     }
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses = array();
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $reviewFormTitles = array();
     foreach ($submission->getReviewAssignments($round) as $reviewAssignment) {
         $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
         if ($reviewForm) {
             $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
         }
         unset($reviewForm);
         $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round));
     $templateMgr->assign('round', $round);
     $templateMgr->assign_by_ref('reviewAssignments', $submission->getReviewAssignments($round));
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
     $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
     $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
     $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
     $templateMgr->assign('showPeerReviewOptions', $showPeerReviewOptions);
     $templateMgr->assign_by_ref('sections', $sections->toArray());
     $templateMgr->assign('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     $templateMgr->assign_by_ref('lastDecision', $lastDecision);
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
     $templateMgr->assign('allowRecommendation', $allowRecommendation);
     $templateMgr->assign('allowResubmit', $allowResubmit);
     $templateMgr->assign('allowCopyedit', $allowCopyedit);
     $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
     $templateMgr->display('sectionEditor/submissionReview.tpl');
 }
 /**
  * Display a summary of the status of an author's submission.
  */
 function submission($args)
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId);
     $submission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $journalSettings = $journalSettingsDao->getJournalSettings($journal->getId());
     $templateMgr =& TemplateManager::getManager();
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
     if ($publishedArticle) {
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
         $templateMgr->assign_by_ref('issue', $issue);
     }
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($submission->getSectionId());
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalSettings', $journalSettings);
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     $templateMgr->assign_by_ref('reportFiles', $submission->getReportFiles());
     $templateMgr->assign_by_ref('saeFiles', $submission->getSAEFiles());
     $suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
     $templateMgr->assign_by_ref('suppFileDao', $suppFileDao);
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $templateMgr->assign_by_ref('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole');
     $lastSectionDecision = $submission->getLastSectionDecision();
     if ($lastSectionDecision->getDecision() == SUBMISSION_SECTION_NO_DECISION && $lastSectionDecision->getReviewType() == REVIEW_TYPE_INITIAL) {
         $canEditMetadata = true;
         $canEditFiles = true;
     } else {
         $canEditMetadata = false;
         $canEditFiles = false;
     }
     $templateMgr->assign('canEditMetadata', $canEditMetadata);
     $templateMgr->assign('canEditFiles', $canEditFiles);
     $templateMgr->assign_by_ref('riskAssessment', $submission->getRiskAssessment());
     $templateMgr->assign_by_ref('abstract', $submission->getLocalizedAbstract());
     $currencyDao =& DAORegistry::getDAO('CurrencyDAO');
     $sourceCurrencyId = $journal->getSetting('sourceCurrency');
     $templateMgr->assign('sourceCurrency', $currencyDao->getCurrencyByAlphaCode($sourceCurrencyId));
     $templateMgr->display('author/submission.tpl');
 }
 /**
  * Display specific details of an author's submission.
  */
 function submissionReview($args)
 {
     $user =& Request::getUser();
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId);
     $authorSubmission =& $this->submission;
     $this->setupTemplate(true, $articleId);
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OJS_EDITOR));
     // editor.article.decision etc. FIXME?
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewModifiedByRound = $reviewAssignmentDao->getLastModifiedByRound($articleId);
     $reviewEarliestNotificationByRound = $reviewAssignmentDao->getEarliestNotificationByRound($articleId);
     $reviewFilesByRound =& $reviewAssignmentDao->getReviewFilesByRound($articleId);
     $authorViewableFilesByRound =& $reviewAssignmentDao->getAuthorViewableFilesByRound($articleId);
     $editorDecisions = $authorSubmission->getDecisions($authorSubmission->getCurrentRound());
     $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1] : null;
     $templateMgr =& TemplateManager::getManager();
     $reviewAssignments =& $authorSubmission->getReviewAssignments();
     $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
     $templateMgr->assign_by_ref('submission', $authorSubmission);
     $templateMgr->assign_by_ref('reviewFilesByRound', $reviewFilesByRound);
     $templateMgr->assign_by_ref('authorViewableFilesByRound', $authorViewableFilesByRound);
     $templateMgr->assign_by_ref('reviewModifiedByRound', $reviewModifiedByRound);
     $reviewIndexesByRound = array();
     for ($round = 1; $round <= $authorSubmission->getCurrentRound(); $round++) {
         $reviewIndexesByRound[$round] = $reviewAssignmentDao->getReviewIndexesForRound($articleId, $round);
     }
     $templateMgr->assign_by_ref('reviewIndexesByRound', $reviewIndexesByRound);
     $templateMgr->assign('reviewEarliestNotificationByRound', $reviewEarliestNotificationByRound);
     $templateMgr->assign_by_ref('submissionFile', $authorSubmission->getSubmissionFile());
     $templateMgr->assign_by_ref('revisedFile', $authorSubmission->getRevisedFile());
     $templateMgr->assign_by_ref('suppFiles', $authorSubmission->getSuppFiles());
     $templateMgr->assign('lastEditorDecision', $lastDecision);
     import('classes.submission.sectionEditor.SectionEditorSubmission');
     $templateMgr->assign('editorDecisionOptions', SectionEditorSubmission::getEditorDecisionOptions());
     $templateMgr->assign('helpTopicId', 'editorial.authorsRole.review');
     $templateMgr->display('author/submissionReview.tpl');
 }
 /**
  * Records an editor's submission decision. (Modified: Update if there is already an existing decision.)
  * @param $sectionEditorSubmission object
  * @param $decision int
  * @param $lastDecisionId int (Added)
  */
 function recordDecision($sectionEditorSubmission, $decision, $reviewType, $round, $comments = null, $dateDecided = null, $lastDecisionId = null)
 {
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $user =& Request::getUser();
     $journal =& Request::getJournal();
     $currentDate = date(Core::getCurrentDate());
     $approvalDate = $dateDecided == null ? $currentDate : date($dateDecided);
     // Create the section decision
     import('classes.article.SectionDecision');
     $sectionDecision = new SectionDecision();
     if ($lastDecisionId) {
         $sectionDecision->setId($lastDecisionId);
     }
     $sectionDecision->setArticleId($sectionEditorSubmission->getArticleId());
     $sectionDecision->setDecision($decision);
     $sectionDecision->setReviewType($reviewType);
     $sectionDecision->setRound($round);
     $sectionDecision->setSectionId($user->getSecretaryCommitteeId());
     $sectionDecision->setComments($comments);
     $sectionDecision->setDateDecided($approvalDate);
     if (!HookRegistry::call('SectionEditorAction::recordDecision', array($sectionEditorSubmission, $decision, $reviewType, $round, $dateDecided, $lastDecisionId))) {
         if ($reviewType == REVIEW_TYPE_FR && ($decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments())) {
             if (!SectionEditorAction::_publishResearch($sectionEditorSubmission)) {
                 Request::redirect(null, null, 'submissionReview', $sectionEditorSubmission->getArticleId());
             }
         }
         if ($reviewType == REVIEW_TYPE_FR && ($decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments())) {
             $sectionEditorSubmission->setStatus(STATUS_COMPLETED);
         } elseif ($decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments() || $decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_DONE || $decision == SUBMISSION_SECTION_DECISION_INCOMPLETE || $decision == SUBMISSION_SECTION_DECISION_RESUBMIT) {
             $sectionEditorSubmission->setStatus(STATUS_REVIEWED);
         } elseif ($decision == SUBMISSION_SECTION_DECISION_DECLINED) {
             $sectionEditorSubmission->setStatus(STATUS_ARCHIVED);
         }
         $sectionEditorSubmission->stampStatusModified();
         $sectionEditorSubmission->addDecision($sectionDecision);
         $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
         // Send a notification to the user
         import('lib.pkp.classes.notification.NotificationManager');
         $notificationManager = new NotificationManager();
         $url = Request::url($journal->getPath(), 'author', 'submissionReview', array($sectionEditorSubmission->getArticleId()));
         switch ($decision) {
             case SUBMISSION_SECTION_DECISION_COMPLETE:
                 $message = 'notification.type.submissionComplete';
                 break;
             case SUBMISSION_SECTION_DECISION_INCOMPLETE:
                 $message = 'notification.type.submissionIncomplete';
                 break;
             case SUBMISSION_SECTION_DECISION_EXPEDITED:
                 $message = 'notification.type.submissionExpedited';
                 break;
             case SUBMISSION_SECTION_DECISION_FULL_REVIEW:
                 $message = 'notification.type.submissionAssigned';
                 break;
             case SUBMISSION_SECTION_DECISION_EXEMPTED:
                 $message = 'notification.type.submissionExempted';
                 break;
             case SUBMISSION_SECTION_DECISION_DECLINED:
                 $message = 'notification.type.submissionDecline';
                 break;
             case SUBMISSION_SECTION_DECISION_APPROVED:
                 $message = 'notification.type.submissionAccept';
                 break;
             case SUBMISSION_SECTION_DECISION_DONE:
                 $message = 'notification.type.submissionDone';
                 break;
             case SUBMISSION_SECTION_DECISION_RESUBMIT:
                 $message = 'notification.type.reviseAndResubmit';
                 break;
         }
         switch ($reviewType) {
             case REVIEW_TYPE_PR:
                 $message = $message . '.continuingReview';
                 break;
             case REVIEW_TYPE_AMENDMENT:
                 $message = $message . '.amendment';
                 break;
             case REVIEW_TYPE_SAE:
                 $message = $message . '.sae';
                 break;
             case REVIEW_TYPE_FR:
                 $message = $message . '.eos';
                 break;
         }
         $notificationManager->createNotification($sectionEditorSubmission->getUserId(), $message, $sectionEditorSubmission->getProposalId(), $url, 1, NOTIFICATION_TYPE_SECTION_DECISION_COMMENT);
         $decisions = SectionEditorSubmission::getAllPossibleEditorDecisionOptions();
         // Add log
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_SUBMISSION));
         ArticleLog::logEvent($sectionEditorSubmission->getArticleId(), ARTICLE_LOG_SECTION_DECISION, ARTICLE_LOG_TYPE_EDITOR, $user->getId(), 'log.editor.decision', array('editorName' => $user->getFullName(), 'proposalId' => $sectionEditorSubmission->getProposalId(), 'decision' => Locale::translate($sectionDecision->getReviewTypeKey()) . ' - ' . $sectionDecision->getRound() . ': ' . Locale::translate($decisions[$decision])));
     }
 }
 function submissionReview($args)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId, SECTION_EDITOR_ACCESS_REVIEW);
     $journal =& Request::getJournal();
     $submission =& $this->submission;
     $this->setupTemplate(1, $articleId);
     $user =& Request::getUser();
     Locale::requireComponents(array(LOCALE_COMPONENT_OJS_MANAGER));
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sections =& $sectionDao->getJournalSections($journal->getId());
     $sectionDecisionDao =& DAORegistry::getDAO("SectionDecisionDAO");
     $lastDecision = $sectionDecisionDao->getLastSectionDecision($articleId);
     $reviewAssignments =& $lastDecision->getReviewAssignments();
     $articleMoreRecent = strtotime($submission->getLastModified()) > strtotime($lastDecision->getDateDecided()) ? true : false;
     $approvalNoticeDao =& DAORegistry::getDAO("ApprovalNoticeDAO");
     $templates =& $approvalNoticeDao->getApprovalNoticesByCommitteeAndTypeId($lastDecision->getSectionId(), $lastDecision->getReviewType());
     // Prepare an array to store the 'Notify Reviewer' email logs
     $notifyReviewerLogs = array();
     foreach ($reviewAssignments as $reviewAssignment) {
         $notifyReviewerLogs[$reviewAssignment->getId()] = array();
     }
     // Parse the list of email logs and populate the array.
     import('classes.article.log.ArticleLog');
     $emailLogEntries =& ArticleLog::getEmailLogEntries($articleId);
     foreach ($emailLogEntries->toArray() as $emailLog) {
         if ($emailLog->getEventType() == ARTICLE_EMAIL_REVIEW_NOTIFY_REVIEWER) {
             if (isset($notifyReviewerLogs[$emailLog->getAssocId()]) && is_array($notifyReviewerLogs[$emailLog->getAssocId()])) {
                 array_push($notifyReviewerLogs[$emailLog->getAssocId()], $emailLog);
             }
         }
     }
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewFormResponses = array();
     $reviewFormTitles = array();
     foreach ($reviewAssignments as $reviewAssignment) {
         $reviewForm =& $reviewFormDao->getReviewForm($reviewAssignment->getReviewFormId());
         if ($reviewForm) {
             $reviewFormTitles[$reviewForm->getId()] = $reviewForm->getLocalizedTitle();
         }
         unset($reviewForm);
         $reviewFormResponses[$reviewAssignment->getId()] = $reviewFormResponseDao->reviewFormResponseExists($reviewAssignment->getId());
     }
     $ercReviewersDao =& DAORegistry::getDAO('ErcReviewersDAO');
     $ercReviewers =& $ercReviewersDao->getReviewersBySectionId($journal->getId(), $lastDecision->getSectionId());
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('articleId', $submission->getArticleId());
     $templateMgr->assign('scientificTitle', $submission->getScientificTitle());
     $templateMgr->assign('submitter', $submission->getUser());
     $templateMgr->assign('commentsToEditor', $submission->getCommentsToEditor());
     $templateMgr->assign('dateSubmitted', $submission->getDateSubmitted());
     $templateMgr->assign('proposalStatus', $submission->getSubmissionStatus());
     $templateMgr->assign('withdrawComments', $submission->getWithdrawComments('en_US'));
     $templateMgr->assign('withdrawReason', $submission->getWithdrawReason('en_US'));
     $templateMgr->assign_by_ref('reviewers', $ercReviewers);
     $templateMgr->assign('proposalId', $submission->getProposalId());
     $templateMgr->assign_by_ref('reviewAssignmentCount', count($reviewAssignments));
     $templateMgr->assign_by_ref('reviewIndexes', $reviewAssignmentDao->getReviewIndexesForDecision($lastDecision->getId()));
     $templateMgr->assign_by_ref('reviewAssignments', $reviewAssignments);
     $templateMgr->assign('reviewFormResponses', $reviewFormResponses);
     $templateMgr->assign('reviewFormTitles', $reviewFormTitles);
     $templateMgr->assign('sectionId', $submission->getSectionId());
     $templateMgr->assign('templates', $templates);
     $templateMgr->assign_by_ref('notifyReviewerLogs', $notifyReviewerLogs);
     $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile());
     $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles());
     $templateMgr->assign_by_ref('reportFiles', $submission->getReportFiles());
     $templateMgr->assign_by_ref('saeFiles', $submission->getSAEFiles());
     $templateMgr->assign_by_ref('reviewFile', $submission->getReviewFile());
     $templateMgr->assign_by_ref('previousFiles', $submission->getPreviousFiles());
     $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL'));
     $templateMgr->assign_by_ref('revisedFile', $submission->getRevisedFile());
     $templateMgr->assign_by_ref('editorFile', $submission->getEditorFile());
     $templateMgr->assign_by_ref('sectionDecisions', $submission->getDecisions());
     $templateMgr->assign('rateReviewerOnQuality', $journal->getSetting('rateReviewerOnQuality'));
     $templateMgr->assign_by_ref('sections', $sections->toArray());
     $sectionDecisions = SectionEditorSubmission::getEditorDecisionOptions();
     $templateMgr->assign('sectionDecisionOptions', $sectionDecisions);
     import('classes.submission.common.Action');
     unset($sectionDecisions[SUBMISSION_SECTION_DECISION_DECLINED]);
     $templateMgr->assign('sectionDecisionOptionsWithoutDeclined', $sectionDecisions);
     $templateMgr->assign('initialReviewOptions', SectionEditorSubmission::getInitialReviewOptions());
     $reviewOptions = SectionEditorSubmission::getReviewOptions();
     $templateMgr->assign('reviewOptions', $reviewOptions);
     unset($reviewOptions[SUBMISSION_SECTION_DECISION_EXEMPTED]);
     $templateMgr->assign('reviewOptionsWithoutExempted', $reviewOptions);
     $templateMgr->assign('continuingReviewOptions', SectionEditorSubmission::getContinuingReviewOptions());
     $templateMgr->assign('articleMoreRecent', $articleMoreRecent);
     $templateMgr->assign('lastDecision', $lastDecision);
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign_by_ref('reviewerRatingOptions', ReviewAssignment::getReviewerRatingOptions());
     // Set up required Payment Related Information
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
         $templateMgr->assign('authorFees', true);
         $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         if ($paymentManager->submissionEnabled()) {
             $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId));
         }
         if ($paymentManager->fastTrackEnabled()) {
             $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId));
         }
         if ($paymentManager->publicationEnabled()) {
             $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDAO->getPublicationCompletedPayment($journal->getId(), $articleId));
         }
     }
     $templateMgr->assign_by_ref('userId', $user->getId());
     $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.review');
     $templateMgr->display('sectionEditor/submissionReview.tpl');
 }
 /**
  * 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;
 }