• Main Page
  • Modules
  • Classes
  • Files
  • File List

controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.inc.php

00001 <?php
00002 
00015 // Import the base Handler.
00016 import('pages.authorDashboard.AuthorDashboardHandler');
00017 import('lib.pkp.classes.core.JSONMessage');
00018 
00019 class AuthorDashboardReviewRoundTabHandler extends AuthorDashboardHandler {
00020 
00024    function AuthorDashboardReviewRoundTabHandler() {
00025       parent::Handler();
00026       $this->addRoleAssignment($this->_getAssignmentRoles(), array('fetchReviewRoundInfo'));
00027    }
00028 
00029 
00030    //
00031    // Extended methods from Handler
00032    //
00036    function authorize(&$request, $args, $roleAssignments) {
00037       $stageId = (int)$request->getUserVar('stageId');
00038 
00039       // Authorize stage id.
00040       import('classes.security.authorization.internal.WorkflowStageRequiredPolicy');
00041       $this->addPolicy(new WorkflowStageRequiredPolicy($stageId));
00042 
00043       // We need a review round id in request.
00044       import('classes.security.authorization.internal.ReviewRoundRequiredPolicy');
00045       $this->addPolicy(new ReviewRoundRequiredPolicy($request, $args));
00046 
00047       return parent::authorize($request, $args, $roleAssignments);
00048    }
00049 
00050 
00051    //
00052    // Public handler operations
00053    //
00060    function fetchReviewRoundInfo($args, &$request) {
00061       $this->setupTemplate($request);
00062       $templateMgr =& TemplateManager::getManager();
00063 
00064       $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
00065       if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
00066          fatalError('Invalid Stage Id');
00067       }
00068       $templateMgr->assign('stageId', $stageId);
00069 
00070       $reviewRound =& $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
00071       $templateMgr->assign('reviewRoundId', $reviewRound->getId());
00072       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00073       $templateMgr->assign_by_ref('monograph', $monograph);
00074 
00075       // Review round request notification options.
00076       $notificationRequestOptions = array(
00077          NOTIFICATION_LEVEL_NORMAL => array(
00078             NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())),
00079          NOTIFICATION_LEVEL_TRIVIAL => array()
00080       );
00081       $templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
00082 
00083       // Editor has taken an action and sent an email; Display the email
00084       import('classes.workflow.EditorDecisionActionsManager');
00085       if(EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound)) {
00086          $monographEmailLogDao =& DAORegistry::getDAO('MonographEmailLogDAO');
00087          $user =& $request->getUser();
00088          $monographEmailFactory =& $monographEmailLogDao->getByEventType($monograph->getId(), MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId());
00089 
00090          $templateMgr->assign_by_ref('monographEmails', $monographEmailFactory);
00091          $templateMgr->assign('showReviewAttachments', true);
00092       }
00093 
00094       return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
00095    }
00096 
00097 }
00098 
00099 ?>

Generated on Mon Sep 17 2012 13:58:56 for Open Monograph Press by  doxygen 1.7.1