Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ReviewReminderForm.inc.php
1 <?php
2 
16 import('lib.pkp.classes.form.Form');
17 
18 class ReviewReminderForm extends Form {
21 
25  function ReviewReminderForm($reviewAssignment) {
26  parent::Form('controllers/grid/users/reviewer/form/reviewReminderForm.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  //
46  // Overridden template methods
47  //
53  function initData($args, $request) {
54  $userDao = DAORegistry::getDAO('UserDAO');
55  $user = $request->getUser();
56  $context = $request->getContext();
57 
58  $reviewAssignment = $this->getReviewAssignment();
59  $reviewerId = $reviewAssignment->getReviewerId();
60  $reviewer = $userDao->getById($reviewerId);
61 
62  $submissionDao = Application::getSubmissionDAO();
63  $submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
64 
65  import('lib.pkp.classes.mail.SubmissionMailTemplate');
66  $email = new SubmissionMailTemplate($submission, 'REVIEW_REMIND');
67 
68  // Format the review due date
69  $reviewDueDate = strtotime($reviewAssignment->getDateDue());
70  $dateFormatShort = Config::getVar('general', 'date_format_short');
71  if ($reviewDueDate == -1) $reviewDueDate = $dateFormatShort; // Default to something human-readable if no date specified
72  else $reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
73 
74  $dispatcher = $request->getDispatcher();
75  $paramArray = array(
76  'reviewerName' => $reviewer->getFullName(),
77  'reviewDueDate' => $reviewDueDate,
78  'editorialContactSignature' => $user->getContactSignature(),
79  'reviewerUserName' => $reviewer->getUsername(),
80  'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))),
81  'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId()))
82  );
83  $email->assignParams($paramArray);
84 
85  $this->setData('stageId', $reviewAssignment->getStageId());
86  $this->setData('reviewAssignmentId', $reviewAssignment->getId());
87  $this->setData('reviewAssignment', $reviewAssignment);
88  $this->setData('reviewerName', $reviewer->getFullName() . ' <' . $reviewer->getEmail() . '>');
89  $this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
90  }
91 
96  function readInputData() {
97  $this->readUserVars(array('message'));
98  }
99 
105  function execute($args, $request) {
106  $userDao = DAORegistry::getDAO('UserDAO');
107  $submissionDao = Application::getSubmissionDAO();
108 
109  $reviewAssignment = $this->getReviewAssignment();
110  $reviewerId = $reviewAssignment->getReviewerId();
111  $reviewer = $userDao->getById($reviewerId);
112  $submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
113 
114  import('lib.pkp.classes.mail.SubmissionMailTemplate');
115  $email = new SubmissionMailTemplate($submission, 'REVIEW_REMIND', null, null, null, false);
116 
117  $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
118  $email->setBody($this->getData('message'));
119  $email->send($request);
120 
121  // update the ReviewAssignment with the reminded and modified dates
122  $reviewAssignment->setDateReminded(Core::getCurrentDate());
123  $reviewAssignment->stampModified();
124  $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
125  $reviewAssignmentDao->updateObject($reviewAssignment);
126  }
127 }
128 
129 ?>
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
Class defining basic operations for handling HTML forms.
Definition: Form.inc.php:47
getData($key)
Definition: Form.inc.php:210
static getVar($section, $key, $default=null)
Definition: Config.inc.php:35
static getSubmissionDAO()
Form for sending a review reminder to a reviewer.
ReviewReminderForm($reviewAssignment)
static getCurrentDate($ts=null)
Definition: Core.inc.php:95