function initialize(&$request) { // Set the Is Selectable boolean flag $isSelectable = (bool) $request->getUserVar('isSelectable'); $this->setIsSelectable($isSelectable); // Columns import('controllers.grid.files.reviewAttachments.ReviewAttachmentsGridCellProvider'); $cellProvider =& new ReviewAttachmentsGridCellProvider(); if ($this->getIsSelectable()) { $this->addColumn(new GridColumn('select', 'common.select', null, 'controllers/grid/files/reviewAttachments/gridRowSelectInput.tpl', $cellProvider)); } parent::initialize($request); $monographId = (int) $request->getUserVar('monographId'); $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $monographFiles =& $submissionFileDao->getLatestRevisions($monographId, MONOGRAPH_FILE_ATTACHMENT); $rowData = array(); foreach ($monographFiles as $monographFile) { $rowData[$monographFile->getFileId()] = $monographFile; } $this->setData($rowData); if ($isSelectable) { // Load a different grid template $this->setTemplate('controllers/grid/files/reviewFiles/grid.tpl'); // There are no pre-selected files--Assign an empty array to gridRowSelectInput.tpl to avoid warnings $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('selectedFileIds', array()); } // Add grid-level actions if (!$this->getReadOnly()) { $router =& $request->getRouter(); $this->addAction(new LegacyLinkAction('addFile', LINK_ACTION_MODE_MODAL, LINK_ACTION_TYPE_APPEND, $router->url($request, null, null, 'addFile', null, array('monographId' => $monographId)), 'grid.reviewAttachments.add')); } }
function initialize(&$request) { parent::initialize($request); $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); $monographId = $monograph->getId(); $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $monographFiles =& $submissionFileDao->getLatestRevisions($monographId, MONOGRAPH_FILE_ATTACHMENT); $rowData = array(); foreach ($monographFiles as $monographFile) { // Only include files where the 'viewable' flag has been set, i.e. which the editor has approved for the author to see if ($monographFile->getViewable()) { $rowData[$monographFile->getFileId()] = $monographFile; } } $this->setData($rowData); }
function initialize(&$request) { parent::initialize($request); // Retrieve the authorized monograph. $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH); $monographId = $monograph->getId(); // FIXME: Must be replaced with an object from the authorized context, see #6200. $reviewId = (int) $request->getUserVar('reviewId'); $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ if (!$reviewId && $monographId) { $monographFiles =& $submissionFileDao->getLatestRevisions($monographId, MONOGRAPH_FILE_ATTACHMENT); } else { $monographFiles =& $submissionFileDao->getAllRevisionsByAssocId(ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewId, MONOGRAPH_FILE_ATTACHMENT); } $this->setData($monographFiles); // Add grid-level actions if (!$this->getReadOnly()) { $router =& $request->getRouter(); $this->addAction(new LegacyLinkAction('addFile', LINK_ACTION_MODE_MODAL, LINK_ACTION_TYPE_APPEND, $router->url($request, null, null, 'addFile', null, array('reviewId' => $reviewId, 'monographId' => $monographId)), 'grid.reviewAttachments.add')); } }
/** * @see PKPHandler::authorize() * @param $request PKPRequest * @param $args array * @param $roleAssignments array */ function authorize(&$request, $args, $roleAssignments) { import('classes.security.authorization.OmpSubmissionAccessPolicy'); $this->addPolicy(new OmpSubmissionAccessPolicy($request, $args, $roleAssignments)); return parent::authorize($request, $args, $roleAssignments); }
/** * @see SubmissionFilesGridHandler::uploadFile() */ function uploadFile($args, &$request) { $fileModifyCallback = array($this, 'setFileReviewId'); return parent::uploadFile($args, $request, $fileModifyCallback); }