00001 <?php
00002
00016 import('controllers.grid.files.FilesGridDataProvider');
00017
00018 class SubmissionFilesGridDataProvider extends FilesGridDataProvider {
00019
00021 var $_stageId;
00022
00024 var $_fileStage;
00025
00026
00031 function SubmissionFilesGridDataProvider($fileStage, $viewableOnly = false) {
00032 assert(is_numeric($fileStage) && $fileStage > 0);
00033 $this->_fileStage = (int)$fileStage;
00034 parent::FilesGridDataProvider();
00035
00036 $this->setViewableOnly($viewableOnly);
00037 }
00038
00039
00040
00041
00042
00046 function setStageId($stageId) {
00047 $this->_stageId = $stageId;
00048 }
00049
00054 function getStageId() {
00055 return $this->_stageId;
00056 }
00057
00058
00059
00060
00061
00065 function getAuthorizationPolicy(&$request, $args, $roleAssignments) {
00066 $this->setUploaderRoles($roleAssignments);
00067
00068 import('classes.security.authorization.OmpWorkflowStageAccessPolicy');
00069 $policy = new OmpWorkflowStageAccessPolicy($request, $args, $roleAssignments, 'monographId', $this->getStageId());
00070 return $policy;
00071 }
00072
00076 function getRequestArgs() {
00077 $monograph =& $this->getMonograph();
00078 return array(
00079 'monographId' => $monograph->getId(),
00080 'stageId' => $this->getStageId(),
00081 'fileStage' => $this->getFileStage()
00082 );
00083 }
00084
00089 function getFileStage() {
00090 return $this->_fileStage;
00091 }
00092
00096 function &loadData() {
00097
00098 $monograph =& $this->getMonograph();
00099 $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
00100 $monographFiles =& $submissionFileDao->getLatestRevisions($monograph->getId(), $this->getFileStage());
00101 return $this->prepareSubmissionFileData($monographFiles, $this->_viewableOnly);
00102 }
00103
00104
00105
00106
00107
00111 function &getAddFileAction($request) {
00112 import('controllers.api.file.linkAction.AddFileLinkAction');
00113 $monograph =& $this->getMonograph();
00114 $addFileAction = new AddFileLinkAction(
00115 $request, $monograph->getId(), $this->getStageId(),
00116 $this->getUploaderRoles(), $this->getFileStage()
00117 );
00118 return $addFileAction;
00119 }
00120 }
00121
00122 ?>