Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
UnassignReviewerForm.inc.php
1 <?php
15 import('lib.pkp.classes.form.Form');
16 
17 class UnassignReviewerForm extends Form {
20 
23 
26 
33  function UnassignReviewerForm($reviewAssignment, $reviewRound, $submission) {
34  $this->setReviewAssignment($reviewAssignment);
35  $this->setReviewRound($reviewRound);
36  $this->setSubmission($submission);
37 
38  parent::Form('controllers/grid/users/reviewer/form/unassignReviewerForm.tpl');
39  }
40 
41  //
42  // Overridden template methods
43  //
50  function initData($args, $request) {
51  $context = $request->getContext();
52  $submission = $this->getSubmission();
53  $reviewAssignment = $this->getReviewAssignment();
54  $reviewRound = $this->getReviewRound();
55  $reviewerId = $reviewAssignment->getReviewerId();
56 
57  $this->setData('submissionId', $submission->getId());
58  $this->setData('stageId', $reviewRound->getStageId());
59  $this->setData('reviewRoundId', $reviewRound->getId());
60  $this->setData('reviewAssignmentId', $reviewAssignment->getId());
61  $this->setData('reviewerId', $reviewerId);
62 
63  import('lib.pkp.classes.mail.SubmissionMailTemplate');
64  $template = new SubmissionMailTemplate($submission, 'REVIEW_CANCEL');
65  if ($template) {
66  $userDao = DAORegistry::getDAO('UserDAO');
67  $reviewer = $userDao->getById($reviewerId);
68  $user = $request->getUser();
69 
70  $template->assignParams(array(
71  'reviewerName' => $reviewer->getFullName(),
72  'editorialContactSignature' => $user->getContactSignature(),
73  'signatureFullName' => $user->getFullname(),
74  ));
75 
76  $this->setData('personalMessage', $template->getBody() . "\n" . $context->getSetting('emailSignature'));
77  }
78  }
79 
87  function execute($args, $request) {
88  $submission = $this->getSubmission();
89  $reviewAssignment = $this->getReviewAssignment();
90 
91  // Notify the reviewer via email.
92  import('lib.pkp.classes.mail.SubmissionMailTemplate');
93  $mail = new SubmissionMailTemplate($submission, 'REVIEW_CANCEL', null, null, null, false);
94 
95  if ($mail->isEnabled() && !$this->getData('skipEmail')) {
96  $userDao = DAORegistry::getDAO('UserDAO');
97  $reviewerId = (int) $this->getData('reviewerId');
98  $reviewer = $userDao->getById($reviewerId);
99  $mail->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
100  $mail->setBody($this->getData('personalMessage'));
101  $mail->send($request);
102  }
103 
104  // Delete the review assignment.
105  // NB: EditorAction::clearReview() will check that this review
106  // id is actually attached to the submission so no need for further
107  // validation here.
108  import('lib.pkp.classes.submission.action.EditorAction');
109  $editorAction = new EditorAction();
110  return $editorAction->clearReview($request, $submission->getId(), $reviewAssignment->getId());
111  }
112 
117  function readInputData() {
118  $this->readUserVars(array(
119  'personalMessage',
120  'reviewAssignmentId',
121  'reviewRoundId',
122  'reviewerId',
123  'skipEmail',
124  'stageId',
125  'submissionId',
126  ));
127  }
128 
129  //
130  // Getters and Setters
131  //
137  function setReviewAssignment($reviewAssignment) {
138  $this->_reviewAssignment = $reviewAssignment;
139  }
140 
146  function getReviewAssignment() {
148  }
149 
155  function setReviewRound($reviewRound) {
156  $this->_reviewRound = $reviewRound;
157  }
158 
164  function getReviewRound() {
165  return $this->_reviewRound;
166  }
167 
172  function setSubmission($submission) {
173  $this->_submission = $submission;
174  }
175 
180  function getSubmission() {
181  return $this->_submission;
182  }
183 }
Subclass of MailTemplate for sending emails related to submissions.
static & getDAO($name, $dbconn=null)
setData($key, $value)
Definition: Form.inc.php:219
Allow the editor to remove a review assignment.
readUserVars($vars)
Definition: Form.inc.php:364
Class defining basic operations for handling HTML forms.
Definition: Form.inc.php:47
getData($key)
Definition: Form.inc.php:210
UnassignReviewerForm($reviewAssignment, $reviewRound, $submission)
Editor actions.
setReviewAssignment($reviewAssignment)