• Main Page
  • Modules
  • Classes
  • Files
  • File List

classes/submission/seriesEditor/SeriesEditorSubmission.inc.php

00001 <?php
00002 
00018 import('classes.monograph.Monograph');
00019 
00020 class SeriesEditorSubmission extends Monograph {
00021 
00023    var $reviewAssignments;
00024 
00026    var $removedReviewAssignments;
00027 
00029    var $editorDecisions;
00030 
00034    function SeriesEditorSubmission() {
00035       parent::Monograph();
00036       $this->reviewAssignments = array();
00037       $this->removedReviewAssignments = array();
00038    }
00039 
00044    function addReviewAssignment($reviewAssignment) {
00045       if ($reviewAssignment->getSubmissionId() == null) {
00046          $reviewAssignment->setSubmissionId($this->getMonographId());
00047       }
00048 
00049       if (isset($this->reviewAssignments[$reviewAssignment->getStageId()][$reviewAssignment->getRound()])) {
00050          $roundReviewAssignments = $this->reviewAssignments[$reviewAssignment->getStageId()][$reviewAssignment->getRound()];
00051       } else {
00052          $roundReviewAssignments = Array();
00053       }
00054       array_push($roundReviewAssignments, $reviewAssignment);
00055 
00056       return $this->reviewAssignments[$reviewAssignment->getStageId()][$reviewAssignment->getRound()] = $roundReviewAssignments;
00057    }
00058 
00065    function addDecision($editorDecision, $stageId, $round) {
00066       if (isset($this->editorDecisions[$stageId][$round]) && is_array($this->editorDecisions[$stageId][$round])) {
00067          array_push($this->editorDecisions[$stageId][$round], $editorDecision);
00068       }
00069       else $this->editorDecisions[$stageId][$round] = Array($editorDecision);
00070    }
00071 
00077    function removeReviewAssignment($reviewId) {
00078       $found = false;
00079 
00080       if ($reviewId != 0) {
00081          // FIXME maintain a hash for quicker get/remove
00082          $reviewAssignments = array();
00083          $empty = array();
00084          foreach ($this->reviewAssignments as $stageId => $reviewRounds)  {
00085             foreach ($reviewRounds as $round => $junk )  {
00086                $roundReviewAssignments = $this->reviewAssignments[$stageId][$round];
00087                foreach ( $roundReviewAssignments as $assignment ) {
00088                   if ($assignment->getId() == $reviewId) {
00089                      array_push($this->removedReviewAssignments, $reviewId);
00090                      $found = true;
00091                   } else {
00092                      array_push($reviewAssignments, $assignment);
00093                   }
00094                }
00095                $this->reviewAssignments[$stageId][$round] = $reviewAssignments;
00096                $reviewAssignments = $empty;
00097             }
00098          }
00099       }
00100       return $found;
00101    }
00102 
00107    function updateReviewAssignment($reviewAssignment) {
00108       $reviewAssignments = array();
00109       $roundReviewAssignments = $this->reviewAssignments[$reviewAssignment->getStageId()][$reviewAssignment->getRound()];
00110       foreach ($roundReviewAssignments as $existingAssignment) {
00111          if ($existingAssignment->getId() == $reviewAssignment->getId()) {
00112             array_push($reviewAssignments, $reviewAssignment);
00113          } else {
00114             array_push($reviewAssignments, $existingAssignment);
00115          }
00116       }
00117 
00118       $this->reviewAssignments[$reviewAssignment->getStageId()][$reviewAssignment->getRound()] = $reviewAssignments;
00119    }
00120 
00129    function getSubmissionStatus() {
00130       $status = $this->getStatus();
00131       if ($status == STATUS_ARCHIVED || $status == STATUS_PUBLISHED || $status == STATUS_DECLINED) return $status;
00132 
00133       // The submission is STATUS_QUEUED or the author's submission was STATUS_INCOMPLETE.
00134       if ($this->getSubmissionProgress()) return (STATUS_INCOMPLETE);
00135 
00136       if($this->getStageId() == WORKFLOW_STAGE_ID_INTERNAL_REVIEW || $this->getStageId() == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
00137          return STATUS_QUEUED_REVIEW;
00138       }
00139 
00140       $decisions = $this->getDecisions();
00141       if (!is_array($decisions)) {
00142          $decisions = array($decisions);
00143       }
00144       $decision = array_pop($decisions);
00145       if (!empty($decision)) {
00146          $latestDecision = array_pop($decision);
00147          if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT || $latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_DECLINE) {
00148             return STATUS_QUEUED_EDITING;
00149          }
00150       }
00151 
00152       return STATUS_QUEUED_UNASSIGNED;
00153    }
00154 
00155 
00156    //
00157    // Review Assignments
00158    //
00163    function &getReviewAssignments($stageId = null, $round = null) {
00164       if ($stageId == null) {
00165          return $this->reviewAssignments;
00166       } elseif ($round == null) {
00167          return $this->reviewAssignments[$stageId];
00168       } else {
00169          return $this->reviewAssignments[$stageId][$round];
00170       }
00171    }
00172 
00177    function setReviewAssignments($reviewAssignments, $stageId, $round) {
00178       return $this->reviewAssignments[$stageId][$round] = $reviewAssignments;
00179    }
00180 
00185    function &getRemovedReviewAssignments() {
00186       return $this->removedReviewAssignments;
00187    }
00188 
00189 
00190    //
00191    // Editor Decisions
00192    //
00197    function getDecisions($stageId = null, $round = null) {
00198       if ($stageId == null) {
00199          return $this->editorDecisions;
00200       } elseif ($round == null) {
00201          if (isset($this->editorDecisions[$stageId])) return $this->editorDecisions[$stageId];
00202       } else {
00203          if (isset($this->editorDecisions[$stageId][$round])) return $this->editorDecisions[$stageId][$round];
00204       }
00205 
00206       return null;
00207 
00208    }
00209 
00216    function setDecisions($editorDecisions, $stageId, $round) {
00217       $this->editorDecisions[$stageId][$round] = $editorDecisions;
00218    }
00219 
00220    //
00221    // Comments
00222    //
00223 
00228    function getMostRecentEditorDecisionComment() {
00229       return $this->getData('mostRecentEditorDecisionComment');
00230    }
00231 
00236    function setMostRecentEditorDecisionComment($mostRecentEditorDecisionComment) {
00237       return $this->setData('mostRecentEditorDecisionComment', $mostRecentEditorDecisionComment);
00238    }
00239 
00244    function getMostRecentCopyeditComment() {
00245       return $this->getData('mostRecentCopyeditComment');
00246    }
00247 
00252    function setMostRecentCopyeditComment($mostRecentCopyeditComment) {
00253       return $this->setData('mostRecentCopyeditComment', $mostRecentCopyeditComment);
00254    }
00255 
00260    function getMostRecentLayoutComment() {
00261       return $this->getData('mostRecentLayoutComment');
00262    }
00263 
00268    function setMostRecentLayoutComment($mostRecentLayoutComment) {
00269       return $this->setData('mostRecentLayoutComment', $mostRecentLayoutComment);
00270    }
00271 
00276    function getMostRecentProofreadComment() {
00277       return $this->getData('mostRecentProofreadComment');
00278    }
00279 
00284    function setMostRecentProofreadComment($mostRecentProofreadComment) {
00285       return $this->setData('mostRecentProofreadComment', $mostRecentProofreadComment);
00286    }
00287 
00292    function &getGalleys() {
00293       $galleys =& $this->getData('galleys');
00294       return $galleys;
00295    }
00296 
00301    function setGalleys(&$galleys) {
00302       return $this->setData('galleys', $galleys);
00303    }
00304 }
00305 
00306 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1