Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
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 
26  parent::Handler();
27  $this->addRoleAssignment($this->_getAssignmentRoles(), 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  $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
66  if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
67  fatalError('Invalid Stage Id');
68  }
69  $templateMgr->assign('stageId', $stageId);
70 
71  $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
72  $templateMgr->assign('reviewRoundId', $reviewRound->getId());
73  $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
74  $templateMgr->assign('submission', $submission);
75 
76  // Review round request notification options.
77  $notificationRequestOptions = array(
78  NOTIFICATION_LEVEL_NORMAL => array(
79  NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())),
80  NOTIFICATION_LEVEL_TRIVIAL => array()
81  );
82  $templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
83 
84  // Editor has taken an action and sent an email; Display the email
85  import('classes.workflow.EditorDecisionActionsManager');
87  $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
88  $user = $request->getUser();
89  $submissionEmailFactory = $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId());
90 
91  $templateMgr->assign('submissionEmails', $submissionEmailFactory);
92  $templateMgr->assign('showReviewAttachments', true);
93  }
94 
95  return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
96  }
97 }
98 
99 ?>
static & getDAO($name, $dbconn=null)
addPolicy($authorizationPolicy, $addToTop=false)
Policy that ensures that the given workflow stage is valid.
Handle requests for the author dashboard.
Policy that ensures that the request contains a valid review round.
addRoleAssignment($roleIds, $operations)
Handle AJAX operations for review round tabs on author dashboard page.
getEditorTakenActionInReviewRound($reviewRound, $decisions=array())
& getAuthorizedContextObject($assocType)