00001 <?php
00002
00015 import('lib.pkp.classes.form.Form');
00016
00017
00018 import('classes.monograph.reviewRound.ReviewRound');
00019
00020 class EditorDecisionForm extends Form {
00022 var $_seriesEditorSubmission;
00023
00025 var $_stageId;
00026
00028 var $_reviewRound;
00029
00031 var $_decision;
00032
00033
00041 function EditorDecisionForm(&$seriesEditorSubmission, $decision, $stageId, $template, $reviewRound = null) {
00042 parent::Form($template);
00043 $this->_seriesEditorSubmission = $seriesEditorSubmission;
00044 $this->_stageId = $stageId;
00045 $this->_reviewRound = $reviewRound;
00046 $this->_decision = $decision;
00047
00048
00049 $this->addCheck(new FormValidatorPost($this));
00050 }
00051
00052
00053
00054
00059 function getDecision() {
00060 return $this->_decision;
00061 }
00062
00067 function &getSeriesEditorSubmission() {
00068 return $this->_seriesEditorSubmission;
00069 }
00070
00075 function getStageId() {
00076 return $this->_stageId;
00077 }
00078
00083 function &getReviewRound() {
00084 return $this->_reviewRound;
00085 }
00086
00087
00088
00089
00093 function readInputData() {
00094 $this->readUserVars(array('selectedFiles'));
00095 parent::initData();
00096 }
00097
00098
00102 function fetch(&$request) {
00103 $seriesEditorSubmission =& $this->getSeriesEditorSubmission();
00104
00105 $reviewRound =& $this->getReviewRound();
00106 if (is_a($reviewRound, 'ReviewRound')) {
00107 $this->setData('reviewRoundId', $reviewRound->getId());
00108 }
00109
00110 $this->setData('stageId', $this->getStageId());
00111
00112
00113 $templateMgr =& TemplateManager::getManager();
00114 $templateMgr->assign('monographId', $seriesEditorSubmission->getId());
00115 $templateMgr->assign_by_ref('monograph', $seriesEditorSubmission);
00116
00117
00118 $stageDecisions = EditorDecisionActionsManager::getStageDecisions($this->getStageId());
00119 $templateMgr->assign('decisionData', $stageDecisions[$this->getDecision()]);
00120
00121 return parent::fetch($request);
00122 }
00123
00124
00125
00126
00127
00137 function _initiateReviewRound(&$monograph, $stageId, &$request, $status = null) {
00138
00139
00140
00141 $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00142 $lastReviewRound =& $reviewRoundDao->getLastReviewRoundByMonographId($monograph->getId(), $stageId);
00143 if ($lastReviewRound) {
00144 $newRound = $lastReviewRound->getRound() + 1;
00145 } else {
00146
00147 $newRound = 1;
00148 }
00149
00150
00151 $reviewRound =& $reviewRoundDao->build($monograph->getId(), $stageId, $newRound, $status);
00152
00153
00154 $notificationDao =& DAORegistry::getDAO('NotificationDAO');
00155 $notificationFactory =& $notificationDao->getByAssoc(
00156 ASSOC_TYPE_REVIEW_ROUND,
00157 $reviewRound->getId(),
00158 null,
00159 NOTIFICATION_TYPE_REVIEW_ROUND_STATUS,
00160 $monograph->getPressId()
00161 );
00162
00163
00164 if ($notificationFactory->wasEmpty()) {
00165 $notificationMgr = new NotificationManager();
00166 $notificationMgr->createNotification(
00167 $request,
00168 null,
00169 NOTIFICATION_TYPE_REVIEW_ROUND_STATUS,
00170 $monograph->getPressId(),
00171 ASSOC_TYPE_REVIEW_ROUND,
00172 $reviewRound->getId(),
00173 NOTIFICATION_LEVEL_NORMAL
00174 );
00175 }
00176
00177
00178 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00179
00180
00181 import('classes.monograph.MonographFile');
00182
00183 import('classes.file.MonographFileManager');
00184 $monographFileManager = new MonographFileManager($monograph->getPressId(), $monograph->getId());
00185 foreach (array('selectedFiles', 'selectedAttachments') as $userVar) {
00186 $selectedFiles = $this->getData($userVar);
00187 if(is_array($selectedFiles)) {
00188 foreach ($selectedFiles as $selectedFile) {
00189
00190 list($fileId, $revision) = explode('-', $selectedFile);
00191 list($newFileId, $newRevision) = $monographFileManager->copyFileToFileStage($fileId, $revision, MONOGRAPH_FILE_REVIEW_FILE, null, true);
00192 $submissionFileDao->assignRevisionToReviewRound($newFileId, $newRevision, $reviewRound);
00193 }
00194 }
00195 }
00196
00197 return $newRound;
00198 }
00199 }
00200
00201 ?>