| Server IP : 195.134.90.114 / Your IP : 216.73.217.14 Web Server : Apache/2.4.58 System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/lib/pkp/controllers/grid/users/reviewer/form/ |
Upload File : |
<?php
/**
* @file controllers/grid/users/reviewer/form/UnassignReviewerForm.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class UnassignReviewerForm
* @ingroup controllers_grid_users_reviewer_form
*
* @brief Allow the editor to remove a review assignment
*/
import('lib.pkp.controllers.grid.users.reviewer.form.ReviewerNotifyActionForm');
class UnassignReviewerForm extends ReviewerNotifyActionForm {
/**
* Constructor
* @param mixed $reviewAssignment ReviewAssignment
* @param mixed $reviewRound ReviewRound
* @param mixed $submission Submission
*/
function __construct($reviewAssignment, $reviewRound, $submission) {
parent::__construct($reviewAssignment, $reviewRound, $submission, 'controllers/grid/users/reviewer/form/unassignReviewerForm.tpl');
}
/**
* @copydoc ReviewerNotifyActionForm::getEmailKey()
*/
public function getEmailKey() {
return 'REVIEW_CANCEL';
}
/**
* @copydoc Form::execute()
* @return bool whether or not the review assignment was deleted successfully
*/
function execute(...$functionArgs) {
if (!parent::execute(...$functionArgs)) return false;
$request = Application::get()->getRequest();
$submission = $this->getSubmission();
$reviewAssignment = $this->getReviewAssignment();
// Delete or cancel the review assignment.
$submissionDao = DAORegistry::getDAO('SubmissionDAO'); /* @var $submissionDao SubmissionDAO */
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */
$userDao = DAORegistry::getDAO('UserDAO'); /* @var $userDao UserDAO */
if (isset($reviewAssignment) && $reviewAssignment->getSubmissionId() == $submission->getId() && !HookRegistry::call('EditorAction::clearReview', array(&$submission, $reviewAssignment))) {
$reviewer = $userDao->getById($reviewAssignment->getReviewerId());
if (!isset($reviewer)) return false;
if ($reviewAssignment->getDateConfirmed()) {
// The review has been confirmed but not completed. Flag it as cancelled.
$reviewAssignment->setCancelled(true);
$reviewAssignmentDao->updateObject($reviewAssignment);
} else {
// The review had not been confirmed yet. Delete the assignment.
$reviewAssignmentDao->deleteById($reviewAssignment->getId());
}
// Stamp the modification date
$submission->stampModified();
$submissionDao->updateObject($submission);
$notificationDao = DAORegistry::getDAO('NotificationDAO'); /* @var $notificationDao NotificationDAO */
$notificationDao->deleteByAssoc(
ASSOC_TYPE_REVIEW_ASSIGNMENT,
$reviewAssignment->getId(),
$reviewAssignment->getReviewerId(),
NOTIFICATION_TYPE_REVIEW_ASSIGNMENT
);
// Insert a trivial notification to indicate the reviewer was removed successfully.
$currentUser = $request->getUser();
$notificationMgr = new NotificationManager();
$notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => $reviewAssignment->getDateConfirmed()?__('notification.cancelledReviewer'):__('notification.removedReviewer')));
// Add log
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_CLEAR, 'log.review.reviewCleared', array('reviewAssignmentId' => $reviewAssignment->getId(), 'reviewerName' => $reviewer->getFullName(), 'submissionId' => $submission->getId(), 'stageId' => $reviewAssignment->getStageId(), 'round' => $reviewAssignment->getRound()));
return true;
}
return false;
}
}