コード例 #1
0
    /**
     * Update an existing section editor submission.
     * @param $sectionEditorSubmission SectionEditorSubmission
     */
    function updateSectionEditorSubmission(&$sectionEditorSubmission)
    {
        // update edit assignment
        $editAssignments =& $sectionEditorSubmission->getEditAssignments();
        foreach ($editAssignments as $editAssignment) {
            if ($editAssignment->getEditId() > 0) {
                $this->editAssignmentDao->updateEditAssignment($editAssignment);
            } else {
                $this->editAssignmentDao->insertEditAssignment($editAssignment);
            }
        }
        // Update editor decisions
        for ($i = 1; $i <= $sectionEditorSubmission->getCurrentRound(); $i++) {
            $editorDecisions = $sectionEditorSubmission->getDecisions($i);
            if (is_array($editorDecisions)) {
                foreach ($editorDecisions as $editorDecision) {
                    if ($editorDecision['editDecisionId'] == null) {
                        $this->update(sprintf('INSERT INTO edit_decisions
								(article_id, round, editor_id, decision, date_decided)
								VALUES (?, ?, ?, ?, %s)', $this->datetimeToDB($editorDecision['dateDecided'])), array($sectionEditorSubmission->getArticleId(), $sectionEditorSubmission->getCurrentRound(), $editorDecision['editorId'], $editorDecision['decision']));
                    }
                }
            }
        }
        if ($this->reviewRoundExists($sectionEditorSubmission->getArticleId(), $sectionEditorSubmission->getCurrentRound())) {
            $this->update('UPDATE review_rounds
					SET
						review_revision = ?
					WHERE article_id = ? AND round = ?', array($sectionEditorSubmission->getReviewRevision(), $sectionEditorSubmission->getArticleId(), $sectionEditorSubmission->getCurrentRound()));
        } elseif ($sectionEditorSubmission->getReviewRevision() != null) {
            $this->createReviewRound($sectionEditorSubmission->getArticleId(), $sectionEditorSubmission->getCurrentRound() === null ? 1 : $sectionEditorSubmission->getCurrentRound(), $sectionEditorSubmission->getReviewRevision());
        }
        // Update copyeditor assignment
        $copyeditSignoff = $this->signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $sectionEditorSubmission->getArticleId());
        if ($copyeditSignoff) {
            $copyeditorSubmission =& $this->copyeditorSubmissionDao->getCopyeditorSubmission($sectionEditorSubmission->getArticleId());
        } else {
            $copyeditorSubmission = new CopyeditorSubmission();
        }
        // Only update the fields that an editor can modify.
        $copyeditorSubmission->setArticleId($sectionEditorSubmission->getArticleId());
        $copyeditorSubmission->setDateStatusModified($sectionEditorSubmission->getDateStatusModified());
        $copyeditorSubmission->setLastModified($sectionEditorSubmission->getLastModified());
        // update review assignments
        foreach ($sectionEditorSubmission->getReviewAssignments() as $roundReviewAssignments) {
            foreach ($roundReviewAssignments as $reviewAssignment) {
                if ($reviewAssignment->getId() > 0) {
                    $this->reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
                } else {
                    $this->reviewAssignmentDao->insertReviewAssignment($reviewAssignment);
                }
            }
        }
        // Remove deleted review assignments
        $removedReviewAssignments = $sectionEditorSubmission->getRemovedReviewAssignments();
        for ($i = 0, $count = count($removedReviewAssignments); $i < $count; $i++) {
            $this->reviewAssignmentDao->deleteReviewAssignmentById($removedReviewAssignments[$i]);
        }
        // Update article
        if ($sectionEditorSubmission->getArticleId()) {
            $article =& $this->articleDao->getArticle($sectionEditorSubmission->getArticleId());
            // Only update fields that can actually be edited.
            $article->setSectionId($sectionEditorSubmission->getSectionId());
            $article->setCurrentRound($sectionEditorSubmission->getCurrentRound());
            $article->setReviewFileId($sectionEditorSubmission->getReviewFileId());
            $article->setEditorFileId($sectionEditorSubmission->getEditorFileId());
            $article->setStatus($sectionEditorSubmission->getStatus());
            $article->setDateStatusModified($sectionEditorSubmission->getDateStatusModified());
            $article->setLastModified($sectionEditorSubmission->getLastModified());
            $article->setCommentsStatus($sectionEditorSubmission->getCommentsStatus());
            $this->articleDao->updateArticle($article);
        }
    }
コード例 #2
0
 /**
  * Update an existing section editor submission.
  * @param $sectionEditorSubmission SectionEditorSubmission
  */
 function updateSectionEditorSubmission(&$sectionEditorSubmission)
 {
     // Update section decisions
     $sectionDecisions = $sectionEditorSubmission->getDecisions();
     if (is_array($sectionDecisions)) {
         foreach ($sectionDecisions as $sectionDecision) {
             if ($sectionDecision->getId() == null) {
                 $this->sectionDecisionDao->insertSectionDecision($sectionDecision);
             } else {
                 $this->sectionDecisionDao->updateSectionDecision($sectionDecision);
             }
         }
     }
     // Update copyeditor assignment
     $copyeditSignoff = $this->signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $sectionEditorSubmission->getArticleId());
     if ($copyeditSignoff) {
         $copyeditorSubmission =& $this->copyeditorSubmissionDao->getCopyeditorSubmission($sectionEditorSubmission->getArticleId());
     } else {
         $copyeditorSubmission = new CopyeditorSubmission();
     }
     // Only update the fields that an editor can modify.
     $copyeditorSubmission->setArticleId($sectionEditorSubmission->getArticleId());
     $copyeditorSubmission->setDateStatusModified($sectionEditorSubmission->getDateStatusModified());
     $copyeditorSubmission->setLastModified($sectionEditorSubmission->getLastModified());
     // Update article
     if ($sectionEditorSubmission->getArticleId()) {
         $article =& $this->articleDao->getArticle($sectionEditorSubmission->getArticleId());
         // Only update fields that can actually be edited.
         $article->setReviewFileId($sectionEditorSubmission->getReviewFileId());
         $article->setEditorFileId($sectionEditorSubmission->getEditorFileId());
         $article->setStatus($sectionEditorSubmission->getStatus());
         $article->setDateStatusModified($sectionEditorSubmission->getDateStatusModified());
         $article->setLastModified($sectionEditorSubmission->getLastModified());
         $article->setCommentsStatus($sectionEditorSubmission->getCommentsStatus());
         $this->articleDao->updateArticle($article);
     }
 }