00001 <?php
00002
00016
00017
00018 import('paper.Paper');
00019
00020 class AuthorSubmission extends Paper {
00021
00023 var $reviewAssignments;
00024
00026 var $directorDecisions;
00027
00029 var $authorFileRevisions;
00030
00032 var $directorFileRevisions;
00033
00037 function AuthorSubmission() {
00038 parent::Paper();
00039 $this->reviewAssignments = array();
00040 }
00041
00050 function &getEditAssignments() {
00051 $editAssignments =& $this->getData('editAssignments');
00052 return $editAssignments;
00053 }
00054
00059 function setEditAssignments($editAssignments) {
00060 return $this->setData('editAssignments', $editAssignments);
00061 }
00062
00067 function addReviewAssignment($reviewAssignment) {
00068 if ($reviewAssignment->getPaperId() == null) {
00069 $reviewAssignment->setPaperId($this->getPaperId());
00070 }
00071
00072 $stage = $reviewAssignment->getStage();
00073
00074 if(!isset($this->reviewAssignments[$stage]))
00075 $this->reviewAssignments[$stage] = array();
00076
00077 $this->reviewAssignments[$stage][] = $reviewAssignment;
00078
00079 return $this->reviewAssignments[$stage];
00080 }
00081
00087 function removeReviewAssignment($reviewId) {
00088 $reviewAssignments = array();
00089 $found = false;
00090 for ($i=0, $count=count($this->reviewAssignments); $i < $count; $i++) {
00091 if ($this->reviewAssignments[$i]->getReviewId() == $reviewId) {
00092 $found = true;
00093 } else {
00094 array_push($reviewAssignments, $this->reviewAssignments[$i]);
00095 }
00096 }
00097 $this->reviewAssignments = $reviewAssignments;
00098
00099 return $found;
00100 }
00101
00102
00103
00104
00105
00110 function getReviewAssignments($stage) {
00111 if($stage == null)
00112 return $this->reviewAssignments;
00113
00114 if(!isset($this->reviewAssignments[$stage]))
00115 return null;
00116
00117 return $this->reviewAssignments[$stage];
00118 }
00119
00124 function setReviewAssignments($reviewAssignments, $stage) {
00125 return $this->reviewAssignments[$stage] = $reviewAssignments;
00126 }
00127
00128
00129
00130
00131
00136 function getDecisions($stage = null) {
00137 if ($stage == null)
00138 return $this->directorDecisions;
00139
00140 if(!isset($this->directorDecisions[$stage]))
00141 return null;
00142
00143 return $this->directorDecisions[$stage];
00144 }
00145
00151 function setDecisions($directorDecisions, $stage) {
00152 return $this->directorDecisions[$stage] = $directorDecisions;
00153 }
00154
00165 function getSubmissionStatus() {
00166
00167
00168 $schedConf =& Request::getSchedConf();
00169 if (!$schedConf || $this->getSchedConfId() != $schedConf->getId()) {
00170 unset($schedConf);
00171 $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
00172 $schedConf =& $schedConfDao->getSchedConf($this->getSchedConfId());
00173 }
00174
00175 $status = $this->getStatus();
00176 if ($status == STATUS_ARCHIVED ||
00177 $status == STATUS_PUBLISHED ||
00178 $status == STATUS_DECLINED) return $status;
00179
00180
00181 if ($this->getSubmissionProgress()) return (STATUS_INCOMPLETE);
00182
00183
00184 $editAssignments = $this->getEditAssignments();
00185 if (empty($editAssignments))
00186 return (STATUS_QUEUED_UNASSIGNED);
00187
00188 $latestDecision = $this->getMostRecentDecision();
00189 if ($latestDecision) {
00190 if ($latestDecision == SUBMISSION_DIRECTOR_DECISION_ACCEPT || $latestDecision == SUBMISSION_DIRECTOR_DECISION_DECLINE) {
00191 return STATUS_QUEUED_EDITING;
00192 }
00193 }
00194 return STATUS_QUEUED_REVIEW;
00195 }
00196
00201 function getMostRecentDecision() {
00202 $decisions = $this->getDecisions();
00203 $decision = array_pop($decisions);
00204 if (!empty($decision)) {
00205 $latestDecision = array_pop($decision);
00206 if (isset($latestDecision['decision'])) return $latestDecision['decision'];
00207 }
00208 return null;
00209 }
00210
00211
00212
00213
00214
00219 function &getSubmissionFile() {
00220 $returner =& $this->getData('submissionFile');
00221 return $returner;
00222 }
00223
00228 function setSubmissionFile($submissionFile) {
00229 return $this->setData('submissionFile', $submissionFile);
00230 }
00231
00236 function &getRevisedFile() {
00237 $returner =& $this->getData('revisedFile');
00238 return $returner;
00239 }
00240
00245 function setRevisedFile($revisedFile) {
00246 return $this->setData('revisedFile', $revisedFile);
00247 }
00248
00253 function &getLayoutFile() {
00254 $returner =& $this->getData('layoutFile');
00255 return $returner;
00256 }
00257
00262 function setLayoutFile($layoutFile) {
00263 return $this->setData('layoutFile', $layoutFile);
00264 }
00265
00270 function &getSuppFiles() {
00271 $returner =& $this->getData('suppFiles');
00272 return $returner;
00273 }
00274
00279 function setSuppFiles($suppFiles) {
00280 return $this->setData('suppFiles', $suppFiles);
00281 }
00282
00287 function getAuthorFileRevisions($stage = null) {
00288 if ($stage == null) {
00289 return $this->authorFileRevisions;
00290 } else {
00291 return $this->authorFileRevisions[$stage];
00292 }
00293 }
00294
00299 function setAuthorFileRevisions($authorFileRevisions, $stage) {
00300 return $this->authorFileRevisions[$stage] = $authorFileRevisions;
00301 }
00302
00307 function getDirectorFileRevisions($stage = null) {
00308 if ($stage == null) {
00309 return $this->directorFileRevisions;
00310 } else {
00311 return $this->directorFileRevisions[$stage];
00312 }
00313 }
00314
00319 function setDirectorFileRevisions($directorFileRevisions, $stage) {
00320 return $this->directorFileRevisions[$stage] = $directorFileRevisions;
00321 }
00322
00327 function &getGalleys() {
00328 $galleys =& $this->getData('galleys');
00329 return $galleys;
00330 }
00331
00336 function setGalleys(&$galleys) {
00337 return $this->setData('galleys', $galleys);
00338 }
00339
00340
00341
00342
00343
00348 function getMostRecentDirectorDecisionComment() {
00349 return $this->getData('mostRecentDirectorDecisionComment');
00350 }
00351
00356 function setMostRecentDirectorDecisionComment($mostRecentDirectorDecisionComment) {
00357 return $this->setData('mostRecentDirectorDecisionComment', $mostRecentDirectorDecisionComment);
00358 }
00359 }
00360
00361 ?>