00001 <?php
00002
00016
00017
00018 import('paper.Paper');
00019
00020 class TrackDirectorSubmission extends Paper {
00021
00023 var $reviewAssignments;
00024
00026 var $removedReviewAssignments;
00027
00029 var $directorDecisions;
00030
00032 var $directorFileRevisions;
00033
00035 var $authorFileRevisions;
00036
00040 function TrackDirectorSubmission() {
00041 parent::Paper();
00042 $this->reviewAssignments = array();
00043 $this->removedReviewAssignments = array();
00044 }
00045
00050 function addReviewAssignment($reviewAssignment) {
00051 if ($reviewAssignment->getPaperId() == null) {
00052 $reviewAssignment->setPaperId($this->getPaperId());
00053 }
00054
00055 $stage = $reviewAssignment->getStage();
00056
00057 if(!isset($this->reviewAssignments[$stage]))
00058 $this->reviewAssignments[$stage] = array();
00059
00060 $this->reviewAssignments[$stage][] = $reviewAssignment;
00061
00062 return $this->reviewAssignments[$stage];
00063 }
00064
00070 function addDecision($directorDecision, $stage) {
00071 if(!is_array($this->directorDecisions))
00072 $this->directorDecisions = array();
00073
00074 if(!isset($this->directorDecisions[$stage]))
00075 $this->directorDecisions[$stage] = array();
00076
00077 array_push($this->directorDecisions[$stage], $directorDecision);
00078 }
00079
00085 function removeReviewAssignment($reviewId) {
00086 if ($reviewId == 0) return false;
00087
00088 foreach($this->getReviewAssignments() as $stageKey => $reviews) {
00089 foreach ($reviews as $reviewKey => $review) {
00090 if($review->getId() == $reviewId) {
00091 $this->removedReviewAssignments[] =& $this->reviewAssignments[$stageKey][$reviewKey];
00092 unset($this->reviewAssignments[$stageKey][$reviewKey]);
00093 return true;
00094 }
00095 }
00096 }
00097 return false;
00098 }
00099
00104 function updateReviewAssignment($reviewAssignment) {
00105 $reviewAssignments = array();
00106 $stageReviewAssignments = $this->reviewAssignments[$reviewAssignment->getStage()];
00107 for ($i=0, $count=count($stageReviewAssignments); $i < $count; $i++) {
00108 if ($stageReviewAssignments[$i]->getReviewId() == $reviewAssignment->getId()) {
00109 array_push($reviewAssignments, $reviewAssignment);
00110 } else {
00111 array_push($reviewAssignments, $stageReviewAssignments[$i]);
00112 }
00113 }
00114 $this->reviewAssignments[$reviewAssignment->getStage()] = $reviewAssignments;
00115 }
00116
00127 function getSubmissionStatus() {
00128 $status = $this->getStatus();
00129 if ($status == STATUS_ARCHIVED ||
00130 $status == STATUS_PUBLISHED ||
00131 $status == STATUS_DECLINED) return $status;
00132
00133
00134 if ($this->getSubmissionProgress()) return (STATUS_INCOMPLETE);
00135
00136
00137 $editAssignments = $this->getEditAssignments();
00138 if (empty($editAssignments))
00139 return (STATUS_QUEUED_UNASSIGNED);
00140
00141 $decisions = $this->getDecisions();
00142 $decision = array_pop($decisions);
00143 if (!empty($decision)) {
00144 $latestDecision = array_pop($decision);
00145 if ($latestDecision['decision'] == SUBMISSION_DIRECTOR_DECISION_ACCEPT) {
00146 return STATUS_QUEUED_EDITING;
00147 }
00148 }
00149 return STATUS_QUEUED_REVIEW;
00150 }
00151
00160 function &getEditAssignments() {
00161 $editAssignments =& $this->getData('editAssignments');
00162 return $editAssignments;
00163 }
00164
00169 function setEditAssignments($editAssignments) {
00170 return $this->setData('editAssignments', $editAssignments);
00171 }
00172
00173
00174
00175
00176
00181 function getReviewAssignments($stage = null) {
00182 if($stage == null)
00183 return $this->reviewAssignments;
00184
00185 if(!isset($this->reviewAssignments[$stage]))
00186 return null;
00187
00188 return $this->reviewAssignments[$stage];
00189 }
00190
00195 function setReviewAssignments($reviewAssignments, $stage) {
00196 return $this->reviewAssignments[$stage] = $reviewAssignments;
00197 }
00198
00203 function &getRemovedReviewAssignments() {
00204 return $this->removedReviewAssignments;
00205 }
00206
00207
00208
00209
00210
00215 function getDecisions($stage = null) {
00216 if ($stage == null)
00217 return $this->directorDecisions;
00218
00219 if(!isset($this->directorDecisions[$stage]))
00220 return null;
00221
00222 return $this->directorDecisions[$stage];
00223 }
00224
00230 function setDecisions($directorDecisions, $stage) {
00231 return $this->directorDecisions[$stage] = $directorDecisions;
00232 }
00233
00234
00235
00236
00237
00242 function &getSubmissionFile() {
00243 $returner =& $this->getData('submissionFile');
00244 return $returner;
00245 }
00246
00251 function setSubmissionFile($submissionFile) {
00252 return $this->setData('submissionFile', $submissionFile);
00253 }
00254
00259 function &getRevisedFile() {
00260 $returner =& $this->getData('revisedFile');
00261 return $returner;
00262 }
00263
00268 function setRevisedFile($revisedFile) {
00269 return $this->setData('revisedFile', $revisedFile);
00270 }
00271
00276 function &getSuppFiles() {
00277 $returner =& $this->getData('suppFiles');
00278 return $returner;
00279 }
00280
00285 function setSuppFiles($suppFiles) {
00286 return $this->setData('suppFiles', $suppFiles);
00287 }
00288
00293 function &getReviewFile() {
00294 $returner =& $this->getData('reviewFile');
00295 return $returner;
00296 }
00297
00302 function setReviewFile($reviewFile) {
00303 return $this->setData('reviewFile', $reviewFile);
00304 }
00305
00310 function &getLayoutFile() {
00311 $returner =& $this->getData('layoutFile');
00312 return $returner;
00313 }
00314
00319 function setLayoutFile($layoutFile) {
00320 return $this->setData('layoutFile', $layoutFile);
00321 }
00322
00327 function getDirectorFileRevisions($stage = null) {
00328 if ($stage == null) {
00329 return $this->directorFileRevisions;
00330 } else {
00331 return $this->directorFileRevisions[$stage];
00332 }
00333 }
00334
00339 function setDirectorFileRevisions($directorFileRevisions, $stage) {
00340 return $this->directorFileRevisions[$stage] = $directorFileRevisions;
00341 }
00342
00347 function getAuthorFileRevisions($stage = null) {
00348 if ($stage == null) {
00349 return $this->authorFileRevisions;
00350 } else {
00351 return $this->authorFileRevisions[$stage];
00352 }
00353 }
00354
00359 function setAuthorFileRevisions($authorFileRevisions, $stage) {
00360 return $this->authorFileRevisions[$stage] = $authorFileRevisions;
00361 }
00362
00367 function &getDirectorFile() {
00368 $returner =& $this->getData('directorFile');
00369 return $returner;
00370 }
00371
00376 function setDirectorFile($directorFile) {
00377 return $this->setData('directorFile', $directorFile);
00378 }
00379
00380
00381
00382
00383
00388 function getReviewRevision() {
00389 return $this->getData('reviewRevision');
00390 }
00391
00396 function setReviewRevision($reviewRevision) {
00397 return $this->setData('reviewRevision', $reviewRevision);
00398 }
00399
00400
00401
00402
00403
00408 function getMostRecentDirectorDecisionComment() {
00409 return $this->getData('mostRecentDirectorDecisionComment');
00410 }
00411
00416 function setMostRecentDirectorDecisionComment($mostRecentDirectorDecisionComment) {
00417 return $this->setData('mostRecentDirectorDecisionComment', $mostRecentDirectorDecisionComment);
00418 }
00419
00424 function &getGalleys() {
00425 $galleys =& $this->getData('galleys');
00426 return $galleys;
00427 }
00428
00433 function setGalleys(&$galleys) {
00434 return $this->setData('galleys', $galleys);
00435 }
00436
00442 function &getDirectorDecisionOptions($schedConf = null, $stage = null) {
00443 $directorDecisionOptions = array('' => 'common.chooseOne');
00444 if (!$schedConf || ($stage == REVIEW_STAGE_ABSTRACT && $this->getReviewMode() == REVIEW_MODE_BOTH_SEQUENTIAL)) $directorDecisionOptions[SUBMISSION_DIRECTOR_DECISION_INVITE] = 'director.paper.decision.invitePresentation';
00445 if (!$schedConf || ($stage != REVIEW_STAGE_ABSTRACT || $this->getReviewMode() != REVIEW_MODE_BOTH_SEQUENTIAL)) $directorDecisionOptions[SUBMISSION_DIRECTOR_DECISION_ACCEPT] = 'director.paper.decision.accept';
00446
00447 $directorDecisionOptions[SUBMISSION_DIRECTOR_DECISION_PENDING_REVISIONS] = 'director.paper.decision.pendingRevisions';
00448 $directorDecisionOptions[SUBMISSION_DIRECTOR_DECISION_DECLINE] = 'director.paper.decision.decline';
00449 return $directorDecisionOptions;
00450 }
00451
00452 function isOriginalSubmissionComplete() {
00453 $reviewMode = $this->getReviewMode();
00454 if ($reviewMode == REVIEW_MODE_BOTH_SEQUENTIAL) {
00455 return ($this->getSubmissionProgress() != 1);
00456 }
00457 return ($this->getSubmissionProgress() == 0);
00458 }
00459 }
00460
00461 ?>