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

controllers/tab/workflow/ReviewRoundTabHandler.inc.php

00001 <?php
00002 
00015 // Import the base Handler.
00016 import('classes.handler.Handler');
00017 import('lib.pkp.classes.core.JSONMessage');
00018 
00019 class ReviewRoundTabHandler extends Handler {
00020 
00024    function ReviewRoundTabHandler() {
00025       parent::Handler();
00026       $this->addRoleAssignment(
00027          array(ROLE_ID_SERIES_EDITOR, ROLE_ID_PRESS_MANAGER, ROLE_ID_PRESS_ASSISTANT),
00028          array('internalReviewRound', 'externalReviewRound')
00029       );
00030    }
00031 
00032 
00033    //
00034    // Extended methods from Handler
00035    //
00039    function authorize(&$request, $args, $roleAssignments) {
00040       $stageId = (int) $request->getUserVar('stageId'); // This is validated in OmpWorkflowStageAccessPolicy.
00041 
00042       import('classes.security.authorization.OmpWorkflowStageAccessPolicy');
00043       $this->addPolicy(new OmpWorkflowStageAccessPolicy($request, $args, $roleAssignments, 'monographId', $stageId));
00044 
00045       // We need a review round id in request.
00046       import('classes.security.authorization.internal.ReviewRoundRequiredPolicy');
00047       $this->addPolicy(new ReviewRoundRequiredPolicy($request, $args));
00048 
00049       return parent::authorize($request, $args, $roleAssignments);
00050    }
00051 
00057    function internalReviewRound($args, &$request) {
00058       return $this->_reviewRound($args, $request);
00059    }
00060 
00066    function externalReviewRound($args, &$request) {
00067       return $this->_reviewRound($args, $request);
00068    }
00069 
00070 
00074    function setupTemplate() {
00075       AppLocale::requireComponents(LOCALE_COMPONENT_OMP_EDITOR);
00076       parent::setupTemplate();
00077    }
00078 
00079 
00080    //
00081    // Private helper methods.
00082    //
00088    function _reviewRound($args, &$request) {
00089       $this->setupTemplate();
00090 
00091       // Retrieve the authorized submission, stage id and review round.
00092       $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
00093       $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
00094       $reviewRound =& $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
00095 
00096       // Add the round information to the template.
00097       $templateMgr =& TemplateManager::getManager();
00098       $templateMgr->assign('stageId', $stageId);
00099       $templateMgr->assign('reviewRoundId', $reviewRound->getId());
00100       $templateMgr->assign_by_ref('monograph', $monograph);
00101 
00102       // Assign editor decision actions to the template, only if
00103       // user is accessing the last review round for this stage.
00104       $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO');
00105 
00106       $notificationRequestOptions = array(
00107          NOTIFICATION_LEVEL_NORMAL => array(
00108             NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())),
00109          NOTIFICATION_LEVEL_TASK => array(
00110             NOTIFICATION_TYPE_ALL_REVIEWS_IN => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId()),
00111             NOTIFICATION_TYPE_ALL_REVISIONS_IN => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())),
00112          NOTIFICATION_LEVEL_TRIVIAL => array()
00113       );
00114       $templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
00115 
00116       return $templateMgr->fetchJson('workflow/reviewRound.tpl');
00117    }
00118 }
00119 
00120 ?>

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