Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ThankReviewerForm.inc.php
1 <?php
2 
16 import('lib.pkp.classes.form.Form');
17 
18 class ThankReviewerForm extends Form {
21 
25  function ThankReviewerForm($reviewAssignment) {
26  parent::Form('controllers/grid/users/reviewer/form/thankReviewerForm.tpl');
27  $this->_reviewAssignment = $reviewAssignment;
28 
29  // Validation checks for this form
30  $this->addCheck(new FormValidatorPost($this));
31  }
32 
33  //
34  // Getters and Setters
35  //
40  function getReviewAssignment() {
42  }
43 
44  //
45  // Overridden template methods
46  //
52  function initData($args, $request) {
53  $userDao = DAORegistry::getDAO('UserDAO');
54  $user = $request->getUser();
55  $context = $request->getContext();
56 
57  $reviewAssignment = $this->getReviewAssignment();
58  $reviewerId = $reviewAssignment->getReviewerId();
59  $reviewer = $userDao->getById($reviewerId);
60 
61  $submissionDao = Application::getSubmissionDAO();
62  $submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
63 
64  import('lib.pkp.classes.mail.SubmissionMailTemplate');
65  $email = new SubmissionMailTemplate($submission, 'REVIEW_ACK');
66 
67  $dispatcher = $request->getDispatcher();
68  $paramArray = array(
69  'reviewerName' => $reviewer->getFullName(),
70  'editorialContactSignature' => $user->getContactSignature(),
71  'reviewerUserName' => $reviewer->getUsername(),
72  'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))),
73  'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId()))
74  );
75  $email->assignParams($paramArray);
76 
77  $this->setData('submissionId', $submission->getId());
78  $this->setData('stageId', $reviewAssignment->getStageId());
79  $this->setData('reviewAssignmentId', $reviewAssignment->getId());
80  $this->setData('reviewAssignment', $reviewAssignment);
81  $this->setData('reviewerName', $reviewer->getFullName() . ' <' . $reviewer->getEmail() . '>');
82  $this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
83  }
84 
89  function readInputData() {
90  $this->readUserVars(array('message', 'skipEmail'));
91  }
92 
98  function execute($args, $request) {
99  $userDao = DAORegistry::getDAO('UserDAO');
100  $submissionDao = Application::getSubmissionDAO();
101 
102  $reviewAssignment = $this->getReviewAssignment();
103  $reviewerId = $reviewAssignment->getReviewerId();
104  $reviewer = $userDao->getById($reviewerId);
105  $submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
106 
107  import('lib.pkp.classes.mail.SubmissionMailTemplate');
108  $email = new SubmissionMailTemplate($submission, 'REVIEW_ACK', null, null, null, false);
109 
110  $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
111  $email->setBody($this->getData('message'));
112 
113  if (!$this->getData('skipEmail')) {
114  HookRegistry::call('ThankReviewerForm::thankReviewer', array(&$submission, &$reviewAssignment, &$email));
115  $email->send($request);
116  }
117 
118  // update the ReviewAssignment with the acknowledged date
119  $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
120  $reviewAssignment->setDateAcknowledged(Core::getCurrentDate());
121  $reviewAssignment->stampModified();
122  $reviewAssignment->setUnconsidered(REVIEW_ASSIGNMENT_NOT_UNCONSIDERED);
123  $reviewAssignmentDao->updateObject($reviewAssignment);
124  }
125 }
126 
127 ?>
Subclass of MailTemplate for sending emails related to submissions.
static & getDAO($name, $dbconn=null)
addCheck($formValidator)
Definition: Form.inc.php:396
setData($key, $value)
Definition: Form.inc.php:219
static generatePasswordResetHash($userId)
Form validation check to make sure the form is POSTed.
readUserVars($vars)
Definition: Form.inc.php:364
Form for sending a thank you to a reviewer.
Class defining basic operations for handling HTML forms.
Definition: Form.inc.php:47
getData($key)
Definition: Form.inc.php:210
static getSubmissionDAO()
static call($hookName, $args=null)
ThankReviewerForm($reviewAssignment)
execute($args, $request)
initData($args, $request)
static getCurrentDate($ts=null)
Definition: Core.inc.php:95