pages/reviewer/ReviewerHandler.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00016 // $Id$
00017 
00018 
00019 import('submission.reviewer.ReviewerAction');
00020 import('handler.Handler');
00021 
00022 class ReviewerHandler extends Handler {
00026    function ReviewerHandler() {
00027       parent::Handler();
00028 
00029       $this->addCheck(new HandlerValidatorConference($this));
00030       $this->addCheck(new HandlerValidatorSchedConf($this));
00031       $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_REVIEWER)));      
00032    }
00033 
00037    function index($args) {
00038       $this->validate();
00039       $this->setupTemplate();
00040 
00041       $schedConf =& Request::getSchedConf();
00042       $user =& Request::getUser();
00043       $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO');
00044       $rangeInfo = Handler::getRangeInfo('submissions');
00045 
00046       $page = isset($args[0]) ? $args[0] : '';
00047       switch($page) {
00048          case 'completed':
00049             AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DIRECTOR));
00050             $active = false;
00051             break;
00052          default:
00053             $page = 'active';
00054             $active = true;
00055       }
00056 
00057       $submissions = $reviewerSubmissionDao->getReviewerSubmissionsByReviewerId($user->getId(), $schedConf->getId(), $active, $rangeInfo);
00058 
00059       $templateMgr =& TemplateManager::getManager();
00060       $templateMgr->assign('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
00061       $templateMgr->assign('pageToDisplay', $page);
00062       $templateMgr->assign_by_ref('submissions', $submissions);
00063       $templateMgr->assign_by_ref('schedConf', $schedConf);
00064 
00065       import('submission.reviewAssignment.ReviewAssignment');
00066       $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
00067 
00068       $templateMgr->assign('helpTopicId', 'editorial.reviewersRole.submissions');
00069       $templateMgr->display('reviewer/index.tpl');
00070    }
00071 
00079    function &validateAccessKey($userId, $reviewId, $newKey = null) {
00080       $schedConf =& Request::getSchedConf();
00081       if (!$schedConf || !$schedConf->getSetting('reviewerAccessKeysEnabled')) {
00082          $accessKey = false;
00083          return $accessKey;
00084       }
00085 
00086       define('REVIEWER_ACCESS_KEY_SESSION_VAR', 'ReviewerAccessKey');
00087 
00088       import('security.AccessKeyManager');
00089       $accessKeyManager = new AccessKeyManager();
00090 
00091       $session =& Request::getSession();
00092       // Check to see if a new access key is being used.
00093       if (!empty($newKey)) {
00094          if (Validation::isLoggedIn()) {
00095             Validation::logout();
00096          }
00097          $keyHash = $accessKeyManager->generateKeyHash($newKey);
00098          $session->setSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR, $keyHash);
00099       } else {
00100          $keyHash = $session->getSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR);
00101       }
00102 
00103       // Now that we've gotten the key hash (if one exists), validate it.
00104       $accessKey =& $accessKeyManager->validateKey(
00105          'ReviewerContext',
00106          $userId,
00107          $keyHash,
00108          $reviewId
00109       );
00110 
00111       if ($accessKey) {
00112          $userDao =& DAORegistry::getDAO('UserDAO');
00113          $user =& $userDao->getUser($accessKey->getUserId(), false);
00114          return $user;
00115       }
00116 
00117       // No valid access key -- return NULL.
00118       return $accessKey;
00119    }
00120 
00125    function setupTemplate($subclass = false, $paperId = 0, $reviewId = 0) {
00126       parent::setupTemplate();
00127       AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_SUBMISSION));
00128       $templateMgr =& TemplateManager::getManager();
00129       $pageHierarchy = $subclass ? array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'reviewer'), 'user.role.reviewer'))
00130             : array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'reviewer'), 'user.role.reviewer'));
00131 
00132       if ($paperId && $reviewId) {
00133          $pageHierarchy[] = array(Request::url(null, null, 'reviewer', 'submission', $reviewId), "#$paperId", true);
00134       }
00135       $templateMgr->assign('pageHierarchy', $pageHierarchy);
00136    }
00137 }
00138 
00139 ?>

Generated on 25 Jul 2013 for Open Conference Systems by  doxygen 1.4.7