Open Journal Systems  3.3.0
AuthorDashboardReviewRoundTabHandler.inc.php
1 <?php
2 
16 // Import the base Handler.
17 import('pages.authorDashboard.AuthorDashboardHandler');
18 import('lib.pkp.classes.core.JSONMessage');
19 
21 
25  function __construct() {
26  parent::__construct();
27  $this->addRoleAssignment(array(ROLE_ID_AUTHOR), array('fetchReviewRoundInfo'));
28  }
29 
30 
31  //
32  // Extended methods from Handler
33  //
37  function authorize($request, &$args, $roleAssignments) {
38  $stageId = (int)$request->getUserVar('stageId');
39 
40  // Authorize stage id.
41  import('lib.pkp.classes.security.authorization.internal.WorkflowStageRequiredPolicy');
42  $this->addPolicy(new WorkflowStageRequiredPolicy($stageId));
43 
44  // We need a review round id in request.
45  import('lib.pkp.classes.security.authorization.internal.ReviewRoundRequiredPolicy');
46  $this->addPolicy(new ReviewRoundRequiredPolicy($request, $args));
47 
48  return parent::authorize($request, $args, $roleAssignments);
49  }
50 
51 
52  //
53  // Public handler operations
54  //
61  function fetchReviewRoundInfo($args, $request) {
62  $this->setupTemplate($request);
63  $templateMgr = TemplateManager::getManager($request);
64 
65  $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
66  $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
67  $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
68  if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
69  fatalError('Invalid Stage Id');
70  }
71 
72  $templateMgr->assign(array(
73  'stageId' => $stageId,
74  'reviewRoundId' => $reviewRound->getId(),
75  'submission' => $submission,
76  'reviewRoundNotificationRequestOptions' => array(
77  NOTIFICATION_LEVEL_NORMAL => array(
78  NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())),
79  NOTIFICATION_LEVEL_TRIVIAL => array()
80  ),
81  ));
82 
83  // If open reviews exist, show the reviewers grid
84  $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /* @var $reviewAssignmentDao ReviewAssignmentDAO */
85  if ($reviewAssignmentDao->getOpenReviewsByReviewRoundId($reviewRound->getId())){
86  $templateMgr->assign('showReviewerGrid', true);
87  }
88 
89  // Editor has taken an action and sent an email; Display the email
90  import('classes.workflow.EditorDecisionActionsManager');
91  if((new EditorDecisionActionsManager())->getEditorTakenActionInReviewRound($request->getContext(), $reviewRound)) {
92  $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO'); /* @var $submissionEmailLogDao SubmissionEmailLogDAO */
93  $user = $request->getUser();
94  $templateMgr->assign(array(
95  'submissionEmails' => $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId()),
96  'showReviewAttachments' => true,
97  ));
98  }
99 
100  return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
101  }
102 }
103 
104 
PKPHandler\addRoleAssignment
addRoleAssignment($roleIds, $operations)
Definition: PKPHandler.inc.php:213
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
ReviewRoundRequiredPolicy
Policy that ensures that the request contains a valid review round.
Definition: ReviewRoundRequiredPolicy.inc.php:17
AuthorDashboardReviewRoundTabHandler\fetchReviewRoundInfo
fetchReviewRoundInfo($args, $request)
Definition: AuthorDashboardReviewRoundTabHandler.inc.php:61
AuthorDashboardReviewRoundTabHandler\authorize
authorize($request, &$args, $roleAssignments)
Definition: AuthorDashboardReviewRoundTabHandler.inc.php:37
EditorDecisionActionsManager
Wrapper class for create and assign editor decisions actions to template manager.
Definition: EditorDecisionActionsManager.inc.php:33
PKPAuthorDashboardHandler\setupTemplate
setupTemplate($request)
Definition: PKPAuthorDashboardHandler.inc.php:120
AuthorDashboardReviewRoundTabHandler\__construct
__construct()
Definition: AuthorDashboardReviewRoundTabHandler.inc.php:25
AuthorDashboardHandler
Handle requests for the author dashboard.
Definition: AuthorDashboardHandler.inc.php:19
PKPTemplateManager\getManager
static & getManager($request=null)
Definition: PKPTemplateManager.inc.php:1239
PKPHandler\getAuthorizedContextObject
& getAuthorizedContextObject($assocType)
Definition: PKPHandler.inc.php:174
AuthorDashboardReviewRoundTabHandler
Handle AJAX operations for review round tabs on author dashboard page.
Definition: AuthorDashboardReviewRoundTabHandler.inc.php:20
PKPHandler\addPolicy
addPolicy($authorizationPolicy, $addToTop=false)
Definition: PKPHandler.inc.php:157
fatalError
if(!function_exists('import')) fatalError($reason)
Definition: functions.inc.php:32
WorkflowStageRequiredPolicy
Policy that ensures that the given workflow stage is valid.
Definition: WorkflowStageRequiredPolicy.inc.php:17