SubmissionFilesGridHandler::initialize PHP Method

initialize() public method

public initialize ( $request )
    function initialize($request)
    {
        parent::initialize($request);
        // Load translations.
        AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_PKP_EDITOR, LOCALE_COMPONENT_PKP_COMMON, LOCALE_COMPONENT_APP_COMMON);
        // Add grid actions
        $capabilities = $this->getCapabilities();
        $dataProvider = $this->getDataProvider();
        if ($capabilities->canAdd()) {
            assert(isset($dataProvider));
            $this->addAction($dataProvider->getAddFileAction($request));
        }
        // Test whether the tar binary is available for the export to work, if so, add 'download all' grid action
        if ($capabilities->canDownloadAll() && $this->hasGridDataElements($request)) {
            $submission = $this->getSubmission();
            $stageId = $this->getStageId();
            $linkParams = array('submissionId' => $submission->getId(), 'stageId' => $stageId);
            $files = $this->getFilesToDownload($request);
            $this->addAction($capabilities->getDownloadAllAction($request, $files, $linkParams), GRID_ACTION_POSITION_BELOW);
        }
        // The file name column is common to all file grid types.
        $this->addColumn(new FileNameGridColumn($capabilities->canViewNotes(), $this->getStageId()));
        // Set the no items row text
        $this->setEmptyRowText('grid.noFiles');
    }

Usage Example

 /**
  * @see PKPHandler::initialize()
  */
 function initialize(&$request)
 {
     // Basic grid configuration
     $this->setId('fairCopyFiles');
     $this->setTitle('editor.monograph.fairCopy');
     // Load grid data.
     $this->loadMonographFiles();
     // Test whether the tar binary is available for the export to work, if so, add grid action
     $tarBinary = Config::getVar('cli', 'tar');
     if ($this->hasData() && !empty($tarBinary) && file_exists($tarBinary)) {
         $monograph =& $this->getMonograph();
         $router =& $request->getRouter();
         $this->addAction(new LinkAction('downloadAll', new RedirectAction($router->url($request, null, null, 'downloadAllFiles', null, array('monographId' => $monograph->getId()))), 'submission.files.downloadAll', 'getPackage'));
     }
     // Load additional translation components.
     Locale::requireComponents(array(LOCALE_COMPONENT_OMP_EDITOR));
     // Columns
     import('controllers.grid.files.fairCopyFiles.FairCopyFilesGridCellProvider');
     $cellProvider =& new FairCopyFilesGridCellProvider();
     parent::initialize($request, $cellProvider);
     // Add a column for the uploader.
     // FIXME: We're just adding some placeholder text here until this
     // is correctly implemented, see #6233.
     $this->addColumn(new GridColumn('select', null, 'FIXME', 'controllers/grid/common/cell/roleCell.tpl', $cellProvider));
     // Add another column for the uploader's role
     // FIXME: We're just adding some placeholder text here until this
     // is correctly implemented, see #6233.
     $this->addColumn(new GridColumn('uploader-name', null, 'FIXME', 'controllers/grid/common/cell/roleCell.tpl', $cellProvider));
 }
All Usage Examples Of SubmissionFilesGridHandler::initialize