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

controllers/grid/files/review/ReviewGridDataProvider.inc.php

00001 <?php
00002 
00016 import('controllers.grid.files.SubmissionFilesGridDataProvider');
00017 
00018 class ReviewGridDataProvider extends SubmissionFilesGridDataProvider {
00019 
00023    function ReviewGridDataProvider($fileStageId, $viewableOnly = false) {
00024       $this->_viewableOnly = $viewableOnly;
00025       parent::SubmissionFilesGridDataProvider($fileStageId);
00026    }
00027 
00028 
00029    //
00030    // Implement template methods from GridDataProvider
00031    //
00035    function getAuthorizationPolicy(&$request, $args, $roleAssignments) {
00036       // Get the parent authorization policy.
00037       $policy = parent::getAuthorizationPolicy($request, $args, $roleAssignments);
00038 
00039       // Add policy to ensure there is a review round id.
00040       import('classes.security.authorization.internal.ReviewRoundRequiredPolicy');
00041       $policy->addPolicy(new ReviewRoundRequiredPolicy($request, $args));
00042 
00043       return $policy;
00044    }
00045 
00049    function getRequestArgs() {
00050       $reviewRound = $this->getReviewRound();
00051       return array_merge(parent::getRequestArgs(), array(
00052          'reviewRoundId' => $reviewRound->getId()
00053          )
00054       );
00055    }
00056 
00060    function &loadData() {
00061       // Get all review files assigned to this submission.
00062       $reviewRound =& $this->getReviewRound();
00063       $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
00064       $monographFiles =& $submissionFileDao->getLatestNewRevisionsByReviewRound($reviewRound, $this->getFileStage());
00065       $data = $this->prepareSubmissionFileData($monographFiles, $this->_viewableOnly);
00066 
00067       return $data;
00068    }
00069 
00070    //
00071    // Overridden public methods from FilesGridDataProvider
00072    //
00076    function &getSelectAction($request) {
00077       import('controllers.grid.files.fileList.linkAction.SelectReviewFilesLinkAction');
00078       $monograph =& $this->getMonograph();
00079       $reviewRound =& $this->getReviewRound();
00080       $modalTitle = __('editor.monograph.review.currentFiles', array('round' => $reviewRound->getRound()));
00081       $selectAction = new SelectReviewFilesLinkAction(
00082          &$request, $reviewRound,
00083          __('editor.monograph.uploadSelectFiles'),
00084          $modalTitle
00085       );
00086       return $selectAction;
00087    }
00088 
00092    function &getAddFileAction($request) {
00093       import('controllers.api.file.linkAction.AddFileLinkAction');
00094       $monograph =& $this->getMonograph();
00095       $reviewRound =& $this->getReviewRound();
00096 
00097       $addFileAction = new AddFileLinkAction(
00098          $request, $monograph->getId(), $this->getStageId(),
00099          $this->getUploaderRoles(), $this->getFileStage(),
00100          null, null, $reviewRound->getId()
00101       );
00102       return $addFileAction;
00103    }
00104 
00109    function &getReviewRound() {
00110       $reviewRound =& $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
00111       return $reviewRound;
00112    }
00113 }
00114 
00115 ?>

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